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

Sylius 2.0 #69

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 1 addition & 2 deletions .gitattibutes
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/features export-ignore
/spec export-ignore
/ecs.php export-ignore
/behat.yml.dist export-ignore
/phpspec.yml.dist export-ignore
Expand All @@ -8,4 +7,4 @@
/psalm.xml export-ignore
/tests export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.gitignore export-ignore
39 changes: 5 additions & 34 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,8 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ "7.4", "8.1" ]
symfony: [ "^5.4", "^6.4" ]
exclude:
-
php: "7.4"
symfony: "^6.4"
php: [ "8.2" ]
symfony: [ "^6.4", "^7.2" ]

steps:
-
Expand Down Expand Up @@ -99,11 +95,6 @@ jobs:
name: Run PHPStan
run: vendor/bin/phpstan analyse
if: always() && steps.end-of-setup.outcome == 'success'

-
name: Run PHPSpec
run: vendor/bin/phpspec run --ansi -f progress --no-interaction
if: always() && steps.end-of-setup.outcome == 'success'
tests:
runs-on: ubuntu-latest

Expand All @@ -112,26 +103,12 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ["8.0", "8.1", "8.2", "8.3"]
symfony: ["^5.4", "^6.4"]
sylius: ["~1.12.0", "~1.13.0"]
php: ["8.2", "8.3", "8.4"]
symfony: ["^6.4", "7.2"]
sylius: ["~2.0.0"]
node: ["20.x"]
mysql: ["8.0"]

exclude:
-
sylius: "~1.12.0"
php: "7.4"
-
sylius: "~1.13.0"
php: "7.4"
-
sylius: "~1.13.0"
php: "8.0"
-
php: "8.0"
symfony: "^6.4"

env:
APP_ENV: test
DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?serverVersion=${{ matrix.mysql }}"
Expand Down Expand Up @@ -197,12 +174,6 @@ jobs:
if: matrix.sylius != ''
run: composer require "sylius/sylius:${{ matrix.sylius }}" --no-update --no-scripts --no-interaction

-
name: Fix build with PHP 8.3
if: matrix.php == '8.3'
run: |
composer remove --dev "phpspec/phpspec" --no-update --no-scripts --no-interaction

-
name: Fix build with Symfony ^5.4
if: matrix.symfony == '^5.4'
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ drivers
/.phpunit.result.cache
/phpunit.xml
/phpstan.neon
/phpspec.yml
/behat.yml

# Symfony CLI https://symfony.com/doc/current/setup/symfony_server.html#different-php-settings-per-project
Expand Down
50 changes: 26 additions & 24 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,46 +11,49 @@
}
],
"require": {
"flux-se/payum-stripe-bundle": "^2.0",
"sylius/sylius": "^1.9"
"flux-se/payum-stripe-bundle": "^3.0",
"sylius/sylius": "^2.0"
},
"require-dev": {
"ext-json": "*",
"behat/behat": "^3.7",
"dbrekelmans/bdi": "^1.2",
"dbrekelmans/bdi": "^1.4",
"friends-of-behat/mink": "^1.9",
"friends-of-behat/mink-browserkit-driver": "^1.4",
"friends-of-behat/mink-debug-extension": "^2.0",
"friends-of-behat/mink-extension": "^2.5",
"friends-of-behat/page-object-extension": "^0.3",
"friends-of-behat/suite-settings-extension": "^1.1",
"friends-of-behat/symfony-extension": "^2.1",
"friends-of-behat/symfony-extension": "^2.0",
"friends-of-behat/variadic-extension": "^1.3",
"phpspec/phpspec": "^7.2",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan-doctrine": "^1.0",
"phpstan/phpstan-strict-rules": "^1.0",
"phpstan/phpstan-webmozart-assert": "^1.0",
"phpunit/phpunit": "^9.5",
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
"nyholm/psr7": "^1.4",
"phpstan/extension-installer": "^1.4",
"phpstan/phpstan": "^2.1",
"phpstan/phpstan-doctrine": "^2.0",
"phpstan/phpstan-symfony": "^2.0",
"phpstan/phpstan-webmozart-assert": "^2.0",
"spaze/phpstan-stripe": "^3.2",
"phpunit/phpunit": "^10",
"robertfausk/behat-panther-extension": "^1.1",
"sylius-labs/coding-standard": "^4.1",
"sylius-labs/suite-tags-extension": "^0.2.0",
"symfony/browser-kit": "^5.4|^6.4",
"symfony/debug-bundle": "^5.4|^6.4",
"symfony/dotenv": "^5.4|^6.4",
"symfony/http-client": "^5.4|^6.4",
"symfony/intl": "^5.4|^6.4",
"symfony/runtime": "^5.4|^6.4",
"symfony/web-profiler-bundle": "^5.4|^6.4",
"symfony/webpack-encore-bundle": "^1|^2"
"symfony/browser-kit": "^6.4|^7.2",
"symfony/debug-bundle": "^6.4|^7.2",
"symfony/dotenv": "^6.4|^7.2",
"symfony/http-client": "^6.4|^7.2",
"symfony/intl": "^6.4|^7.2",
"symfony/runtime": "^6.4|^7.2",
"symfony/web-profiler-bundle": "^6.4|^7.2",
"symfony/webpack-encore-bundle": "^2",
"rector/rector": "^2.0",
"mockery/mockery": "^1.6",
"phpstan/phpstan-mockery": "^2.0"
},
"autoload": {
"psr-4": { "FluxSE\\SyliusPayumStripePlugin\\": "src/" }
},
"autoload-dev": {
"psr-4": {
"spec\\FluxSE\\SyliusPayumStripePlugin\\": "spec/",
"Tests\\FluxSE\\SyliusPayumStripePlugin\\": "tests/",
"Tests\\FluxSE\\SyliusPayumStripePlugin\\App\\": "tests/Application/src/"
}
Expand All @@ -68,16 +71,15 @@
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": false,
"phpstan/extension-installer": false,
"symfony/flex": false,
"dealerdirect/phpcodesniffer-composer-installer": true,
"phpstan/extension-installer": true,
"symfony/thanks": true,
"symfony/runtime": true
}
},
"extra": {
"branch-alias": {
"dev-master": "2.0-dev"
"dev-master": "3.0-dev"
},
"runtime": {
"project_dir": "tests/Application",
Expand Down
2 changes: 2 additions & 0 deletions config/app/twig_hooks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
imports:
- { resource: 'twig_hooks/**/*.yaml' }
40 changes: 40 additions & 0 deletions config/app/twig_hooks/admin/payment_method/admin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
sylius_twig_hooks:
hooks:
'sylius_admin.payment_method.create.content': &component
form:
props:
factoryName: '@=_context.resource.getGatewayConfig().getFactoryName()'
'sylius_admin.payment_method.update.content': *component

'sylius_admin.payment_method.create.content.form.sections.gateway_configuration.stripe_checkout_session': &form
form:
template: '@FluxSESyliusPayumStripePlugin/admin/payment_method/form.html.twig'
priority: 0
'sylius_admin.payment_method.create.content.form.sections.gateway_configuration.stripe_js': *form
'sylius_admin.payment_method.update.content.form.sections.gateway_configuration.stripe_checkout_session': *form
'sylius_admin.payment_method.update.content.form.sections.gateway_configuration.stripe_js': *form

'sylius_admin.payment_method.create.content.form.sections.gateway_configuration.stripe_checkout_session.form': &form_inner
publishable_key:
template: '@FluxSESyliusPayumStripePlugin/admin/payment_method/form/publishable_key.html.twig'
priority: 400
secret_key:
template: '@FluxSESyliusPayumStripePlugin/admin/payment_method/form/secret_key.html.twig'
priority: 300
use_authorize:
template: '@FluxSESyliusPayumStripePlugin/admin/payment_method/form/use_authorize.html.twig'
priority: 200
webhook_secret_keys:
template: '@FluxSESyliusPayumStripePlugin/admin/payment_method/form/webhook_secret_keys.html.twig'
priority: 100
'sylius_admin.payment_method.create.content.form.sections.gateway_configuration.stripe_js.form': *form_inner
'sylius_admin.payment_method.update.content.form.sections.gateway_configuration.stripe_checkout_session.form': *form_inner
'sylius_admin.payment_method.update.content.form.sections.gateway_configuration.stripe_js.form': *form_inner

'sylius_admin.payment_method.create.content.form.sections.gateway_configuration.stripe_checkout_session.form.webhook_secret_keys': &webhook_secret_keys
webhook_secret_key:
template: '@FluxSESyliusPayumStripePlugin/admin/payment_method/form/webhook_secret_keys/webhook_secret_key.html.twig'
priority: 0
'sylius_admin.payment_method.create.content.form.sections.gateway_configuration.stripe_js.form.webhook_secret_keys': *webhook_secret_keys
'sylius_admin.payment_method.update.content.form.sections.gateway_configuration.stripe_checkout_session.form.webhook_secret_keys': *webhook_secret_keys
'sylius_admin.payment_method.update.content.form.sections.gateway_configuration.stripe_js.form.webhook_secret_keys': *webhook_secret_keys
4 changes: 4 additions & 0 deletions config/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
imports:
- { resource: 'app/twig_hooks.yaml' }


File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
services:

flux_se.sylius_payum_stripe.abstraction.state_machine.winzou:
class: FluxSE\SyliusPayumStripePlugin\Abstraction\StateMachine\WinzouStateMachine
arguments:
$factory: '@sm.factory'

flux_se.sylius_payum_stripe.abstraction.state_machine.composite:
alias: flux_se.sylius_payum_stripe.abstraction.state_machine.winzou

flux_se.sylius_payum_stripe.extension.update_payment_state:
public: true
class: FluxSE\SyliusPayumStripePlugin\Extension\UpdatePaymentStateExtension
arguments:
$stateMachine: '@flux_se.sylius_payum_stripe.abstraction.state_machine.composite'
$stateMachine: '@sylius_abstraction.state_machine'
# Alias of "@payum.storage.sylius_component_core_model_payment"
# or "@payum.storage.app_entity_payment_payment" or any other available
# Payum storage handling Payment entity
$storage: '@payum.storage.flux_se_sylius_payment'
$getStatusRequestFactory: '@sylius.factory.payum_get_status_action'
$getStatusRequestFactory: '@sylius_payum.factory.get_status'
tags:
- name: payum.extension
factory: stripe_checkout_session
Expand Down
19 changes: 7 additions & 12 deletions ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,14 @@

declare(strict_types=1);

use PhpCsFixer\Fixer\ControlStructure\TrailingCommaInMultilineFixer;
use Symplify\EasyCodingStandard\Config\ECSConfig;

return static function (ECSConfig $config): void {
$config->import(__DIR__ . '/vendor/sylius-labs/coding-standard/ecs.php');

$config->paths([
return ECSConfig::configure()
->withSets([
'vendor/sylius-labs/coding-standard/ecs.php',
])
->withPaths([
'src',
'tests/Behat',
'spec',
'ecs.php',
]);

// PHP 7 compatibility
$config->ruleWithConfiguration(TrailingCommaInMultilineFixer::class, ['elements' => ['arrays']]);
};
])
;
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ Feature: Adding a new Stripe Checkout Session payment method

@ui @javascript
Scenario: Adding a new stripe payment method using authorize
Given I want to create a new Stripe Checkout Session payment method
Given I want to create a new payment method with "Stripe Checkout Session" gateway factory
When I name it "Stripe Checkout Session" in "English (United States)"
And I specify its code as "stripe_sca_test"
And I configure it with test stripe gateway data "TEST", "TEST"
And I configure it with test stripe gateway data "TEST" and "TEST"
And I add a webhook secret key "TEST"
And I use authorize
And I add it
Expand All @@ -23,13 +23,13 @@ Feature: Adding a new Stripe Checkout Session payment method

@ui @javascript
Scenario: Adding a new stripe payment method not using authorize
Given I want to create a new Stripe Checkout Session payment method
Given I want to create a new payment method with "Stripe Checkout Session" gateway factory
When I name it "Stripe Checkout Session" in "English (United States)"
And I specify its code as "stripe_sca_test"
And I configure it with test stripe gateway data "TEST", "TEST"
And I configure it with test stripe gateway data "TEST" and "TEST"
And I add a webhook secret key "TEST"
And I don't use authorize
And I add it
Then I should be notified that it has been successfully created
And I shouldn't see a warning message under the use authorize field
And I should not see a warning message under the use authorize field
And the payment method "Stripe Checkout Session" should appear in the registry
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ Feature: Refunding an order with Stripe Checkout Session
When I mark this order's payment as refunded
Then I should be notified that the order's payment has been successfully refunded
And it should have payment with state refunded
And it's payment state should be refunded
And it should have payment state "Refunded"
10 changes: 5 additions & 5 deletions features/admin/stripe_js/managing_payment_method.feature
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ Feature: Adding a new Stripe JS payment method

@ui @javascript
Scenario: Adding a new stripe payment method using authorize
Given I want to create a new Stripe JS payment method
Given I want to create a new payment method with "Stripe JS" gateway factory
When I name it "Stripe JS" in "English (United States)"
And I specify its code as "stripe_sca_test"
And I configure it with test stripe gateway data "TEST", "TEST"
And I configure it with test stripe gateway data "TEST" and "TEST"
And I add a webhook secret key "TEST"
And I use authorize
And I add it
Expand All @@ -23,13 +23,13 @@ Feature: Adding a new Stripe JS payment method

@ui @javascript
Scenario: Adding a new stripe payment method not using authorize
Given I want to create a new Stripe JS payment method
Given I want to create a new payment method with "Stripe JS" gateway factory
When I name it "Stripe JS" in "English (United States)"
And I specify its code as "stripe_sca_test"
And I configure it with test stripe gateway data "TEST", "TEST"
And I configure it with test stripe gateway data "TEST" and "TEST"
And I add a webhook secret key "TEST"
And I don't use authorize
And I add it
Then I should be notified that it has been successfully created
And I shouldn't see a warning message under the use authorize field
And I should not see a warning message under the use authorize field
And the payment method "Stripe JS" should appear in the registry
2 changes: 1 addition & 1 deletion features/admin/stripe_js/refunding_order.feature
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ Feature: Refunding an order with Stripe JS
When I mark this order's payment as refunded
Then I should be notified that the order's payment has been successfully refunded
And it should have payment with state refunded
And it's payment state should be refunded
And it should have payment state "Refunded"
29 changes: 8 additions & 21 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,14 @@ parameters:

paths:
- src
- tests

excludePaths:
# Makes PHPStan crash
- 'src/DependencyInjection/Configuration.php'

- tests/Application/Kernel.php
- tests/Application/public/index.php
- tests/Application/config/**.php
- tests/Application/var/**.php
- tests/Application/node_modules/**.php
- tests/Behat
- tests/Unit

ignoreErrors:
- identifier: missingType.iterableValue
- identifier: return.unusedType
- identifier: missingType.generics
- '/Parameter #1 \$configuration of method Symfony\\Component\\DependencyInjection\\Extension\\Extension::processConfiguration\(\) expects Symfony\\Component\\Config\\Definition\\ConfigurationInterface, Symfony\\Component\\Config\\Definition\\ConfigurationInterface\|null given\./'
- '/Parameter #1 \$request \(Payum\\Core\\Request\\Convert\) of method FluxSE\\SyliusPayumStripePlugin\\Action\\ConvertPaymentAction::execute\(\) should be contravariant with parameter \$request \(mixed\) of method Payum\\Core\\Action\\ActionInterface::execute\(\)/'
- '/Parameter #1 \$request \(Payum\\Core\\Request\\Convert\) of method FluxSE\\SyliusPayumStripePlugin\\Action\\StripeJs\\ConvertPaymentAction::execute\(\) should be contravariant with parameter \$request \(mixed\) of method Payum\\Core\\Action\\ActionInterface::execute\(\)/'

- message: '/Call to an undefined method Mockery\\ExpectationInterface\|Mockery\\HigherOrderMessage::(once|andReturnUsing)\(\)\./'
paths:
- tests/Behat/Mocker/Api/CheckoutSessionMocker.php
- tests/Behat/Mocker/Api/PaymentIntentMocker.php
- tests/Behat/Mocker/Api/RefundMocker.php
path: src/Form/Type/StripeGatewayConfigurationType.php
- identifier: argument.type
path: tests/Behat/Mocker/PayumActionMocker.php
- identifier: staticMethod.unresolvableReturnType
path: tests/Behat/Mocker/PayumActionMocker.php
Loading
Loading