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.8.0 #143

Merged
merged 23 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
14da36b
Merge pull request #137 from alma/chore/backport-main-to-develop
joyet-simon Oct 7, 2024
963f77b
chore(deps): update dependency @types/chai to v4.3.20
alma-renovate-bot[bot] Oct 14, 2024
d5920e9
feat: change cording for in page config
joyet-simon Oct 31, 2024
8455a21
Merge pull request #139 from alma/feature/ecom-2160-sfcc-change-wordi…
joyet-simon Oct 31, 2024
b6ce47b
chore(deps): update slackapi/slack-github-action action to v2
alma-renovate-bot[bot] Nov 18, 2024
949cd59
Update Aqua workflow with trivy-db fix
gdraynz Oct 10, 2024
3d7b5bd
Fix branch targets
gdraynz Oct 10, 2024
a96fcdb
fix(build): fix build with commonJS on node 22
FranceBe Nov 13, 2024
e60904c
fix(test): with node 22 & commonJS
FranceBe Nov 13, 2024
4e949ce
fix(eslint): for node 22 and ecmaVersion 2020
FranceBe Nov 13, 2024
1fd55d3
chore(gitignore): ignore .nyc_output folder
FranceBe Nov 13, 2024
383bcfb
fix: update site-preference-builder import
joyet-simon Nov 25, 2024
e5302e4
fix(aqua): repository for github action
FranceBe Nov 26, 2024
11d12cc
Handlie breaking changes
remi-zuffinetti Nov 26, 2024
8aa2293
fix(node): update node version for CI and docker files
FranceBe Nov 26, 2024
a2fd80e
fix(lint): remove scss linting as we dont use scss files
FranceBe Nov 26, 2024
4599e02
Merge pull request #140 from alma/renovate/github-actions
remi-zuffinetti Nov 26, 2024
3a90b0a
Merge pull request #141 from alma/feature/ecom-2016-security-update-s…
joyet-simon Nov 29, 2024
26b8a10
chore(deps): update npm dependencies
alma-renovate-bot[bot] Dec 2, 2024
74dd9c0
Merge pull request #142 from alma/renovate/npm-dependencies
joyet-simon Dec 2, 2024
001d301
chore: update version
joyet-simon Dec 2, 2024
a4eeca5
fix: remove .nyc_output files
joyet-simon Dec 3, 2024
ead3be4
Merge branch 'main' into release/v4.8.0
carine-bonnafous Dec 3, 2024
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
3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"root": true,
"extends": "airbnb-base/legacy",
"parserOptions": {
"ecmaVersion": 2020
},
"rules": {
"import/no-unresolved": "off",
"indent": ["error", 4, { "SwitchCase": 1, "VariableDeclarator": 1 }],
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/aqua.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ jobs:
AQUA_URL: https://api.eu-1.supply-chain.cloud.aquasec.com
CSPM_URL: https://eu-1.api.cloudsploit.com
TRIVY_RUN_AS_PLUGIN: aqua
TRIVY_DB_REPOSITORY: europe-docker.pkg.dev/lyrical-carver-335213/ghcr-remote-cache/aquasecurity/trivy-db:2
TRIVY_DB_REPOSITORY: europe-docker.pkg.dev/lyrical-carver-335213/aquasec/trivy-db:2
with:
args: trivy fs --sast --reachability --scanners misconfig,vuln,secret .
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

strategy:
matrix:
node-version: [12.x]
node-version: [22.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
Expand Down
16 changes: 7 additions & 9 deletions .github/workflows/release-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,12 @@ jobs:
cc <@france.berut> <@khadija.cherif>

- name: Send changelog to Slack
uses: slackapi/slack-github-action@v1.27.0
uses: slackapi/slack-github-action@v2.0.0
with:
channel-id: CR9C57YM6
slack-message: ${{ steps.slack-markdown-release-notes.outputs.text }}
method: chat.postMessage
token: ${{ secrets.SLACK_RELEASE_CHANGELOG_BOT_TOKEN }}
payload: |
{
"username": "${{ github.event.sender.login }}",
"icon_url": "${{ github.event.sender.avatar_url }}"
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_RELEASE_CHANGELOG_BOT_TOKEN }}
channel: CR9C57YM6
username: "${{ github.event.sender.login }}"
icon_url: "${{ github.event.sender.avatar_url }}"
text: ${{ toJson(steps.slack-markdown-release-notes.outputs.text) }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ metadata/

# coverage report
/coverage
.nyc_output/
4 changes: 2 additions & 2 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"node": true,
"esversion": 8,
"esversion": 11,
"expr": true,
"predef": [
"describe",
"it"
]
}
}
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v12.22.12
v22.11.0
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# CHANGELOG

## v4.8.0 - 2024-12-02

### Changes

- Security update sfcc node version (#141)

### 🚀 New Features

- Change wording for in page configuration (#139)

#### Contributors

@FranceBe, @alma-renovate-bot, @alma-renovate-bot[bot], @gdraynz, @github-actions, @joyet-simon and @remi-zuffinetti

## v4.7.0 - 2024-10-07

### Changes
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# SFCC Cartridge requires npm 6.14^ and node 12.22.12
FROM node:12
# SFCC Cartridge requires npm 10.9^ and node 22.11.0
FROM node:22

# Create app directory, and make it the current directory
RUN mkdir -p /app
Expand Down
15 changes: 8 additions & 7 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ version: 3

env:
REPOSITORY: sfcc-cartridge
# This project requires node 12.x.
# You can set RUN_IN_DOCKER env var to true to run the tasks if you don't have node 12.x installed.
# This project requires node 22.x.
# You can set RUN_IN_DOCKER env var to true to run the tasks if you don't have node 22.x installed.
RUN_IN_DOCKER: '{{ .RUN_IN_DOCKER | default "false" }}'

tasks:
Expand Down Expand Up @@ -53,9 +53,9 @@ tasks:
cmds:
- |
{{if eq .RUN_IN_DOCKER "true"}}
docker compose run --build --rm sfcc-cartridge node site_preference_builder/compress.js && node site_preference_builder/main.js
docker compose run --build --rm sfcc-cartridge node site_preference_builder/compress.cjs && node site_preference_builder/main.cjs
{{else}}
node site_preference_builder/compress.js && node site_preference_builder/main.js
node site_preference_builder/compress.cjs && node site_preference_builder/main.cjs
{{end}}

test:
Expand All @@ -72,7 +72,8 @@ tasks:
desc: Run linter
deps:
- js:lint
- css:lint
# Removing css lint, as sgmf-scripts only lint scss files but we are using css files
# TODO : use another linter for css files

js:lint:
desc: Run JS linter
Expand Down Expand Up @@ -175,7 +176,7 @@ tasks:
deps:
- gh-cli
desc: Create a release pull request
cmds:
cmds:
- gh workflow run release-pull-request.yml
- cmd: sleep 2
silent: true
Expand All @@ -197,7 +198,7 @@ tasks:
msg: |
⚠️ This task requires a changelog message.
Please provide a changelog message. Example: `task hotfix CHANGELOG_MESSAGE='This is a message'`.
cmds:
cmds:
- gh workflow run hotfix-pull-request.yml -F changelog-message='{{.CHANGELOG_MESSAGE}}'
- cmd: sleep 2
silent: true
Expand Down
13 changes: 8 additions & 5 deletions cartridges/int_alma/cartridge/controllers/Alma.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ server.get('PaymentSuccess', function (req, res, next) {
paymentHelper.emptyCurrentBasket();
orderHelper.addAlmaPaymentDetails(order, paymentHelper.getPaymentDetails(paymentObj));

res.render('checkout/confirmation/confirmation',
res.render(
'checkout/confirmation/confirmation',
buildViewParams(paymentObj, order, req.locale.id, req.currentCustomer.profile)
);

Expand Down Expand Up @@ -350,7 +351,6 @@ server.post(
});
}


return next();
}
);
Expand Down Expand Up @@ -406,9 +406,11 @@ server.get(
}

return next();
});
}
);

server.get('Plans',
server.get(
'Plans',
server.middleware.https,
function (req, res, next) {
var getLocale = require('*/cartridge/scripts/helpers/almaHelpers').getLocale;
Expand All @@ -424,6 +426,7 @@ server.get('Plans',
plans: almaPlanHelper.getPlansForCheckout(getLocale(req), currentBasket, isDeferredCaptureEnabled)
});
return next();
});
}
);

module.exports = server.exports();
3 changes: 0 additions & 3 deletions cartridges/int_alma/cartridge/controllers/Checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ function getAlmaInfo() {
};
}


/**
* Fetch all the Alma URL needed by frontend
* @returns {Object} string urls
Expand Down Expand Up @@ -47,7 +46,6 @@ server.append('Begin', function (req, res, next) {
var almaConfigInfo = getAlmaInfo();
var almaConfigHelper = require('*/cartridge/scripts/helpers/almaConfigHelper');


var BasketMgr = require('dw/order/BasketMgr');
var currentBasket = BasketMgr.getCurrentBasket();

Expand Down Expand Up @@ -82,5 +80,4 @@ server.append('Begin', function (req, res, next) {
next();
});


module.exports = server.exports();
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ function getCreditInfo(plan, currencyCode) {
* @returns {string} the message to display fees
*/
function getPaymentFees(plan, currencyCode) {
return plan.payment_plan[0].customer_fee > 0 ?
Resource.msgf('alma.with_fee', 'alma', null, formatCurrency(plan.payment_plan[0].customer_fee / 100, currencyCode)) :
Resource.msg('alma.not_fee', 'alma', null);
return plan.payment_plan[0].customer_fee > 0
? Resource.msgf('alma.with_fee', 'alma', null, formatCurrency(plan.payment_plan[0].customer_fee / 100, currencyCode))
: Resource.msg('alma.not_fee', 'alma', null);
}

/**
Expand All @@ -112,40 +112,40 @@ function getInstallmentCountAfterFirst(plan) {
function getPaymentInstallments(plan, currencyCode) {
// deferred payment
if (plan.deferred_days > 0) {
return Resource.msgf(getPropertyCategory(plan) + '.installments', 'alma', null,
return Resource.msgf(
getPropertyCategory(plan) + '.installments',
'alma',
null,
formatCurrency(plan.payment_plan[0].purchase_amount / 100, currencyCode),
plan.deferred_days
);
}

// pay now
if (plan.installments_count === 1 && plan.deferred_days === 0) {
return formatCurrency(plan.payment_plan[0].purchase_amount / 100, currencyCode) + ' ' +
Resource.msgf(getPropertyCategory(plan) + '.installments', 'alma', null);
return formatCurrency(plan.payment_plan[0].purchase_amount / 100, currencyCode) + ' '
+ Resource.msgf(getPropertyCategory(plan) + '.installments', 'alma', null);
}
// on shipment payment
if (isOnShipmentPaymentEnabled(plan.installments_count)) {
return formatCurrency(plan.payment_plan[0].purchase_amount / 100, currencyCode) + ' ' +
Resource.msg(getPropertyCategory(plan) + '.installments.onshipment', 'alma', null) + ' ' +
getInstallmentCountAfterFirst(plan) +
formatCurrency(plan.payment_plan[1].purchase_amount / 100, currencyCode)
;
return formatCurrency(plan.payment_plan[0].purchase_amount / 100, currencyCode) + ' '
+ Resource.msg(getPropertyCategory(plan) + '.installments.onshipment', 'alma', null) + ' '
+ getInstallmentCountAfterFirst(plan)
+ formatCurrency(plan.payment_plan[1].purchase_amount / 100, currencyCode);
}
// on deferred capture
if (almaPaymentHelper.isAvailableForManualCapture(almaConfigHelper.isDeferredCaptureEnable(), plan.installments_count, plan.deferred_days)) {
return formatCurrency(plan.payment_plan[0].purchase_amount / 100, currencyCode) + ' ' +
plan.payment_plan[0].localized_due_date +
Resource.msg(getPropertyCategory(plan) + '.installments.then', 'alma', null) + ' ' +
getInstallmentCountAfterFirst(plan) +
formatCurrency(plan.payment_plan[1].purchase_amount / 100, currencyCode)
;
return formatCurrency(plan.payment_plan[0].purchase_amount / 100, currencyCode) + ' '
+ plan.payment_plan[0].localized_due_date
+ Resource.msg(getPropertyCategory(plan) + '.installments.then', 'alma', null) + ' '
+ getInstallmentCountAfterFirst(plan)
+ formatCurrency(plan.payment_plan[1].purchase_amount / 100, currencyCode);
}
// installment payment
return formatCurrency(plan.payment_plan[0].purchase_amount / 100, currencyCode) + ' ' +
Resource.msg(getPropertyCategory(plan) + '.installments', 'alma', null) + ' ' +
getInstallmentCountAfterFirst(plan) +
formatCurrency(plan.payment_plan[1].purchase_amount / 100, currencyCode)
;
return formatCurrency(plan.payment_plan[0].purchase_amount / 100, currencyCode) + ' '
+ Resource.msg(getPropertyCategory(plan) + '.installments', 'alma', null) + ' '
+ getInstallmentCountAfterFirst(plan)
+ formatCurrency(plan.payment_plan[1].purchase_amount / 100, currencyCode);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

var Site = require('dw/system/Site');

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ function callEligibility(param) {
return [];
}


/**
* Get eligibility params for a given set of plan, a locale and a basket
* @param {Object} plansForEligibility Alma plans
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ function getSfccVersion() {
return sfccMajor + '.' + sfccMinor;
}


/**
* Return current Api key
* @returns {string} current api key
Expand Down Expand Up @@ -220,7 +219,6 @@ function formatItem(product, productLine, locale) {
};
}


module.exports = {
addHeaders: addHeaders,
formatCustomerData: formatCustomerData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ function getPartialCaptureAmount(order) {
return order.custom.ALMA_Deferred_Capture_Partial_Amount;
}


module.exports = {
addPidToOrder: addPidToOrder,
addAlmaPaymentDetails: addAlmaPaymentDetails,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ function getPaymentObj(almaPaymentId) {
return JSON.parse(httpResult.getObject().text);
}


/**
* Once Alma API return a success for the Order payment, accept the Order
* @param {dw.order.Order} order the order to accept
Expand Down Expand Up @@ -100,17 +99,19 @@ function getPaymentDetails(paymentObj) {
}
var payDetail = '';
var payPlan = paymentObj.payment_plan;
// TODO: muting no-plusplus rule until we refactor more efficiently the code to match Node >=22
// eslint-disable-next-line no-plusplus
for (var i = 0, l = payPlan.length; i < l; i++) {
payDetail +=
StringUtils.formatCalendar(
payDetail
+= StringUtils.formatCalendar(
new Calendar(new Date(payPlan[i].due_date * 1000)),
'dd/MM/yyyy'
) +
': ' +
formatCurrency(payPlan[i].purchase_amount / 100, 'EUR') +
' ' +
payPlan[i].state +
' ';
)
+ ': '
+ formatCurrency(payPlan[i].purchase_amount / 100, 'EUR')
+ ' '
+ payPlan[i].state
+ ' ';
}
return payDetail;
}
Expand Down Expand Up @@ -409,7 +410,6 @@ function buildPaymentData(installmentsCount, deferredDays, locale, isManualCaptu
paymentData.payment.capture_method = 'manual';
}


var products = currentBasket.getAllProductLineItems();
var items = [];

Expand All @@ -423,7 +423,6 @@ function buildPaymentData(installmentsCount, deferredDays, locale, isManualCaptu
items: items
};


return paymentData;
}

Expand Down Expand Up @@ -483,7 +482,6 @@ function isPaymentAuthorizationExpired(paymentObj) {
return authorizationExpiresAtDate.getTime() < today.getTime();
}


module.exports = {
orderStatusEquals: orderStatusEquals,
getPaymentObj: getPaymentObj,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ function getFeePlans() {
*/
function getSitePrefNameFromPlan(plan) {
// ALMA_general + number of installments (p1x, p3x, p4x, ....) + by how many days is the payment deferred
return 'ALMA_general_' + plan.installments_count + '_' + plan.deferred_days
;
return 'ALMA_general_' + plan.installments_count + '_' + plan.deferred_days;
}

/**
Expand Down
Loading
Loading