+
+
+ Alma is currently being tested
+
+ The transaction will be fake and the order will not be completed if you chose the payement method
+
+
+
From bcc6a7bb7ce0ea45357422149b1a5a3443d4bf51 Mon Sep 17 00:00:00 2001
From: joyet simon <43644110+joyet-simon@users.noreply.github.com>
Date: Fri, 2 Aug 2024 09:35:39 +0200
Subject: [PATCH 02/10] fix: linter
---
.../int_alma/cartridge/scripts/helpers/almaCheckoutHelper.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cartridges/int_alma/cartridge/scripts/helpers/almaCheckoutHelper.js b/cartridges/int_alma/cartridge/scripts/helpers/almaCheckoutHelper.js
index a53e940a..1e0a8936 100644
--- a/cartridges/int_alma/cartridge/scripts/helpers/almaCheckoutHelper.js
+++ b/cartridges/int_alma/cartridge/scripts/helpers/almaCheckoutHelper.js
@@ -6,7 +6,7 @@ var isOnShipmentPaymentEnabled = require('*/cartridge/scripts/helpers/almaOnShip
var PaymentMgr = require('dw/order/PaymentMgr');
var almaConfigHelper = require('*/cartridge/scripts/helpers/almaConfigHelper');
var almaPaymentHelper = require('*/cartridge/scripts/helpers/almaPaymentHelper');
-const {getMode} = require("./almaHelpers");
+var {getMode} = require("./almaHelpers");
var ALMA_PNX_ID = 'ALMA_PNX';
var ALMA_CREDIT_ID = 'ALMA_CREDIT';
From 281883830c806f57a120cca2f6edb74c23d0407f Mon Sep 17 00:00:00 2001
From: joyet simon <43644110+joyet-simon@users.noreply.github.com>
Date: Fri, 2 Aug 2024 09:37:27 +0200
Subject: [PATCH 03/10] fix: linter
---
.../cartridge/scripts/helpers/almaCheckoutHelper.js | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/cartridges/int_alma/cartridge/scripts/helpers/almaCheckoutHelper.js b/cartridges/int_alma/cartridge/scripts/helpers/almaCheckoutHelper.js
index 1e0a8936..4be07026 100644
--- a/cartridges/int_alma/cartridge/scripts/helpers/almaCheckoutHelper.js
+++ b/cartridges/int_alma/cartridge/scripts/helpers/almaCheckoutHelper.js
@@ -6,7 +6,7 @@ var isOnShipmentPaymentEnabled = require('*/cartridge/scripts/helpers/almaOnShip
var PaymentMgr = require('dw/order/PaymentMgr');
var almaConfigHelper = require('*/cartridge/scripts/helpers/almaConfigHelper');
var almaPaymentHelper = require('*/cartridge/scripts/helpers/almaPaymentHelper');
-var {getMode} = require("./almaHelpers");
+var almaHelpers = require("*/cartridge/scripts/helpers/almaHelpers");
var ALMA_PNX_ID = 'ALMA_PNX';
var ALMA_CREDIT_ID = 'ALMA_CREDIT';
@@ -232,7 +232,7 @@ function formatPlanForCheckout(plan, currencyCode) {
payment_plan: plan.payment_plan,
properties: getPropertiesForPlan(plan, currencyCode),
payment_method: getPlanPaymentMethodID(plan),
- alma_mode: getMode()
+ alma_mode: almaHelpers.getMode()
};
}
if (plan.installments_count >= 5 && planIsActivated(PaymentMgr.getPaymentMethod(ALMA_CREDIT_ID), plan)) {
@@ -246,7 +246,7 @@ function formatPlanForCheckout(plan, currencyCode) {
payment_plan: plan.payment_plan,
properties: getPropertiesForPlan(plan, currencyCode),
payment_method: getPlanPaymentMethodID(plan),
- alma_mode: getMode()
+ alma_mode: almaHelpers.getMode()
};
}
if (plan.deferred_days > 0 && planIsActivated(PaymentMgr.getPaymentMethod(ALMA_DEFERRED_ID), plan)) {
@@ -260,7 +260,7 @@ function formatPlanForCheckout(plan, currencyCode) {
payment_plan: plan.payment_plan,
properties: getPropertiesForPlan(plan, currencyCode),
payment_method: getPlanPaymentMethodID(plan),
- alma_mode: getMode()
+ alma_mode: almaHelpers.getMode()
};
}
if (plan.installments_count === 1 && plan.deferred_days === 0 && planIsActivated(PaymentMgr.getPaymentMethod(ALMA_PAY_NOW_ID), plan)) {
@@ -274,7 +274,7 @@ function formatPlanForCheckout(plan, currencyCode) {
payment_plan: plan.payment_plan,
properties: getPropertiesForPlan(plan, currencyCode),
payment_method: getPlanPaymentMethodID(plan),
- alma_mode: getMode()
+ alma_mode: almaHelpers.getMode()
};
}
return formatPlan;
From 9661a9d6e670775cf49af13a5b0bff59faf6ad3d Mon Sep 17 00:00:00 2001
From: joyet simon <43644110+joyet-simon@users.noreply.github.com>
Date: Fri, 2 Aug 2024 09:38:09 +0200
Subject: [PATCH 04/10] fix: linter
---
.../int_alma/cartridge/scripts/helpers/almaCheckoutHelper.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cartridges/int_alma/cartridge/scripts/helpers/almaCheckoutHelper.js b/cartridges/int_alma/cartridge/scripts/helpers/almaCheckoutHelper.js
index 4be07026..bf375075 100644
--- a/cartridges/int_alma/cartridge/scripts/helpers/almaCheckoutHelper.js
+++ b/cartridges/int_alma/cartridge/scripts/helpers/almaCheckoutHelper.js
@@ -6,7 +6,7 @@ var isOnShipmentPaymentEnabled = require('*/cartridge/scripts/helpers/almaOnShip
var PaymentMgr = require('dw/order/PaymentMgr');
var almaConfigHelper = require('*/cartridge/scripts/helpers/almaConfigHelper');
var almaPaymentHelper = require('*/cartridge/scripts/helpers/almaPaymentHelper');
-var almaHelpers = require("*/cartridge/scripts/helpers/almaHelpers");
+var almaHelpers = require('*/cartridge/scripts/helpers/almaHelpers');
var ALMA_PNX_ID = 'ALMA_PNX';
var ALMA_CREDIT_ID = 'ALMA_CREDIT';
From 94763534454738e93535eb7b18a211e58b39a798 Mon Sep 17 00:00:00 2001
From: joyet simon <43644110+joyet-simon@users.noreply.github.com>
Date: Fri, 2 Aug 2024 09:45:56 +0200
Subject: [PATCH 05/10] test: fix unit tests
---
test/mocks/helpers/almaCheckoutHelpers.js | 2 ++
test/mocks/helpers/almaHelpers.js | 7 ++++++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/test/mocks/helpers/almaCheckoutHelpers.js b/test/mocks/helpers/almaCheckoutHelpers.js
index 28e98175..b4cfafa0 100644
--- a/test/mocks/helpers/almaCheckoutHelpers.js
+++ b/test/mocks/helpers/almaCheckoutHelpers.js
@@ -5,6 +5,7 @@ var proxyquire = require('proxyquire')
.noCallThru()
.noPreserveCache();
var almaConfigHelpers = require('./almaConfigHelpers').almaConfigHelpers;
+var almaHelpers = require('./almaHelpers');
var setCustomPreferenceValue = require('./almaConfigHelpers').setCustomPreferenceValue;
var resource = {
@@ -73,6 +74,7 @@ function proxyModel() {
},
'dw/system/Site': site,
'*/cartridge/scripts/helpers/almaConfigHelper': almaConfigHelpers,
+ '*/cartridge/scripts/helpers/almaHelpers': almaHelpers,
'dw/order/PaymentMgr': paymentMgr,
'*/cartridge/scripts/helpers/almaPaymentHelper': {
isAvailableForManualCapture: function () {
diff --git a/test/mocks/helpers/almaHelpers.js b/test/mocks/helpers/almaHelpers.js
index 3b64de25..fd91c81c 100644
--- a/test/mocks/helpers/almaHelpers.js
+++ b/test/mocks/helpers/almaHelpers.js
@@ -11,7 +11,12 @@ function formatCustomerData() {
};
}
+function getMode() {
+ return 'TEST';
+}
+
module.exports = {
getSfccVersion: getSfccVersion,
- formatCustomerData: formatCustomerData
+ formatCustomerData: formatCustomerData,
+ getMode: getMode
};
From 93d61130e34179c616334ed91dee560ee1db605a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?France=20B=C3=A9rut?=
Date: Mon, 12 Aug 2024 15:09:12 +0200
Subject: [PATCH 06/10] chore(crowdin): add translation to test mode warning
---
.../scripts/helpers/almaCheckoutHelper.js | 24 +++++++++++++++----
.../almaContent/almaContent.isml | 6 ++---
.../templates/resources/alma.properties | 2 ++
.../templates/resources/alma_de_DE.properties | 2 ++
.../templates/resources/alma_es_ES.properties | 2 ++
.../templates/resources/alma_fr_FR.properties | 2 ++
.../templates/resources/alma_it_IT.properties | 2 ++
.../templates/resources/alma_nl_NL.properties | 2 ++
.../templates/resources/alma_pt_PT.properties | 2 ++
9 files changed, 37 insertions(+), 7 deletions(-)
diff --git a/cartridges/int_alma/cartridge/scripts/helpers/almaCheckoutHelper.js b/cartridges/int_alma/cartridge/scripts/helpers/almaCheckoutHelper.js
index bf375075..1f090f7b 100644
--- a/cartridges/int_alma/cartridge/scripts/helpers/almaCheckoutHelper.js
+++ b/cartridges/int_alma/cartridge/scripts/helpers/almaCheckoutHelper.js
@@ -213,6 +213,22 @@ function getPlanPaymentMethodID(plan) {
return paymentMethodId;
}
+/**
+ * Format Alma mode data to fit in Checkout view data
+ * @returns {Object} Alma mode data
+ * - isTest: boolean true if Alma mode is TEST
+ * - labels: object with title and description for translations
+ */
+function getFormattedAlmaModeData() {
+ return {
+ isTest: almaHelpers.getMode() === 'TEST',
+ labels: {
+ title: Resource.msg('alma.test.mode.warn.title', 'alma', null),
+ description: Resource.msg('alma.test.mode.warn.description', 'alma', null)
+ }
+ };
+}
+
/**
* Format plan data to fit in Checkout view data
* @param {Object} plan any alma plan
@@ -232,7 +248,7 @@ function formatPlanForCheckout(plan, currencyCode) {
payment_plan: plan.payment_plan,
properties: getPropertiesForPlan(plan, currencyCode),
payment_method: getPlanPaymentMethodID(plan),
- alma_mode: almaHelpers.getMode()
+ alma_mode: getFormattedAlmaModeData()
};
}
if (plan.installments_count >= 5 && planIsActivated(PaymentMgr.getPaymentMethod(ALMA_CREDIT_ID), plan)) {
@@ -246,7 +262,7 @@ function formatPlanForCheckout(plan, currencyCode) {
payment_plan: plan.payment_plan,
properties: getPropertiesForPlan(plan, currencyCode),
payment_method: getPlanPaymentMethodID(plan),
- alma_mode: almaHelpers.getMode()
+ alma_mode: getFormatAlmaModeData()
};
}
if (plan.deferred_days > 0 && planIsActivated(PaymentMgr.getPaymentMethod(ALMA_DEFERRED_ID), plan)) {
@@ -260,7 +276,7 @@ function formatPlanForCheckout(plan, currencyCode) {
payment_plan: plan.payment_plan,
properties: getPropertiesForPlan(plan, currencyCode),
payment_method: getPlanPaymentMethodID(plan),
- alma_mode: almaHelpers.getMode()
+ alma_mode: getFormatAlmaModeData()
};
}
if (plan.installments_count === 1 && plan.deferred_days === 0 && planIsActivated(PaymentMgr.getPaymentMethod(ALMA_PAY_NOW_ID), plan)) {
@@ -274,7 +290,7 @@ function formatPlanForCheckout(plan, currencyCode) {
payment_plan: plan.payment_plan,
properties: getPropertiesForPlan(plan, currencyCode),
payment_method: getPlanPaymentMethodID(plan),
- alma_mode: almaHelpers.getMode()
+ alma_mode: getFormatAlmaModeData()
};
}
return formatPlan;
diff --git a/cartridges/int_alma/cartridge/templates/default/checkout/billing/paymentOptions/almaContent/almaContent.isml b/cartridges/int_alma/cartridge/templates/default/checkout/billing/paymentOptions/almaContent/almaContent.isml
index db040a0e..b17a1a2e 100644
--- a/cartridges/int_alma/cartridge/templates/default/checkout/billing/paymentOptions/almaContent/almaContent.isml
+++ b/cartridges/int_alma/cartridge/templates/default/checkout/billing/paymentOptions/almaContent/almaContent.isml
@@ -46,13 +46,13 @@
-
+
- Alma is currently being tested
+ "${plan.alma_mode.labels.title}"
- The transaction will be fake and the order will not be completed if you chose the payement method
+ "${plan.alma_mode.labels.description}"
diff --git a/cartridges/int_alma/cartridge/templates/resources/alma.properties b/cartridges/int_alma/cartridge/templates/resources/alma.properties
index 64bf996a..e6aa478a 100644
--- a/cartridges/int_alma/cartridge/templates/resources/alma.properties
+++ b/cartridges/int_alma/cartridge/templates/resources/alma.properties
@@ -45,3 +45,5 @@ alma.pay.now.installments=Today
alma.pay.now=Pay now with credit card
alma.pay.now.description=Fast and secured payments
+alma.test.mode.warn.title=Sandbox/Test Mode
+alma.test.mode.warn.description=All transactions are simulated.
diff --git a/cartridges/int_alma/cartridge/templates/resources/alma_de_DE.properties b/cartridges/int_alma/cartridge/templates/resources/alma_de_DE.properties
index 7ab7e51a..1c49315d 100644
--- a/cartridges/int_alma/cartridge/templates/resources/alma_de_DE.properties
+++ b/cartridges/int_alma/cartridge/templates/resources/alma_de_DE.properties
@@ -45,3 +45,5 @@ alma.pay.now.installments=Heute
alma.pay.now=Jetzt mit Kreditkarte bezahlen
alma.pay.now.description=Schnelle und sichere Zahlungen
+alma.test.mode.warn.title=Sandbox/Testmodus
+alma.test.mode.warn.description=Alle Transaktionen werden simuliert.
diff --git a/cartridges/int_alma/cartridge/templates/resources/alma_es_ES.properties b/cartridges/int_alma/cartridge/templates/resources/alma_es_ES.properties
index 8b049fc4..4eabfea8 100644
--- a/cartridges/int_alma/cartridge/templates/resources/alma_es_ES.properties
+++ b/cartridges/int_alma/cartridge/templates/resources/alma_es_ES.properties
@@ -45,3 +45,5 @@ alma.pay.now.installments=Hoy
alma.pay.now=Pague ahora con tarjeta de crédito
alma.pay.now.description=Pagos rápidos y seguros
+alma.test.mode.warn.title=Modo Sandbox/Prueba
+alma.test.mode.warn.description=Todas las transacciones son simuladas.
diff --git a/cartridges/int_alma/cartridge/templates/resources/alma_fr_FR.properties b/cartridges/int_alma/cartridge/templates/resources/alma_fr_FR.properties
index 8826ec86..a6c5488b 100644
--- a/cartridges/int_alma/cartridge/templates/resources/alma_fr_FR.properties
+++ b/cartridges/int_alma/cartridge/templates/resources/alma_fr_FR.properties
@@ -45,3 +45,5 @@ alma.pay.now.installments=Aujourd'hui
alma.pay.now=Payer maintenant par carte de crédit
alma.pay.now.description=Paiements rapides et sécurisés
+alma.test.mode.warn.title=Mode Test
+alma.test.mode.warn.description=Toutes les transactions sont simulées.
diff --git a/cartridges/int_alma/cartridge/templates/resources/alma_it_IT.properties b/cartridges/int_alma/cartridge/templates/resources/alma_it_IT.properties
index 1e5ae7c7..3560ee6c 100644
--- a/cartridges/int_alma/cartridge/templates/resources/alma_it_IT.properties
+++ b/cartridges/int_alma/cartridge/templates/resources/alma_it_IT.properties
@@ -45,3 +45,5 @@ alma.pay.now.installments=Oggi
alma.pay.now=Paga ora con la carta
alma.pay.now.description=Pagamenti rapidi e sicuri
+alma.test.mode.warn.title=Modalità Sandbox/Test
+alma.test.mode.warn.description=Tutte le transazioni sono simulate.
diff --git a/cartridges/int_alma/cartridge/templates/resources/alma_nl_NL.properties b/cartridges/int_alma/cartridge/templates/resources/alma_nl_NL.properties
index c975aa7f..6e0526b9 100644
--- a/cartridges/int_alma/cartridge/templates/resources/alma_nl_NL.properties
+++ b/cartridges/int_alma/cartridge/templates/resources/alma_nl_NL.properties
@@ -45,3 +45,5 @@ alma.pay.now.installments=Vandaag
alma.pay.now=Betaal nu met creditcard
alma.pay.now.description=Snelle en veilige betalingen
+alma.test.mode.warn.title=Sandbox/Testmodus
+alma.test.mode.warn.description=Alle transacties worden gesimuleerd.
diff --git a/cartridges/int_alma/cartridge/templates/resources/alma_pt_PT.properties b/cartridges/int_alma/cartridge/templates/resources/alma_pt_PT.properties
index 63160bfc..0b8dbc12 100644
--- a/cartridges/int_alma/cartridge/templates/resources/alma_pt_PT.properties
+++ b/cartridges/int_alma/cartridge/templates/resources/alma_pt_PT.properties
@@ -45,3 +45,5 @@ alma.pay.now.installments=Hoje
alma.pay.now=Pagar agora com cartão de crédito
alma.pay.now.description=Pagamentos rápidos e seguros
+alma.test.mode.warn.title=Modo Sandbox/Teste
+alma.test.mode.warn.description=Todas as transacções são simuladas.
From f400d4781ba3f760827a6ebba1a9fdebccf90b10 Mon Sep 17 00:00:00 2001
From: Francois-Gomis
Date: Mon, 12 Aug 2024 15:14:17 +0200
Subject: [PATCH 07/10] fix: getFormattedAlmaModeData function name
---
.../cartridge/scripts/helpers/almaCheckoutHelper.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/cartridges/int_alma/cartridge/scripts/helpers/almaCheckoutHelper.js b/cartridges/int_alma/cartridge/scripts/helpers/almaCheckoutHelper.js
index 1f090f7b..cb0893b5 100644
--- a/cartridges/int_alma/cartridge/scripts/helpers/almaCheckoutHelper.js
+++ b/cartridges/int_alma/cartridge/scripts/helpers/almaCheckoutHelper.js
@@ -262,7 +262,7 @@ function formatPlanForCheckout(plan, currencyCode) {
payment_plan: plan.payment_plan,
properties: getPropertiesForPlan(plan, currencyCode),
payment_method: getPlanPaymentMethodID(plan),
- alma_mode: getFormatAlmaModeData()
+ alma_mode: getFormattedAlmaModeData()
};
}
if (plan.deferred_days > 0 && planIsActivated(PaymentMgr.getPaymentMethod(ALMA_DEFERRED_ID), plan)) {
@@ -276,7 +276,7 @@ function formatPlanForCheckout(plan, currencyCode) {
payment_plan: plan.payment_plan,
properties: getPropertiesForPlan(plan, currencyCode),
payment_method: getPlanPaymentMethodID(plan),
- alma_mode: getFormatAlmaModeData()
+ alma_mode: getFormattedAlmaModeData()
};
}
if (plan.installments_count === 1 && plan.deferred_days === 0 && planIsActivated(PaymentMgr.getPaymentMethod(ALMA_PAY_NOW_ID), plan)) {
@@ -290,7 +290,7 @@ function formatPlanForCheckout(plan, currencyCode) {
payment_plan: plan.payment_plan,
properties: getPropertiesForPlan(plan, currencyCode),
payment_method: getPlanPaymentMethodID(plan),
- alma_mode: getFormatAlmaModeData()
+ alma_mode: getFormattedAlmaModeData()
};
}
return formatPlan;
From 9d26d53bdb3d8750ca07b4e4a5b758f21b53b211 Mon Sep 17 00:00:00 2001
From: Francois-Gomis
Date: Mon, 12 Aug 2024 15:17:34 +0200
Subject: [PATCH 08/10] fix: remove quote
---
.../billing/paymentOptions/almaContent/almaContent.isml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cartridges/int_alma/cartridge/templates/default/checkout/billing/paymentOptions/almaContent/almaContent.isml b/cartridges/int_alma/cartridge/templates/default/checkout/billing/paymentOptions/almaContent/almaContent.isml
index b17a1a2e..98a9b385 100644
--- a/cartridges/int_alma/cartridge/templates/default/checkout/billing/paymentOptions/almaContent/almaContent.isml
+++ b/cartridges/int_alma/cartridge/templates/default/checkout/billing/paymentOptions/almaContent/almaContent.isml
@@ -50,9 +50,9 @@