diff --git a/Model/CheckoutConfigProvider.php b/Model/CheckoutConfigProvider.php index 3edf95a..edd10f9 100644 --- a/Model/CheckoutConfigProvider.php +++ b/Model/CheckoutConfigProvider.php @@ -17,6 +17,7 @@ use Monei\MoneiPayment\Api\Config\MoneiGoogleApplePaymentModuleConfigInterface; use Monei\MoneiPayment\Api\Config\MoneiPaymentModuleConfigInterface; use Monei\MoneiPayment\Block\Monei\Customer\CardRenderer; +use Monei\MoneiPayment\Model\Config\Source\Mode; use Monei\MoneiPayment\Model\Payment\Monei; use Monei\MoneiPayment\Service\Shared\IsEnabledApplePayInMoneiAccount; use Monei\MoneiPayment\Service\Shared\IsEnabledGooglePayInMoneiAccount; @@ -59,6 +60,7 @@ public function getConfig(): array return [ 'moneiAccountId' => $this->moneiPaymentConfig->getAccountId($this->getStoreId()), 'moneiApiKey' => $this->moneiPaymentConfig->getApiKey($this->getStoreId()), + 'isMoneiTestMode' => $this->moneiPaymentConfig->getMode($this->getStoreId()) === Mode::MODE_TEST, 'payment' => [ Monei::CODE => [ 'redirectUrl' => $this->urlBuilder->getUrl('monei/payment/redirect'), diff --git a/i18n/es_ES.csv b/i18n/es_ES.csv index 48db572..b77822a 100644 --- a/i18n/es_ES.csv +++ b/i18n/es_ES.csv @@ -37,3 +37,4 @@ "Google Pay and Apple Pay payment methods are not available in your Monei account. Enable at least one of them in your Monei account to use it.","Los métodos de pago Google Pay y Apple Pay no están disponibles en su cuenta de Monei. Habilite al menos uno de ellos en su cuenta de Monei para poder usarlo." "Multibanco payment method is not available in your Monei account. Please enable it in your Monei account to use it.","El método de pago de Multibanco no está disponible en su cuenta de Monei. Por favor, habilítelo en su cuenta de Monei para poder usarlo." "MBWay payment method is not available in your Monei account. Please enable it in your Monei account to use it.","El método de pago de MBWay no está disponible en su cuenta de Monei. Por favor, habilítelo en su cuenta de Monei para poder usarlo." +"(Test Mode)","(Modo de Prueba)" diff --git a/view/frontend/web/js/view/payment/method-renderer/monei-google-apple-method.js b/view/frontend/web/js/view/payment/method-renderer/monei-google-apple-method.js index 85e564a..8ea3783 100644 --- a/view/frontend/web/js/view/payment/method-renderer/monei-google-apple-method.js +++ b/view/frontend/web/js/view/payment/method-renderer/monei-google-apple-method.js @@ -72,6 +72,9 @@ define( if(result.paymentMethods.includes('applePay') && this.applePaySupported){ this.paymentMethodTitle(window.checkoutConfig.payment[this.getCode()].appleTitle); } + if(window.checkoutConfig.isMoneiTestMode){ + this.paymentMethodTitle(this.paymentMethodTitle() + ' ' + $.mage.__('(Test Mode)')); + } }, createMoneiPayment: function(){ diff --git a/view/frontend/web/js/view/payment/method-renderer/monei-insite.js b/view/frontend/web/js/view/payment/method-renderer/monei-insite.js index 926f834..6415c73 100644 --- a/view/frontend/web/js/view/payment/method-renderer/monei-insite.js +++ b/view/frontend/web/js/view/payment/method-renderer/monei-insite.js @@ -5,6 +5,7 @@ define( [ 'Magento_Checkout/js/view/payment/default', + 'jquery', 'mage/storage', 'Magento_Customer/js/model/customer', 'Magento_Checkout/js/model/quote', @@ -13,7 +14,7 @@ define( 'mage/url', 'Magento_Checkout/js/model/full-screen-loader' ], - function (Component, storage, customer, quote, urlBuilder, globalMessageList, url, fullScreenLoader) { + function (Component, $, storage, customer, quote, urlBuilder, globalMessageList, url, fullScreenLoader) { 'use strict'; return Component.extend({ @@ -108,5 +109,14 @@ define( getPaymentCode: function () { return 'method_'+this.getCode(); }, + + getTitle: function () { + var title = this._super(); + if(window.checkoutConfig.isMoneiTestMode){ + title = title + ' ' + $.mage.__('(Test Mode)'); + } + + return title; + }, }); }); diff --git a/view/frontend/web/js/view/payment/method-renderer/monei-redirect-method.js b/view/frontend/web/js/view/payment/method-renderer/monei-redirect-method.js index 14d78ff..a6efcec 100644 --- a/view/frontend/web/js/view/payment/method-renderer/monei-redirect-method.js +++ b/view/frontend/web/js/view/payment/method-renderer/monei-redirect-method.js @@ -5,10 +5,11 @@ define( [ 'Magento_Checkout/js/view/payment/default', + 'jquery', 'Monei_MoneiPayment/js/action/set-payment-method', 'Magento_Checkout/js/model/payment/additional-validators' ], - function (Component, setPaymentMethodAction, additionalValidators) { + function (Component, $, setPaymentMethodAction, additionalValidators) { 'use strict'; return Component.extend({ @@ -27,5 +28,14 @@ define( getPaymentCode: function () { return 'method_'+this.getCode(); }, + + getTitle: function () { + var title = this._super(); + if(window.checkoutConfig.isMoneiTestMode){ + title = title + ' ' + $.mage.__('(Test Mode)'); + } + + return title; + }, }); });