Skip to content

Commit

Permalink
Refactor SubmitQuoteObserver
Browse files Browse the repository at this point in the history
  • Loading branch information
hossam-adyen committed Feb 15, 2024
1 parent cca4040 commit 3bd8a24
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions Observer/SubmitQuoteObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,14 @@ public function execute(Observer $observer)
$order = $observer->getEvent()->getOrder();
/** @var Order\Payment $payment */
$payment = $order->getPayment();
$isAdyenPaymentMethod = $this->paymentMethodsHelper->isAdyenPayment($payment->getMethod());
$isActionRequired = in_array(
$payment->getAdditionalInformation('resultCode'),
PaymentResponseHandler::ACTION_REQUIRED_STATUSES
);
$isPosPayment = $payment->getMethod() === 'adyen_pos_cloud';

if ($this->paymentMethodsHelper->isAdyenPayment($payment->getMethod()) &&
(
in_array(
$payment->getAdditionalInformation('resultCode'),
PaymentResponseHandler::ACTION_REQUIRED_STATUSES
)
OR $payment->getMethod() === 'adyen_pos_cloud'
)
) {
if ($isPosPayment || ($isAdyenPaymentMethod && $isActionRequired)) {
// Further shopper action required (e.g. redirect or 3DS authentication)
/** @var Quote $quote */
$quote = $observer->getEvent()->getQuote();
Expand Down

0 comments on commit 3bd8a24

Please sign in to comment.