Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v4.6.0 #132

Merged
merged 18 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/backport-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
git reset --hard main

- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
uses: peter-evans/create-pull-request@v7
with:
commit-message: 'chore: backport main to develop'
title: Backport main to develop
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/hotfix-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
./scripts/update-files-with-release-version.sh ${{ steps.release-drafter.outputs.tag_name }}

- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
uses: peter-evans/create-pull-request@v7
with:
commit-message: 'chore: update version'
title: Release ${{ steps.release-drafter.outputs.tag_name }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ jobs:
cc <@france.berut> <@khadija.cherif>

- name: Send changelog to Slack
uses: slackapi/slack-github-action@v1.26.0
uses: slackapi/slack-github-action@v1.27.0
with:
channel-id: CR9C57YM6
slack-message: ${{ steps.slack-markdown-release-notes.outputs.text }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
repositories: sfcc-cartridge

- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
uses: peter-evans/create-pull-request@v7
with:
token: ${{ steps.github-token.outputs.token }}
commit-message: 'chore: update version'
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ metadata/
*.p12
**/dw.js
**/dw.json
**/dw.json.*
.env

# avoid publishing translation config
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# CHANGELOG

## v4.6.0 - 2024-09-16

### 🚀 New Features

- Add hmac verification on IPN (#129)
- Add test warning on Frontstore (#124)

#### Contributors

@CapMousse, @FranceBe, @Francois-Gomis, @alma-renovate-bot, @alma-renovate-bot[bot], @carine-bonnafous, @gdraynz, @github-actions, @hyahiaoui and @joyet-simon

## v4.5.2 - 2024-07-16

### Changes
Expand Down Expand Up @@ -110,6 +121,7 @@
* `build:sitepref` (see below)
* `lint` allow to lint css, js and isml for the cartridge
* `uploadCartridge` upload cartridge to a sandbox

* refactored widget and fragment usage to use Alma plans
* refactored Alma controller
* refactored job for onShipment orders
Expand Down
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');
var almaHelpers = require('*/cartridge/scripts/helpers/almaHelpers');

var ALMA_PNX_ID = 'ALMA_PNX';
var ALMA_CREDIT_ID = 'ALMA_CREDIT';
Expand Down Expand Up @@ -212,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
Expand All @@ -220,46 +237,11 @@ function getPlanPaymentMethodID(plan) {
*/
function formatPlanForCheckout(plan, currencyCode) {
var formatPlan = {};
if (plan.installments_count < 5 && planIsActivated(PaymentMgr.getPaymentMethod(ALMA_PNX_ID), plan)) {
formatPlan = {
in_page: isAvailableForInpage(plan.installments_count) && almaConfigHelper.isInpageActivated(),
selector: getSelectorNameFromPlan(plan),
installments_count: plan.installments_count,
deferred_days: plan.deferred_days,
purchase_amount: plan.purchase_amount,
customer_fee: plan.customer_fee,
payment_plan: plan.payment_plan,
properties: getPropertiesForPlan(plan, currencyCode),
payment_method: getPlanPaymentMethodID(plan)
};
}
if (plan.installments_count >= 5 && planIsActivated(PaymentMgr.getPaymentMethod(ALMA_CREDIT_ID), plan)) {
formatPlan = {
in_page: isAvailableForInpage(plan.installments_count) && almaConfigHelper.isInpageActivated(),
selector: getSelectorNameFromPlan(plan),
installments_count: plan.installments_count,
deferred_days: plan.deferred_days,
purchase_amount: plan.purchase_amount,
customer_fee: plan.customer_fee,
payment_plan: plan.payment_plan,
properties: getPropertiesForPlan(plan, currencyCode),
payment_method: getPlanPaymentMethodID(plan)
};
}
if (plan.deferred_days > 0 && planIsActivated(PaymentMgr.getPaymentMethod(ALMA_DEFERRED_ID), plan)) {
formatPlan = {
in_page: isAvailableForInpage(plan.installments_count) && almaConfigHelper.isInpageActivated(),
selector: getSelectorNameFromPlan(plan),
installments_count: plan.installments_count,
deferred_days: plan.deferred_days,
purchase_amount: plan.purchase_amount,
customer_fee: plan.customer_fee,
payment_plan: plan.payment_plan,
properties: getPropertiesForPlan(plan, currencyCode),
payment_method: getPlanPaymentMethodID(plan)
};
}
if (plan.installments_count === 1 && plan.deferred_days === 0 && planIsActivated(PaymentMgr.getPaymentMethod(ALMA_PAY_NOW_ID), plan)) {
var ALMA_PNX = plan.installments_count < 5 && planIsActivated(PaymentMgr.getPaymentMethod(ALMA_PNX_ID), plan);
var ALMA_CREDIT = plan.installments_count >= 5 && planIsActivated(PaymentMgr.getPaymentMethod(ALMA_CREDIT_ID), plan);
var ALMA_DEFERRED = plan.deferred_days > 0 && planIsActivated(PaymentMgr.getPaymentMethod(ALMA_DEFERRED_ID), plan);
var ALMA_PAY_NOW = plan.installments_count === 1 && plan.deferred_days === 0 && planIsActivated(PaymentMgr.getPaymentMethod(ALMA_PAY_NOW_ID), plan);
if (ALMA_PNX || ALMA_CREDIT || ALMA_DEFERRED || ALMA_PAY_NOW) {
formatPlan = {
in_page: isAvailableForInpage(plan.installments_count) && almaConfigHelper.isInpageActivated(),
selector: getSelectorNameFromPlan(plan),
Expand All @@ -269,7 +251,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: getFormattedAlmaModeData()
};
}
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
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.isTest}">
<p class="alma-test-mode">
<img src="${URLUtils.staticURL('/images/warning.svg')}" alt="">
<span>
<b>${plan.alma_mode.labels.title}</b>
<br>
${plan.alma_mode.labels.description}
</span>
</p>
</isif>
</isif>
</div>
<div class="col-1 icon">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 1 addition & 1 deletion cartridges/int_alma/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "4.5.2",
"version": "4.6.0",
"hooks": "./hooks.json"
}
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "alma-sfcc-plugin",
"version": "4.5.2",
"version": "4.6.0",
"description": "Alma SFCC integration plugin",
"main": "index.js",
"engines": {
Expand Down
2 changes: 2 additions & 0 deletions test/mocks/helpers/almaCheckoutHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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 () {
Expand Down
7 changes: 6 additions & 1 deletion test/mocks/helpers/almaHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ function formatCustomerData() {
};
}

function getMode() {
return 'TEST';
}

module.exports = {
getSfccVersion: getSfccVersion,
formatCustomerData: formatCustomerData
formatCustomerData: formatCustomerData,
getMode: getMode
};
2 changes: 1 addition & 1 deletion test/mocks/helpers/almaPaymentHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ function resolvedPaymentData(installmentsCount, defferedDays, locale, origin, ha
custom_data: {
cms_name: 'SFCC',
cms_version: '4.0.0',
alma_plugin_version: '4.5.2'
alma_plugin_version: '4.6.0'
}
},
customer: {
Expand Down
Loading