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 b3a741d5 authored by rikterbeek's avatar rikterbeek

use payment_action from config and added exception if CSE key is not generated on checkout

parent 9b182736
...@@ -68,6 +68,8 @@ class Cc extends \Magento\Payment\Model\Method\Cc ...@@ -68,6 +68,8 @@ class Cc extends \Magento\Payment\Model\Method\Cc
protected $_urlBuilder; protected $_urlBuilder;
protected $_adyenHelper;
/** /**
* @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Model\Context $context
...@@ -88,6 +90,7 @@ class Cc extends \Magento\Payment\Model\Method\Cc ...@@ -88,6 +90,7 @@ class Cc extends \Magento\Payment\Model\Method\Cc
\Adyen\Payment\Logger\AdyenLogger $adyenLogger, \Adyen\Payment\Logger\AdyenLogger $adyenLogger,
\Magento\Checkout\Model\Session $checkoutSession, \Magento\Checkout\Model\Session $checkoutSession,
\Magento\Framework\UrlInterface $urlBuilder, \Magento\Framework\UrlInterface $urlBuilder,
\Adyen\Payment\Helper\Data $adyenHelper,
\Magento\Framework\Model\Context $context, \Magento\Framework\Model\Context $context,
\Magento\Framework\Registry $registry, \Magento\Framework\Registry $registry,
\Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory,
...@@ -119,6 +122,7 @@ class Cc extends \Magento\Payment\Model\Method\Cc ...@@ -119,6 +122,7 @@ class Cc extends \Magento\Payment\Model\Method\Cc
$this->_adyenLogger = $adyenLogger; $this->_adyenLogger = $adyenLogger;
$this->_checkoutSession = $checkoutSession; $this->_checkoutSession = $checkoutSession;
$this->_urlBuilder = $urlBuilder; $this->_urlBuilder = $urlBuilder;
$this->_adyenHelper = $adyenHelper;
} }
protected $_paymentMethodType = 'api'; protected $_paymentMethodType = 'api';
...@@ -137,13 +141,13 @@ class Cc extends \Magento\Payment\Model\Method\Cc ...@@ -137,13 +141,13 @@ class Cc extends \Magento\Payment\Model\Method\Cc
parent::assignData($data); parent::assignData($data);
$infoInstance = $this->getInfoInstance(); $infoInstance = $this->getInfoInstance();
$this->_adyenLogger if($this->_adyenHelper->getAdyenAbstractConfigDataFlag('cse_enabled')) {
if(isset($data['encrypted_data'])) {
if(isset($data['encrypted_data'])) { $infoInstance->setAdditionalInformation('encrypted_data', $data['encrypted_data']);
$infoInstance->setAdditionalInformation('encrypted_data', $data['encrypted_data']); } else {
throw new \Magento\Framework\Exception\LocalizedException(__('Card encryption failed'));
}
} }
$this->_adyenLogger->info("CSE key is set");
return $this; return $this;
} }
...@@ -162,20 +166,6 @@ class Cc extends \Magento\Payment\Model\Method\Cc ...@@ -162,20 +166,6 @@ class Cc extends \Magento\Payment\Model\Method\Cc
return $this; return $this;
} }
/**
* Get config payment action url
* Used to universalize payment actions when processing payment place
*
* @return string
* @api
*/
public function getConfigPaymentAction()
{
// return $this->getConfigData('payment_action');
return \Magento\Payment\Model\Method\AbstractMethod::ACTION_AUTHORIZE;
}
protected function _processRequest(\Magento\Framework\Object $payment, $amount, $request) protected function _processRequest(\Magento\Framework\Object $payment, $amount, $request)
{ {
switch ($request) { switch ($request) {
...@@ -189,7 +179,6 @@ class Cc extends \Magento\Payment\Model\Method\Cc ...@@ -189,7 +179,6 @@ class Cc extends \Magento\Payment\Model\Method\Cc
} else { } else {
throw new \Magento\Framework\Exception\LocalizedException(__('Empty result.')); throw new \Magento\Framework\Exception\LocalizedException(__('Empty result.'));
} }
} }
protected function _processResponse(\Magento\Payment\Model\InfoInterface $payment, $response) protected function _processResponse(\Magento\Payment\Model\InfoInterface $payment, $response)
......
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
<sort_order>10</sort_order> <sort_order>10</sort_order>
<place_order_url>adyen/process/redirect</place_order_url> <place_order_url>adyen/process/redirect</place_order_url>
<order_place_redirect_url>adyen/process/redirect</order_place_redirect_url> <order_place_redirect_url>adyen/process/redirect</order_place_redirect_url>
<payment_action>Authorization</payment_action> <payment_action>authorize</payment_action>
<group>adyen</group> <group>adyen</group>
</adyen_hpp> </adyen_hpp>
</payment> </payment>
......
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