Skip to content

Commit a2adb71

Browse files
committed
Merge branch 'main' into split_ci_into_steps
2 parents ff9a936 + fb2a6fe commit a2adb71

20 files changed

Lines changed: 453 additions & 277 deletions

File tree

.github/actions/build/action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ runs:
6262
e2e_js: ${{ inputs.e2e_js }}
6363
node_version: "20.x"
6464
env:
65-
DATABASE_URL: "mysql://root:root@127.0.0.1:3306/sylius?serverVersion=${{ matrix.mysql }}"
65+
DATABASE_URL: "mysql://root:root@127.0.0.1:3306/sylius?serverVersion=${{ inputs.mysql }}"
6666

6767
- name: "Save Docker image to cache"
6868
run: |

.github/workflows/ci.yaml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
sylius: ${{ matrix.sylius }}
5050
symfony: ${{ matrix.symfony }}
5151
check_service_definitions: yes
52-
52+
5353
static-analysis:
5454
name: Static analysis - PHP ${{ matrix.php || '' }}
5555
needs: [ get-matrix, build ]
@@ -71,7 +71,7 @@ jobs:
7171

7272
- name: ECS
7373
run: vendor/bin/ecs check
74-
74+
7575
unit-tests:
7676
name: Unit tests - PHP ${{ matrix.php || '' }}
7777
needs: [ get-matrix, build ]
@@ -94,7 +94,7 @@ jobs:
9494
if: always()
9595
with:
9696
subject: Unit tests - PHP ${{ matrix.php || '' }}
97-
97+
9898
e2e-tests:
9999
name: E2E tests - PHP ${{ matrix.php || '' }}
100100
needs: [ get-matrix, build ]
@@ -124,16 +124,15 @@ jobs:
124124
e2e: yes
125125
e2e_js: yes
126126

127-
- name: Install browser drivers
128-
run: vendor/bin/bdi detect drivers
129-
130-
- run: vendor/bin/phpunit --testsuite e2e --exclude-group requires-fixes --testdox
127+
- run: vendor/bin/phpunit --testsuite e2e --exclude-group requires-fixes --debug
128+
timeout-minutes: 10
129+
continue-on-error: true
131130

132131
- uses: ./.github/actions/upload-logs
133132
if: always()
134133
with:
135134
subject: E2E tests - PHP ${{ matrix.php || '' }}
136-
135+
137136
api-tests:
138137
name: API tests - PHP ${{ matrix.php || '' }}
139138
needs: [ get-matrix, build ]

assets/shop/js/retry_payment.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ function showPaymentDetails(paymentCode) {
1212
.forEach(function(element) {
1313
element.disabled = false;
1414
});
15+
16+
const checkoutButton = document.querySelector('form[name="sylius_checkout_select_payment"] button[type="submit"]');
17+
if (checkoutButton) {
18+
const hiddenFor = ['tpay_apple_pay', 'tpay_google_pay'];
19+
checkoutButton.hidden = hiddenFor.includes(paymentCode);
20+
}
1521
}
1622

1723
function resetPaymentDetails() {

assets/shop/order_show_entrypoint.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import './scss/style.scss';
22
import './scss/pay_by_link.scss';
3+
import './js/apple_pay';
34
import './js/blik_code';
45
import './js/retry_payment';
56
import './js/visa_mobile';

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@
4747
"phpstan/phpstan-symfony": "^2.0",
4848
"phpstan/phpstan-webmozart-assert": "^2.0",
4949
"phpunit/phpunit": "^9.5",
50-
"psr/cache": "^3.0",
5150
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
51+
"psr/cache": "^3.0",
5252
"shipmonk/composer-dependency-analyser": "^1.7",
53+
"slevomat/coding-standard": "< 8.23.0",
5354
"sylius-labs/coding-standard": "^4.2",
5455
"sylius/refund-plugin": "^2.0",
5556
"sylius/sylius": "^2.0",

config/services_test.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
66

77
use CommerceWeavers\SyliusTpayPlugin\Test\Payum\Cypher\FakeCypher;
8+
use Tests\CommerceWeavers\SyliusTpayPlugin\Helper\AlwaysValidChecksumVerifier;
9+
use Tests\CommerceWeavers\SyliusTpayPlugin\Helper\AlwaysValidSignatureVerifier;
810

911
return function(ContainerConfigurator $container): void {
1012
$services = $container->services();
@@ -14,4 +16,14 @@
1416
env('PAYUM_CYPHER_KEY'),
1517
])
1618
;
19+
20+
$services->set('commerce_weavers_sylius_tpay.tests.always_valid_signature_verifier', AlwaysValidSignatureVerifier::class);
21+
22+
$services->set('commerce_weavers_sylius_tpay.tests.always_valid_checksum_verifier', AlwaysValidChecksumVerifier::class);
23+
24+
$services->set('commerce_weavers_sylius_tpay.tpay.security.notification.verifier.signature')
25+
->alias('commerce_weavers_sylius_tpay.tpay.security.notification.verifier.signature', 'commerce_weavers_sylius_tpay.tests.always_valid_signature_verifier');
26+
27+
$services->set('commerce_weavers_sylius_tpay.tpay.security.notification.verifier.checksum')
28+
->alias('commerce_weavers_sylius_tpay.tpay.security.notification.verifier.checksum', 'commerce_weavers_sylius_tpay.tests.always_valid_checksum_verifier');
1729
};

config/twig_hooks/shop/checkout/select_payment.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@
1313
'priority' => 150,
1414
],
1515
],
16+
'sylius_shop.order.show.content.form.select_payment.payment' => [
17+
'apple_pay' => [
18+
'template' => '@CommerceWeaversSyliusTpayPlugin/shop/order/pay/apple_pay.html.twig',
19+
'priority' => -300,
20+
],
21+
'google_pay' => [
22+
'template' => '@CommerceWeaversSyliusTpayPlugin/shop/order/pay/google_pay.html.twig',
23+
'priority' => -300,
24+
],
25+
],
1626
'sylius_shop.shared.form.select_payment.payment.choice.details' => [
1727
'payment_image' => [
1828
'template' => '@CommerceWeaversSyliusTpayPlugin/shop/checkout/select_payment/payment/choice/details/image.html.twig',

public/shop/scripts/order-show.js

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Model/OrderLastNewPaymentAwareTrait.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,9 @@ public function getLastCartPayment(): ?PaymentInterface
1212
{
1313
return $this->getLastPayment('cart');
1414
}
15+
16+
public function getLastNewPayment(): ?PaymentInterface
17+
{
18+
return $this->getLastPayment('new');
19+
}
1520
}

templates/shop/cart/complete/apple_pay.html.twig

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,7 @@
33

44
{% if payment is not null and payment.method.gatewayConfig.factoryName == 'tpay_apple_pay' %}
55
{% set form = get_hookable_context().form %}
6+
{% set gatewayConfig = payment.method.gatewayConfig %}
67

7-
<input type="hidden" data-apple-pay-amount value="{{ order.total|cw_tpay_convert_minor_to_major_currency }}">
8-
<input type="hidden" data-apple-pay-merchant-identifier value="{{ cw_tpay_get_gateway_config_value(payment.method.gatewayConfig, 'apple_pay_merchant_id') }}">
9-
<input type="hidden" data-apple-pay-currency value="{{ order.currencyCode }}">
10-
<input type="hidden" data-apple-pay-channel-name value="{{ order.channel.name }}" />
11-
12-
<apple-pay-button data-apple-pay-button buttonstyle="black" type="plain" locale="{{ order.localeCode|replace({'_': '-'}) }}"></apple-pay-button>
13-
{{ form_row(form.tpay.apple_pay_token, { attr: { 'data-apple-pay-token-input': '' } }) }}
14-
15-
<script crossorigin src="https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js"></script>
8+
{% include '@CommerceWeaversSyliusTpayPlugin/shop/partial/apple_pay_button.html.twig' with { order, form, gatewayConfig } %}
169
{% endif %}

0 commit comments

Comments
 (0)