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 7773f97d authored by attilak's avatar attilak Committed by Rik ter Beek

Add live endpoint prefix to admin settings

Add live endpoint prefix to initialize client
parent 0d06f645
......@@ -127,7 +127,6 @@ class Data extends AbstractHelper
* @param \Magento\Tax\Model\Calculation $taxCalculation
* @param \Magento\Framework\App\ProductMetadataInterface $productMetadata
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
* @param \Adyen\Service\ServiceFactory $adyenServiceFactory
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param \Magento\Framework\App\CacheInterface $cache
*/
......@@ -145,7 +144,6 @@ class Data extends AbstractHelper
\Magento\Tax\Model\Calculation $taxCalculation,
\Magento\Framework\App\ProductMetadataInterface $productMetadata,
\Adyen\Payment\Logger\AdyenLogger $adyenLogger,
\Adyen\Service\ServiceFactory $adyenServiceFactory,
\Magento\Store\Model\StoreManagerInterface $storeManager,
\Magento\Framework\App\CacheInterface $cache
......@@ -163,7 +161,6 @@ class Data extends AbstractHelper
$this->_taxCalculation = $taxCalculation;
$this->productMetadata = $productMetadata;
$this->adyenLogger = $adyenLogger;
$this->adyenServiceFactory = $adyenServiceFactory;
$this->storeManager = $storeManager;
$this->cache = $cache;
}
......@@ -607,10 +604,12 @@ class Data extends AbstractHelper
return $secretWord;
}
/**
* @desc Check if configuration is set to demo mode
* @return mixed
*/
/**
* @desc Check if configuration is set to demo mode
*
* @param int|null $storeId
* @return mixed
*/
public function isDemoMode($storeId = null)
{
return $this->getAdyenAbstractConfigDataFlag('demo_mode', $storeId);
......@@ -627,6 +626,8 @@ class Data extends AbstractHelper
/**
* @desc Retrieve the API key
*
* @param int|null $storeId
* @return string
*/
public function getAPIKey($storeId = null)
......@@ -643,6 +644,8 @@ class Data extends AbstractHelper
/**
* @desc Retrieve the webserver username
*
* @param int|null $storeId
* @return string
*/
public function getWsUsername($storeId = null)
......@@ -655,6 +658,22 @@ class Data extends AbstractHelper
return $wsUsername;
}
/**
* @desc Retrieve the Live endpoint prefix key
*
* @param int|null $storeId
* @return string
*/
public function getLiveEndpointPrefix($storeId = null)
{
if ($this->isDemoMode($storeId)) {
$prefix = "";
} else {
$prefix = trim($this->getAdyenAbstractConfigData('live_endpoint_url_prefix', $storeId));
}
return $prefix;
}
/**
* @desc Cancels the order
* @param $order
......@@ -1318,7 +1337,7 @@ class Data extends AbstractHelper
if ($this->isDemoMode($storeId)) {
$client->setEnvironment(\Adyen\Environment::TEST);
} else {
$client->setEnvironment(\Adyen\Environment::LIVE);
$client->setEnvironment(\Adyen\Environment::LIVE, $this->getLiveEndpointPrefix($storeId));
}
$client->setLogger($this->adyenLogger);
......
......@@ -61,6 +61,13 @@
<backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model>
<config_path>payment/adyen_abstract/api_key_live</config_path>
</field>
<field id="live_endpoint_url_prefix" translate="label" type="obscure" 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">
<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>
......
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