Skip to content

Commit 5715b7f

Browse files
committed
add logging when payment intent not found
1 parent 3577bed commit 5715b7f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

backend/app/Services/Domain/Payment/Stripe/EventHandlers/PaymentIntentSucceededHandler.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
use HiEvents\Services\Domain\Payment\Stripe\StripeRefundExpiredOrderService;
2424
use HiEvents\Services\Domain\Product\ProductQuantityUpdateService;
2525
use Illuminate\Database\DatabaseManager;
26+
use Psr\Log\LoggerInterface;
2627
use Stripe\Exception\ApiErrorException;
2728
use Stripe\PaymentIntent;
2829
use Throwable;
@@ -36,6 +37,7 @@ public function __construct(
3637
private readonly StripeRefundExpiredOrderService $refundExpiredOrderService,
3738
private readonly AttendeeRepositoryInterface $attendeeRepository,
3839
private readonly DatabaseManager $databaseManager,
40+
private readonly LoggerInterface $logger,
3941
)
4042
{
4143
}
@@ -53,6 +55,14 @@ public function handleEvent(PaymentIntent $paymentIntent): void
5355
StripePaymentDomainObjectAbstract::PAYMENT_INTENT_ID => $paymentIntent->id,
5456
]);
5557

58+
if (!$stripePayment) {
59+
$this->logger->error('Payment intent not found when handling payment intent succeeded event', [
60+
'paymentIntent' => $paymentIntent->toArray(),
61+
]);
62+
63+
return;
64+
}
65+
5666
$this->validatePaymentAndOrderStatus($stripePayment, $paymentIntent);
5767

5868
$this->updateStripePaymentInfo($paymentIntent, $stripePayment);

0 commit comments

Comments
 (0)