Skip to content

Commit

Permalink
Add test mode in title
Browse files Browse the repository at this point in the history
  • Loading branch information
moneimagento committed Jun 10, 2024
1 parent ecb0a91 commit 63540ba
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Model/CheckoutConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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'),
Expand Down
1 change: 1 addition & 0 deletions i18n/es_ES.csv
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Original file line number Diff line number Diff line change
Expand Up @@ -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(){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
define(
[
'Magento_Checkout/js/view/payment/default',
'jquery',
'mage/storage',
'Magento_Customer/js/model/customer',
'Magento_Checkout/js/model/quote',
Expand All @@ -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({
Expand Down Expand Up @@ -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;
},
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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;
},
});
});

0 comments on commit 63540ba

Please sign in to comment.