Skip to content

Commit

Permalink
Merge pull request #517 from alma/release/v4.1.3
Browse files Browse the repository at this point in the history
Release v4.1.3
  • Loading branch information
Benjamin-Freoua-Alma authored Jul 18, 2024
2 parents 5c849c5 + 37903d3 commit 131b6e0
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 34 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## v4.1.3 - 2024-07-18

### Changes

### 🐛 Bug Fixes

- fix: Declaration LinkFactory (#514)
- fix: Issue with insurance on mobile display (#515)

#### Contributors

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

## v4.1.2 - 2024-07-16

### Changes
Expand Down
55 changes: 40 additions & 15 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,36 @@ tasks:
desc: Create a release pull request
cmds:
- gh workflow run release-pull-request.yml
- cmd: sleep 2
- sleep 5
- 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 "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"
silent: true
- cmd: echo "Please, review and merge the pull request."
- defer: { task: release:info }

release:help:
desc: Print help regarding the release process
cmds:
- cmd: |
echo -e "ℹ️ The Release PR can be created using \e[3mtask release\e[0m command"
echo " Run it and check out https://github.com/alma/{{.REPOSITORY}}/pulls?q=is%3Aopen+is%3Apr+label%3Arelease"
echo " If no pull request is created, check out https://github.com/alma/{{.REPOSITORY}}/actions/workflows/release-pull-request.yml for errors"
silent: true
- cmd: echo "After merging, the release will be automatically created."
- defer: { task: release:info }

release:info:
internal: true
cmds:
- cmd: |
echo "TODO next:"
echo "➡️ Review and merge the pull request to publish the release in Github"
echo "➡️ Publish the release in the Prestashop Marketplace"
echo " - Go to https://addons.prestashop.com"
echo " - Log in using 1Password credentials"
echo " - Go to compte vendeur => product => module Alma => Add a zip"
echo " - Add the zip that can be downloaded from last release assets https://github.com/alma/alma-installments-prestashop/releases/latest"
echo " - Set Compatibility 1.5.3.1 to latest"
echo " - Add changelogs (one by line)"
echo " - Check the RGPD Europe compliance box (2nd one)"
echo "➡️ Merge the Backport PR to update develop branch"
silent: true
hotfix:
Expand All @@ -161,13 +182,17 @@ 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}}'
- 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"
- sleep 5
- 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 "Please, review and merge the pull request."
silent: true
- cmd: echo "After merging, the release will be automatically created."
- defer: { task: release:info }

hotfix:help:
desc: Print help regarding the hotfix process
cmds:
- cmd: |
echo -e "ℹ️ The Hotfix PR can be created using \e[3mtask hotfix CHANGELOG_MESSAGE='insert a changelog message'\e[0m command"
echo " Run it and check out https://github.com/alma/{{.REPOSITORY}}/pulls?q=is%3Aopen+is%3Apr+label%3Ahotfix"
echo " If no pull request is created, check out https://github.com/alma/{{.REPOSITORY}}/actions/workflows/hotfix-pull-request.yml for errors"
silent: true
- defer: { task: release:info }
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.2';
const VERSION = '4.1.3';

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.2';
$this->version = '4.1.3';
$this->author = 'Alma';
$this->need_instance = false;
$this->bootstrap = true;
Expand Down
11 changes: 8 additions & 3 deletions alma/lib/Factories/LinkFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,15 @@
/**
* Class CustomerFactory.
*/
class LinkFactory extends \Link
class LinkFactory
{
public function getImageLink($name, $ids, $type = null)
/**
* @var \Link
*/
protected $link;

public function create()
{
return parent::getImageLink($name, $ids, $type);
return new \Link();
}
}
14 changes: 6 additions & 8 deletions alma/lib/Services/InsuranceProductService.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
use Alma\PrestaShop\Exceptions\InsuranceContractException;
use Alma\PrestaShop\Factories\CombinationFactory;
use Alma\PrestaShop\Factories\ContextFactory;
use Alma\PrestaShop\Factories\LinkFactory;
use Alma\PrestaShop\Factories\ProductFactory;
use Alma\PrestaShop\Factories\ToolsFactory;
use Alma\PrestaShop\Helpers\ConstantsHelper;
Expand Down Expand Up @@ -111,10 +112,6 @@ class InsuranceProductService
* @var ToolsHelper
*/
protected $toolsHelper;
/**
* @var \Link
*/
protected $link;
/**
* @var ProductFactory
*/
Expand All @@ -124,9 +121,9 @@ class InsuranceProductService
*/
protected $combinationFactory;
/**
* @var mixed
* @var \Link
*/
protected $linkFactory;
protected $link;
/**
* @var ToolsFactory
*/
Expand All @@ -139,6 +136,7 @@ class InsuranceProductService
/**
* @param AlmaInsuranceProductRepository $almaInsuranceProductRepository
* @param ContextFactory $contextFactory
* @param LinkFactory $linkFactory
* @param AttributeGroupProductService $attributeGroupProductService
* @param AttributeProductService $attributeProductService
* @param CombinationProductAttributeService $combinationProductAttributeService
Expand Down Expand Up @@ -174,7 +172,7 @@ public function __construct(
) {
$this->productFactory = $productFactory;
$this->combinationFactory = $combinationFactory;
$this->linkFactory = $linkFactory;
$this->link = $linkFactory->create();
$this->almaInsuranceProductRepository = $almaInsuranceProductRepository;
$this->context = $contextFactory->getContext();
$this->attributeGroupProductService = $attributeGroupProductService;
Expand Down Expand Up @@ -411,7 +409,7 @@ public function getItemsCartInsuranceProductAttributes($product, $cartId, $insur
$resultInsurance[] = [
'idInsuranceProduct' => $almaInsuranceProduct->id,
'nameInsuranceProduct' => $almaInsuranceProduct->name[$this->context->language->id],
'urlImageInsuranceProduct' => '//' . $this->linkFactory->getImageLink(
'urlImageInsuranceProduct' => '//' . $this->link->getImageLink(
$linkRewrite,
$idImage,
$this->imageHelper->getFormattedImageTypeName('cart')
Expand Down
10 changes: 8 additions & 2 deletions alma/tests/Unit/Services/InsuranceProductServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,18 +104,24 @@ class InsuranceProductServiceTest extends TestCase
*/
protected $priceHelperMock;
/**
* @var LinkFactory|(LinkFactory&\PHPUnit_Framework_MockObject_MockObject)|\PHPUnit_Framework_MockObject_MockObject
* @var LinkFactory
*/
protected $linkFactoryMock;
/**
* @var \Link
*/
protected $linkMock;

public function setUp()
{
$this->linkMock = $this->createMock(\Link::class);
$this->toolsFactorySpy = \Mockery::spy(ToolsFactory::class);
$this->contextFactoryMock = \Mockery::mock(ContextFactory::class)->makePartial();
$this->almaInsuranceProductRepository = $this->createMock(AlmaInsuranceProductRepository::class);
$this->productFactoryMock = $this->createMock(ProductFactory::class);
$this->combinationFactoryMock = $this->createMock(CombinationFactory::class);
$this->linkFactoryMock = $this->createMock(LinkFactory::class);
$this->linkFactoryMock->method('create')->willReturn($this->linkMock);
$this->cart = $this->createMock(\Cart::class);
$this->newCart = $this->createMock(\Cart::class);
$this->context = $this->createMock(\Context::class);
Expand Down Expand Up @@ -239,7 +245,7 @@ public function testGetItemCartInsuranceProductAttributes()
$this->priceHelperMock->expects($this->exactly(2))
->method('convertPriceFromCents')
->willReturnOnConsecutiveCalls(47.899999999999999, 22.899999999999999);
$this->linkFactoryMock->expects($this->exactly(2))
$this->linkMock->expects($this->exactly(2))
->method('getImageLink')
->willReturn('url_image');
$this->almaInsuranceProductRepository->expects($this->exactly(2))
Expand Down
8 changes: 5 additions & 3 deletions alma/views/js/alma-insurance.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ function loadInsuranceMiniCart() {
if ($(e).hasClass(`cart-item-${insuranceId}`)) {
$(e).find('input').prop('disabled', true)
// Remove change number of input when you wheel (scroll) inside the input
e.querySelector('input').addEventListener('wheel', function (e) {
document.activeElement.blur();
});
if ($(e).find('input').length > 0) {
e.querySelector('input').addEventListener('wheel', function (e) {
document.activeElement.blur();
});
}
$(e).find('.pscartdropdown-product-line-grid-right .input-group-btn-vertical').remove()
$(e).find('a.label').removeAttr('href')
// TODO : Need to edit the url of delete product for remove an insurance product
Expand Down
2 changes: 1 addition & 1 deletion alma/views/js/alma-product-insurance.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ function addModalListenerToAddToCart() {
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.removeEventListener("click", insuranceListener);
addToCart.addEventListener("click", insuranceListener);
}
}
Expand Down

0 comments on commit 131b6e0

Please sign in to comment.