From 479dbc8225f9cb4fa43a4c2d7744f3d12637ebab Mon Sep 17 00:00:00 2001 From: Imants Date: Mon, 24 Feb 2025 14:55:13 +0200 Subject: [PATCH] fix: handle null application fee and update logged amount for payment intent succeeded event --- .../Stripe/EventHandlers/PaymentIntentSucceededHandler.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/app/Services/Domain/Payment/Stripe/EventHandlers/PaymentIntentSucceededHandler.php b/backend/app/Services/Domain/Payment/Stripe/EventHandlers/PaymentIntentSucceededHandler.php index acc2593918..5a134f2a90 100644 --- a/backend/app/Services/Domain/Payment/Stripe/EventHandlers/PaymentIntentSucceededHandler.php +++ b/backend/app/Services/Domain/Payment/Stripe/EventHandlers/PaymentIntentSucceededHandler.php @@ -120,7 +120,7 @@ private function updateStripePaymentInfo(PaymentIntent $paymentIntent, StripePay attributes: [ StripePaymentDomainObjectAbstract::LAST_ERROR => $paymentIntent->last_payment_error?->toArray(), StripePaymentDomainObjectAbstract::AMOUNT_RECEIVED => $paymentIntent->amount_received, - StripePaymentDomainObjectAbstract::APPLICATION_FEE => $paymentIntent->application_fee_amount, + StripePaymentDomainObjectAbstract::APPLICATION_FEE => $paymentIntent->application_fee_amount ?? 0, StripePaymentDomainObjectAbstract::PAYMENT_METHOD_ID => is_string($paymentIntent->payment_method) ? $paymentIntent->payment_method : $paymentIntent->payment_method?->id, @@ -214,7 +214,7 @@ private function markPaymentIntentAsHandled(PaymentIntent $paymentIntent, OrderD $this->logger->info('Stripe payment intent succeeded event handled', [ 'payment_intent' => $paymentIntent->id, 'order_id' => $updatedOrder->getId(), - 'amount_received' => $paymentIntent->amount_received, + 'amount_received' => $paymentIntent->amount_captured, 'currency' => $paymentIntent->currency, ]);