Skip to content

Commit

Permalink
[ECP-9064] Use constant definition for payment action field
Browse files Browse the repository at this point in the history
  • Loading branch information
Can Demiralp committed Mar 25, 2024
1 parent ff0fee7 commit b46398e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions Model/Config/Source/PaymentAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace Adyen\Payment\Model\Config\Source;

use Magento\Framework\Data\OptionSourceInterface;
use Magento\Payment\Model\MethodInterface;

class PaymentAction implements OptionSourceInterface
{
Expand All @@ -21,8 +22,8 @@ class PaymentAction implements OptionSourceInterface
public function toOptionArray()
{
return [
['value' => 'authorize', 'label' => 'Authorize'],
['value' => 'order', 'label' => 'Order']
['value' => MethodInterface::ACTION_AUTHORIZE, 'label' => MethodInterface::ACTION_AUTHORIZE],
['value' => MethodInterface::ACTION_ORDER, 'label' => MethodInterface::ACTION_ORDER],
];
}

Expand Down
4 changes: 2 additions & 2 deletions Observer/SetOrderStateAfterPaymentObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;
use Magento\Framework\Exception\LocalizedException;
use Magento\Paypal\Model\AbstractConfig;
use Magento\Payment\Model\MethodInterface;
use Magento\Sales\Model\Order;
use Magento\Sales\Model\Order\Payment;
use Magento\Sales\Model\Order\StatusResolver;
Expand Down Expand Up @@ -75,7 +75,7 @@ private function handlePosPayment(Payment $payment): void
$storeId = $payment->getOrder()->getStoreId();
$posPaymentAction = $this->configHelper->getAdyenPosCloudPaymentAction($storeId);

if ($posPaymentAction === AbstractConfig::PAYMENT_ACTION_ORDER) {
if ($posPaymentAction === MethodInterface::ACTION_ORDER) {
$order = $payment->getOrder();
$status = $this->statusResolver->getOrderStatusByState(
$payment->getOrder(),
Expand Down
4 changes: 2 additions & 2 deletions Observer/SubmitQuoteObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
use Adyen\Payment\Helper\PaymentResponseHandler;
use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;
use Magento\Paypal\Model\AbstractConfig;
use Magento\Payment\Model\MethodInterface;
use Magento\Quote\Model\Quote;
use Magento\Sales\Model\Order;

Expand Down Expand Up @@ -66,7 +66,7 @@ public function execute(Observer $observer): void
$isPosPayment = $payment->getMethod() === 'adyen_pos_cloud';
$posPaymentAction = $this->configHelper->getAdyenPosCloudPaymentAction($storeId);

if (($isPosPayment && $posPaymentAction === AbstractConfig::PAYMENT_ACTION_ORDER) ||
if (($isPosPayment && $posPaymentAction === MethodInterface::ACTION_ORDER) ||
($isAdyenPaymentMethod && $isActionRequired)) {
// Further shopper action required (e.g. redirect or 3DS authentication)
/** @var Quote $quote */
Expand Down

0 comments on commit b46398e

Please sign in to comment.