Commit 28277d69 authored by alexandros's avatar alexandros

Replace isPaymentMethodOpenInvoiceMethod with isOpenInvoicePaymentMethod from the library

parent 9efc5be7
...@@ -35,14 +35,21 @@ class CaptureDataBuilder implements BuilderInterface ...@@ -35,14 +35,21 @@ class CaptureDataBuilder implements BuilderInterface
*/ */
private $adyenHelper; private $adyenHelper;
/*
* @var \Adyen\Util\OpenInvoice;
*/
private $openInvoice;
/** /**
* CaptureDataBuilder constructor. * CaptureDataBuilder constructor.
* *
* @param \Adyen\Payment\Helper\Data $adyenHelper * @param \Adyen\Payment\Helper\Data $adyenHelper
* @param Adyen\Util\OpenInvoice;
*/ */
public function __construct(\Adyen\Payment\Helper\Data $adyenHelper) public function __construct(\Adyen\Payment\Helper\Data $adyenHelper,
\Adyen\Util\OpenInvoice $openInvoice)
{ {
$this->adyenHelper = $adyenHelper; $this->adyenHelper = $adyenHelper;
$this->openInvoice = $openInvoice;
} }
/** /**
...@@ -75,7 +82,7 @@ class CaptureDataBuilder implements BuilderInterface ...@@ -75,7 +82,7 @@ class CaptureDataBuilder implements BuilderInterface
\Adyen\Payment\Observer\AdyenHppDataAssignObserver::BRAND_CODE \Adyen\Payment\Observer\AdyenHppDataAssignObserver::BRAND_CODE
); );
if ($this->adyenHelper->isPaymentMethodOpenInvoiceMethod($brandCode)) { if ($this->openInvoice->isOpenInvoicePaymentMethod($brandCode)) {
$openInvoiceFields = $this->getOpenInvoiceData($payment); $openInvoiceFields = $this->getOpenInvoiceData($payment);
$requestBody["additionalData"] = $openInvoiceFields; $requestBody["additionalData"] = $openInvoiceFields;
} }
......
...@@ -48,22 +48,31 @@ class CheckoutDataBuilder implements BuilderInterface ...@@ -48,22 +48,31 @@ class CheckoutDataBuilder implements BuilderInterface
*/ */
private $gender; private $gender;
/**
* @var \Adyen\Util\OpenInvoice
*/
private $openInvoice;
/** /**
* @param \Adyen\Payment\Helper\Data $adyenHelper * @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param \Magento\Quote\Api\CartRepositoryInterface $cartRepository * @param \Magento\Quote\Api\CartRepositoryInterface $cartRepository
* @param \Adyen\Payment\Model\Gender $gender * @param \Adyen\Payment\Model\Gender $gender
* @param \Adyen\Util\OpenInvoice $openInvoice
*/ */
public function __construct( public function __construct(
\Adyen\Payment\Helper\Data $adyenHelper, \Adyen\Payment\Helper\Data $adyenHelper,
\Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Store\Model\StoreManagerInterface $storeManager,
\Magento\Quote\Api\CartRepositoryInterface $cartRepository, \Magento\Quote\Api\CartRepositoryInterface $cartRepository,
\Adyen\Payment\Model\Gender $gender \Adyen\Payment\Model\Gender $gender,
\Adyen\Util\OpenInvoice $openInvoice
) { ) {
$this->adyenHelper = $adyenHelper; $this->adyenHelper = $adyenHelper;
$this->storeManager = $storeManager; $this->storeManager = $storeManager;
$this->cartRepository = $cartRepository; $this->cartRepository = $cartRepository;
$this->gender = $gender; $this->gender = $gender;
$this->openInvoice = $openInvoice;
} }
/** /**
...@@ -150,7 +159,7 @@ class CheckoutDataBuilder implements BuilderInterface ...@@ -150,7 +159,7 @@ class CheckoutDataBuilder implements BuilderInterface
$requestBodyPaymentMethod['sepa.ibanNumber'] = $payment->getAdditionalInformation("ibanNumber"); $requestBodyPaymentMethod['sepa.ibanNumber'] = $payment->getAdditionalInformation("ibanNumber");
} }
if ($this->adyenHelper->isPaymentMethodOpenInvoiceMethod( if ($this->openInvoice->isOpenInvoicePaymentMethod(
$payment->getAdditionalInformation(AdyenHppDataAssignObserver::BRAND_CODE) $payment->getAdditionalInformation(AdyenHppDataAssignObserver::BRAND_CODE)
) || $this->adyenHelper->isPaymentMethodAfterpayTouchMethod( ) || $this->adyenHelper->isPaymentMethodAfterpayTouchMethod(
$payment->getAdditionalInformation(AdyenHppDataAssignObserver::BRAND_CODE) $payment->getAdditionalInformation(AdyenHppDataAssignObserver::BRAND_CODE)
......
...@@ -45,20 +45,27 @@ class RefundDataBuilder implements BuilderInterface ...@@ -45,20 +45,27 @@ class RefundDataBuilder implements BuilderInterface
*/ */
protected $adyenInvoiceCollectionFactory; protected $adyenInvoiceCollectionFactory;
/*
* @var \Adyen\Util\OpenInvoice
*/
private $openInvoice;
/** /**
* RefundDataBuilder constructor. * RefundDataBuilder constructor.
* *
* @param \Adyen\Payment\Helper\Data $adyenHelper * @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Adyen\Payment\Model\ResourceModel\Order\Payment\CollectionFactory $orderPaymentCollectionFactory * @param \Adyen\Payment\Model\ResourceModel\Order\Payment\CollectionFactory $orderPaymentCollectionFactory
* @param \Adyen\Util\OpenInvoice $openInvoice
*/ */
public function __construct( public function __construct(
\Adyen\Payment\Helper\Data $adyenHelper, \Adyen\Payment\Helper\Data $adyenHelper,
\Adyen\Payment\Model\ResourceModel\Order\Payment\CollectionFactory $orderPaymentCollectionFactory, \Adyen\Payment\Model\ResourceModel\Order\Payment\CollectionFactory $orderPaymentCollectionFactory,
\Adyen\Payment\Model\ResourceModel\Invoice\CollectionFactory $adyenInvoiceCollectionFactory \Adyen\Payment\Model\ResourceModel\Invoice\CollectionFactory $adyenInvoiceCollectionFactory,
\Adyen\Util\OpenInvoice $openInvoice
) { ) {
$this->adyenHelper = $adyenHelper; $this->adyenHelper = $adyenHelper;
$this->orderPaymentCollectionFactory = $orderPaymentCollectionFactory; $this->orderPaymentCollectionFactory = $orderPaymentCollectionFactory;
$this->adyenInvoiceCollectionFactory = $adyenInvoiceCollectionFactory; $this->adyenInvoiceCollectionFactory = $adyenInvoiceCollectionFactory;
$this->openInvoice = $openInvoice;
} }
/** /**
...@@ -165,7 +172,7 @@ class RefundDataBuilder implements BuilderInterface ...@@ -165,7 +172,7 @@ class RefundDataBuilder implements BuilderInterface
\Adyen\Payment\Observer\AdyenHppDataAssignObserver::BRAND_CODE \Adyen\Payment\Observer\AdyenHppDataAssignObserver::BRAND_CODE
); );
if ($this->adyenHelper->isPaymentMethodOpenInvoiceMethod($brandCode)) { if ( $this->openInvoice->isOpenInvoicePaymentMethod($brandCode)) {
$openInvoiceFields = $this->getOpenInvoiceData($payment); $openInvoiceFields = $this->getOpenInvoiceData($payment);
//There is only one payment, so we add the fields to the first(and only) result //There is only one payment, so we add the fields to the first(and only) result
......
...@@ -144,6 +144,11 @@ class Data extends AbstractHelper ...@@ -144,6 +144,11 @@ class Data extends AbstractHelper
*/ */
private $componentRegistrar; private $componentRegistrar;
/**
* @var \Adyen\Util\OpenInvoice
*/
private $openInvoice;
/** /**
* Data constructor. * Data constructor.
* *
...@@ -168,6 +173,7 @@ class Data extends AbstractHelper ...@@ -168,6 +173,7 @@ class Data extends AbstractHelper
* @param \Magento\Framework\App\Config\ScopeConfigInterface $config * @param \Magento\Framework\App\Config\ScopeConfigInterface $config
* @param \Magento\Backend\Helper\Data $helperBackend * @param \Magento\Backend\Helper\Data $helperBackend
* @param \Magento\Framework\Serialize\SerializerInterface $serializer * @param \Magento\Framework\Serialize\SerializerInterface $serializer
* @param \Adyen\Util\OpenInvoice $openInvoice
*/ */
public function __construct( public function __construct(
\Magento\Framework\App\Helper\Context $context, \Magento\Framework\App\Helper\Context $context,
...@@ -191,7 +197,8 @@ class Data extends AbstractHelper ...@@ -191,7 +197,8 @@ class Data extends AbstractHelper
\Magento\Framework\App\Config\ScopeConfigInterface $config, \Magento\Framework\App\Config\ScopeConfigInterface $config,
\Magento\Backend\Helper\Data $helperBackend, \Magento\Backend\Helper\Data $helperBackend,
\Magento\Framework\Serialize\SerializerInterface $serializer, \Magento\Framework\Serialize\SerializerInterface $serializer,
\Magento\Framework\Component\ComponentRegistrarInterface $componentRegistrar \Magento\Framework\Component\ComponentRegistrarInterface $componentRegistrar,
\Adyen\Util\OpenInvoice $openInvoice
) { ) {
parent::__construct($context); parent::__construct($context);
$this->_encryptor = $encryptor; $this->_encryptor = $encryptor;
...@@ -215,6 +222,7 @@ class Data extends AbstractHelper ...@@ -215,6 +222,7 @@ class Data extends AbstractHelper
$this->helperBackend = $helperBackend; $this->helperBackend = $helperBackend;
$this->serializer = $serializer; $this->serializer = $serializer;
$this->componentRegistrar = $componentRegistrar; $this->componentRegistrar = $componentRegistrar;
$this->openInvoice = $openInvoice;
} }
/** /**
...@@ -1061,6 +1069,7 @@ class Data extends AbstractHelper ...@@ -1061,6 +1069,7 @@ class Data extends AbstractHelper
/** /**
* @param $paymentMethod * @param $paymentMethod
* @return bool * @return bool
* @depecated
*/ */
public function isPaymentMethodOpenInvoiceMethod($paymentMethod) public function isPaymentMethodOpenInvoiceMethod($paymentMethod)
{ {
...@@ -1133,7 +1142,7 @@ class Data extends AbstractHelper ...@@ -1133,7 +1142,7 @@ class Data extends AbstractHelper
*/ */
public function doesPaymentMethodSkipDetails($paymentMethod) public function doesPaymentMethodSkipDetails($paymentMethod)
{ {
if ($this->isPaymentMethodOpenInvoiceMethod($paymentMethod) || if ($this->openInvoice->isOpenInvoicePaymentMethod($paymentMethod) ||
$this->isPaymentMethodMolpayMethod($paymentMethod) || $this->isPaymentMethodMolpayMethod($paymentMethod) ||
$this->isPaymentMethodOneyMethod($paymentMethod) $this->isPaymentMethodOneyMethod($paymentMethod)
) { ) {
......
...@@ -90,6 +90,11 @@ class PaymentMethods extends AbstractHelper ...@@ -90,6 +90,11 @@ class PaymentMethods extends AbstractHelper
*/ */
protected $quote; protected $quote;
/**
* @var \Adyen\Util\OpenInvoice
*/
private $openInvoice;
/** /**
* PaymentMethods constructor. * PaymentMethods constructor.
* *
...@@ -104,6 +109,7 @@ class PaymentMethods extends AbstractHelper ...@@ -104,6 +109,7 @@ class PaymentMethods extends AbstractHelper
* @param \Magento\Framework\View\Asset\Source $assetSource * @param \Magento\Framework\View\Asset\Source $assetSource
* @param \Magento\Framework\View\DesignInterface $design * @param \Magento\Framework\View\DesignInterface $design
* @param \Magento\Framework\View\Design\Theme\ThemeProviderInterface $themeProvider * @param \Magento\Framework\View\Design\Theme\ThemeProviderInterface $themeProvider
* @param \Adyen\Util\OpenInvoice $openInvoice
*/ */
public function __construct( public function __construct(
\Magento\Quote\Api\CartRepositoryInterface $quoteRepository, \Magento\Quote\Api\CartRepositoryInterface $quoteRepository,
...@@ -116,7 +122,8 @@ class PaymentMethods extends AbstractHelper ...@@ -116,7 +122,8 @@ class PaymentMethods extends AbstractHelper
\Magento\Framework\App\RequestInterface $request, \Magento\Framework\App\RequestInterface $request,
\Magento\Framework\View\Asset\Source $assetSource, \Magento\Framework\View\Asset\Source $assetSource,
\Magento\Framework\View\DesignInterface $design, \Magento\Framework\View\DesignInterface $design,
\Magento\Framework\View\Design\Theme\ThemeProviderInterface $themeProvider \Magento\Framework\View\Design\Theme\ThemeProviderInterface $themeProvider,
\Adyen\Util\OpenInvoice $openInvoice
) { ) {
$this->quoteRepository = $quoteRepository; $this->quoteRepository = $quoteRepository;
$this->config = $config; $this->config = $config;
...@@ -129,6 +136,7 @@ class PaymentMethods extends AbstractHelper ...@@ -129,6 +136,7 @@ class PaymentMethods extends AbstractHelper
$this->assetSource = $assetSource; $this->assetSource = $assetSource;
$this->design = $design; $this->design = $design;
$this->themeProvider = $themeProvider; $this->themeProvider = $themeProvider;
$this->openInvoice = $openInvoice;
} }
/** /**
...@@ -199,8 +207,8 @@ class PaymentMethods extends AbstractHelper ...@@ -199,8 +207,8 @@ class PaymentMethods extends AbstractHelper
$paymentMethod = $this->fieldMapPaymentMethod($paymentMethod); $paymentMethod = $this->fieldMapPaymentMethod($paymentMethod);
// check if payment method is an openinvoice method // check if payment method is an openinvoice method
$paymentMethod['isPaymentMethodOpenInvoiceMethod'] = $paymentMethod['isOpenInvoicePaymentMethod'] =
$this->adyenHelper->isPaymentMethodOpenInvoiceMethod($paymentMethodCode); $this->openInvoice->isOpenInvoicePaymentMethod($paymentMethodCode);
// add icon location in result // add icon location in result
if ($this->adyenHelper->showLogos()) { if ($this->adyenHelper->showLogos()) {
......
...@@ -49,21 +49,29 @@ class Requests extends AbstractHelper ...@@ -49,21 +49,29 @@ class Requests extends AbstractHelper
*/ */
private $urlBuilder; private $urlBuilder;
/*
* @var \Adyen\Util\OpenInvoice
*/
private $openInvoice;
/** /**
* Requests constructor. * Requests constructor.
* *
* @param Data $adyenHelper * @param Data $adyenHelper
* @param Config $adyenConfig * @param Config $adyenConfig
* @param \Magento\Framework\UrlInterface $urlBuilder * @param \Magento\Framework\UrlInterface $urlBuilder
* @param \Adyen\Util\OpenInvoice
*/ */
public function __construct( public function __construct(
\Adyen\Payment\Helper\Data $adyenHelper, \Adyen\Payment\Helper\Data $adyenHelper,
\Adyen\Payment\Helper\Config $adyenConfig, \Adyen\Payment\Helper\Config $adyenConfig,
\Magento\Framework\UrlInterface $urlBuilder \Magento\Framework\UrlInterface $urlBuilder,
\Adyen\Util\OpenInvoice $openInvoice
) { ) {
$this->adyenHelper = $adyenHelper; $this->adyenHelper = $adyenHelper;
$this->adyenConfig = $adyenConfig; $this->adyenConfig = $adyenConfig;
$this->urlBuilder = $urlBuilder; $this->urlBuilder = $urlBuilder;
$this->openInvoice = $openInvoice;
} }
/** /**
...@@ -116,8 +124,8 @@ class Requests extends AbstractHelper ...@@ -116,8 +124,8 @@ class Requests extends AbstractHelper
// In case of virtual product and guest checkout there is a workaround to get the guest's email address // In case of virtual product and guest checkout there is a workaround to get the guest's email address
if (!empty($additionalData['guestEmail'])) { if (!empty($additionalData['guestEmail'])) {
if ($this->adyenHelper->isPaymentMethodOpenInvoiceMethod($paymentMethod) && if ($this->openInvoice->isOpenInvoicePaymentMethod($paymentMethod) &&
!$this->adyenHelper->isPaymentMethodAfterpayTouchMethod($paymentMethod) !$this->openInvoice->isAfterPayTouchPaymentMethod($paymentMethod)
) { ) {
$request['paymentMethod']['personalDetails']['shopperEmail'] = $additionalData['guestEmail']; $request['paymentMethod']['personalDetails']['shopperEmail'] = $additionalData['guestEmail'];
} else { } else {
...@@ -127,8 +135,8 @@ class Requests extends AbstractHelper ...@@ -127,8 +135,8 @@ class Requests extends AbstractHelper
if (!empty($billingAddress)) { if (!empty($billingAddress)) {
// Openinvoice (klarna and afterpay BUT not afterpay touch) methods requires different request format // Openinvoice (klarna and afterpay BUT not afterpay touch) methods requires different request format
if ($this->adyenHelper->isPaymentMethodOpenInvoiceMethod($paymentMethod) && if ($this->openInvoice->isOpenInvoicePaymentMethod($paymentMethod)&&
!$this->adyenHelper->isPaymentMethodAfterpayTouchMethod($paymentMethod) !$this->openInvoice->isAfterPayTouchPaymentMethod($paymentMethod)
) { ) {
if ($customerEmail = $billingAddress->getEmail()) { if ($customerEmail = $billingAddress->getEmail()) {
$request['paymentMethod']['personalDetails']['shopperEmail'] = $customerEmail; $request['paymentMethod']['personalDetails']['shopperEmail'] = $customerEmail;
......
...@@ -269,6 +269,11 @@ class Cron ...@@ -269,6 +269,11 @@ class Cron
*/ */
protected $encryptor; protected $encryptor;
/**
* @var \Adyen\Util\OpenInvoice
*/
private $openInvoice;
/** /**
* Cron constructor. * Cron constructor.
* *
...@@ -300,6 +305,7 @@ class Cron ...@@ -300,6 +305,7 @@ class Cron
* @param PaymentTokenFactoryInterface $paymentTokenFactory * @param PaymentTokenFactoryInterface $paymentTokenFactory
* @param PaymentTokenRepositoryInterface $paymentTokenRepository * @param PaymentTokenRepositoryInterface $paymentTokenRepository
* @param EncryptorInterface $encryptor * @param EncryptorInterface $encryptor
* @param \Adyen\Util\OpenInvoice $openInvoice
*/ */
public function __construct( public function __construct(
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
...@@ -329,7 +335,8 @@ class Cron ...@@ -329,7 +335,8 @@ class Cron
PaymentTokenManagement $paymentTokenManagement, PaymentTokenManagement $paymentTokenManagement,
PaymentTokenFactoryInterface $paymentTokenFactory, PaymentTokenFactoryInterface $paymentTokenFactory,
PaymentTokenRepositoryInterface $paymentTokenRepository, PaymentTokenRepositoryInterface $paymentTokenRepository,
EncryptorInterface $encryptor EncryptorInterface $encryptor,
\Adyen\Util\OpenInvoice $openInvoice
) { ) {
$this->_scopeConfig = $scopeConfig; $this->_scopeConfig = $scopeConfig;
$this->_adyenLogger = $adyenLogger; $this->_adyenLogger = $adyenLogger;
...@@ -359,6 +366,7 @@ class Cron ...@@ -359,6 +366,7 @@ class Cron
$this->paymentTokenFactory = $paymentTokenFactory; $this->paymentTokenFactory = $paymentTokenFactory;
$this->paymentTokenRepository = $paymentTokenRepository; $this->paymentTokenRepository = $paymentTokenRepository;
$this->encryptor = $encryptor; $this->encryptor = $encryptor;
$this->openInvoice = $openInvoice;
} }
/** /**
...@@ -752,7 +760,7 @@ class Cron ...@@ -752,7 +760,7 @@ class Cron
} }
// if payment method is klarna, ratepay or openinvoice/afterpay show the reservartion number // if payment method is klarna, ratepay or openinvoice/afterpay show the reservartion number
if ($this->_adyenHelper->isPaymentMethodOpenInvoiceMethod( if ($this->openInvoice->isOpenInvoicePaymentMethod(
$this->_paymentMethod) && !empty($this->_klarnaReservationNumber)) { $this->_paymentMethod) && !empty($this->_klarnaReservationNumber)) {
$klarnaReservationNumberText = "<br /> reservationNumber: " . $this->_klarnaReservationNumber; $klarnaReservationNumberText = "<br /> reservationNumber: " . $this->_klarnaReservationNumber;
} else { } else {
...@@ -1688,7 +1696,7 @@ class Cron ...@@ -1688,7 +1696,7 @@ class Cron
// if auto capture mode for openinvoice is turned on then use auto capture // if auto capture mode for openinvoice is turned on then use auto capture
if ($captureModeOpenInvoice == true && if ($captureModeOpenInvoice == true &&
$this->_adyenHelper->isPaymentMethodOpenInvoiceMethod($this->_paymentMethod) $this->openInvoice->isOpenInvoicePaymentMethod($this->_paymentMethod)
) { ) {
$this->_adyenLogger->addAdyenNotificationCronjob( $this->_adyenLogger->addAdyenNotificationCronjob(
'This payment method is configured to be working as auto capture ' 'This payment method is configured to be working as auto capture '
...@@ -1722,7 +1730,7 @@ class Cron ...@@ -1722,7 +1730,7 @@ class Cron
* online capture after delivery, use Magento backend to online invoice * online capture after delivery, use Magento backend to online invoice
* (if the option auto capture mode for openinvoice is not set) * (if the option auto capture mode for openinvoice is not set)
*/ */
if ($this->_adyenHelper->isPaymentMethodOpenInvoiceMethod($this->_paymentMethod)) { if ($this->openInvoice->isOpenInvoicePaymentMethod($this->_paymentMethod)) {
$this->_adyenLogger->addAdyenNotificationCronjob $this->_adyenLogger->addAdyenNotificationCronjob
( (
'Capture mode for klarna is by default set to manual' 'Capture mode for klarna is by default set to manual'
...@@ -1754,7 +1762,7 @@ class Cron ...@@ -1754,7 +1762,7 @@ class Cron
$paymentMethod = $this->_paymentMethod; $paymentMethod = $this->_paymentMethod;
// For all openinvoice methods manual capture is the default // For all openinvoice methods manual capture is the default
if ($this->_adyenHelper->isPaymentMethodOpenInvoiceMethod($paymentMethod)) { if ($this->openInvoice->isOpenInvoicePaymentMethod($paymentMethod)) {
return true; return true;
} }
......
...@@ -49,21 +49,28 @@ class BeforeShipmentObserver extends AbstractDataAssignObserver ...@@ -49,21 +49,28 @@ class BeforeShipmentObserver extends AbstractDataAssignObserver
*/ */
private $invoiceRepository; private $invoiceRepository;
/**
* @var \Adyen\Util\OpenInvoice
*/
private $openInvoice;
/** /**
* BeforeShipmentObserver constructor. * BeforeShipmentObserver constructor.
* *
* @param AdyenHelper $adyenHelper * @param AdyenHelper $adyenHelper
* @param AdyenLogger $logger * @param AdyenLogger $logger
* @param InvoiceRepository $invoiceRepository * @param InvoiceRepository $invoiceRepository
* @param \Adyen\Util\OpenInvoice $openInvoice
*/ */
public function __construct( public function __construct(
AdyenHelper $adyenHelper, AdyenHelper $adyenHelper,
AdyenLogger $logger, AdyenLogger $logger,
InvoiceRepository $invoiceRepository InvoiceRepository $invoiceRepository,
\Adyen\Util\OpenInvoice $openInvoice
) { ) {
$this->adyenHelper = $adyenHelper; $this->adyenHelper = $adyenHelper;
$this->logger = $logger; $this->logger = $logger;
$this->invoiceRepository = $invoiceRepository; $this->invoiceRepository = $invoiceRepository;
$this->openInvoice = $openInvoice;
} }
/** /**
...@@ -101,7 +108,7 @@ class BeforeShipmentObserver extends AbstractDataAssignObserver ...@@ -101,7 +108,7 @@ class BeforeShipmentObserver extends AbstractDataAssignObserver
$payment = $order->getPayment(); $payment = $order->getPayment();
$brandCode = $payment->getAdditionalInformation(AdyenHppDataAssignObserver::BRAND_CODE); $brandCode = $payment->getAdditionalInformation(AdyenHppDataAssignObserver::BRAND_CODE);
if (!$this->adyenHelper->isPaymentMethodOpenInvoiceMethod($brandCode)) { if (!$this->openInvoice->isOpenInvoicePaymentMethod($brandCode)) {
$this->logger->info( $this->logger->info(
"Payment method is from Adyen but isn't OpenInvoice for order id {$order->getId()}", "Payment method is from Adyen but isn't OpenInvoice for order id {$order->getId()}",
['observer' => 'BeforeShipmentObserver'] ['observer' => 'BeforeShipmentObserver']
......
...@@ -225,22 +225,22 @@ define( ...@@ -225,22 +225,22 @@ define(
}; };
/** /**
* Checks if payment method is open invoice * Checks if payment method is open invoice
* @returns {*|isPaymentMethodOpenInvoiceMethod} * @returns {*|isOpenInvoicePaymentMethod}
*/ */
result.isPaymentMethodOpenInvoiceMethod = function () { result.isOpenInvoicePaymentMethod = function () {
return value.isPaymentMethodOpenInvoiceMethod; return value.isOpenInvoicePaymentMethod;
}; };
/** /**
* Checks if payment method is open invoice but not in the list below * Checks if payment method is open invoice but not in the list below
* [klarna, afterpay] * [klarna, afterpay]
* @returns {boolean} * @returns {boolean}
*/ */
result.isPaymentMethodOtherOpenInvoiceMethod = function () { result.isOpenInvoicePaymentMethod = function () {
if ( if (
!result.isPaymentMethodAfterPay() && !result.isPaymentMethodAfterPay() &&
!result.isPaymentMethodKlarna() && !result.isPaymentMethodKlarna() &&
!result.isPaymentMethodAfterPayTouch() && !result.isPaymentMethodAfterPayTouch() &&
value.isPaymentMethodOpenInvoiceMethod value.isOpenInvoicePaymentMethod
) { ) {
return true; return true;
} }
...@@ -500,7 +500,7 @@ define( ...@@ -500,7 +500,7 @@ define(
if (self.hasIssuersAvailable()) { if (self.hasIssuersAvailable()) {
additionalData.issuer_id = this.issuer(); additionalData.issuer_id = this.issuer();
} else if (self.isPaymentMethodOpenInvoiceMethod()) { } else if (self.isOpenInvoicePaymentMethod()) {
additionalData.gender = this.gender(); additionalData.gender = this.gender();
additionalData.dob = this.dob(); additionalData.dob = this.dob();
additionalData.telephone = this.telephone(); additionalData.telephone = this.telephone();
...@@ -532,7 +532,7 @@ define( ...@@ -532,7 +532,7 @@ define(
result.issuerIds = result.getIssuers(); result.issuerIds = result.getIssuers();
result.issuer = ko.observable(null); result.issuer = ko.observable(null);
} else if (value.isPaymentMethodOpenInvoiceMethod) { } else if (value.isOpenInvoicePaymentMethod) {
result.telephone = ko.observable(quote.shippingAddress().telephone); result.telephone = ko.observable(quote.shippingAddress().telephone);
result.gender = ko.observable(window.checkoutConfig.payment.adyenHpp.gender); result.gender = ko.observable(window.checkoutConfig.payment.adyenHpp.gender);
result.dob = ko.observable(window.checkoutConfig.payment.adyenHpp.dob); result.dob = ko.observable(window.checkoutConfig.payment.adyenHpp.dob);
......
...@@ -145,7 +145,7 @@ ...@@ -145,7 +145,7 @@
<div class="checkout-component-dock" afterRender="renderAfterPayComponent()" data-bind="attr: { id: 'afterPayContainer'}"></div> <div class="checkout-component-dock" afterRender="renderAfterPayComponent()" data-bind="attr: { id: 'afterPayContainer'}"></div>
<!--/ko--> <!--/ko-->
<!-- ko if: isPaymentMethodOtherOpenInvoiceMethod() --> <!-- ko if: isOpenInvoicePaymentMethod() -->
<div class="field gender required"> <div class="field gender required">
<label data-bind="attr: {for: getCode() + '_gender_type_' + value}" class="label"> <label data-bind="attr: {for: getCode() + '_gender_type_' + value}" class="label">
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment