Skip to content

Commit

Permalink
feat: add test warning on frontstore
Browse files Browse the repository at this point in the history
  • Loading branch information
joyet-simon committed Aug 2, 2024
1 parent 5a6ded3 commit 1938fd1
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +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 ALMA_PNX_ID = 'ALMA_PNX';
var ALMA_CREDIT_ID = 'ALMA_CREDIT';
Expand Down Expand Up @@ -230,7 +231,8 @@ function formatPlanForCheckout(plan, currencyCode) {
customer_fee: plan.customer_fee,
payment_plan: plan.payment_plan,
properties: getPropertiesForPlan(plan, currencyCode),
payment_method: getPlanPaymentMethodID(plan)
payment_method: getPlanPaymentMethodID(plan),
alma_mode: getMode()
};
}
if (plan.installments_count >= 5 && planIsActivated(PaymentMgr.getPaymentMethod(ALMA_CREDIT_ID), plan)) {
Expand All @@ -243,7 +245,8 @@ function formatPlanForCheckout(plan, currencyCode) {
customer_fee: plan.customer_fee,
payment_plan: plan.payment_plan,
properties: getPropertiesForPlan(plan, currencyCode),
payment_method: getPlanPaymentMethodID(plan)
payment_method: getPlanPaymentMethodID(plan),
alma_mode: getMode()
};
}
if (plan.deferred_days > 0 && planIsActivated(PaymentMgr.getPaymentMethod(ALMA_DEFERRED_ID), plan)) {
Expand All @@ -256,7 +259,8 @@ function formatPlanForCheckout(plan, currencyCode) {
customer_fee: plan.customer_fee,
payment_plan: plan.payment_plan,
properties: getPropertiesForPlan(plan, currencyCode),
payment_method: getPlanPaymentMethodID(plan)
payment_method: getPlanPaymentMethodID(plan),
alma_mode: getMode()
};
}
if (plan.installments_count === 1 && plan.deferred_days === 0 && planIsActivated(PaymentMgr.getPaymentMethod(ALMA_PAY_NOW_ID), plan)) {
Expand All @@ -269,7 +273,8 @@ function formatPlanForCheckout(plan, currencyCode) {
customer_fee: plan.customer_fee,
payment_plan: plan.payment_plan,
properties: getPropertiesForPlan(plan, currencyCode),
payment_method: getPlanPaymentMethodID(plan)
payment_method: getPlanPaymentMethodID(plan),
alma_mode: getMode()
};
}
return formatPlan;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ function buildEligiblePlans(purchaseAmount, feePlans, locale, currentBasket, pla
plans[planEligible.payment_method][planEligible.selector].payment_plans = planEligible.payment_plan;
plans[planEligible.payment_method][planEligible.selector].properties = planEligible.properties;
plans[planEligible.payment_method][planEligible.selector].in_page = planEligible.in_page;
plans[planEligible.payment_method][planEligible.selector].alma_mode = planEligible.alma_mode;
});

return plans;
Expand Down
11 changes: 11 additions & 0 deletions cartridges/int_alma/cartridge/static/default/css/almaContent.css
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,14 @@
transform: rotate(360deg);
}
}

.alma-test-mode {
background-color: #FFF5CC;
padding: 24px;
border-radius: 20px;
font-size: small;
display: flex;
flex-direction: row;
gap: 16px;
align-items: flex-start;
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@
<p class="pt-30" id="${plan.key + '-fees'}">
<isprint value="${plan.properties.fees}"/>
</p>
<isif condition="${plan.alma_mode === 'TEST'}">
<p class="alma-test-mode">
<img src="${URLUtils.staticURL('/images/warning.svg')}" alt="">
<span>
<b>Alma is currently being tested</b>
<br>
The transaction will be fake and the order will not be completed if you chose the payement method
</span>
</p>
</isif>
</isif>
</div>
<div class="col-1 icon">
Expand Down

0 comments on commit 1938fd1

Please sign in to comment.