From f961d48adb29d25175db55da8b24d975d26ace66 Mon Sep 17 00:00:00 2001 From: stephen-gilbert-cko Date: Fri, 14 Oct 2022 15:05:16 +0100 Subject: [PATCH] Add payment_authentication_failed event Add support for payment_authentication_failed webhook notification --- Model/Service/OrderStatusHandlerService.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Model/Service/OrderStatusHandlerService.php b/Model/Service/OrderStatusHandlerService.php index f23285fa..11578ed2 100644 --- a/Model/Service/OrderStatusHandlerService.php +++ b/Model/Service/OrderStatusHandlerService.php @@ -159,6 +159,9 @@ public function setOrderStatus(OrderInterface $order, array $webhook): void case 'payment_expired': $this->paymentExpired(); break; + case 'payment_authentication_failed': + $this->paymentAuthenticationFailed(); + break; } if ($this->state) { @@ -192,6 +195,7 @@ public function handleFailedPayment(OrderInterface $order, $webhook = false): vo $failedWebhooks = [ "payment_declined", "payment_expired", + "payment_authentication_failed", "payment_cancelled", "payment_voided", "payment_capture_declined", @@ -312,4 +316,16 @@ protected function paymentExpired(): void $this->order->addStatusHistoryComment(__('3DS payment expired.')); $this->handleFailedPayment($this->order); } + + /** + * Set the order status for a payment authentication failed webhook. + * + * @return void + * @throws NoSuchEntityException + */ + protected function paymentAuthenticationFailed(): void + { + $this->order->addStatusHistoryComment(__('3DS authentication failed/expired.')); + $this->handleFailedPayment($this->order); + } }