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.4.2 #601

Closed
wants to merge 46 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
7e1d0e3
chore(deps): update github actions
alma-renovate-bot[bot] Oct 7, 2024
c26d18e
Merge pull request #580 from alma/chore/backport-main-to-develop
Benjamin-Freoua-Alma Oct 7, 2024
581c43c
Try setuping python first
remi-zuffinetti Oct 8, 2024
96290f5
Merge pull request #574 from alma/renovate/github-actions
remi-zuffinetti Oct 8, 2024
090c434
feat: add inpage setting for selector payment buttons
Benjamin-Freoua-Alma Oct 8, 2024
3b2f564
feat: add unit test
Benjamin-Freoua-Alma Oct 9, 2024
085bc33
feat: review Sonar
Benjamin-Freoua-Alma Oct 9, 2024
cd15399
chore(deps): update pre-commit hook pre-commit/pre-commit-hooks to v5
alma-renovate-bot[bot] Oct 14, 2024
c24175f
feat: review [FRA]
Benjamin-Freoua-Alma Oct 14, 2024
43cd6ed
feat: update translation
Benjamin-Freoua-Alma Oct 14, 2024
61cf190
Merge pull request #581 from alma/feature/ecom-2080-ps-refactor-in-pa…
Benjamin-Freoua-Alma Oct 15, 2024
5143d06
Merge pull request #579 from alma/renovate/pre-commit-pre-commit-hook…
Benjamin-Freoua-Alma Oct 15, 2024
8c156c8
chore(deps): update pre-commit repositories (#570)
alma-renovate-bot[bot] Oct 15, 2024
3fe44a3
chore(deps): update pre-commit hook returntocorp/semgrep to v1.92.0
alma-renovate-bot[bot] Oct 21, 2024
69a0193
feat: add renovate in pre-commit check branch name
Benjamin-Freoua-Alma Oct 22, 2024
63dc2fc
Merge pull request #586 from alma/renovate/pre-commit-repositories
remi-zuffinetti Oct 25, 2024
cad5a95
fix: stop polluting the global JS scope
olance Oct 23, 2024
4e3415d
fix: use getAddToCartButton function consistently
olance Oct 23, 2024
2ad7946
chore: coding style
olance Oct 23, 2024
2d3bc72
fix: use product details data provided by PS
olance Oct 23, 2024
3ad023f
chore: fix code style warnings
olance Oct 23, 2024
c6011a8
chore: make Aqua happy
olance Oct 23, 2024
85f612e
fix: update quantity_wanted with correct value
olance Oct 23, 2024
00d478d
fix: work around PS bug to maintain quantity_wanted
olance Oct 24, 2024
6c9ffa8
Merge pull request #590 from alma/fix/js-product-details
olance Oct 25, 2024
b61d5c3
refactor: simplify & document insurance on product page
olance Oct 24, 2024
b5a7b6e
fix: include wanted product quantity in widget iframe URL
olance Oct 25, 2024
50fb334
refactor: simplify widget & modal control flow
olance Oct 25, 2024
bfe76b8
chore(deps): update mysql docker tag to v9.1
alma-renovate-bot[bot] Oct 28, 2024
3246c1f
chore(deps): update pre-commit repositories
alma-renovate-bot[bot] Oct 28, 2024
47a6eb5
fix: issue with some translation in payment buttons
Benjamin-Freoua-Alma Oct 28, 2024
09f5681
Merge pull request #592 from alma/renovate/pre-commit-repositories
Benjamin-Freoua-Alma Oct 29, 2024
1de63d1
Merge pull request #585 from alma/renovate/docker-updates
Benjamin-Freoua-Alma Oct 29, 2024
014b0d4
fix: Update wording for In-Page advanced feature
Benjamin-Freoua-Alma Oct 29, 2024
ad0cf10
Merge pull request #591 from alma/fix/infinite-reload
olance Oct 30, 2024
0828e39
Merge branch 'develop' into chore/backport-main-to-develop
carine-bonnafous Oct 30, 2024
c23d862
Merge pull request #596 from alma/chore/backport-main-to-develop
Benjamin-Freoua-Alma Oct 30, 2024
be86f48
Merge pull request #594 from alma/feature/ecom-2153-ps-update-wording…
Benjamin-Freoua-Alma Nov 4, 2024
bd20c45
chore(deps): update pre-commit hook returntocorp/semgrep to v1.95.0
alma-renovate-bot[bot] Nov 4, 2024
609ba97
Merge pull request #597 from alma/renovate/pre-commit-repositories
Benjamin-Freoua-Alma Nov 7, 2024
96044bc
fix: don't crash when there is not quantity input
olance Nov 8, 2024
7a66947
chore(deps): update pre-commit repositories
alma-renovate-bot[bot] Nov 11, 2024
a504025
Merge pull request #593 from alma/fix/ecom-2147-eurl-mecatera-word-in…
Benjamin-Freoua-Alma Nov 12, 2024
f2ffd85
Merge pull request #599 from alma/renovate/pre-commit-repositories
Benjamin-Freoua-Alma Nov 12, 2024
b85c770
Merge pull request #598 from alma/fix/insurance-no-qty
olance Nov 13, 2024
fa4f400
chore: update version
Benjamin-Freoua-Alma Nov 13, 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
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
7 changes: 6 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

lint-and-test:

runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v4
Expand All @@ -25,6 +25,11 @@ jobs:
version: 3.x
repo-token: ${{ github.token }}

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-test-post-results.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ on:
jobs:

e2e-post-results:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/e2e-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
launch:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
if: github.event.pull_request.draft == false && !contains(github.event.pull_request.labels.*.name, 'hotfix')

strategy:
Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:
repositories: integration-infrastructure

- name: Trigger E2E tests in the integration-infrastructure repository
uses: codex-/return-dispatch@v1
uses: codex-/return-dispatch@v2
id: e2e-tests-workflow-dispatch
with:
token: ${{ steps.github-token-infrastructure.outputs.token }}
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
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/commitizen-tools/commitizen
rev: v3.29.0
rev: v3.30.1
hooks:
- id: commitizen
name: Check commit message format
stages: [commit-msg]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-added-large-files
args: ["--maxkb=1024"]
Expand Down Expand Up @@ -39,7 +39,7 @@ repos:
stages: [commit]

- repo: https://github.com/returntocorp/semgrep
rev: v1.87.0
rev: v1.96.0
hooks:
- id: semgrep
args:
Expand All @@ -58,4 +58,4 @@ repos:
hooks:
- id: check-branch-name
args:
- "-r^((chore|ci|dependabot|devx|docs|feature|fix|release|hotfix|hotfix-backport|infra|other|perf|refactor|security|test)\/.+|(snyk)-.+|main|develop|HEAD)$$"
- "-r^((chore|ci|dependabot|devx|renovate|docs|feature|fix|release|hotfix|hotfix-backport|infra|other|perf|refactor|security|test)\/.+|(snyk)-.+|main|develop|HEAD)$$"
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## v4.4.2 - 2024-11-13

### Changes

### 🐛 Bug Fixes

- fix: Prevent crash when there is not quantity input on product page for insurance (#598)
- fix: issue with some translation in payment buttons (#593)
- fix: Update wording for In-Page advanced feature (#594)

#### Contributors

@Benjamin-Freoua-Alma, @alma-renovate-bot, @alma-renovate-bot[bot], @carine-bonnafous, @github-actions and @olance

## v4.4.1 - 2024-10-30

### 🐛 Bug Fixes
Expand Down
4 changes: 2 additions & 2 deletions alma/alma.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

class Alma extends PaymentModule
{
const VERSION = '4.4.1';
const VERSION = '4.4.2';
const PS_ACCOUNTS_VERSION_REQUIRED = '5.3.0';

public $_path;
Expand Down Expand Up @@ -81,7 +81,7 @@ public function __construct()
{
$this->name = 'alma';
$this->tab = 'payments_gateways';
$this->version = '4.4.1';
$this->version = '4.4.2';
$this->author = 'Alma';
$this->need_instance = false;
$this->bootstrap = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ public function run($params)
? $productParams['id_product_attribute']
: null;

$quantityWanted = isset($productParams['quantity_wanted']) ? $productParams['quantity_wanted'] : 1;

$cmsReference = $this->insuranceHelper->createCmsReference($productId, $productAttributeId);

$staticPrice = $this->productHelper->getPriceStatic($productId, $productAttributeId);
Expand All @@ -132,11 +134,12 @@ public function run($params)
'productDetails' => $this->handleProductDetails($params),
'settingsInsurance' => $this->handleSettings($merchantId),
'iframeUrl' => sprintf(
'%s%s?cms_reference=%s&product_price=%s&product_name=%s&merchant_id=%s&customer_session_id=%s&cart_id=%s',
'%s%s?cms_reference=%s&product_price=%s&product_quantity=%s&product_name=%s&merchant_id=%s&customer_session_id=%s&cart_id=%s',
$this->adminInsuranceHelper->envUrl(),
ConstantsHelper::FO_IFRAME_WIDGET_INSURANCE_PATH,
$cmsReference,
$staticPriceInCents,
$quantityWanted,
$productName,
$merchantId,
$this->context->cookie->checksum,
Expand Down
12 changes: 12 additions & 0 deletions alma/controllers/hook/FrontHeaderHookController.php
Original file line number Diff line number Diff line change
Expand Up @@ -478,8 +478,20 @@ private function assetsInPage()
$this->controller->unregisterJavascript(ConstantsHelper::WIDGETS_JS_ID);
}
}

$content .= $this->almaInPageHeader();
}

return $content;
}

/**
* @return string
*/
protected function almaInPageHeader()
{
$settings = json_encode($this->settingsHelper->getInPageSettings());

return "<div id='alma-inpage-global' data-settings='{$settings}'></div>";
}
}
4 changes: 4 additions & 0 deletions alma/controllers/hook/GetContentHookController.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ final class GetContentHookController extends AdminHookController
'action' => 'cast_bool',
'suffix' => '_ON',
],
InpageAdminFormBuilder::ALMA_INPAGE_PAYMENT_BUTTON_SELECTOR => 'none',
InpageAdminFormBuilder::ALMA_INPAGE_PLACE_ORDER_BUTTON_SELECTOR => 'none',
'ALMA_ACTIVATE_LOGGING' => [
'action' => 'cast_bool',
'suffix' => '_ON',
Expand Down Expand Up @@ -709,6 +711,8 @@ protected function getFieldsValueForForm()
PaymentButtonAdminFormBuilder::ALMA_PNX_AIR_BUTTON_DESC
),
InpageAdminFormBuilder::ALMA_ACTIVATE_INPAGE . '_ON' => $this->settingsHelper->isInPageEnabled(),
InpageAdminFormBuilder::ALMA_INPAGE_PAYMENT_BUTTON_SELECTOR => $this->settingsHelper->getKey(InpageAdminFormBuilder::ALMA_INPAGE_PAYMENT_BUTTON_SELECTOR, InpageAdminFormBuilder::ALMA_INPAGE_DEFAULT_VALUE_PAYMENT_BUTTON_SELECTOR),
InpageAdminFormBuilder::ALMA_INPAGE_PLACE_ORDER_BUTTON_SELECTOR => $this->settingsHelper->getKey(InpageAdminFormBuilder::ALMA_INPAGE_PLACE_ORDER_BUTTON_SELECTOR, InpageAdminFormBuilder::ALMA_INPAGE_DEFAULT_VALUE_PLACE_ORDER_BUTTON_SELECTOR),
'ALMA_SHOW_DISABLED_BUTTON' => SettingsHelper::showDisabledButton(),
'ALMA_SHOW_ELIGIBILITY_MESSAGE_ON' => SettingsHelper::showEligibilityMessage(),
'ALMA_CART_WDGT_NOT_ELGBL_ON' => SettingsHelper::showCartWidgetIfNotEligible(),
Expand Down
26 changes: 25 additions & 1 deletion alma/lib/Forms/InpageAdminFormBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
class InpageAdminFormBuilder extends AbstractAlmaAdminFormBuilder
{
const ALMA_ACTIVATE_INPAGE = 'ALMA_ACTIVATE_INPAGE';
const ALMA_INPAGE_PAYMENT_BUTTON_SELECTOR = 'ALMA_INPAGE_PAYMENT_BUTTON_SELECTOR';
const ALMA_INPAGE_DEFAULT_VALUE_PAYMENT_BUTTON_SELECTOR = '[data-module-name=alma]';
const ALMA_INPAGE_PLACE_ORDER_BUTTON_SELECTOR = 'ALMA_INPAGE_PLACE_ORDER_BUTTON_SELECTOR';
const ALMA_INPAGE_DEFAULT_VALUE_PLACE_ORDER_BUTTON_SELECTOR = '#payment-confirmation button';

/**
* @return array
Expand All @@ -44,9 +48,29 @@ protected function configForm()
$this->inputAlmaSwitchForm(
self::ALMA_ACTIVATE_INPAGE,
$this->module->l('Activate in-page checkout', 'InpageAdminFormBuilder'),
$this->module->l('Activate in-page checkout for Pay Now, P2X, P3X and P4X', 'InpageAdminFormBuilder'),
$this->module->l('Activate in-page checkout for all Alma payment methods', 'InpageAdminFormBuilder'),
$this->module->l('The checkout in-page in your own website', 'InpageAdminFormBuilder')
),
$this->inputTextForm(
self::ALMA_INPAGE_PAYMENT_BUTTON_SELECTOR,
$this->module->l('Input payment button Alma selector', 'InpageAdminFormBuilder'),
sprintf(
$this->module->l('%1$sAdvanced%2$s [Optional] CSS selector used by our scripts to identify the Alma payment button', 'InpageAdminFormBuilder'),
'<b>',
'</b>'
),
$this->module->l('E.g. #id, .class, ...', 'InpageAdminFormBuilder')
),
$this->inputTextForm(
self::ALMA_INPAGE_PLACE_ORDER_BUTTON_SELECTOR,
$this->module->l('Place order button selector', 'InpageAdminFormBuilder'),
sprintf(
$this->module->l('%1$sAdvanced%2$s [Optional] CSS selector used by our scripts to identify the payment confirmation button', 'InpageAdminFormBuilder'),
'<b>',
'</b>'
),
$this->module->l('E.g. #id, .class, ...', 'InpageAdminFormBuilder')
),
];
}

Expand Down
2 changes: 1 addition & 1 deletion alma/lib/Helpers/PaymentOptionTemplateHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public function buildTemplateVar(

if ($isDeferred) {
$templateVar['installmentText'] = sprintf(
$this->translationHelper->getTranslation('0 € today then %1$s on %2$s', 'PaymentOptionsHookController'),
$this->translationHelper->l('0 € today then %1$s on %2$s', 'PaymentOptionTemplateHelper'),
$this->priceHelper->formatPriceToCentsByCurrencyId(
$plans[0]['purchase_amount'] + $plans[0]['customer_fee']
),
Expand Down
6 changes: 3 additions & 3 deletions alma/lib/Helpers/PlanHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,18 +128,18 @@ public function buildDates($plans, $locale, $feePlans, $key, $isPayNow)
$plans[$keyPlan]['human_date'] = $this->dateHelper->getDateFormat($locale, $paymentPlan['due_date']);

if (0 === $keyPlan) {
$plans[$keyPlan]['human_date'] = $this->translationHelper->getTranslation('Today', 'PaymentService');
$plans[$keyPlan]['human_date'] = $this->translationHelper->l('Today', 'PlanHelper');
continue;
}

if ($isPayNow) {
$plans[$keyPlan]['human_date'] = $this->translationHelper->getTranslation('Total', 'PaymentService');
$plans[$keyPlan]['human_date'] = $this->translationHelper->l('Total', 'PlanHelper');
continue;
}

if ($this->settingsHelper->isDeferredTriggerLimitDays($feePlans, $key)) {
$plans[$keyPlan]['human_date'] = sprintf(
$this->translationHelper->getTranslation('%s month later', 'PaymentService'),
$this->translationHelper->l('%s month later', 'PaymentService'),
$keyPlan
);

Expand Down
14 changes: 14 additions & 0 deletions alma/lib/Helpers/SettingsHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ public static function deleteAllValues()
PaymentButtonAdminFormBuilder::ALMA_PNX_AIR_BUTTON_DESC,
ExcludedCategoryAdminFormBuilder::ALMA_NOT_ELIGIBLE_CATEGORIES,
InpageAdminFormBuilder::ALMA_ACTIVATE_INPAGE,
InpageAdminFormBuilder::ALMA_INPAGE_PAYMENT_BUTTON_SELECTOR,
InpageAdminFormBuilder::ALMA_INPAGE_PLACE_ORDER_BUTTON_SELECTOR,
'ALMA_STATE_REFUND',
'ALMA_STATE_REFUND_ENABLED',
'ALMA_STATE_TRIGGER',
Expand Down Expand Up @@ -496,6 +498,18 @@ public function isInPageEnabled()
return (bool) (int) $this->getKey(InpageAdminFormBuilder::ALMA_ACTIVATE_INPAGE, false);
}

/**
* @return array
*/
public function getInPageSettings()
{
return [
'enabled' => $this->isInPageEnabled(),
'paymentButtonSelector' => $this->getKey(InpageAdminFormBuilder::ALMA_INPAGE_PAYMENT_BUTTON_SELECTOR, InpageAdminFormBuilder::ALMA_INPAGE_DEFAULT_VALUE_PAYMENT_BUTTON_SELECTOR),
'placeOrderButtonSelector' => $this->getKey(InpageAdminFormBuilder::ALMA_INPAGE_PLACE_ORDER_BUTTON_SELECTOR, InpageAdminFormBuilder::ALMA_INPAGE_DEFAULT_VALUE_PLACE_ORDER_BUTTON_SELECTOR),
];
}

/**
* Return activated plans.
*
Expand Down
2 changes: 1 addition & 1 deletion alma/lib/Helpers/TranslationHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function __construct($moduleFactory)
*
* @return mixed
*/
public function getTranslation($string, $file)
public function l($string, $file)
{
return $this->module->l($string, $file);
}
Expand Down
4 changes: 2 additions & 2 deletions alma/tests/Unit/Helper/PaymentOptionTemplateHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function testBuildTemplateVarNoDeferredPlan()
$this->settingsHelperMock->shouldReceive('getModeActive')->andReturn('test');
$this->settingsHelperMock->shouldReceive('getIdMerchant')->andReturn('merchantId');
$this->configurationHelperMock->shouldReceive('isInPageEnabled')->andReturn(true);
$this->translationHelperMock->shouldReceive('getTranslation')->andReturn('My translation');
$this->translationHelperMock->shouldReceive('l')->andReturn('My translation');
$this->priceHelperMock->shouldReceive('formatPriceToCentsByCurrencyId')->andReturn('110.00');
$this->dateHelperMock->shouldReceive('getDateFormat')->andReturn('22/05/2024');

Expand Down Expand Up @@ -163,7 +163,7 @@ public function testBuildTemplateVarDeferredPlan()
$this->settingsHelperMock->shouldReceive('getModeActive')->andReturn('test');
$this->settingsHelperMock->shouldReceive('getIdMerchant')->andReturn('merchantId');
$this->configurationHelperMock->shouldReceive('isInPageEnabled')->andReturn(true);
$this->translationHelperMock->shouldReceive('getTranslation')->andReturn('My translation');
$this->translationHelperMock->shouldReceive('l')->andReturn('My translation');
$this->priceHelperMock->shouldReceive('formatPriceToCentsByCurrencyId')->andReturn('110.00');
$this->dateHelperMock->shouldReceive('getDateFormat')->andReturn('22/05/2024');

Expand Down
Loading