Skip to content

Commit 4d44bd3

Browse files
Merge pull request #124 from Adyen/develop
Release 1.3.0
2 parents 571f21b + b0b8d09 commit 4d44bd3

34 files changed

+1330
-1093
lines changed

.github/docker-compose.e2e.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: '3'
22
services:
33
playwright:
4-
image: mcr.microsoft.com/playwright:v1.50.1
4+
image: mcr.microsoft.com/playwright:v1.54.0
55
shm_size: 1gb
66
ipc: host
77
cap_add:

.github/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ services:
5050
MARIADB_USER: magento
5151
MARIADB_PASSWORD: magento
5252
elastic:
53-
image: elasticsearch:7.17.13
53+
image: elasticsearch:7.17.28
5454
container_name: elasticsearch
5555
networks:
5656
- backend

.github/workflows/e2e-test.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@ jobs:
1010
group: larger-runners
1111
labels: ubuntu-latest-8-cores
1212
timeout-minutes: 25
13+
permissions:
14+
contents: read
15+
attestations: write
1316
env:
1417
PHP_VERSION: "8.1"
15-
MAGENTO_VERSION: "2.4.5"
18+
MAGENTO_VERSION: "2.4.5-p12"
1619
ADYEN_API_KEY: ${{secrets.ADYEN_API_KEY}}
1720
ADYEN_CLIENT_KEY: ${{secrets.ADYEN_CLIENT_KEY}}
1821
ADYEN_MERCHANT: ${{secrets.ADYEN_MERCHANT}}

.github/workflows/main.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: Main CI workflow
22

33
on:
4+
push:
5+
branches: [main,develop]
46
pull_request:
57
pull_request_target:
68
workflow_dispatch:
@@ -10,6 +12,9 @@ jobs:
1012
if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository) || (github.event_name == 'workflow_dispatch')
1113
environment: ${{ (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository) && 'external' || 'internal' }}
1214
runs-on: ubuntu-latest
15+
timeout-minutes: 10
16+
permissions:
17+
contents: read
1318

1419
strategy:
1520
matrix:
@@ -66,9 +71,9 @@ jobs:
6671
- name: Fix code coverage paths
6772
run: sed -i "s;`pwd`/;;g" build/*.xml
6873

69-
- name: SonarCloud Scan
74+
- name: SonarQube Scan
7075
if: ${{ env.SONAR_TOKEN }}
71-
uses: SonarSource/sonarcloud-github-action@master
76+
uses: SonarSource/sonarqube-scan-action@v5
7277
env:
7378
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7479
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

Magewire/Payment/MethodList.php

Lines changed: 7 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,13 @@
44

55
namespace Adyen\Hyva\Magewire\Payment;
66

7-
use Hyva\Checkout\Model\Magewire\Component\EvaluationInterface;
8-
use Hyva\Checkout\Model\Magewire\Component\EvaluationResultFactory;
9-
use Hyva\Checkout\Model\Magewire\Component\EvaluationResultInterface;
10-
use Magento\Checkout\Model\Session as SessionCheckout;
11-
use Magento\Framework\Exception\LocalizedException;
12-
use Magento\Quote\Api\CartRepositoryInterface;
13-
use Magewirephp\Magewire\Component;
7+
use Hyva\Checkout\Magewire\Checkout\Payment\MethodList as HyvaMethodList;
148

159
/**
1610
* Substitute for \Hyva\Checkout\Magewire\Checkout\Payment\MethodList
1711
*/
18-
class MethodList extends Component implements EvaluationInterface
12+
class MethodList extends HyvaMethodList
1913
{
20-
public ?string $method = null;
21-
2214
protected $listeners = [
2315
'billing_address_saved' => 'refresh',
2416
'shipping_address_saved' => 'refresh',
@@ -30,56 +22,20 @@ class MethodList extends Component implements EvaluationInterface
3022
'shipping_address_activated' => 'refresh',
3123
];
3224

33-
protected $loader = [
34-
'method' => 'Saving method'
35-
];
36-
37-
public function __construct(
38-
protected readonly SessionCheckout $sessionCheckout,
39-
protected readonly CartRepositoryInterface $cartRepository,
40-
protected readonly EvaluationResultFactory $evaluationResultFactory
41-
) {
42-
}
43-
4425
public function boot(): void
4526
{
46-
try {
47-
$method = $this->sessionCheckout->getQuote()->getPayment()->getMethod();
48-
} catch (LocalizedException $exception) {
49-
$method = null;
50-
}
27+
parent::boot();
5128

52-
$this->method = $method;
53-
//This custom event notifies that the method list has rebooted
54-
$this->dispatchBrowserEvent('checkout:payment:method-list-boot', ['method' => $method]);
29+
// This custom event notifies that the method list has rebooted
30+
$this->dispatchBrowserEvent('checkout:payment:method-list-boot', ['method' => $this->method]);
5531
}
5632

5733
public function updatedMethod(string $value): string
5834
{
59-
try {
60-
$quote = $this->sessionCheckout->getQuote();
61-
$quote->getPayment()->setMethod($value);
62-
63-
$this->cartRepository->save($quote);
64-
65-
$this->dispatchBrowserEvent('checkout:payment:method-activate', ['method' => $value]);
66-
$this->emit('payment_method_selected');
67-
} catch (LocalizedException $exception) {
68-
$this->dispatchErrorMessage('Something went wrong while saving your payment preferences.');
69-
}
35+
$value = parent::updatedMethod($value);
7036

37+
$this->dispatchBrowserEvent('checkout:payment:method-activate', ['method' => $value]);
7138
return $value;
7239
}
73-
74-
public function evaluateCompletion(EvaluationResultFactory $resultFactory): EvaluationResultInterface
75-
{
76-
if ($this->method === null) {
77-
return $resultFactory->createErrorMessageEvent()
78-
->withCustomEvent('payment:method:error')
79-
->withMessage('The payment method is missing. Select the payment method and try again.');
80-
}
81-
82-
return $resultFactory->createSuccess([], 'payment:method:success');
83-
}
8440
}
8541

composer.json

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,38 @@
11
{
2-
"name": "adyen/module-hyva-checkout",
3-
"description": "Adyen Integration with Hyva Checkout",
4-
"type": "magento2-module",
5-
"version": "1.2.3",
6-
"license": "MIT",
7-
"require": {
8-
"adyen/module-payment": "^9.13.0",
9-
"hyva-themes/magento2-default-theme": "^1.3",
10-
"hyva-themes/magento2-hyva-checkout": "^1.1"
11-
},
12-
"require-dev": {
13-
"phpunit/phpunit": "~9.6.1",
14-
"magento/magento-coding-standard": "*",
15-
"squizlabs/php_codesniffer": "~3.8.0"
16-
},
17-
"autoload": {
18-
"files": [
19-
"registration.php"
20-
],
21-
"psr-4": {
22-
"Adyen\\Hyva\\": ""
23-
}
24-
},
25-
"repositories": [
26-
{
27-
"type": "composer",
28-
"url": "https://repo.magento.com/"
29-
}
2+
"name": "adyen/module-hyva-checkout",
3+
"description": "Adyen Integration with Hyva Checkout",
4+
"type": "magento2-module",
5+
"version": "1.3.0",
6+
"license": "MIT",
7+
"require": {
8+
"adyen/module-payment": "^9.13.0",
9+
"hyva-themes/magento2-default-theme": "^1.3",
10+
"hyva-themes/magento2-hyva-checkout": "^1.3",
11+
"hyva-themes/magento2-theme-module": "^1.3.11"
12+
},
13+
"require-dev": {
14+
"phpunit/phpunit": "~9.6.1",
15+
"magento/magento-coding-standard": "*",
16+
"squizlabs/php_codesniffer": "~3.13.0"
17+
},
18+
"autoload": {
19+
"files": [
20+
"registration.php"
3021
],
31-
"config": {
32-
"allow-plugins": {
33-
"magento/composer-dependency-version-audit-plugin": true,
34-
"dealerdirect/phpcodesniffer-composer-installer": true
35-
}
22+
"psr-4": {
23+
"Adyen\\Hyva\\": ""
3624
}
25+
},
26+
"repositories": [
27+
{
28+
"type": "composer",
29+
"url": "https://repo.magento.com/"
30+
}
31+
],
32+
"config": {
33+
"allow-plugins": {
34+
"magento/composer-dependency-version-audit-plugin": true,
35+
"dealerdirect/phpcodesniffer-composer-installer": true
36+
}
37+
}
3738
}

renovate.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"config:base",
55
":disableDependencyDashboard"
66
],
7-
"minimumReleaseAge": "30 days",
7+
"minimumReleaseAge": "21 days",
88
"labels": ["dependencies"],
99
"prConcurrentLimit": 5,
1010
"baseBranches": ["develop"],
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Hyvä Themes - https://hyva.io
5+
* Copyright © Hyvä Themes 2022-present. All rights reserved.
6+
* This product is licensed per Magento install
7+
* See https://hyva.io/license
8+
*/
9+
-->
10+
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
11+
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"
12+
>
13+
<body>
14+
<referenceContainer name="magewire.plugin.scripts">
15+
<block name="payment.method-renderer.adyen-affirm-method"
16+
template="Adyen_Hyva::payment/method-renderer/adyen-affirm-method-csp-js.phtml"
17+
/>
18+
<block name="payment.method-renderer.adyen-amazonpay-method"
19+
template="Adyen_Hyva::payment/method-renderer/adyen-amazonpay-method-csp-js.phtml"
20+
/>
21+
<block name="payment.method-renderer.adyen-applepay-method"
22+
template="Adyen_Hyva::payment/method-renderer/adyen-applepay-method-csp-js.phtml"
23+
/>
24+
<block name="payment.method-renderer.adyen-cashapp-method"
25+
template="Adyen_Hyva::payment/method-renderer/adyen-cashapp-method-csp-js.phtml"
26+
/>
27+
<block name="payment.method-renderer.adyen-cc-method"
28+
template="Adyen_Hyva::payment/method-renderer/adyen-cc-method-csp-js.phtml"
29+
/>
30+
<block name="payment.method-renderer.adyen-cc-vault-method"
31+
template="Adyen_Hyva::payment/method-renderer/adyen-cc-vault-method-csp-js.phtml"
32+
/>
33+
<block name="payment.method-renderer.adyen-default-method"
34+
template="Adyen_Hyva::payment/method-renderer/adyen-default-method-csp-js.phtml"
35+
/>
36+
<block name="payment.method-renderer.adyen-facilypay-3x-method"
37+
template="Adyen_Hyva::payment/method-renderer/adyen-facilypay-3x-method-csp-js.phtml"
38+
/>
39+
<block name="payment.method-renderer.adyen-facilypay-method"
40+
template="Adyen_Hyva::payment/method-renderer/adyen-facilypay-method-csp-js.phtml"
41+
/>
42+
<block name="payment.method-renderer.adyen-googlepay-method"
43+
template="Adyen_Hyva::payment/method-renderer/adyen-googlepay-method-csp-js.phtml"
44+
/>
45+
<block name="payment.method-renderer.adyen-paypal-method"
46+
template="Adyen_Hyva::payment/method-renderer/adyen-paypal-method-csp-js.phtml"
47+
/>
48+
</referenceContainer>
49+
</body>
50+
</page>

view/frontend/templates/checkout/payment/method-list.phtml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,9 @@ $methods = $viewModel->getList();
2121
?>
2222
<div id="payment-methods">
2323
<?php if ($methods): ?>
24-
<script>
25-
window.addEventListener('checkout:step:loaded', () => {
26-
if('<?= $escaper->escapeJs($magewire->method) ?>' && document.getElementById('payment-method-list')) {
27-
window.dispatchEvent(new CustomEvent('checkout:payment:method-activate', { detail: { method: '<?= $escaper->escapeJs($magewire->method) ?>'} }))
28-
}
29-
}, { once: true })
30-
</script>
31-
32-
<ol id="payment-method-list" class="space-y-4">
24+
<ol id="payment-method-list"
25+
class="space-y-4"
26+
>
3327
<?= $block->getChildHtml('adyen_vault_stored_cards');?>
3428
<?php foreach ($methods as $method): ?>
3529
<?php $methodCodeAttr = $method->getCode() ?>

view/frontend/templates/checkout/success.phtml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
<?php
22

3+
34
/** @var MagewireSuccess $magewire */
45
/** @var Escaper $escaper */
56
/** @var Success $block */
7+
/** @var HyvaCsp $hyvaCsp */
68

79
use Adyen\Payment\Block\Checkout\Success;
8-
use \Adyen\Hyva\Magewire\Checkout\Success as MagewireSuccess;
10+
use Adyen\Hyva\Magewire\Checkout\Success as MagewireSuccess;
11+
use Hyva\Theme\ViewModel\HyvaCsp;
912
use Magento\Framework\Escaper;
1013

1114
?>
@@ -28,16 +31,16 @@ use Magento\Framework\Escaper;
2831
.then(() => {
2932
handleSuccess(wire,component);
3033
}).catch(() => {
31-
component.setStatus('error');
32-
});
34+
component.setStatus('error');
35+
});
3336
} else {
3437
const orderId = <?= $escaper->escapeJs($block->getOrder()->getId()) ?>;
3538
wire.donate(orderId, payload)
3639
.then(() => {
3740
handleSuccess(wire,component);
3841
}).catch(() => {
39-
component.setStatus('error');
40-
});
42+
component.setStatus('error');
43+
});
4144
}
4245
} else {
4346
component.setStatus('ready');
@@ -85,5 +88,6 @@ use Magento\Framework\Escaper;
8588
}
8689
})();
8790
</script>
91+
<?php $hyvaCsp->registerInlineScript() ?>
8892
<?php endif; ?>
8993
</div>

0 commit comments

Comments
 (0)