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.1.2 #511

Merged
merged 16 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
1166f79
chore(Taskfile): Fix displayed workflow url
carine-bonnafous Jun 14, 2024
69e19eb
chore(pre-commit): Allow release branch name
carine-bonnafous Jun 18, 2024
8cccf2a
chore(Taskfile): use task:test to be aligned with other repositories
carine-bonnafous Jun 21, 2024
74fbdaa
chore(Taskfile): Add a task to install pre-commits
carine-bonnafous Jun 21, 2024
16bc54e
chore(Taskfile): review: change task prefix
carine-bonnafous Jun 21, 2024
af55ce1
Merge pull request #502 from alma/chore/backport-main-to-develop
Benjamin-Freoua-Alma Jul 10, 2024
6639ff8
Merge pull request #475 from alma/devx/various-small-changes-on-tasks
carine-bonnafous Jul 10, 2024
9de5b0f
fix: Issue PS Account with PS 8.1.7
Benjamin-Freoua-Alma Jul 15, 2024
19becf1
fix: Issue quantity insurance if we change quantity in cart
Benjamin-Freoua-Alma Jul 15, 2024
30da8f7
fix: Issue insurance for product not eligible created after import
Benjamin-Freoua-Alma Jul 15, 2024
1539c20
Merge pull request #509 from alma/fix/ecom-1861-ps-fix-error-js-on-th…
Benjamin-Freoua-Alma Jul 16, 2024
c68a37b
Merge pull request #508 from alma/fix/ecom-1866-ps-issue-if-we-change…
Benjamin-Freoua-Alma Jul 16, 2024
78c87e4
Merge pull request #506 from alma/fix/ecom-1869-ps-issue-ps-account-w…
Benjamin-Freoua-Alma Jul 16, 2024
65a4e57
fix: Avoid change quantity with module pscartdropdown for insurance
Benjamin-Freoua-Alma Jul 16, 2024
336e4b9
Merge pull request #510 from alma/fix/ecom-1880-ps-avoid-change-quant…
Benjamin-Freoua-Alma Jul 16, 2024
ed1b683
chore: update version
Benjamin-Freoua-Alma Jul 16, 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/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ jobs:

- name: Run unit Tests and Coverage
if: ${{ !contains(github.event.pull_request.labels.*.name, 'hotfix') }}
run: task test:coverage
run: task test
env:
XDEBUG_MODE: coverage
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## v4.1.2 - 2024-07-16

### Changes

### 🐛 Bug Fixes

- fix: Avoid change quantity with module pscartdropdown for insurance (#510)
- fix: Issue PS Account with PS 8.1.7 (#506)
- fix: Issue quantity insurance if we change quantity in cart (#508)
- fix: Issue insurance for product not eligible created after import (#509)

#### Contributors

@Benjamin-Freoua-Alma, @carine-bonnafous and @github-actions

## v4.1.1 - 2024-07-10

### Changes
Expand Down
54 changes: 38 additions & 16 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,40 @@ tasks:
cmds:
- task -l

brew:
preconditions:
- sh: brew -v
msg: 'This task requires `brew`. Please refer to this documentation: https://brew.sh/'

pre-commit:
desc: Install pre-commit tool
internal: true
deps: [brew]
status:
- pre-commit --version
cmds:
- brew install pre-commit

pre-commit:install:
desc: Install and set up pre-commit hooks
deps: [pre-commit]
cmds:
- pre-commit install --hook-type pre-commit --hook-type commit-msg

tools:install:
desc: Composer install of tools
sources:
- alma/composer.json
- alma/composer.lock
cmds:
- composer install --optimize-autoloader --working-dir=alma

docker:build:
desc: Build prestashop docker image
cmds:
- docker compose build prestashop

test:coverage:
test:
desc: Execute Unit Tests with coverage
deps:
- docker:build
Expand All @@ -35,14 +63,6 @@ tasks:
cmds:
- rm -rf ./dist

install-tools:
desc: Composer install of tools
sources:
- alma/composer.json
- alma/composer.lock
cmds:
- composer install --optimize-autoloader --working-dir=alma

lint:ci:
desc: Run linter within docker-compose for the CI
deps:
Expand All @@ -53,7 +73,7 @@ tasks:
lint:
desc: Run linter
deps:
- install-tools
- tools:install
cmds:
- php alma/vendor/bin/php-cs-fixer fix --dry-run --diff alma
# Search for variables in smarty templates that are not escaped
Expand All @@ -66,7 +86,7 @@ tasks:
lint:fix:
desc: Run linter and apply fix
deps:
- install-tools
- tools:install
cmds:
- php alma/vendor/bin/php-cs-fixer fix alma
# Execute autoindex to add index in all folders
Expand All @@ -78,7 +98,7 @@ tasks:
php-compatibility:
desc: Check compatibility code
deps:
- install-tools
- tools:install
cmds:
- php ./alma/vendor/bin/phpcs -p alma --standard=PHPCompatibility -s --runtime-set testVersion 5.6-8.1 --ignore=\*/vendor/\*

Expand Down Expand Up @@ -119,10 +139,11 @@ tasks:
desc: Create a release pull request
cmds:
- gh workflow run release-pull-request.yml
- sleep 2
- cmd: sleep 2
silent: true
- cmd: echo "Release pull request created, check out https://github.com/alma/{{.REPOSITORY}}/pulls?q=is%3Aopen+is%3Apr+label%3Arelease"
silent: true
- cmd: echo "If no pull request is created, check out https://github.com/alma/{{.REPOSITORY}}/actions/workflows/release-pull-request.yml."
- cmd: echo "If no pull request is created, check out https://github.com/alma/{{.REPOSITORY}}/actions/workflows/release-pull-request.yml"
silent: true
- cmd: echo "Please, review and merge the pull request."
silent: true
Expand All @@ -140,10 +161,11 @@ tasks:
Please provide a changelog message. Example: `task hotfix CHANGELOG_MESSAGE='This is a message'`.
cmds:
- gh workflow run hotfix-pull-request.yml -F changelog-message='{{.CHANGELOG_MESSAGE}}'
- sleep 2
- cmd: sleep 2
silent: true
- cmd: echo "Hotfix pull request created, check out https://github.com/alma/{{.REPOSITORY}}/pulls?q=is%3Aopen+is%3Apr+label%3Ahotfix"
silent: true
- cmd: echo "If no pull request is created, check out https://github.com/alma/{{.REPOSITORY}}/actions/workflows/hotfix-pull-request.yml."
- cmd: echo "If no pull request is created, check out https://github.com/alma/{{.REPOSITORY}}/actions/workflows/hotfix-pull-request.yml"
silent: true
- cmd: echo "Please, review and merge the pull request."
silent: true
Expand Down
4 changes: 2 additions & 2 deletions alma/alma.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

class Alma extends PaymentModule
{
const VERSION = '4.1.1';
const VERSION = '4.1.2';

public $_path;
public $local_path;
Expand Down Expand Up @@ -83,7 +83,7 @@ public function __construct()
{
$this->name = 'alma';
$this->tab = 'payments_gateways';
$this->version = '4.1.1';
$this->version = '4.1.2';
$this->author = 'Alma';
$this->need_instance = false;
$this->bootstrap = true;
Expand Down
4 changes: 3 additions & 1 deletion alma/config/admin/services.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
services:
_defaults:
public: true

#####################
# PS Account
Expand All @@ -10,4 +12,4 @@ services:
alma.ps_accounts_facade:
class: 'PrestaShop\PsAccountsInstaller\Installer\Facade\PsAccounts'
arguments:
- '@alma.ps_accounts_installer'
- '@alma.ps_accounts_installer'
10 changes: 7 additions & 3 deletions alma/controllers/hook/FrontHeaderHookController.php
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,8 @@ protected function manageAssetVersionForPrestashopBefore17()
*/
public function manageInsuranceAssetsAfter17()
{
$scripts = '';

if (
$this->insuranceHelper->isInsuranceAllowedInProductPage()
&& $this->iAmInProductPage()
Expand All @@ -337,7 +339,7 @@ public function manageInsuranceAssetsAfter17()
"modules/$this->moduleName/" . ConstantsHelper::INSURANCE_PRODUCT_CSS_PATH
);

return $this->urlScriptInsuranceModal();
$scripts .= $this->urlScriptInsuranceModal();
}

if (
Expand All @@ -352,7 +354,7 @@ public function manageInsuranceAssetsAfter17()
);

if ($this->insuranceHelper->isInsuranceAllowedInCartPage()) {
return $this->urlScriptInsuranceModal();
$scripts .= $this->urlScriptInsuranceModal();
}
}

Expand All @@ -365,7 +367,9 @@ public function manageInsuranceAssetsAfter17()

$this->controller->addJS($this->module->_path . ConstantsHelper::INSURANCE_SCRIPT_PATH);

return $this->almaInsuranceIdInHeader();
$scripts .= $this->almaInsuranceIdInHeader();

return $scripts;
}

/**
Expand Down
9 changes: 4 additions & 5 deletions alma/views/js/alma-cart-insurance.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
if (window.prestashop != null && window.prestashop.on != null) {
prestashop.on("updatedCart", onloadInsuranceItemCartAlma);
}
window.addEventListener('message', (e) => {
handleAddInsuranceProductFromWidget(e);
});
Benjamin-Freoua-Alma marked this conversation as resolved.
Show resolved Hide resolved
});
})(jQuery);

Expand Down Expand Up @@ -182,10 +185,6 @@ function onloadInsuranceClickEvents() {
});

});

window.addEventListener('message', (e) => {
handleAddInsuranceProductFromWidget(e);
});
}

function handleAddInsuranceProductFromWidget(e) {
Expand Down Expand Up @@ -218,7 +217,7 @@ function handleAddInsuranceProductFromWidget(e) {
}
}
if (e.data.type === 'almaEligibilityAnswer') {
if (e.data.eligibilityCallResult.length > 0) {
if (e.data.eligibilityCallResponseStatus.response.eligibleProduct && e.data.eligibilityCallResult.length > 0) {
$('#' + e.data.iFrameIdForProductWidget).show();
}
}
Expand Down
22 changes: 22 additions & 0 deletions alma/views/js/alma-insurance.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
/**
* 2018-2024 Alma SAS
*
* THE MIT LICENSE
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
* to permit persons to whom the Software is furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*
* @author Alma SAS <[email protected]>
* @copyright 2018-2024 Alma SAS
* @license https://opensource.org/licenses/MIT The MIT License
*/
(function ($) {
$(function () {
loadInsuranceMiniCart();
Expand Down
9 changes: 6 additions & 3 deletions alma/views/js/alma-product-insurance.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ let selectedAlmaInsurance = null;
let addToCartFlow = false;
let productDetails = null;
let quantity = 1;
let almaEligibilityAnswer = false;

(function ($) {
$(function () {
Expand Down Expand Up @@ -97,8 +98,9 @@ function onloadAddInsuranceInputOnProductAlma() {

window.addEventListener('message', (e) => {
if (e.data.type === 'almaEligibilityAnswer') {
almaEligibilityAnswer = e.data.eligibilityCallResponseStatus.response.eligibleProduct;
btnLoaders('stop');
if (e.data.eligibilityCallResponseStatus.response.eligibleProduct === true) {
if (almaEligibilityAnswer) {
let heightIframe = e.data.widgetSize.height;
let stringHeightIframe = heightIframe + 'px';
if (heightIframe <= 45) {
Expand All @@ -108,7 +110,7 @@ function onloadAddInsuranceInputOnProductAlma() {
document.getElementById('alma-widget-insurance-product-page').style.height = stringHeightIframe;
} else {
let addToCart = document.querySelector('.add-to-cart');
addToCart.removeEventListener("click",insuranceListener)
addToCart.removeEventListener("click", insuranceListener)
}
}
if (e.data.type === 'getSelectedInsuranceData') {
Expand Down Expand Up @@ -204,8 +206,9 @@ function removeInputInsurance() {
}

function addModalListenerToAddToCart() {
if (settings.isAddToCartPopupActivated === true) {
if (settings.isAddToCartPopupActivated === true && almaEligibilityAnswer) {
let addToCart = document.querySelector('.add-to-cart');
// If we change the quantity the DOM is reloaded then we need to remove and add the listener again
addToCart.removeEventListener("click",insuranceListener)
addToCart.addEventListener("click", insuranceListener);
}
Expand Down