We will be off from 27/1 (Monday) to 31/1 (Friday) (GMT +7) for our Tet Holiday (Lunar New Year) in our country

Commit fa758982 authored by Rik ter Beek's avatar Rik ter Beek

fix rebase

parents 7e95d1ca 48811d7c
...@@ -38,79 +38,78 @@ class CcAuthorizationDataBuilder implements BuilderInterface ...@@ -38,79 +38,78 @@ class CcAuthorizationDataBuilder implements BuilderInterface
*/ */
private $appState; private $appState;
/** /**
* CcAuthorizationDataBuilder constructor. * CcAuthorizationDataBuilder constructor.
* *
* @param \Adyen\Payment\Helper\Data $adyenHelper * @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Model\Context $context
*/ */
public function __construct( public function __construct(
\Adyen\Payment\Helper\Data $adyenHelper, \Adyen\Payment\Helper\Data $adyenHelper,
\Magento\Framework\Model\Context $context \Magento\Framework\Model\Context $context
) ) {
{ $this->adyenHelper = $adyenHelper;
$this->adyenHelper = $adyenHelper; $this->appState = $context->getAppState();
$this->appState = $context->getAppState(); }
}
/** /**
* @param array $buildSubject * @param array $buildSubject
* @return mixed * @return mixed
*/ */
public function build(array $buildSubject) public function build(array $buildSubject)
{ {
/** @var \Magento\Payment\Gateway\Data\PaymentDataObject $paymentDataObject */ /** @var \Magento\Payment\Gateway\Data\PaymentDataObject $paymentDataObject */
$paymentDataObject = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($buildSubject); $paymentDataObject = \Magento\Payment\Gateway\Helper\SubjectReader::readPayment($buildSubject);
$payment = $paymentDataObject->getPayment(); $payment = $paymentDataObject->getPayment();
$order = $paymentDataObject->getOrder(); $order = $paymentDataObject->getOrder();
$storeId = $order->getStoreId(); $storeId = $order->getStoreId();
$request = []; $request = [];
$request['paymentMethod']['type'] = "scheme"; $request['paymentMethod']['type'] = "scheme";
if ($cardNumber = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::CREDIT_CARD_NUMBER)) { if ($cardNumber = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::CREDIT_CARD_NUMBER)) {
$request['paymentMethod']['encryptedCardNumber'] = $cardNumber; $request['paymentMethod']['encryptedCardNumber'] = $cardNumber;
} }
if ($expiryMonth = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::EXPIRY_MONTH)) { if ($expiryMonth = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::EXPIRY_MONTH)) {
$request['paymentMethod']['encryptedExpiryMonth'] = $expiryMonth; $request['paymentMethod']['encryptedExpiryMonth'] = $expiryMonth;
} }
if ($expiryYear = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::EXPIRY_YEAR)) { if ($expiryYear = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::EXPIRY_YEAR)) {
$request['paymentMethod']['encryptedExpiryYear'] = $expiryYear; $request['paymentMethod']['encryptedExpiryYear'] = $expiryYear;
} }
if ($holderName = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::HOLDER_NAME)) { if ($holderName = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::HOLDER_NAME)) {
$request['paymentMethod']['holderName'] = $holderName; $request['paymentMethod']['holderName'] = $holderName;
} }
if ($securityCode = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::SECURITY_CODE)) { if ($securityCode = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::SECURITY_CODE)) {
$request['paymentMethod']['encryptedSecurityCode'] = $securityCode; $request['paymentMethod']['encryptedSecurityCode'] = $securityCode;
} }
// Remove from additional data // Remove from additional data
$payment->unsAdditionalInformation(AdyenCcDataAssignObserver::CREDIT_CARD_NUMBER); $payment->unsAdditionalInformation(AdyenCcDataAssignObserver::CREDIT_CARD_NUMBER);
$payment->unsAdditionalInformation(AdyenCcDataAssignObserver::EXPIRY_MONTH); $payment->unsAdditionalInformation(AdyenCcDataAssignObserver::EXPIRY_MONTH);
$payment->unsAdditionalInformation(AdyenCcDataAssignObserver::EXPIRY_YEAR); $payment->unsAdditionalInformation(AdyenCcDataAssignObserver::EXPIRY_YEAR);
$payment->unsAdditionalInformation(AdyenCcDataAssignObserver::SECURITY_CODE); $payment->unsAdditionalInformation(AdyenCcDataAssignObserver::SECURITY_CODE);
$payment->unsAdditionalInformation(AdyenCcDataAssignObserver::HOLDER_NAME); $payment->unsAdditionalInformation(AdyenCcDataAssignObserver::HOLDER_NAME);
/** /**
* if MOTO for backend is enabled use MOTO as shopper interaction type * if MOTO for backend is enabled use MOTO as shopper interaction type
*/ */
$enableMoto = $this->adyenHelper->getAdyenCcConfigDataFlag('enable_moto', $storeId); $enableMoto = $this->adyenHelper->getAdyenCcConfigDataFlag('enable_moto', $storeId);
if ($this->appState->getAreaCode() === \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE && if ($this->appState->getAreaCode() === \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE &&
$enableMoto $enableMoto
) { ) {
$request['shopperInteraction'] = "Moto"; $request['shopperInteraction'] = "Moto";
} }
// if installments is set add it into the request // if installments is set add it into the request
if ($payment->getAdditionalInformation(AdyenCcDataAssignObserver::NUMBER_OF_INSTALLMENTS) && if ($payment->getAdditionalInformation(AdyenCcDataAssignObserver::NUMBER_OF_INSTALLMENTS) &&
$payment->getAdditionalInformation(AdyenCcDataAssignObserver::NUMBER_OF_INSTALLMENTS) > 0 $payment->getAdditionalInformation(AdyenCcDataAssignObserver::NUMBER_OF_INSTALLMENTS) > 0
) { ) {
$request['installments']['value'] = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::NUMBER_OF_INSTALLMENTS); $request['installments']['value'] = $payment->getAdditionalInformation(AdyenCcDataAssignObserver::NUMBER_OF_INSTALLMENTS);
} }
return $request; return $request;
} }
} }
\ No newline at end of file
...@@ -34,9 +34,9 @@ class Data extends AbstractHelper ...@@ -34,9 +34,9 @@ class Data extends AbstractHelper
const TEST = 'test'; const TEST = 'test';
const LIVE = 'live'; const LIVE = 'live';
const CHECKOUT_CONTEXT_URL_LIVE = 'https://checkoutshopper-live.adyen.com/checkoutshopper/'; const CHECKOUT_CONTEXT_URL_LIVE = 'https://checkoutshopper-live.adyen.com/checkoutshopper/';
const CHECKOUT_CONTEXT_URL_TEST = 'https://checkoutshopper-test.adyen.com/checkoutshopper/'; const CHECKOUT_CONTEXT_URL_TEST = 'https://checkoutshopper-test.adyen.com/checkoutshopper/';
const CHECKOUT_COMPONENT_JS_LIVE = 'https://checkoutshopper-live.adyen.com/checkoutshopper/sdk/2.0.0-beta.4/adyen.js'; const CHECKOUT_COMPONENT_JS_LIVE = 'https://checkoutshopper-live.adyen.com/checkoutshopper/sdk/2.0.0-beta.4/adyen.js';
const CHECKOUT_COMPONENT_JS_TEST = 'https://checkoutshopper-test.adyen.com/checkoutshopper/sdk/2.0.0-beta.4/adyen.js'; const CHECKOUT_COMPONENT_JS_TEST = 'https://checkoutshopper-test.adyen.com/checkoutshopper/sdk/2.0.0-beta.4/adyen.js';
/** /**
* @var \Magento\Framework\Encryption\EncryptorInterface * @var \Magento\Framework\Encryption\EncryptorInterface
...@@ -98,35 +98,35 @@ class Data extends AbstractHelper ...@@ -98,35 +98,35 @@ class Data extends AbstractHelper
*/ */
protected $adyenLogger; protected $adyenLogger;
/** /**
* @var \Magento\Store\Model\StoreManagerInterface * @var \Magento\Store\Model\StoreManagerInterface
*/ */
protected $storeManager; protected $storeManager;
/** /**
* @var \Magento\Framework\App\CacheInterface * @var \Magento\Framework\App\CacheInterface
*/ */
protected $cache; protected $cache;
/** /**
* Data constructor. * Data constructor.
* *
* @param \Magento\Framework\App\Helper\Context $context * @param \Magento\Framework\App\Helper\Context $context
* @param \Magento\Framework\Encryption\EncryptorInterface $encryptor * @param \Magento\Framework\Encryption\EncryptorInterface $encryptor
* @param \Magento\Framework\Config\DataInterface $dataStorage * @param \Magento\Framework\Config\DataInterface $dataStorage
* @param \Magento\Directory\Model\Config\Source\Country $country * @param \Magento\Directory\Model\Config\Source\Country $country
* @param \Magento\Framework\Module\ModuleListInterface $moduleList * @param \Magento\Framework\Module\ModuleListInterface $moduleList
* @param \Adyen\Payment\Model\ResourceModel\Billing\Agreement\CollectionFactory $billingAgreementCollectionFactory * @param \Adyen\Payment\Model\ResourceModel\Billing\Agreement\CollectionFactory $billingAgreementCollectionFactory
* @param \Magento\Framework\View\Asset\Repository $assetRepo * @param \Magento\Framework\View\Asset\Repository $assetRepo
* @param \Magento\Framework\View\Asset\Source $assetSource * @param \Magento\Framework\View\Asset\Source $assetSource
* @param \Adyen\Payment\Model\ResourceModel\Notification\CollectionFactory $notificationFactory * @param \Adyen\Payment\Model\ResourceModel\Notification\CollectionFactory $notificationFactory
* @param \Magento\Tax\Model\Config $taxConfig * @param \Magento\Tax\Model\Config $taxConfig
* @param \Magento\Tax\Model\Calculation $taxCalculation * @param \Magento\Tax\Model\Calculation $taxCalculation
* @param \Magento\Framework\App\ProductMetadataInterface $productMetadata * @param \Magento\Framework\App\ProductMetadataInterface $productMetadata
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger * @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
* @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param \Magento\Framework\App\CacheInterface $cache * @param \Magento\Framework\App\CacheInterface $cache
*/ */
public function __construct( public function __construct(
\Magento\Framework\App\Helper\Context $context, \Magento\Framework\App\Helper\Context $context,
\Magento\Framework\Encryption\EncryptorInterface $encryptor, \Magento\Framework\Encryption\EncryptorInterface $encryptor,
...@@ -139,11 +139,10 @@ class Data extends AbstractHelper ...@@ -139,11 +139,10 @@ class Data extends AbstractHelper
\Adyen\Payment\Model\ResourceModel\Notification\CollectionFactory $notificationFactory, \Adyen\Payment\Model\ResourceModel\Notification\CollectionFactory $notificationFactory,
\Magento\Tax\Model\Config $taxConfig, \Magento\Tax\Model\Config $taxConfig,
\Magento\Tax\Model\Calculation $taxCalculation, \Magento\Tax\Model\Calculation $taxCalculation,
\Magento\Framework\App\ProductMetadataInterface $productMetadata, \Magento\Framework\App\ProductMetadataInterface $productMetadata,
\Adyen\Payment\Logger\AdyenLogger $adyenLogger, \Adyen\Payment\Logger\AdyenLogger $adyenLogger,
\Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Store\Model\StoreManagerInterface $storeManager,
\Magento\Framework\App\CacheInterface $cache \Magento\Framework\App\CacheInterface $cache
) { ) {
parent::__construct($context); parent::__construct($context);
$this->_encryptor = $encryptor; $this->_encryptor = $encryptor;
...@@ -601,12 +600,12 @@ class Data extends AbstractHelper ...@@ -601,12 +600,12 @@ class Data extends AbstractHelper
return $secretWord; return $secretWord;
} }
/** /**
* @desc Check if configuration is set to demo mode * @desc Check if configuration is set to demo mode
* *
* @param int|null $storeId * @param int|null $storeId
* @return mixed * @return mixed
*/ */
public function isDemoMode($storeId = null) public function isDemoMode($storeId = null)
{ {
return $this->getAdyenAbstractConfigDataFlag('demo_mode', $storeId); return $this->getAdyenAbstractConfigDataFlag('demo_mode', $storeId);
...@@ -621,51 +620,51 @@ class Data extends AbstractHelper ...@@ -621,51 +620,51 @@ class Data extends AbstractHelper
return $this->_encryptor->decrypt(trim($this->getAdyenAbstractConfigData('notification_password'))); return $this->_encryptor->decrypt(trim($this->getAdyenAbstractConfigData('notification_password')));
} }
/** /**
* @desc Retrieve the API key * @desc Retrieve the API key
* *
* @param int|null $storeId * @param int|null $storeId
* @return string * @return string
*/ */
public function getAPIKey($storeId = null) public function getAPIKey($storeId = null)
{ {
if ($this->isDemoMode($storeId)) { if ($this->isDemoMode($storeId)) {
$apiKey = $this->_encryptor->decrypt(trim($this->getAdyenAbstractConfigData('api_key_test', $apiKey = $this->_encryptor->decrypt(trim($this->getAdyenAbstractConfigData('api_key_test',
$storeId))); $storeId)));
} else { } else {
$apiKey = $this->_encryptor->decrypt(trim($this->getAdyenAbstractConfigData('api_key_live', $apiKey = $this->_encryptor->decrypt(trim($this->getAdyenAbstractConfigData('api_key_live',
$storeId))); $storeId)));
} }
return $apiKey; return $apiKey;
} }
/** /**
* @desc Retrieve the webserver username * @desc Retrieve the webserver username
* *
* @param int|null $storeId * @param int|null $storeId
* @return string * @return string
*/ */
public function getWsUsername($storeId = null) public function getWsUsername($storeId = null)
{ {
if ($this->isDemoMode($storeId)) { if ($this->isDemoMode($storeId)) {
$wsUsername = trim($this->getAdyenAbstractConfigData('ws_username_test', $storeId)); $wsUsername = trim($this->getAdyenAbstractConfigData('ws_username_test', $storeId));
} else { } else {
$wsUsername = trim($this->getAdyenAbstractConfigData('ws_username_live', $storeId)); $wsUsername = trim($this->getAdyenAbstractConfigData('ws_username_live', $storeId));
} }
return $wsUsername; return $wsUsername;
} }
/** /**
* @desc Retrieve the Live endpoint prefix key * @desc Retrieve the Live endpoint prefix key
* *
* @param int|null $storeId * @param int|null $storeId
* @return string * @return string
*/ */
public function getLiveEndpointPrefix($storeId = null) public function getLiveEndpointPrefix($storeId = null)
{ {
$prefix = trim($this->getAdyenAbstractConfigData('live_endpoint_url_prefix', $storeId)); $prefix = trim($this->getAdyenAbstractConfigData('live_endpoint_url_prefix', $storeId));
return $prefix; return $prefix;
} }
/** /**
* @desc Cancels the order * @desc Cancels the order
...@@ -1059,7 +1058,6 @@ class Data extends AbstractHelper ...@@ -1059,7 +1058,6 @@ class Data extends AbstractHelper
$notifications = $this->_notificationFactory->create(); $notifications = $this->_notificationFactory->create();
$notifications->unprocessedNotificationsFilter(); $notifications->unprocessedNotificationsFilter();
return $notifications->getSize(); return $notifications->getSize();
;
} }
/** /**
...@@ -1320,20 +1318,20 @@ class Data extends AbstractHelper ...@@ -1320,20 +1318,20 @@ class Data extends AbstractHelper
$apiKey = $this->getAPIKey($storeId); $apiKey = $this->getAPIKey($storeId);
$client = $this->createAdyenClient(); $client = $this->createAdyenClient();
$client->setApplicationName("Magento 2 plugin"); $client->setApplicationName("Magento 2 plugin");
$client->setXApiKey($apiKey); $client->setXApiKey($apiKey);
$client->setAdyenPaymentSource($this->getModuleName(), $this->getModuleVersion()); $client->setAdyenPaymentSource($this->getModuleName(), $this->getModuleVersion());
$client->setExternalPlatform($this->productMetadata->getName(), $this->productMetadata->getVersion()); $client->setExternalPlatform($this->productMetadata->getName(), $this->productMetadata->getVersion());
if ($this->isDemoMode($storeId)) { if ($this->isDemoMode($storeId)) {
$client->setEnvironment(\Adyen\Environment::TEST); $client->setEnvironment(\Adyen\Environment::TEST);
} else { } else {
$client->setEnvironment(\Adyen\Environment::LIVE, $this->getLiveEndpointPrefix($storeId)); $client->setEnvironment(\Adyen\Environment::LIVE, $this->getLiveEndpointPrefix($storeId));
} }
$client->setLogger($this->adyenLogger); $client->setLogger($this->adyenLogger);
return $client; return $client;
} }
...@@ -1442,5 +1440,5 @@ class Data extends AbstractHelper ...@@ -1442,5 +1440,5 @@ class Data extends AbstractHelper
} }
return self::CHECKOUT_COMPONENT_JS_LIVE; return self::CHECKOUT_COMPONENT_JS_LIVE;
} }
} }
...@@ -34,10 +34,10 @@ class AdyenGenericConfigProvider implements ConfigProviderInterface ...@@ -34,10 +34,10 @@ class AdyenGenericConfigProvider implements ConfigProviderInterface
*/ */
protected $_adyenHelper; protected $_adyenHelper;
/** /**
* @var \Magento\Store\Model\StoreManagerInterface * @var \Magento\Store\Model\StoreManagerInterface
*/ */
protected $storeManager; protected $storeManager;
/** /**
* AdyenGenericConfigProvider constructor. * AdyenGenericConfigProvider constructor.
...@@ -49,7 +49,7 @@ class AdyenGenericConfigProvider implements ConfigProviderInterface ...@@ -49,7 +49,7 @@ class AdyenGenericConfigProvider implements ConfigProviderInterface
\Magento\Store\Model\StoreManagerInterface $storeManager \Magento\Store\Model\StoreManagerInterface $storeManager
) { ) {
$this->_adyenHelper = $adyenHelper; $this->_adyenHelper = $adyenHelper;
$this->storeManager = $storeManager; $this->storeManager = $storeManager;
} }
/** /**
...@@ -69,7 +69,7 @@ class AdyenGenericConfigProvider implements ConfigProviderInterface ...@@ -69,7 +69,7 @@ class AdyenGenericConfigProvider implements ConfigProviderInterface
$config['payment']['adyen']['showLogo'] = false; $config['payment']['adyen']['showLogo'] = false;
} }
$config['payment']['checkoutCardComponentSource'] = $this->_adyenHelper->getCheckoutCardComponentJs($this->storeManager->getStore()->getId()); $config['payment']['checkoutCardComponentSource'] = $this->_adyenHelper->getCheckoutCardComponentJs($this->storeManager->getStore()->getId());
return $config; return $config;
} }
......
...@@ -825,6 +825,13 @@ ...@@ -825,6 +825,13 @@
</arguments> </arguments>
</virtualType> </virtualType>
<!--Checkout Response validator-->
<virtualType name="CheckoutResponseValidator" type="Adyen\Payment\Gateway\Validator\CheckoutResponseValidator">
<arguments>
<argument name="loggerInterface" xsi:type="object">Adyen\Payment\Logger\AdyenLogger</argument>
</arguments>
</virtualType>
<virtualType name="PosCloudResponseValidator" type="Adyen\Payment\Gateway\Validator\PosCloudResponseValidator"> <virtualType name="PosCloudResponseValidator" type="Adyen\Payment\Gateway\Validator\PosCloudResponseValidator">
<arguments> <arguments>
<argument name="loggerInterface" xsi:type="object">Adyen\Payment\Logger\AdyenLogger</argument> <argument name="loggerInterface" xsi:type="object">Adyen\Payment\Logger\AdyenLogger</argument>
......
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