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 81513233 authored by cyattilakiss's avatar cyattilakiss Committed by GitHub

Merge pull request #329 from Adyen/PW-708

PW-708 Add live_endpoint_url_prefix to support checkout live endpoints
parents 1cda5566 f24c2159
...@@ -127,7 +127,6 @@ class Data extends AbstractHelper ...@@ -127,7 +127,6 @@ class Data extends AbstractHelper
* @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 \Adyen\Service\ServiceFactory $adyenServiceFactory
* @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param \Magento\Framework\App\CacheInterface $cache * @param \Magento\Framework\App\CacheInterface $cache
*/ */
...@@ -145,7 +144,6 @@ class Data extends AbstractHelper ...@@ -145,7 +144,6 @@ class Data extends AbstractHelper
\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,
\Adyen\Service\ServiceFactory $adyenServiceFactory,
\Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Store\Model\StoreManagerInterface $storeManager,
\Magento\Framework\App\CacheInterface $cache \Magento\Framework\App\CacheInterface $cache
...@@ -163,7 +161,6 @@ class Data extends AbstractHelper ...@@ -163,7 +161,6 @@ class Data extends AbstractHelper
$this->_taxCalculation = $taxCalculation; $this->_taxCalculation = $taxCalculation;
$this->productMetadata = $productMetadata; $this->productMetadata = $productMetadata;
$this->adyenLogger = $adyenLogger; $this->adyenLogger = $adyenLogger;
$this->adyenServiceFactory = $adyenServiceFactory;
$this->storeManager = $storeManager; $this->storeManager = $storeManager;
$this->cache = $cache; $this->cache = $cache;
} }
...@@ -587,10 +584,12 @@ class Data extends AbstractHelper ...@@ -587,10 +584,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
* @return mixed *
*/ * @param int|null $storeId
* @return mixed
*/
public function isDemoMode($storeId = null) public function isDemoMode($storeId = null)
{ {
return $this->getAdyenAbstractConfigDataFlag('demo_mode', $storeId); return $this->getAdyenAbstractConfigDataFlag('demo_mode', $storeId);
...@@ -607,6 +606,8 @@ class Data extends AbstractHelper ...@@ -607,6 +606,8 @@ class Data extends AbstractHelper
/** /**
* @desc Retrieve the API key * @desc Retrieve the API key
*
* @param int|null $storeId
* @return string * @return string
*/ */
public function getAPIKey($storeId = null) public function getAPIKey($storeId = null)
...@@ -623,6 +624,8 @@ class Data extends AbstractHelper ...@@ -623,6 +624,8 @@ class Data extends AbstractHelper
/** /**
* @desc Retrieve the webserver username * @desc Retrieve the webserver username
*
* @param int|null $storeId
* @return string * @return string
*/ */
public function getWsUsername($storeId = null) public function getWsUsername($storeId = null)
...@@ -635,6 +638,18 @@ class Data extends AbstractHelper ...@@ -635,6 +638,18 @@ class Data extends AbstractHelper
return $wsUsername; return $wsUsername;
} }
/**
* @desc Retrieve the Live endpoint prefix key
*
* @param int|null $storeId
* @return string
*/
public function getLiveEndpointPrefix($storeId = null)
{
$prefix = trim($this->getAdyenAbstractConfigData('live_endpoint_url_prefix', $storeId));
return $prefix;
}
/** /**
* @desc Cancels the order * @desc Cancels the order
* @param $order * @param $order
...@@ -1186,7 +1201,7 @@ class Data extends AbstractHelper ...@@ -1186,7 +1201,7 @@ class Data extends AbstractHelper
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); $client->setEnvironment(\Adyen\Environment::LIVE, $this->getLiveEndpointPrefix($storeId));
} }
$client->setLogger($this->adyenLogger); $client->setLogger($this->adyenLogger);
......
...@@ -61,6 +61,13 @@ ...@@ -61,6 +61,13 @@
<backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model> <backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model>
<config_path>payment/adyen_abstract/api_key_live</config_path> <config_path>payment/adyen_abstract/api_key_live</config_path>
</field> </field>
<field id="live_endpoint_url_prefix" translate="label" type="text" sortOrder="70" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Live endpoint prefix</label>
<tooltip><![CDATA[e.g. if your live endpoint is: <br/> <i>https://1234a567bcd89ef0-MagentoCompany-checkout-live.adyenpayments.com</i> <br/> please type: <strong>1234a567bcd89ef0-MagentoCompany</strong> in this field.]]></tooltip>
<comment><![CDATA[Provide the unique live url prefix: <strong>[random]-[company name]</strong> from the "API URLs and Response" menu in the Adyen Customer Area. For more information, please check <a href="https://docs.adyen.com/developers/development-resources/live-endpoints#checkoutendpoints"> our documentation</a>.]]></comment>
<config_path>payment/adyen_abstract/live_endpoint_url_prefix</config_path>
</field>
<field id="capture_mode" translate="label" type="select" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="1"> <field id="capture_mode" translate="label" type="select" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Capture Delay</label> <label>Capture Delay</label>
<tooltip>Immediate is the default. Set to manual if you want to perform the capture of funds manually later (only affects credit cards and a few alternative payment methods). You need to change this setting as well in Adyen Customer Area => Settings => Merchant Settings => Capture Delay. If you have selected a capture delay of a couple of days in Adyen keep it here on immediate</tooltip> <tooltip>Immediate is the default. Set to manual if you want to perform the capture of funds manually later (only affects credit cards and a few alternative payment methods). You need to change this setting as well in Adyen Customer Area => Settings => Merchant Settings => Capture Delay. If you have selected a capture delay of a couple of days in Adyen keep it here on immediate</tooltip>
......
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