Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/Data/HasData.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ public function merge($data): self
return $this;
}

public function remove(string $key): self
{
unset($this->data[$key]);

return $this;
}

public function toArray(): array
{
return $this->data()->toArray();
Expand Down
13 changes: 13 additions & 0 deletions src/Gateways/Builtin/MollieGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,19 @@ public function webhook(Request $request)

event(new OrderPaymentFailed($order));
}

if ($payment->status === MolliePaymentStatus::STATUS_EXPIRED) {
$order = $this->getOrderFromWebhookRequest($request);

if (! $order) {
throw new OrderNotFound("Order related to Mollie transaction [{$mollieId}] could not be found.");
}

$order
->remove('mollie')
->clearGatewayData()
->save();
}
}

public function fieldtypeDisplay($value): array
Expand Down
7 changes: 7 additions & 0 deletions src/Orders/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,13 @@ public function gatewayData(?string $gateway = null, ?array $data = null, ?array
return new GatewayData($this->gateway);
}

public function clearGatewayData(): self
{
$this->gateway = null;

return $this;
}

public function resource($resource = null)
{
return $this
Expand Down
Loading