Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
iamgergo committed Jul 30, 2024
1 parent 79a620c commit 7e69881
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/StripeDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class StripeDriver extends Driver
/**
* The Stripe client instance.
*/
public readonly StripeClient $client;
protected StripeClient $client;

/**
* Create a new driver instance.
Expand Down Expand Up @@ -120,19 +120,19 @@ public function capture(Request $request, Order $order): Order
/**
* {@inheritdoc}
*/
public function handleNotification(Request $request): Response
public function handleNotification(Request $request, Order $order): Response
{
$event = $this->resolveEvent($request);
$event = $this->resolveEvent($request, $order);

$this->handleWebhook($event);
$this->handleWebhook($event, $order);

return parent::handleNotification($request);
return parent::handleNotification($request, $order);
}

/**
* Resolve the Stripe event.
*/
protected function resolveEvent(Request $request): Event
protected function resolveEvent(Request $request, Order $order): Event
{
return Webhook::constructEvent(
$request->getContent(),
Expand All @@ -144,10 +144,8 @@ protected function resolveEvent(Request $request): Event
/**
* Handle the webhook.
*/
protected function handleWebhook(Event $event): void
protected function handleWebhook(Event $event, Order $order): void
{
$order = $this->resolveOrder($event->data['object']['metadata']['order']);

switch ($event->type) {
case 'charge.refunded':
$this->handleIrn($event, $order);
Expand Down

0 comments on commit 7e69881

Please sign in to comment.