Skip to content

Commit

Permalink
Merge pull request #136 from alma/release/v4.7.0
Browse files Browse the repository at this point in the history
Release v4.7.0
  • Loading branch information
joyet-simon authored Oct 7, 2024
2 parents 23a473a + 00d30d1 commit 625d6e5
Show file tree
Hide file tree
Showing 15 changed files with 52 additions and 65 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/aqua.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
aqua:
name: Aqua scanner
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/backport-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

create-backport-pull-request:
if: ${{ (github.event.pull_request.merged == true) && (contains(github.event.pull_request.labels.*.name, 'release')) }}
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:

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 @@ -11,7 +11,7 @@ on:
jobs:

create-hotfix-pull-request:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
contents: read
pull-requests: write

runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: TimonVS/pr-labeler-action@v5
env:
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 @@ -11,7 +11,7 @@ jobs:

release:
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release')
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:

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 @@ -6,7 +6,7 @@ on:
jobs:

create-release-pull-request:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:

Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# CHANGELOG

## v4.7.0 - 2024-10-07

### Changes

### 🚀 New Features

- Integrate credit for in page (#135)

#### Contributors

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

## v4.6.0 - 2024-09-16

### 🚀 New Features
Expand Down Expand Up @@ -117,14 +129,19 @@
## v3.0.0

* added package.json to pilot the project

* added npm commands :

* `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


## v2.3.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,6 @@ function getPropertiesForPlan(plan, currencyCode) {
);
}

/**
* Returns if the current payment option is pnx 2,3 or 4
* @param {int} installmentsCount installments count
* @returns {boolean} true means we can use inpage
*/
function isAvailableForInpage(installmentsCount) {
return installmentsCount <= 4;
}

/**
* Return true if plan is activated
* @param {Object} paymentMethod payment method
Expand Down Expand Up @@ -243,7 +234,7 @@ function formatPlanForCheckout(plan, currencyCode) {
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(),
in_page: almaConfigHelper.isInpageActivated(),
selector: getSelectorNameFromPlan(plan),
installments_count: plan.installments_count,
deferred_days: plan.deferred_days,
Expand All @@ -260,6 +251,5 @@ function formatPlanForCheckout(plan, currencyCode) {

module.exports = {
formatPlanForCheckout: formatPlanForCheckout,
getPlanPaymentMethodID: getPlanPaymentMethodID,
isAvailableForInpage: isAvailableForInpage
getPlanPaymentMethodID: getPlanPaymentMethodID
};
Original file line number Diff line number Diff line change
Expand Up @@ -363,15 +363,14 @@ function buildPaymentData(installmentsCount, deferredDays, locale, isManualCaptu
var BasketMgr = require('dw/order/BasketMgr');
var URLUtils = require('dw/web/URLUtils');
var almaHelper = require('*/cartridge/scripts/helpers/almaHelpers');
var almaCheckoutHelper = require('*/cartridge/scripts/helpers/almaCheckoutHelper');
var almaConfigHelper = require('*/cartridge/scripts/helpers/almaConfigHelper');

var formatAddress = require('*/cartridge/scripts/helpers/almaAddressHelper').formatAddress;
var isOnShipmentPaymentEnabled = require('*/cartridge/scripts/helpers/almaOnShipmentHelper').isOnShipmentPaymentEnabled;
var formatCustomerData = require('*/cartridge/scripts/helpers/almaHelpers').formatCustomerData;

var origin = 'online';
if (almaCheckoutHelper.isAvailableForInpage(installmentsCount) && almaConfigHelper.isInpageActivated()) {
if (almaConfigHelper.isInpageActivated()) {
origin = 'online_in_page';
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,73 +6,54 @@
data-deferred-days="${plan.deferred_days}"
data-in-page="${plan.in_page}"
data-alma-payment-method="${paymentOption.ID}"
data-captureMethod="${plan.captureMethod}"
>
data-captureMethod="${plan.captureMethod}">

<div class="col-2 img-content">
<div class="img">
<isif condition="${paymentOption.ID !== 'ALMA_PAY_NOW'}">
<div class="img-text" id="${plan.key + '-img'}">
<div class="img-text" id="${plan.key}-img">
<isprint value="${plan.properties.img}" encoding="off"/>
</div>
</isif>
<img alt="" src="${URLUtils.staticURL('/images/alma.png')}" title="ALMA"
style="height: 20px;"/>
</div>
</div>

<div class="col-9">
<h4 id="${plan.key + '-title'}">
<h4 id="${plan.key}-title">
<isprint value="${plan.properties.title}" encoding="off"/>
</h4>
<p id="${plan.key + '-description'}">
<p id="${plan.key}-description">
<isprint value="${plan.properties.description}" encoding="off"/>
</p>
<p class="no-margin" id="${plan.key + '-payment_installments'}">
<p class="no-margin" id="${plan.key}-payment_installments">
<isprint value="${plan.properties.payment_installments}" encoding="off"/>
</p>
<isif condition="${plan.installments_count > 4}">
<p class="no-margin" id="${plan.key + '-basket_cost'}">
<isprint value="${plan.properties.credit.basket_cost}"/>
</p>
<p class="no-margin" id="${plan.key + '-rate'}">
<isprint value="${plan.properties.credit.rate}"/>
</p>
<p class="no-margin" id="${plan.key + '-amount'}">
<isprint value="${plan.properties.credit.amount}"/>
</p>
<p id="${plan.key + '-total_cost'}">
<isprint value="${plan.properties.credit.total_cost}"/>
</p>
<iselse/>
<p class="pt-30" id="${plan.key + '-fees'}">
<isprint value="${plan.properties.fees}"/>

<!-- Mode test Alma (affiché si activé) -->
<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 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">
<span class="fa fa-chevron-right"></span>
</div>
</div>
<isif condition="${plan.key === 'ALMA_general_1_0'}">
<div id="${plan.key}-inpage" hidden></div>
<iselse>
<div id="${plan.key}-inpage"></div>
</iselse>
</isif>

<!-- Gestion de l'affichage dynamique de la section inpage -->
<div id="${plan.key}-inpage" ${plan.key === 'ALMA_general_1_0' ? 'hidden' : ''}></div>
</isloop>
</isif>
</isloop>

<fieldset class="payment-form-fields">
<input type="hidden" class="form-control" name="${pdict.forms.billingForm.paymentMethod.htmlName}"
value="ALMA"/>
<input type="hidden" class="form-control" name="${pdict.forms.billingForm.paymentMethod.htmlName}" value="ALMA"/>
</fieldset>
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.6.0",
"version": "4.7.0",
"hooks": "./hooks.json"
}
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.6.0",
"version": "4.7.0",
"description": "Alma SFCC integration plugin",
"main": "index.js",
"engines": {
Expand Down
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.6.0'
alma_plugin_version: '4.7.0'
}
},
customer: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ describe('AlmaCheckoutHelpers', function () {
installments_count: 10
});
checkoutData = almaCheckoutHelpers.formatPlanForCheckout(planP10x, currencyCode);
assert.equal(checkoutData.in_page, false);
assert.equal(checkoutData.in_page, true);
});

it('Check field selector depending of the plan', function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe('almaPaymentHelper', function () {
setIsAvailableForInpage(false);

var payment = almaPaymentHelper.buildPaymentData(12, 0, 'fr_FR', false);
assert.deepEqual(payment, resolvedPaymentData(12, 0, 'fr_FR', 'online', true));
assert.deepEqual(payment, resolvedPaymentData(12, 0, 'fr_FR', 'online_in_page', true));
});
});
describe('Build payment data for deferred capture', function () {
Expand Down

0 comments on commit 625d6e5

Please sign in to comment.