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

[PW-2091] Fix Google Pay environment value in PRODUCTION (#641)

* Fix Google Pay environment value in PRODUCTION

Google pay expects `PRODUCTION` and not `LIVE` in case of production
environment
Add getGooglePayEnvironment() to retrieve environment value to Google
pay
Replace the getCheckoutEnvironment() with getGooglePayEnvironment() on
the frontend for Google pay

* Move Google Pay fix into the AdyenGooglePayConfigProvider()

Move getGooglePayEnvironment() and PRODUCTION const from Helper/Data to
AdyenGooglePayConfigProvider and make it private
Change environment key back to checkoutEnvironment to be consistent with
the rest if the checkout components and overwrite the live value with
production only for Google pay
Co-authored-by: default avatarMarcos Garcia <marcos.asgarcia@gmail.com>
parent 2bfb1528
......@@ -34,6 +34,8 @@ class AdyenGooglePayConfigProvider implements ConfigProviderInterface
const GOOGLE_PAY_VAULT_CODE = 'adyen_google_pay_vault';
const PRODUCTION = 'production';
/**
* @var PaymentHelper
*/
......@@ -106,9 +108,10 @@ class AdyenGooglePayConfigProvider implements ConfigProviderInterface
];
$config['payment']['adyenGooglePay']['active'] = (bool)$this->adyenHelper->isAdyenGooglePayEnabled($this->storeManager->getStore()->getId());
$config['payment']['adyenGooglePay']['checkoutEnvironment'] = $this->adyenHelper->getCheckoutEnvironment($this->storeManager->getStore()->getId());
$config['payment']['adyenGooglePay']['checkoutEnvironment'] = $this->getGooglePayEnvironment($this->storeManager->getStore()->getId());
$config['payment']['adyenGooglePay']['locale'] = $this->adyenHelper->getStoreLocale($this->storeManager->getStore()->getId());
$config['payment']['adyenGooglePay']['merchantAccount'] = $this->adyenHelper->getAdyenMerchantAccount("adyen_google_pay", $this->storeManager->getStore()->getId());
$config['payment']['adyenGooglePay']['merchantAccount'] = $this->adyenHelper->getAdyenMerchantAccount("adyen_google_pay",
$this->storeManager->getStore()->getId());
$quote = $this->checkoutSession->getQuote();
$currency = $quote->getCurrency();
......@@ -128,4 +131,17 @@ class AdyenGooglePayConfigProvider implements ConfigProviderInterface
{
return $this->_request;
}
/**
* @param null $storeId
* @return mixed
*/
private function getGooglePayEnvironment($storeId = null)
{
if ($this->adyenHelper->isDemoMode($storeId)) {
return \Adyen\Payment\Helper\Data::TEST;
}
return self::PRODUCTION;
}
}
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