mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 09:02:12 +00:00
Merge branch 'payment-request' into upmerge/2.0_payment-request
This commit is contained in:
commit
54238fa3d4
332 changed files with 8377 additions and 681 deletions
2
.env
2
.env
|
|
@ -36,6 +36,8 @@ SYLIUS_MESSENGER_TRANSPORT_MAIN_DSN=doctrine://default
|
||||||
SYLIUS_MESSENGER_TRANSPORT_MAIN_FAILED_DSN=doctrine://default?queue_name=main_failed
|
SYLIUS_MESSENGER_TRANSPORT_MAIN_FAILED_DSN=doctrine://default?queue_name=main_failed
|
||||||
SYLIUS_MESSENGER_TRANSPORT_CATALOG_PROMOTION_REMOVAL_DSN=doctrine://default?queue_name=catalog_promotion_removal
|
SYLIUS_MESSENGER_TRANSPORT_CATALOG_PROMOTION_REMOVAL_DSN=doctrine://default?queue_name=catalog_promotion_removal
|
||||||
SYLIUS_MESSENGER_TRANSPORT_CATALOG_PROMOTION_REMOVAL_FAILED_DSN=doctrine://default?queue_name=catalog_promotion_removal_failed
|
SYLIUS_MESSENGER_TRANSPORT_CATALOG_PROMOTION_REMOVAL_FAILED_DSN=doctrine://default?queue_name=catalog_promotion_removal_failed
|
||||||
|
SYLIUS_MESSENGER_TRANSPORT_PAYMENT_REQUEST_DSN=doctrine://default?queue_name=payment_request
|
||||||
|
SYLIUS_MESSENGER_TRANSPORT_PAYMENT_REQUEST_FAILED_DSN=doctrine://default?queue_name=payment_request_failed
|
||||||
###< symfony/messenger ###
|
###< symfony/messenger ###
|
||||||
|
|
||||||
###> symfony/mailer ###
|
###> symfony/mailer ###
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,8 @@ SYLIUS_MESSENGER_TRANSPORT_MAIN_DSN=sync://
|
||||||
SYLIUS_MESSENGER_TRANSPORT_MAIN_FAILED_DSN=sync://
|
SYLIUS_MESSENGER_TRANSPORT_MAIN_FAILED_DSN=sync://
|
||||||
SYLIUS_MESSENGER_TRANSPORT_CATALOG_PROMOTION_REMOVAL_DSN=sync://
|
SYLIUS_MESSENGER_TRANSPORT_CATALOG_PROMOTION_REMOVAL_DSN=sync://
|
||||||
SYLIUS_MESSENGER_TRANSPORT_CATALOG_PROMOTION_REMOVAL_FAILED_DSN=sync://
|
SYLIUS_MESSENGER_TRANSPORT_CATALOG_PROMOTION_REMOVAL_FAILED_DSN=sync://
|
||||||
|
SYLIUS_MESSENGER_TRANSPORT_PAYMENT_REQUEST_DSN=sync://
|
||||||
|
SYLIUS_MESSENGER_TRANSPORT_PAYMENT_REQUEST_FAILED_DSN=sync://
|
||||||
###< symfony/messenger ###
|
###< symfony/messenger ###
|
||||||
|
|
||||||
MAILER_DSN=null://null
|
MAILER_DSN=null://null
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@ SYLIUS_MESSENGER_TRANSPORT_MAIN_DSN=sync://
|
||||||
SYLIUS_MESSENGER_TRANSPORT_MAIN_FAILED_DSN=sync://
|
SYLIUS_MESSENGER_TRANSPORT_MAIN_FAILED_DSN=sync://
|
||||||
SYLIUS_MESSENGER_TRANSPORT_CATALOG_PROMOTION_REMOVAL_DSN=sync://
|
SYLIUS_MESSENGER_TRANSPORT_CATALOG_PROMOTION_REMOVAL_DSN=sync://
|
||||||
SYLIUS_MESSENGER_TRANSPORT_CATALOG_PROMOTION_REMOVAL_FAILED_DSN=sync://
|
SYLIUS_MESSENGER_TRANSPORT_CATALOG_PROMOTION_REMOVAL_FAILED_DSN=sync://
|
||||||
|
SYLIUS_MESSENGER_TRANSPORT_PAYMENT_REQUEST_DSN=sync://
|
||||||
|
SYLIUS_MESSENGER_TRANSPORT_PAYMENT_REQUEST_FAILED_DSN=sync://
|
||||||
###< symfony/messenger ###
|
###< symfony/messenger ###
|
||||||
|
|
||||||
MAILER_DSN=null://null
|
MAILER_DSN=null://null
|
||||||
|
|
|
||||||
21
.env.test_cached_payum
Normal file
21
.env.test_cached_payum
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
APP_DEBUG=0
|
||||||
|
APP_SECRET='s$cretf0rt3st'
|
||||||
|
|
||||||
|
KERNEL_CLASS='App\Kernel'
|
||||||
|
|
||||||
|
###> lexik/jwt-authentication-bundle ###
|
||||||
|
JWT_SECRET_KEY=%kernel.project_dir%/config/jwt/private-test.pem
|
||||||
|
JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public-test.pem
|
||||||
|
JWT_PASSPHRASE=ALL_THAT_IS_GOLD_DOES_NOT_GLITTER_NOT_ALL_THOSE_WHO_WANDER_ARE_LOST
|
||||||
|
###< lexik/jwt-authentication-bundle ###
|
||||||
|
|
||||||
|
###> symfony/messenger ###
|
||||||
|
SYLIUS_MESSENGER_TRANSPORT_MAIN_DSN=sync://
|
||||||
|
SYLIUS_MESSENGER_TRANSPORT_MAIN_FAILED_DSN=sync://
|
||||||
|
SYLIUS_MESSENGER_TRANSPORT_CATALOG_PROMOTION_REMOVAL_DSN=sync://
|
||||||
|
SYLIUS_MESSENGER_TRANSPORT_CATALOG_PROMOTION_REMOVAL_FAILED_DSN=sync://
|
||||||
|
SYLIUS_MESSENGER_TRANSPORT_PAYMENT_REQUEST_DSN=sync://
|
||||||
|
SYLIUS_MESSENGER_TRANSPORT_PAYMENT_REQUEST_FAILED_DSN=sync://
|
||||||
|
###< symfony/messenger ###
|
||||||
|
|
||||||
|
MAILER_DSN=null://null
|
||||||
12
.github/workflows/ci_e2e-mysql.yaml
vendored
12
.github/workflows/ci_e2e-mysql.yaml
vendored
|
|
@ -44,14 +44,14 @@ jobs:
|
||||||
behat-no-js:
|
behat-no-js:
|
||||||
needs: get-matrix
|
needs: get-matrix
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: "Non-JS, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}, Twig ${{ matrix.twig }}, API Platform ${{ matrix.api-platform }}"
|
name: "Non-JS, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }} (${{ matrix.env }}), MySQL ${{ matrix.mysql }}, Twig ${{ matrix.twig }}, API Platform ${{ matrix.api-platform }}"
|
||||||
timeout-minutes: 45
|
timeout-minutes: 45
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix: ${{ fromJson(needs.get-matrix.outputs.matrix) }}
|
matrix: ${{ fromJson(needs.get-matrix.outputs.matrix) }}
|
||||||
|
|
||||||
env:
|
env:
|
||||||
APP_ENV: test_cached
|
APP_ENV: ${{ matrix.env }}
|
||||||
DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?charset=utf8mb4&serverVersion=${{ matrix.mysql }}"
|
DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?charset=utf8mb4&serverVersion=${{ matrix.mysql }}"
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
@ -132,14 +132,14 @@ jobs:
|
||||||
behat-ui-js-chromedriver:
|
behat-ui-js-chromedriver:
|
||||||
needs: get-matrix
|
needs: get-matrix
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: "JS with Chromedriver, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}, Twig ${{ matrix.twig }}, API Platform ${{ matrix.api-platform }}"
|
name: "JS with Chromedriver, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }} (${{ matrix.env }}), MySQL ${{ matrix.mysql }}, Twig ${{ matrix.twig }}, API Platform ${{ matrix.api-platform }}"
|
||||||
timeout-minutes: 45
|
timeout-minutes: 45
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix: ${{ fromJson(needs.get-matrix.outputs.matrix) }}
|
matrix: ${{ fromJson(needs.get-matrix.outputs.matrix) }}
|
||||||
|
|
||||||
env:
|
env:
|
||||||
APP_ENV: test_cached
|
APP_ENV: ${{ matrix.env }}
|
||||||
DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?charset=utf8mb4&serverVersion=${{ matrix.mysql }}"
|
DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?charset=utf8mb4&serverVersion=${{ matrix.mysql }}"
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
@ -210,14 +210,14 @@ jobs:
|
||||||
behat-ui-js-panther:
|
behat-ui-js-panther:
|
||||||
needs: get-matrix
|
needs: get-matrix
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: "JS with Panther, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}, Twig ${{ matrix.twig }}, API Platform ${{ matrix.api-platform }}"
|
name: "JS with Panther, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }} (${{ matrix.env }}), MySQL ${{ matrix.mysql }}, Twig ${{ matrix.twig }}, API Platform ${{ matrix.api-platform }}"
|
||||||
timeout-minutes: 45
|
timeout-minutes: 45
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix: ${{ fromJson(needs.get-matrix.outputs.matrix) }}
|
matrix: ${{ fromJson(needs.get-matrix.outputs.matrix) }}
|
||||||
|
|
||||||
env:
|
env:
|
||||||
APP_ENV: test_cached
|
APP_ENV: ${{ matrix.env }}
|
||||||
DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?charset=utf8mb4&serverVersion=${{ matrix.mysql }}"
|
DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?charset=utf8mb4&serverVersion=${{ matrix.mysql }}"
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
|
||||||
27
.github/workflows/matrix.json
vendored
27
.github/workflows/matrix.json
vendored
|
|
@ -39,14 +39,24 @@
|
||||||
"symfony": "^6.4",
|
"symfony": "^6.4",
|
||||||
"api-platform": "^3.3",
|
"api-platform": "^3.3",
|
||||||
"mysql": "8.0",
|
"mysql": "8.0",
|
||||||
"twig": "^3.3"
|
"twig": "^3.3",
|
||||||
|
"env": "test_cached"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"php": "8.3",
|
"php": "8.3",
|
||||||
"symfony": "^7.1",
|
"symfony": "^7.1",
|
||||||
"api-platform": "^3.3",
|
"api-platform": "^3.3",
|
||||||
"mysql": "8.4",
|
"mysql": "8.4",
|
||||||
"twig": "^3.3"
|
"twig": "^3.3",
|
||||||
|
"env": "test_cached"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"php": "8.3",
|
||||||
|
"symfony": "^6.4",
|
||||||
|
"api-platform": "^3.3",
|
||||||
|
"mysql": "8.4",
|
||||||
|
"twig": "^3.3",
|
||||||
|
"env": "test_cached_payum"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
@ -101,7 +111,18 @@
|
||||||
"symfony": ["^6.4", "^7.1"],
|
"symfony": ["^6.4", "^7.1"],
|
||||||
"api-platform": ["^3.3"],
|
"api-platform": ["^3.3"],
|
||||||
"mysql": ["8.0", "8.4"],
|
"mysql": ["8.0", "8.4"],
|
||||||
"twig": ["^3.3"]
|
"twig": ["^3.3"],
|
||||||
|
"env": "test_cached",
|
||||||
|
"include": [
|
||||||
|
{
|
||||||
|
"php": "8.3",
|
||||||
|
"symfony": "^6.4",
|
||||||
|
"api-platform": "^2.7.10",
|
||||||
|
"mysql": "8.4",
|
||||||
|
"twig": "^3.3",
|
||||||
|
"env": "test_cached_payum"
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"e2e-pgsql": {
|
"e2e-pgsql": {
|
||||||
"php": ["8.2", "8.3"],
|
"php": ["8.2", "8.3"],
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,7 @@
|
||||||
"Payum\\Core\\Model\\GatewayConfig",
|
"Payum\\Core\\Model\\GatewayConfig",
|
||||||
"Payum\\Core\\Model\\GatewayConfigInterface",
|
"Payum\\Core\\Model\\GatewayConfigInterface",
|
||||||
"Payum\\Core\\Model\\Identity",
|
"Payum\\Core\\Model\\Identity",
|
||||||
|
"Payum\\Core\\Model\\ModelAggregateInterface",
|
||||||
"Payum\\Core\\Model\\Payment",
|
"Payum\\Core\\Model\\Payment",
|
||||||
"Payum\\Core\\Model\\PaymentInterface",
|
"Payum\\Core\\Model\\PaymentInterface",
|
||||||
"Payum\\Core\\Payum",
|
"Payum\\Core\\Payum",
|
||||||
|
|
@ -74,11 +75,15 @@
|
||||||
"Payum\\Core\\Request\\Capture",
|
"Payum\\Core\\Request\\Capture",
|
||||||
"Payum\\Core\\Request\\Convert",
|
"Payum\\Core\\Request\\Convert",
|
||||||
"Payum\\Core\\Request\\Generic",
|
"Payum\\Core\\Request\\Generic",
|
||||||
|
"Payum\\Core\\Request\\GetHttpRequest",
|
||||||
"Payum\\Core\\Request\\GetStatusInterface",
|
"Payum\\Core\\Request\\GetStatusInterface",
|
||||||
"Payum\\Core\\Request\\Notify",
|
"Payum\\Core\\Request\\Notify",
|
||||||
|
"Payum\\Core\\Request\\RenderTemplate",
|
||||||
"Payum\\Core\\Security\\CryptedInterface",
|
"Payum\\Core\\Security\\CryptedInterface",
|
||||||
|
"Payum\\Core\\Security\\CypherInterface",
|
||||||
"Payum\\Core\\Security\\GenericTokenFactoryInterface",
|
"Payum\\Core\\Security\\GenericTokenFactoryInterface",
|
||||||
"Payum\\Core\\Security\\HttpRequestVerifierInterface",
|
"Payum\\Core\\Security\\HttpRequestVerifierInterface",
|
||||||
|
"Payum\\Core\\Security\\TokenAggregateInterface",
|
||||||
"Payum\\Core\\Security\\TokenInterface",
|
"Payum\\Core\\Security\\TokenInterface",
|
||||||
"Payum\\Core\\Security\\Util\\Random",
|
"Payum\\Core\\Security\\Util\\Random",
|
||||||
"Payum\\Core\\Storage\\AbstractStorage",
|
"Payum\\Core\\Storage\\AbstractStorage",
|
||||||
|
|
|
||||||
|
|
@ -129,6 +129,7 @@
|
||||||
"symfony/translation": "^6.4.0 || ^7.1",
|
"symfony/translation": "^6.4.0 || ^7.1",
|
||||||
"symfony/translation-contracts": "^3.3",
|
"symfony/translation-contracts": "^3.3",
|
||||||
"symfony/twig-bundle": "^6.4.0 || ^7.1",
|
"symfony/twig-bundle": "^6.4.0 || ^7.1",
|
||||||
|
"symfony/uid": "^6.4.0 || ^7.1",
|
||||||
"symfony/ux-autocomplete": "^2.17",
|
"symfony/ux-autocomplete": "^2.17",
|
||||||
"symfony/ux-live-component": "^2.17",
|
"symfony/ux-live-component": "^2.17",
|
||||||
"symfony/ux-twig-component": "^2.17",
|
"symfony/ux-twig-component": "^2.17",
|
||||||
|
|
|
||||||
|
|
@ -47,12 +47,12 @@ return [
|
||||||
Sylius\Bundle\ShopBundle\SyliusShopBundle::class => ['all' => true],
|
Sylius\Bundle\ShopBundle\SyliusShopBundle::class => ['all' => true],
|
||||||
ApiPlatform\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true],
|
ApiPlatform\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true],
|
||||||
Sylius\Bundle\ApiBundle\SyliusApiBundle::class => ['all' => true],
|
Sylius\Bundle\ApiBundle\SyliusApiBundle::class => ['all' => true],
|
||||||
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true],
|
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true, 'test_cached_payum' => true],
|
||||||
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true],
|
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true, 'test_cached_payum' => true],
|
||||||
Fidry\AliceDataFixtures\Bridge\Symfony\FidryAliceDataFixturesBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true],
|
Fidry\AliceDataFixtures\Bridge\Symfony\FidryAliceDataFixturesBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true, 'test_cached_payum' => true],
|
||||||
Nelmio\Alice\Bridge\Symfony\NelmioAliceBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true],
|
Nelmio\Alice\Bridge\Symfony\NelmioAliceBundle::class => ['dev' => true, 'test' => true, 'test_cached' => true, 'test_cached_payum' => true],
|
||||||
FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle::class => ['test' => true, 'test_cached' => true],
|
FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle::class => ['test' => true, 'test_cached' => true, 'test_cached_payum' => true],
|
||||||
Sylius\Behat\Application\SyliusTestPlugin\SyliusTestPlugin::class => ['test' => true, 'test_cached' => true],
|
Sylius\Behat\Application\SyliusTestPlugin\SyliusTestPlugin::class => ['test' => true, 'test_cached' => true, 'test_cached_payum' => true],
|
||||||
Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle::class => ['all' => true],
|
Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle::class => ['all' => true],
|
||||||
SyliusLabs\DoctrineMigrationsExtraBundle\SyliusLabsDoctrineMigrationsExtraBundle::class => ['all' => true],
|
SyliusLabs\DoctrineMigrationsExtraBundle\SyliusLabsDoctrineMigrationsExtraBundle::class => ['all' => true],
|
||||||
Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true],
|
Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true],
|
||||||
|
|
|
||||||
2
config/packages/test_cached_payum/_sylius.yaml
Normal file
2
config/packages/test_cached_payum/_sylius.yaml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
imports:
|
||||||
|
- { resource: "../test_cached/_sylius.yaml" }
|
||||||
2
config/packages/test_cached_payum/doctrine.yaml
Normal file
2
config/packages/test_cached_payum/doctrine.yaml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
imports:
|
||||||
|
- { resource: "../test_cached/doctrine.yaml" }
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
imports:
|
||||||
|
- { resource: "../test_cached/fidry_alice_data_fixtures.yaml" }
|
||||||
2
config/packages/test_cached_payum/fos_rest.yaml
Normal file
2
config/packages/test_cached_payum/fos_rest.yaml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
imports:
|
||||||
|
- { resource: "../test_cached/fos_rest.yaml" }
|
||||||
2
config/packages/test_cached_payum/framework.yaml
Normal file
2
config/packages/test_cached_payum/framework.yaml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
imports:
|
||||||
|
- { resource: "../test_cached/framework.yaml" }
|
||||||
2
config/packages/test_cached_payum/mailer.yaml
Normal file
2
config/packages/test_cached_payum/mailer.yaml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
imports:
|
||||||
|
- { resource: "../test_cached/mailer.yaml" }
|
||||||
2
config/packages/test_cached_payum/monolog.yaml
Normal file
2
config/packages/test_cached_payum/monolog.yaml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
imports:
|
||||||
|
- { resource: "../test_cached/monolog.yaml" }
|
||||||
2
config/packages/test_cached_payum/nelmio_alice.yaml
Normal file
2
config/packages/test_cached_payum/nelmio_alice.yaml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
imports:
|
||||||
|
- { resource: ../dev/nelmio_alice.yaml }
|
||||||
2
config/packages/test_cached_payum/security.yaml
Normal file
2
config/packages/test_cached_payum/security.yaml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
imports:
|
||||||
|
- { resource: "../test_cached/security.yaml" }
|
||||||
2
config/packages/test_cached_payum/sylius_channel.yaml
Normal file
2
config/packages/test_cached_payum/sylius_channel.yaml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
imports:
|
||||||
|
- { resource: "../test_cached/sylius_channel.yaml" }
|
||||||
2
config/packages/test_cached_payum/sylius_theme.yaml
Normal file
2
config/packages/test_cached_payum/sylius_theme.yaml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
imports:
|
||||||
|
- { resource: "../test_cached/sylius_theme.yaml" }
|
||||||
2
config/packages/test_cached_payum/sylius_uploader.yaml
Normal file
2
config/packages/test_cached_payum/sylius_uploader.yaml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
imports:
|
||||||
|
- { resource: "../test_cached/sylius_uploader.yaml" }
|
||||||
2
config/packages/test_cached_payum/twig.yaml
Normal file
2
config/packages/test_cached_payum/twig.yaml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
imports:
|
||||||
|
- { resource: "../test_cached/twig.yaml" }
|
||||||
2
config/packages/test_cached_payum/web_profiler.yaml
Normal file
2
config/packages/test_cached_payum/web_profiler.yaml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
imports:
|
||||||
|
- { resource: "../test_cached/web_profiler.yaml" }
|
||||||
2
config/packages/test_cached_payum/webpack_encore.yaml
Normal file
2
config/packages/test_cached_payum/webpack_encore.yaml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
imports:
|
||||||
|
- { resource: "../test_cached/webpack_encore.yaml" }
|
||||||
4
config/packages/uid.yaml
Normal file
4
config/packages/uid.yaml
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
framework:
|
||||||
|
uid:
|
||||||
|
default_uuid_version: 6
|
||||||
|
time_based_uuid_version: 6
|
||||||
5
config/routes/test_cached_payum/routing.yaml
Normal file
5
config/routes/test_cached_payum/routing.yaml
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
sylius_test_plugin_main:
|
||||||
|
path: /test/main
|
||||||
|
controller: Symfony\Bundle\FrameworkBundle\Controller\TemplateController::templateAction
|
||||||
|
defaults:
|
||||||
|
template: "@SyliusTestPlugin/main.html.twig"
|
||||||
14
config/services_test_cached_payum.yaml
Normal file
14
config/services_test_cached_payum.yaml
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
imports:
|
||||||
|
- { resource: "services_test_cached.yaml" }
|
||||||
|
|
||||||
|
services:
|
||||||
|
##
|
||||||
|
# Prioritize Payum by tagging services with a higher priority (or lower for tagged_iterator).
|
||||||
|
##
|
||||||
|
|
||||||
|
'sylius.payment_request.command_provider.payum.offline':
|
||||||
|
class: Sylius\Bundle\CoreBundle\PaymentRequest\CommandProvider\ActionsCommandProvider
|
||||||
|
arguments:
|
||||||
|
- !tagged_locator { tag: 'sylius.payment_request.command_provider.payum.offline', index_by: 'action' }
|
||||||
|
tags:
|
||||||
|
- { name: 'sylius.payment_request.command_provider', gateway-factory: 'offline', priority: -100 }
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
@managing_payments
|
||||||
|
Feature: Browsing payment requests
|
||||||
|
In order to have an overview of all payment requests of a specific payment
|
||||||
|
As an Administrator
|
||||||
|
I want to browse all payment requests of a payment
|
||||||
|
|
||||||
|
Background:
|
||||||
|
Given the store operates on a single channel in "United States"
|
||||||
|
And the store has a product "PHP T-Shirt"
|
||||||
|
And the store ships everywhere for Free
|
||||||
|
And the store allows paying with "Cash on Delivery"
|
||||||
|
And there is an "#00000001" order with "PHP T-Shirt" product
|
||||||
|
And the payment request action "authorize" has been executed for order "#00000001" with the payment method "Cash on Delivery"
|
||||||
|
And the payment request action "capture" has been executed for order "#00000001" with the payment method "Cash on Delivery"
|
||||||
|
And the payment request action "sync" has been executed for order "#00000001" with the payment method "Cash on Delivery"
|
||||||
|
And I am logged in as an administrator
|
||||||
|
|
||||||
|
@api @ui
|
||||||
|
Scenario: Browsing payment requests of a payment
|
||||||
|
When I browse payments
|
||||||
|
And I want to view the payment requests of the first payment
|
||||||
|
Then there should be 3 payment requests on the list
|
||||||
|
And it should be the payment request with action "authorize"
|
||||||
|
And it should be the payment request with action "capture"
|
||||||
|
And it should be the payment request with action "sync"
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
@managing_payments
|
||||||
|
Feature: Filtering payment requests
|
||||||
|
In order to see specific payment requests
|
||||||
|
As an Administrator
|
||||||
|
I want to be able to filter payment requests on the list
|
||||||
|
|
||||||
|
Background:
|
||||||
|
Given the store operates on a single channel in "United States"
|
||||||
|
And the store has a product "PHP T-Shirt"
|
||||||
|
And the store ships everywhere for Free
|
||||||
|
And the store allows paying with "Cash on Delivery"
|
||||||
|
And the store allows paying with "Credit Card"
|
||||||
|
And there is an "#00000001" order with "PHP T-Shirt" product
|
||||||
|
And there is an "#00000002" order with "PHP T-Shirt" product
|
||||||
|
And the payment request action "authorize" has been executed for order "#00000001" with the payment method "Credit Card"
|
||||||
|
And the payment request action "authorize" has been executed for order "#00000001" with the payment method "Cash on Delivery"
|
||||||
|
And the payment request action "capture" has been executed for order "#00000001" with the payment method "Cash on Delivery"
|
||||||
|
And the payment request action "sync" has been executed for order "#00000001" with the payment method "Cash on Delivery"
|
||||||
|
And the payment request action "capture" has been executed for order "#00000002" with the payment method "Cash on Delivery"
|
||||||
|
And I am logged in as an administrator
|
||||||
|
|
||||||
|
@api @ui
|
||||||
|
Scenario: Filtering payment requests by action
|
||||||
|
When I browse payment requests of an order "#00000001"
|
||||||
|
And I filter by the "capture" action
|
||||||
|
Then there should be 1 payment request on the list
|
||||||
|
And it should be the payment request with action "capture"
|
||||||
|
|
||||||
|
@api @ui @mink:chromedriver
|
||||||
|
Scenario: Filtering payment requests by payment method
|
||||||
|
When I browse payment requests of an order "#00000001"
|
||||||
|
And I filter by the "Credit Card" payment method
|
||||||
|
Then there should be 1 payment request on the list
|
||||||
|
And it should be the payment request with payment method "Credit Card"
|
||||||
|
|
||||||
|
@api @ui
|
||||||
|
Scenario: Filtering payment requests by state "New"
|
||||||
|
When I browse payment requests of an order "#00000001"
|
||||||
|
And I filter by the "new" state
|
||||||
|
Then there should be 4 payment requests on the list
|
||||||
|
|
||||||
|
@api @ui
|
||||||
|
Scenario: Filtering payment requests by state "Completed"
|
||||||
|
When I browse payment requests of an order "#00000001"
|
||||||
|
And I filter by the "completed" state
|
||||||
|
Then there should be 0 payment request on the list
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
@managing_payments
|
||||||
|
Feature: Seeing payment request's details
|
||||||
|
In order to have an overview of one of payment requests
|
||||||
|
As an Administrator
|
||||||
|
I want to be able to see its details
|
||||||
|
|
||||||
|
Background:
|
||||||
|
Given the store operates on a single channel in "United States"
|
||||||
|
And the store has a product "PHP T-Shirt"
|
||||||
|
And the store ships everywhere for Free
|
||||||
|
And the store allows paying with "Cash on Delivery"
|
||||||
|
And there is an "#00000001" order with "PHP T-Shirt" product
|
||||||
|
And the payment request action "authorize" has been executed for order "#00000001" with the payment method "Cash on Delivery"
|
||||||
|
And I am logged in as an administrator
|
||||||
|
|
||||||
|
@api @ui
|
||||||
|
Scenario: Seeing payment request's details
|
||||||
|
When I view details of the payment request for the "#00000001" order
|
||||||
|
Then its method should be "Cash on Delivery"
|
||||||
|
And its action should be "Authorize"
|
||||||
|
And its state should be "New"
|
||||||
|
And its payload should has empty value
|
||||||
|
And its response data should has empty value
|
||||||
|
|
@ -13,7 +13,7 @@ Feature: Checking taxons of a product
|
||||||
And the product "T-Shirt" belongs to taxon "T-Shirts"
|
And the product "T-Shirt" belongs to taxon "T-Shirts"
|
||||||
And I am logged in as an administrator
|
And I am logged in as an administrator
|
||||||
|
|
||||||
@ui @no-api @mink:chromedriver
|
@no-api @ui @mink:chromedriver
|
||||||
Scenario: Checking all taxons
|
Scenario: Checking all taxons
|
||||||
When I want to modify the "Shirt" product
|
When I want to modify the "Shirt" product
|
||||||
And I check all taxons
|
And I check all taxons
|
||||||
|
|
@ -21,7 +21,7 @@ Feature: Checking taxons of a product
|
||||||
Then the product "Shirt" should have the "Clothes" taxon
|
Then the product "Shirt" should have the "Clothes" taxon
|
||||||
And the product "Shirt" should have the "T-Shirts" taxon
|
And the product "Shirt" should have the "T-Shirts" taxon
|
||||||
|
|
||||||
@ui @no-api @mink:chromedriver
|
@no-api @ui @mink:chromedriver
|
||||||
Scenario: Unchecking all taxons
|
Scenario: Unchecking all taxons
|
||||||
When I want to modify the "T-Shirt" product
|
When I want to modify the "T-Shirt" product
|
||||||
And I uncheck all taxons
|
And I uncheck all taxons
|
||||||
|
|
@ -29,7 +29,7 @@ Feature: Checking taxons of a product
|
||||||
Then the product "Shirt" should not have the "Clothes" taxon
|
Then the product "Shirt" should not have the "Clothes" taxon
|
||||||
And the product "Shirt" should not have the "T-Shirts" taxon
|
And the product "Shirt" should not have the "T-Shirts" taxon
|
||||||
|
|
||||||
@ui @no-api @mink:chromedriver
|
@no-api @ui @mink:chromedriver
|
||||||
Scenario: Checking all filtered taxons
|
Scenario: Checking all filtered taxons
|
||||||
When I want to modify the "Shirt" product
|
When I want to modify the "Shirt" product
|
||||||
And I filter taxons by "T-Shirts"
|
And I filter taxons by "T-Shirts"
|
||||||
|
|
@ -38,7 +38,7 @@ Feature: Checking taxons of a product
|
||||||
Then the product "Shirt" should have the "T-Shirts" taxon
|
Then the product "Shirt" should have the "T-Shirts" taxon
|
||||||
But the product "Shirt" should not have the "Clothes" taxon
|
But the product "Shirt" should not have the "Clothes" taxon
|
||||||
|
|
||||||
@ui @no-api @mink:chromedriver
|
@no-api @ui @mink:chromedriver
|
||||||
Scenario: Unchecking all filtered taxons
|
Scenario: Unchecking all filtered taxons
|
||||||
When I want to modify the "T-Shirt" product
|
When I want to modify the "T-Shirt" product
|
||||||
And I filter taxons by "T-Shirts"
|
And I filter taxons by "T-Shirts"
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ Feature: Filtering product taxons
|
||||||
And the store has a "Shirt" configurable product
|
And the store has a "Shirt" configurable product
|
||||||
And I am logged in as an administrator
|
And I am logged in as an administrator
|
||||||
|
|
||||||
@ui @no-api @mink:chromedriver
|
@no-api @ui @mink:chromedriver
|
||||||
Scenario: Filtering product taxons
|
Scenario: Filtering product taxons
|
||||||
When I want to modify the "Shirt" product
|
When I want to modify the "Shirt" product
|
||||||
And I filter taxons by "T-Shirts"
|
And I filter taxons by "T-Shirts"
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ Feature: Sorting listed products from a taxon by position
|
||||||
And the 7th product on this page should be named "Pug Master"
|
And the 7th product on this page should be named "Pug Master"
|
||||||
And this product should be at position 16
|
And this product should be at position 16
|
||||||
|
|
||||||
@no-api @ui @mink:chromedriver
|
@no-api @tod-ui @mink:chromedriver
|
||||||
Scenario: Setting two products to the positions overflowing the max available position on the non-last page
|
Scenario: Setting two products to the positions overflowing the max available position on the non-last page
|
||||||
When I am browsing the 1st page of products from "Soft Toys" taxon
|
When I am browsing the 1st page of products from "Soft Toys" taxon
|
||||||
And I set the position of "Old pug" to "25"
|
And I set the position of "Old pug" to "25"
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ Feature: Changing the offline payment method after order confirmation
|
||||||
And I retry the payment with "Offline" payment method
|
And I retry the payment with "Offline" payment method
|
||||||
Then I should have chosen "Offline" payment method
|
Then I should have chosen "Offline" payment method
|
||||||
|
|
||||||
@no-api @ui @javascript
|
@api @ui @javascript
|
||||||
Scenario: Retrying the payment with different Offline payment works correctly together with inventory
|
Scenario: Retrying the payment with different Offline payment works correctly together with inventory
|
||||||
Given there is 1 unit of product "PHP T-Shirt" available in the inventory
|
Given there is 1 unit of product "PHP T-Shirt" available in the inventory
|
||||||
And this product is tracked by the inventory
|
And this product is tracked by the inventory
|
||||||
|
|
@ -33,7 +33,7 @@ Feature: Changing the offline payment method after order confirmation
|
||||||
And I retry the payment with "Offline" payment method
|
And I retry the payment with "Offline" payment method
|
||||||
Then I should have chosen "Offline" payment method
|
Then I should have chosen "Offline" payment method
|
||||||
|
|
||||||
@no-api @ui @javascript
|
@todo-api @ui @javascript
|
||||||
Scenario: Being unable to pay for my order if my chosen payment method gets disabled
|
Scenario: Being unable to pay for my order if my chosen payment method gets disabled
|
||||||
Given I added product "PHP T-Shirt" to the cart
|
Given I added product "PHP T-Shirt" to the cart
|
||||||
When I complete addressing step with email "john@example.com" and "United States" based billing address
|
When I complete addressing step with email "john@example.com" and "United States" based billing address
|
||||||
|
|
@ -44,7 +44,7 @@ Feature: Changing the offline payment method after order confirmation
|
||||||
And I try to pay for my order
|
And I try to pay for my order
|
||||||
Then I should be notified to choose a payment method
|
Then I should be notified to choose a payment method
|
||||||
|
|
||||||
@no-api @ui @javascript
|
@api @ui @javascript
|
||||||
Scenario: Retrying the payment with different payment method after order confirmation when the original is disabled
|
Scenario: Retrying the payment with different payment method after order confirmation when the original is disabled
|
||||||
Given I added product "PHP T-Shirt" to the cart
|
Given I added product "PHP T-Shirt" to the cart
|
||||||
When I complete addressing step with email "john@example.com" and "United States" based billing address
|
When I complete addressing step with email "john@example.com" and "United States" based billing address
|
||||||
|
|
@ -55,7 +55,7 @@ Feature: Changing the offline payment method after order confirmation
|
||||||
And I retry the payment with "Offline" payment method
|
And I retry the payment with "Offline" payment method
|
||||||
Then I should have chosen "Offline" payment method
|
Then I should have chosen "Offline" payment method
|
||||||
|
|
||||||
@no-api @ui @javascript
|
@todo-api @ui @javascript
|
||||||
Scenario: Being unable to pay for my order if no methods are available
|
Scenario: Being unable to pay for my order if no methods are available
|
||||||
Given I added product "PHP T-Shirt" to the cart
|
Given I added product "PHP T-Shirt" to the cart
|
||||||
When I complete addressing step with email "john@example.com" and "United States" based billing address
|
When I complete addressing step with email "john@example.com" and "United States" based billing address
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ Feature: Preventing to pay for the cancelled order
|
||||||
And the store allows paying Offline
|
And the store allows paying Offline
|
||||||
And there is a customer "sylius@example.com" that placed an order "#00000022"
|
And there is a customer "sylius@example.com" that placed an order "#00000022"
|
||||||
|
|
||||||
@no-api @ui
|
@api @ui
|
||||||
Scenario: Not being able to pay for cancelled order
|
Scenario: Not being able to pay for cancelled order
|
||||||
Given the customer bought 3 "Iron Maiden T-Shirt" products
|
Given the customer bought 3 "Iron Maiden T-Shirt" products
|
||||||
And the customer chose "Free" shipping method to "United States" with "Offline" payment
|
And the customer chose "Free" shipping method to "United States" with "Offline" payment
|
||||||
|
|
|
||||||
|
|
@ -1100,6 +1100,26 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: src/Sylius/Bundle/CoreBundle/Order/Checker/OrderPromotionsIntegrityChecker.php
|
path: src/Sylius/Bundle/CoreBundle/Order/Checker/OrderPromotionsIntegrityChecker.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Call to method toBinary\\(\\) on an unknown class Symfony\\\\Component\\\\Uid\\\\Uuid\\.$#"
|
||||||
|
count: 1
|
||||||
|
path: src/Sylius/Bundle/CoreBundle/PaymentRequest/CommandProvider/Offline/CapturePaymentRequestCommandProvider.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Call to method toBinary\\(\\) on an unknown class Symfony\\\\Component\\\\Uid\\\\Uuid\\.$#"
|
||||||
|
count: 1
|
||||||
|
path: src/Sylius/Bundle/CoreBundle/PaymentRequest/CommandProvider/Payum/AuthorizeCommandProvider.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Call to method toBinary\\(\\) on an unknown class Symfony\\\\Component\\\\Uid\\\\Uuid\\.$#"
|
||||||
|
count: 1
|
||||||
|
path: src/Sylius/Bundle/CoreBundle/PaymentRequest/CommandProvider/Payum/CaptureCommandProvider.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Call to method toBinary\\(\\) on an unknown class Symfony\\\\Component\\\\Uid\\\\Uuid\\.$#"
|
||||||
|
count: 1
|
||||||
|
path: src/Sylius/Bundle/CoreBundle/PaymentRequest/CommandProvider/Payum/StatusCommandProvider.php
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Method Sylius\\\\Bundle\\\\CoreBundle\\\\PriceHistory\\\\Command\\\\ApplyLowestPriceOnChannelPricings\\:\\:__construct\\(\\) has parameter \\$channelPricingIds with no value type specified in iterable type array\\.$#"
|
message: "#^Method Sylius\\\\Bundle\\\\CoreBundle\\\\PriceHistory\\\\Command\\\\ApplyLowestPriceOnChannelPricings\\:\\:__construct\\(\\) has parameter \\$channelPricingIds with no value type specified in iterable type array\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
|
@ -1330,41 +1350,6 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: src/Sylius/Bundle/PaymentBundle/Form/Type/PaymentGatewayChoiceType.php
|
path: src/Sylius/Bundle/PaymentBundle/Form/Type/PaymentGatewayChoiceType.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Method Sylius\\\\Bundle\\\\PayumBundle\\\\Controller\\\\PayumController\\:\\:__construct\\(\\) has parameter \\$orderRepository with generic interface Sylius\\\\Component\\\\Order\\\\Repository\\\\OrderRepositoryInterface but does not specify its types\\: T$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Sylius/Bundle/PayumBundle/Controller/PayumController.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Method Sylius\\\\Bundle\\\\PayumBundle\\\\Controller\\\\PayumController\\:\\:prepareCaptureAction\\(\\) has parameter \\$tokenValue with no type specified\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Sylius/Bundle/PayumBundle/Controller/PayumController.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Method Sylius\\\\Bundle\\\\PayumBundle\\\\Controller\\\\PayumController\\:\\:provideTokenBasedOnPayment\\(\\) has parameter \\$redirectOptions with no value type specified in iterable type array\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Sylius/Bundle/PayumBundle/Controller/PayumController.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Method Sylius\\\\Bundle\\\\PayumBundle\\\\Factory\\\\GetStatusFactory\\:\\:createNewWithModel\\(\\) has parameter \\$model with no type specified\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Sylius/Bundle/PayumBundle/Factory/GetStatusFactory.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Method Sylius\\\\Bundle\\\\PayumBundle\\\\Factory\\\\GetStatusFactoryInterface\\:\\:createNewWithModel\\(\\) has parameter \\$model with no type specified\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Sylius/Bundle/PayumBundle/Factory/GetStatusFactoryInterface.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Method Sylius\\\\Bundle\\\\PayumBundle\\\\Factory\\\\ResolveNextRouteFactory\\:\\:createNewWithModel\\(\\) has parameter \\$model with no type specified\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Sylius/Bundle/PayumBundle/Factory/ResolveNextRouteFactory.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Method Sylius\\\\Bundle\\\\PayumBundle\\\\Factory\\\\ResolveNextRouteFactoryInterface\\:\\:createNewWithModel\\(\\) has parameter \\$model with no type specified\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: src/Sylius/Bundle/PayumBundle/Factory/ResolveNextRouteFactoryInterface.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Method Sylius\\\\Bundle\\\\PayumBundle\\\\Request\\\\ResolveNextRoute\\:\\:getRouteParameters\\(\\) return type has no value type specified in iterable type array\\.$#"
|
message: "#^Method Sylius\\\\Bundle\\\\PayumBundle\\\\Request\\\\ResolveNextRoute\\:\\:getRouteParameters\\(\\) return type has no value type specified in iterable type array\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
|
@ -1675,6 +1660,11 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: src/Sylius/Bundle/ShopBundle/DependencyInjection/SyliusShopExtension.php
|
path: src/Sylius/Bundle/ShopBundle/DependencyInjection/SyliusShopExtension.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Method Sylius\\\\Bundle\\\\ShopBundle\\\\DependencyInjection\\\\SyliusShopExtension\\:\\:configureOrderPay\\(\\) has parameter \\$config with no value type specified in iterable type array\\.$#"
|
||||||
|
count: 1
|
||||||
|
path: src/Sylius/Bundle/ShopBundle/DependencyInjection/SyliusShopExtension.php
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Method Sylius\\\\Bundle\\\\ShopBundle\\\\DependencyInjection\\\\SyliusShopExtension\\:\\:registerCheckoutRedirectListener\\(\\) has parameter \\$config with no value type specified in iterable type array\\.$#"
|
message: "#^Method Sylius\\\\Bundle\\\\ShopBundle\\\\DependencyInjection\\\\SyliusShopExtension\\:\\:registerCheckoutRedirectListener\\(\\) has parameter \\$config with no value type specified in iterable type array\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
|
@ -2910,6 +2900,26 @@ parameters:
|
||||||
count: 1
|
count: 1
|
||||||
path: src/Sylius/Component/Payment/Model/PaymentInterface.php
|
path: src/Sylius/Component/Payment/Model/PaymentInterface.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Call to method toBinary\\(\\) on an unknown class Symfony\\\\Component\\\\Uid\\\\Uuid\\.$#"
|
||||||
|
count: 1
|
||||||
|
path: src/Sylius/Component/Payment/Model/PaymentRequest.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Method Sylius\\\\Component\\\\Payment\\\\Model\\\\PaymentRequest\\:\\:getHash\\(\\) has invalid return type Symfony\\\\Component\\\\Uid\\\\Uuid\\.$#"
|
||||||
|
count: 1
|
||||||
|
path: src/Sylius/Component/Payment/Model/PaymentRequest.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Property Sylius\\\\Component\\\\Payment\\\\Model\\\\PaymentRequest\\:\\:\\$hash has unknown class Symfony\\\\Component\\\\Uid\\\\Uuid as its type\\.$#"
|
||||||
|
count: 1
|
||||||
|
path: src/Sylius/Component/Payment/Model/PaymentRequest.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Method Sylius\\\\Component\\\\Payment\\\\Model\\\\PaymentRequestInterface\\:\\:getHash\\(\\) has invalid return type Symfony\\\\Component\\\\Uid\\\\Uuid\\.$#"
|
||||||
|
count: 1
|
||||||
|
path: src/Sylius/Component/Payment/Model/PaymentRequestInterface.php
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Method Sylius\\\\Component\\\\Payment\\\\Resolver\\\\DefaultPaymentMethodResolver\\:\\:__construct\\(\\) has parameter \\$paymentMethodRepository with generic interface Sylius\\\\Component\\\\Payment\\\\Repository\\\\PaymentMethodRepositoryInterface but does not specify its types\\: T$#"
|
message: "#^Method Sylius\\\\Component\\\\Payment\\\\Resolver\\\\DefaultPaymentMethodResolver\\:\\:__construct\\(\\) has parameter \\$paymentMethodRepository with generic interface Sylius\\\\Component\\\\Payment\\\\Repository\\\\PaymentMethodRepositoryInterface but does not specify its types\\: T$#"
|
||||||
count: 1
|
count: 1
|
||||||
|
|
|
||||||
|
|
@ -55,10 +55,10 @@ final class ApiPlatformClient implements ApiClientInterface
|
||||||
/** @param array<string, string> $queryParameters */
|
/** @param array<string, string> $queryParameters */
|
||||||
public function subResourceIndex(string $resource, string $subResource, string $id, array $queryParameters = [], bool $forgetResponse = false): Response
|
public function subResourceIndex(string $resource, string $subResource, string $id, array $queryParameters = [], bool $forgetResponse = false): Response
|
||||||
{
|
{
|
||||||
$request = $this->requestFactory->subResourceIndex($this->section, $resource, $id, $subResource, $queryParameters);
|
$this->request = $this->requestFactory->subResourceIndex($this->section, $resource, $id, $subResource, $queryParameters);
|
||||||
$request->authorize($this->getToken(), $this->authorizationHeader);
|
$this->request->authorize($this->getToken(), $this->authorizationHeader);
|
||||||
|
|
||||||
return $this->request($request, $forgetResponse);
|
return $this->request($this->request, $forgetResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function show(string $resource, string $id, bool $forgetResponse = false): Response
|
public function show(string $resource, string $id, bool $forgetResponse = false): Response
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,156 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Sylius package.
|
||||||
|
*
|
||||||
|
* (c) Sylius Sp. z o.o.
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Sylius\Behat\Context\Api\Admin;
|
||||||
|
|
||||||
|
use Behat\Behat\Context\Context;
|
||||||
|
use Sylius\Behat\Client\ApiClientInterface;
|
||||||
|
use Sylius\Behat\Client\ResponseCheckerInterface;
|
||||||
|
use Sylius\Behat\Context\Api\Resources;
|
||||||
|
use Sylius\Behat\Service\Converter\IriConverterInterface;
|
||||||
|
use Sylius\Component\Core\Formatter\StringInflector;
|
||||||
|
use Sylius\Component\Core\Model\ChannelInterface;
|
||||||
|
use Sylius\Component\Core\Model\CustomerInterface;
|
||||||
|
use Sylius\Component\Core\Model\OrderInterface;
|
||||||
|
use Sylius\Component\Core\Model\PaymentMethodInterface;
|
||||||
|
use Sylius\Component\Payment\PaymentTransitions;
|
||||||
|
use Sylius\Component\Payment\Repository\PaymentRequestRepositoryInterface;
|
||||||
|
use Symfony\Component\HttpFoundation\Request as HttpRequest;
|
||||||
|
use Webmozart\Assert\Assert;
|
||||||
|
|
||||||
|
final readonly class ManagingPaymentRequestsContext implements Context
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
private ApiClientInterface $client,
|
||||||
|
private ResponseCheckerInterface $responseChecker,
|
||||||
|
private IriConverterInterface $iriConverter,
|
||||||
|
private PaymentRequestRepositoryInterface $paymentRequestRepository,
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @When I browse payment requests of an order :order
|
||||||
|
*/
|
||||||
|
public function iBrowseOrdersOfACustomer(OrderInterface $order): void
|
||||||
|
{
|
||||||
|
$this->client->subResourceIndex(
|
||||||
|
Resources::PAYMENTS,
|
||||||
|
Resources::PAYMENT_REQUESTS,
|
||||||
|
(string) $order->getLastPayment()->getId()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @When I view details of the payment request for the :order order
|
||||||
|
*/
|
||||||
|
public function iViewDetailsOfThePaymentRequestForTheOrder(OrderInterface $order): void
|
||||||
|
{
|
||||||
|
$paymentRequest = $this->paymentRequestRepository->findOneBy(['payment' => $order->getLastPayment()]);
|
||||||
|
|
||||||
|
$this->client->show(Resources::PAYMENT_REQUESTS, (string) $paymentRequest->getHash());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @When I filter by the :action action
|
||||||
|
*/
|
||||||
|
public function iFilterByTheAction(string $action): void
|
||||||
|
{
|
||||||
|
$this->client->addFilter('action', $action);
|
||||||
|
$this->client->filter();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @When I filter by the :paymentMethod payment method
|
||||||
|
*/
|
||||||
|
public function iFilterByThePaymentMethod(PaymentMethodInterface $paymentMethod): void
|
||||||
|
{
|
||||||
|
$this->client->addFilter('method.code', $paymentMethod->getCode());
|
||||||
|
$this->client->filter();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @When I filter by the :state state
|
||||||
|
*/
|
||||||
|
public function iFilterByTheState(string $state): void
|
||||||
|
{
|
||||||
|
$this->client->addFilter('state', $state);
|
||||||
|
$this->client->filter();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Then /^there should be (\d+) payment requests? on the list$/
|
||||||
|
*/
|
||||||
|
public function thereShouldBeProductVariantsOnTheList(int $count): void
|
||||||
|
{
|
||||||
|
Assert::same($this->responseChecker->countCollectionItems($this->client->getLastResponse()), $count);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Then it should be the payment request with action :action
|
||||||
|
*/
|
||||||
|
public function itShouldBeThePaymentRequestWithAction(string $action): void
|
||||||
|
{
|
||||||
|
Assert::true($this->responseChecker->hasItemWithValue($this->client->getLastResponse(), 'action', $action));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Then it should be the payment request with payment method :paymentMethod
|
||||||
|
*/
|
||||||
|
public function itShouldBeThePaymentRequestWithPaymentMethod(PaymentMethodInterface $paymentMethod): void
|
||||||
|
{
|
||||||
|
Assert::true(
|
||||||
|
$this->responseChecker->hasItemWithValue(
|
||||||
|
$this->client->getLastResponse(),
|
||||||
|
'method',
|
||||||
|
$this->iriConverter->getIriFromResourceInSection($paymentMethod, 'admin'),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Then its method should be :paymentMethod
|
||||||
|
*/
|
||||||
|
public function itsMethodShouldBe(PaymentMethodInterface $paymentMethod): void
|
||||||
|
{
|
||||||
|
Assert::true($this->responseChecker->hasValue(
|
||||||
|
$this->client->getLastResponse(),
|
||||||
|
'method',
|
||||||
|
$this->iriConverter->getIriFromResourceInSection($paymentMethod, 'admin'))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Then /^its (action|state) should be "([^"]+)"$/
|
||||||
|
*/
|
||||||
|
public function itsActionStateShouldBe(string $field, string $value): void
|
||||||
|
{
|
||||||
|
Assert::true($this->responseChecker->hasValue($this->client->getLastResponse(), $field, strtolower($value)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Then its payload should has empty value
|
||||||
|
*/
|
||||||
|
public function itsPayloadShouldHasEmptyValue(): void
|
||||||
|
{
|
||||||
|
Assert::isEmpty($this->responseChecker->getValue($this->client->getLastResponse(), 'payload'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Then its response data should has empty value
|
||||||
|
*/
|
||||||
|
public function itsResponseDataShouldHasEmptyValue(): void
|
||||||
|
{
|
||||||
|
Assert::isEmpty($this->responseChecker->getValue($this->client->getLastResponse(), 'responseData'));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -58,6 +58,20 @@ final readonly class ManagingPaymentsContext implements Context
|
||||||
$this->client->customItemAction(Resources::ORDERS, $order->getTokenValue(), HttpRequest::METHOD_GET, 'payments');
|
$this->client->customItemAction(Resources::ORDERS, $order->getTokenValue(), HttpRequest::METHOD_GET, 'payments');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @When I want to view the payment requests of the first payment
|
||||||
|
*/
|
||||||
|
public function iWantToViewThePaymentRequestsOfTheFirstPayment(): void
|
||||||
|
{
|
||||||
|
$response = $this->client->getLastResponse();
|
||||||
|
|
||||||
|
$this->client->subResourceIndex(
|
||||||
|
Resources::PAYMENTS,
|
||||||
|
Resources::PAYMENT_REQUESTS,
|
||||||
|
(string) $this->responseChecker->getCollection($response)[0]['id']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Then I should see the details of order :order
|
* @Then I should see the details of order :order
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,8 @@ final class Resources
|
||||||
|
|
||||||
public const PAYMENTS = 'payments';
|
public const PAYMENTS = 'payments';
|
||||||
|
|
||||||
|
public const PAYMENT_REQUESTS = 'payment-requests';
|
||||||
|
|
||||||
public const PRODUCT_ASSOCIATION_TYPES = 'product-association-types';
|
public const PRODUCT_ASSOCIATION_TYPES = 'product-association-types';
|
||||||
|
|
||||||
public const PRODUCT_ASSOCIATIONS = 'product-associations';
|
public const PRODUCT_ASSOCIATIONS = 'product-associations';
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,89 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Sylius package.
|
||||||
|
*
|
||||||
|
* (c) Sylius Sp. z o.o.
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Sylius\Behat\Context\Api\Shop\Checkout;
|
||||||
|
|
||||||
|
use Behat\Behat\Context\Context;
|
||||||
|
use Sylius\Behat\Client\ApiClientInterface;
|
||||||
|
use Sylius\Behat\Client\ResponseCheckerInterface;
|
||||||
|
use Sylius\Behat\Context\Api\Resources;
|
||||||
|
use Sylius\Behat\Service\SharedStorageInterface;
|
||||||
|
use Sylius\Component\Core\Model\OrderInterface;
|
||||||
|
use Sylius\Component\Core\OrderPaymentStates;
|
||||||
|
use Sylius\Component\Payment\Model\PaymentInterface;
|
||||||
|
use Webmozart\Assert\Assert;
|
||||||
|
|
||||||
|
final class CheckoutOrderDetailsContext implements Context
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
private SharedStorageInterface $sharedStorage,
|
||||||
|
private ApiClientInterface $client,
|
||||||
|
private ResponseCheckerInterface $responseChecker,
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @When /^I want to browse order details for (this order)$/
|
||||||
|
*/
|
||||||
|
public function iWantToBrowseOrderDetailsForThisOrder(OrderInterface $order): void
|
||||||
|
{
|
||||||
|
$this->sharedStorage->set('cart_token', $order->getTokenValue());
|
||||||
|
$this->client->show(Resources::ORDERS, $order->getTokenValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Then I should be able to pay (again)
|
||||||
|
*/
|
||||||
|
public function iShouldBeAbleToPay(): void
|
||||||
|
{
|
||||||
|
$state = $this->getLatestPaymentState();
|
||||||
|
Assert::eq($state, PaymentInterface::STATE_NEW);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Then I should not be able to pay (again)
|
||||||
|
*/
|
||||||
|
public function iShouldNotBeAbleToPay(): void
|
||||||
|
{
|
||||||
|
$state = $this->getLatestPaymentState();
|
||||||
|
Assert::notEq($state, PaymentInterface::STATE_NEW);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @When I want to pay for my order
|
||||||
|
* @When I go to the change payment method page
|
||||||
|
*/
|
||||||
|
public function iWantToPayForMyOrder(): void
|
||||||
|
{
|
||||||
|
$this->client->show(Resources::ORDERS, $this->sharedStorage->get('cart_token'));
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getLatestPaymentState(): ?string
|
||||||
|
{
|
||||||
|
$response = $this->client->show(Resources::ORDERS, $this->sharedStorage->get('cart_token'));
|
||||||
|
Assert::same($this->client->getLastResponse()->getStatusCode(), 200);
|
||||||
|
|
||||||
|
// If the payment is canceled we won't be able to retrieve it because only new one are retrievable
|
||||||
|
if (OrderPaymentStates::STATE_CANCELLED === $this->responseChecker->getValue($response, 'paymentState')) {
|
||||||
|
return PaymentInterface::STATE_CANCELLED;
|
||||||
|
}
|
||||||
|
|
||||||
|
$payments = $this->responseChecker->getValue($response, 'payments');
|
||||||
|
$payment = end($payments);
|
||||||
|
|
||||||
|
$paymentId = $payment['id'];
|
||||||
|
$response = $this->client->requestGet(sprintf('/api/v2/shop/orders/%s/payments/%s', $this->sharedStorage->get('cart_token'), $paymentId));
|
||||||
|
|
||||||
|
return $this->responseChecker->getValue($response, 'state');
|
||||||
|
}
|
||||||
|
}
|
||||||
84
src/Sylius/Behat/Context/Api/Shop/PaymentRequestContext.php
Normal file
84
src/Sylius/Behat/Context/Api/Shop/PaymentRequestContext.php
Normal file
|
|
@ -0,0 +1,84 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Sylius\Behat\Context\Api\Shop;
|
||||||
|
|
||||||
|
use Behat\Behat\Context\Context;
|
||||||
|
use Sylius\Behat\Client\ApiClientInterface;
|
||||||
|
use Sylius\Behat\Client\RequestFactoryInterface;
|
||||||
|
use Sylius\Behat\Client\ResponseCheckerInterface;
|
||||||
|
use Sylius\Behat\Context\Api\Resources;
|
||||||
|
use Sylius\Behat\Service\SharedStorageInterface;
|
||||||
|
use Sylius\Bundle\PayumBundle\Model\GatewayConfigInterface;
|
||||||
|
use Sylius\Component\Core\Model\PaymentMethodInterface;
|
||||||
|
use Sylius\Component\Core\Repository\PaymentMethodRepositoryInterface;
|
||||||
|
use Symfony\Component\HttpFoundation\Request as HTTPRequest;
|
||||||
|
|
||||||
|
final readonly class PaymentRequestContext implements Context
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
private SharedStorageInterface $sharedStorage,
|
||||||
|
private ApiClientInterface $client,
|
||||||
|
private ResponseCheckerInterface $responseChecker,
|
||||||
|
private RequestFactoryInterface $requestFactory,
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @When I try to pay for my order
|
||||||
|
*/
|
||||||
|
public function iTryToPayForMyOrder(array $payload = []): void
|
||||||
|
{
|
||||||
|
$this->client->show(Resources::ORDERS, $this->sharedStorage->get('cart_token'));
|
||||||
|
|
||||||
|
$payments = $this->responseChecker->getValue($this->client->getLastResponse(), 'payments');
|
||||||
|
$payment = end($payments);
|
||||||
|
$this->postPaymentRequest($payment, $payload);
|
||||||
|
|
||||||
|
$uri = $this->responseChecker->getValue($this->client->getLastResponse(), '@id');
|
||||||
|
$this->sharedStorage->set('payment_request_uri', $uri);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @When I try to update my payment request
|
||||||
|
*/
|
||||||
|
public function iTryToUpdateMyPaymentRequest(array $payload = []): void
|
||||||
|
{
|
||||||
|
$this->putPaymentRequest($this->sharedStorage->get('payment_request_uri'), $payload);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function postPaymentRequest(array $payment, array $payload): void
|
||||||
|
{
|
||||||
|
$request = $this->requestFactory->create(
|
||||||
|
'shop',
|
||||||
|
Resources::PAYMENT_REQUESTS,
|
||||||
|
'Authorization',
|
||||||
|
$this->client->getToken(),
|
||||||
|
);
|
||||||
|
|
||||||
|
$request->setContent([
|
||||||
|
'paymentId' => $payment['id'],
|
||||||
|
'paymentMethodCode' => $payment['method'],
|
||||||
|
'payload' => $payload,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->client->executeCustomRequest($request);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function putPaymentRequest(string $paymentRequestUri, array $payload = []): void
|
||||||
|
{
|
||||||
|
$request = $this->requestFactory->custom(
|
||||||
|
$paymentRequestUri,
|
||||||
|
HttpRequest::METHOD_PUT,
|
||||||
|
[],
|
||||||
|
$this->client->getToken(),
|
||||||
|
);
|
||||||
|
|
||||||
|
$request->setContent([
|
||||||
|
'payload' => $payload,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->client->executeCustomRequest($request);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -17,14 +17,13 @@ use Behat\Behat\Context\Context;
|
||||||
use Doctrine\Persistence\ObjectManager;
|
use Doctrine\Persistence\ObjectManager;
|
||||||
use Sylius\Behat\Service\SharedStorageInterface;
|
use Sylius\Behat\Service\SharedStorageInterface;
|
||||||
use Sylius\Bundle\CoreBundle\Fixture\Factory\ExampleFactoryInterface;
|
use Sylius\Bundle\CoreBundle\Fixture\Factory\ExampleFactoryInterface;
|
||||||
|
use Sylius\Bundle\PayumBundle\Model\GatewayConfigInterface;
|
||||||
use Sylius\Component\Core\Formatter\StringInflector;
|
use Sylius\Component\Core\Formatter\StringInflector;
|
||||||
use Sylius\Component\Core\Model\ChannelInterface;
|
use Sylius\Component\Core\Model\ChannelInterface;
|
||||||
use Sylius\Component\Core\Model\OrderInterface;
|
|
||||||
use Sylius\Component\Core\Model\PaymentMethodInterface;
|
use Sylius\Component\Core\Model\PaymentMethodInterface;
|
||||||
use Sylius\Component\Payment\Model\PaymentMethodTranslationInterface;
|
use Sylius\Component\Payment\Model\PaymentMethodTranslationInterface;
|
||||||
use Sylius\Component\Payment\Repository\PaymentMethodRepositoryInterface;
|
use Sylius\Component\Payment\Repository\PaymentMethodRepositoryInterface;
|
||||||
use Sylius\Resource\Factory\FactoryInterface;
|
use Sylius\Resource\Factory\FactoryInterface;
|
||||||
use Webmozart\Assert\Assert;
|
|
||||||
|
|
||||||
final readonly class PaymentContext implements Context
|
final readonly class PaymentContext implements Context
|
||||||
{
|
{
|
||||||
|
|
@ -71,7 +70,7 @@ final readonly class PaymentContext implements Context
|
||||||
/**
|
/**
|
||||||
* @Given /^the store allows paying (\w+) for (all channels)$/
|
* @Given /^the store allows paying (\w+) for (all channels)$/
|
||||||
*/
|
*/
|
||||||
public function storeAllowsPayingForAllChannels($paymentMethodName, array $channels)
|
public function storeAllowsPayingForAllChannels($paymentMethodName, array $channels): void
|
||||||
{
|
{
|
||||||
$paymentMethod = $this->createPaymentMethod($paymentMethodName, StringInflector::nameToUppercaseCode($paymentMethodName), 'Offline', 'Payment method', false);
|
$paymentMethod = $this->createPaymentMethod($paymentMethodName, StringInflector::nameToUppercaseCode($paymentMethodName), 'Offline', 'Payment method', false);
|
||||||
|
|
||||||
|
|
@ -91,7 +90,7 @@ final readonly class PaymentContext implements Context
|
||||||
/**
|
/**
|
||||||
* @Given /^(this payment method) is named "([^"]+)" in the "([^"]+)" locale$/
|
* @Given /^(this payment method) is named "([^"]+)" in the "([^"]+)" locale$/
|
||||||
*/
|
*/
|
||||||
public function thisPaymentMethodIsNamedIn(PaymentMethodInterface $paymentMethod, $name, $locale)
|
public function thisPaymentMethodIsNamedIn(PaymentMethodInterface $paymentMethod, $name, $locale): void
|
||||||
{
|
{
|
||||||
/** @var PaymentMethodTranslationInterface $translation */
|
/** @var PaymentMethodTranslationInterface $translation */
|
||||||
$translation = $this->paymentMethodTranslationFactory->createNew();
|
$translation = $this->paymentMethodTranslationFactory->createNew();
|
||||||
|
|
@ -108,7 +107,7 @@ final readonly class PaymentContext implements Context
|
||||||
* @Given /^(this payment method) (?:has been|is) disabled$/
|
* @Given /^(this payment method) (?:has been|is) disabled$/
|
||||||
* @When the payment method :paymentMethod gets disabled
|
* @When the payment method :paymentMethod gets disabled
|
||||||
*/
|
*/
|
||||||
public function theStoreHasAPaymentMethodDisabled(PaymentMethodInterface $paymentMethod)
|
public function theStoreHasAPaymentMethodDisabled(PaymentMethodInterface $paymentMethod): void
|
||||||
{
|
{
|
||||||
$paymentMethod->disable();
|
$paymentMethod->disable();
|
||||||
|
|
||||||
|
|
@ -118,7 +117,7 @@ final readonly class PaymentContext implements Context
|
||||||
/**
|
/**
|
||||||
* @Given /^(it) has instructions "([^"]+)"$/
|
* @Given /^(it) has instructions "([^"]+)"$/
|
||||||
*/
|
*/
|
||||||
public function itHasInstructions(PaymentMethodInterface $paymentMethod, $instructions)
|
public function itHasInstructions(PaymentMethodInterface $paymentMethod, $instructions): void
|
||||||
{
|
{
|
||||||
$paymentMethod->setInstructions($instructions);
|
$paymentMethod->setInstructions($instructions);
|
||||||
|
|
||||||
|
|
@ -128,7 +127,7 @@ final readonly class PaymentContext implements Context
|
||||||
/**
|
/**
|
||||||
* @Given the store has :paymentMethodName payment method not assigned to any channel
|
* @Given the store has :paymentMethodName payment method not assigned to any channel
|
||||||
*/
|
*/
|
||||||
public function theStoreHasPaymentMethodNotAssignedToAnyChannel($paymentMethodName)
|
public function theStoreHasPaymentMethodNotAssignedToAnyChannel(string $paymentMethodName): void
|
||||||
{
|
{
|
||||||
$this->createPaymentMethod($paymentMethodName, 'PM_' . $paymentMethodName, 'Offline', 'Payment method', false);
|
$this->createPaymentMethod($paymentMethodName, 'PM_' . $paymentMethodName, 'Offline', 'Payment method', false);
|
||||||
}
|
}
|
||||||
|
|
@ -136,8 +135,9 @@ final readonly class PaymentContext implements Context
|
||||||
/**
|
/**
|
||||||
* @Given the payment method :paymentMethod requires authorization before capturing
|
* @Given the payment method :paymentMethod requires authorization before capturing
|
||||||
*/
|
*/
|
||||||
public function thePaymentMethodRequiresAuthorizationBeforeCapturing(PaymentMethodInterface $paymentMethod)
|
public function thePaymentMethodRequiresAuthorizationBeforeCapturing(PaymentMethodInterface $paymentMethod): void
|
||||||
{
|
{
|
||||||
|
/** @var GatewayConfigInterface $config */
|
||||||
$config = $paymentMethod->getGatewayConfig();
|
$config = $paymentMethod->getGatewayConfig();
|
||||||
$config->setConfig(array_merge($config->getConfig(), ['use_authorize' => true]));
|
$config->setConfig(array_merge($config->getConfig(), ['use_authorize' => true]));
|
||||||
$paymentMethod->setGatewayConfig($config);
|
$paymentMethod->setGatewayConfig($config);
|
||||||
|
|
@ -161,16 +161,6 @@ final readonly class PaymentContext implements Context
|
||||||
$paymentMethod->addChannel($channel);
|
$paymentMethod->addChannel($channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @Then /^the (latest order) should have a payment with state "([^"]+)"$/
|
|
||||||
*/
|
|
||||||
public function theLatestOrderHasAuthorizedPayment(OrderInterface $order, string $state)
|
|
||||||
{
|
|
||||||
$payment = $order->getLastPayment();
|
|
||||||
|
|
||||||
Assert::eq($payment->getState(), $state);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function createPaymentMethod(
|
private function createPaymentMethod(
|
||||||
string $name,
|
string $name,
|
||||||
string $code,
|
string $code,
|
||||||
|
|
|
||||||
45
src/Sylius/Behat/Context/Setup/PaymentRequestContext.php
Normal file
45
src/Sylius/Behat/Context/Setup/PaymentRequestContext.php
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Sylius package.
|
||||||
|
*
|
||||||
|
* (c) Sylius Sp. z o.o.
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Sylius\Behat\Context\Setup;
|
||||||
|
|
||||||
|
use Behat\Behat\Context\Context;
|
||||||
|
use Sylius\Bundle\ApiBundle\Command\Payment\AddPaymentRequest;
|
||||||
|
use Sylius\Component\Core\Model\OrderInterface;
|
||||||
|
use Sylius\Component\Core\Model\PaymentMethodInterface;
|
||||||
|
use Symfony\Component\Messenger\MessageBusInterface;
|
||||||
|
|
||||||
|
final readonly class PaymentRequestContext implements Context
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
private MessageBusInterface $commandBus,
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Given the payment request action :action has been executed for order :order with the payment method :paymentMethod
|
||||||
|
*/
|
||||||
|
public function thePaymentRequestActionHasBeenExecutedForOrderWithThePaymentMethod(
|
||||||
|
string $action,
|
||||||
|
OrderInterface $order,
|
||||||
|
PaymentMethodInterface $paymentMethod
|
||||||
|
): void {
|
||||||
|
$addPaymentRequest = new AddPaymentRequest(
|
||||||
|
paymentId: $order->getLastPayment()->getId(),
|
||||||
|
paymentMethodCode: $paymentMethod->getCode(),
|
||||||
|
action: $action,
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->commandBus->dispatch($addPaymentRequest);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,129 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Sylius package.
|
||||||
|
*
|
||||||
|
* (c) Sylius Sp. z o.o.
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Sylius\Behat\Context\Ui\Admin;
|
||||||
|
|
||||||
|
use Behat\Behat\Context\Context;
|
||||||
|
use Sylius\Behat\Page\Admin\Payment\PaymentRequest\IndexPageInterface;
|
||||||
|
use Sylius\Behat\Page\Admin\Payment\PaymentRequest\ShowPageInterface;
|
||||||
|
use Sylius\Component\Core\Model\OrderInterface;
|
||||||
|
use Sylius\Component\Core\Model\PaymentMethodInterface;
|
||||||
|
use Sylius\Component\Payment\Repository\PaymentRequestRepositoryInterface;
|
||||||
|
use Webmozart\Assert\Assert;
|
||||||
|
|
||||||
|
final readonly class ManagingPaymentRequestsContext implements Context
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
private IndexPageInterface $indexPage,
|
||||||
|
private ShowPageInterface $showPage,
|
||||||
|
private PaymentRequestRepositoryInterface $paymentRequestRepository,
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @When I browse payment requests of an order :order
|
||||||
|
*/
|
||||||
|
public function iBrowseOrdersOfACustomer(OrderInterface $order): void
|
||||||
|
{
|
||||||
|
$this->indexPage->open(['paymentId' => $order->getLastPayment()->getId()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @When I view details of the payment request for the :order order
|
||||||
|
*/
|
||||||
|
public function iViewDetailsOfThePaymentRequestForTheOrder(OrderInterface $order): void
|
||||||
|
{
|
||||||
|
$payment = $order->getLastPayment();
|
||||||
|
$paymentRequest = $this->paymentRequestRepository->findOneBy(['payment' => $payment]);
|
||||||
|
|
||||||
|
$this->showPage->open([
|
||||||
|
'hash' => $paymentRequest->getHash(),
|
||||||
|
'paymentId' => $payment->getId()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @When I filter by the :action action
|
||||||
|
*/
|
||||||
|
public function iFilterByTheAction(string $action): void
|
||||||
|
{
|
||||||
|
$this->indexPage->chooseActionToFilter($action);
|
||||||
|
$this->indexPage->filter();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @When I filter by the :paymentMethod payment method
|
||||||
|
*/
|
||||||
|
public function iFilterByThePaymentMethod(PaymentMethodInterface $paymentMethod): void
|
||||||
|
{
|
||||||
|
$this->indexPage->choosePaymentMethodToFilter($paymentMethod->getName());
|
||||||
|
$this->indexPage->filter();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @When I filter by the :state state
|
||||||
|
*/
|
||||||
|
public function iFilterByTheState(string $state): void
|
||||||
|
{
|
||||||
|
$this->indexPage->chooseStateToFilter($state);
|
||||||
|
$this->indexPage->filter();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Then /^there should be (\d+) payment requests? on the list$/
|
||||||
|
*/
|
||||||
|
public function thereShouldBeProductVariantsOnTheList(int $count): void
|
||||||
|
{
|
||||||
|
Assert::same($this->indexPage->countItems(), $count);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Then it should be the payment request with action :action
|
||||||
|
*/
|
||||||
|
public function itShouldBeThePaymentRequestWithAction(string $action): void
|
||||||
|
{
|
||||||
|
Assert::true($this->indexPage->isSingleResourceOnPage(['action' => $action]));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Then it should be the payment request with payment method :paymentMethod
|
||||||
|
*/
|
||||||
|
public function itShouldBeThePaymentRequestWithPaymentMethod(PaymentMethodInterface $paymentMethod): void
|
||||||
|
{
|
||||||
|
Assert::true($this->indexPage->isSingleResourceOnPage(['method' => $paymentMethod->getName()]));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Then its :field should be :value
|
||||||
|
*/
|
||||||
|
public function itsFieldShouldBe(string $field, string $value): void
|
||||||
|
{
|
||||||
|
Assert::same($this->showPage->getFieldText($field), $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Then its payload should has empty value
|
||||||
|
*/
|
||||||
|
public function itsPayloadShouldHasEmptyValue(): void
|
||||||
|
{
|
||||||
|
Assert::same($this->showPage->getFieldText('payload'), 'null');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Then its response data should has empty value
|
||||||
|
*/
|
||||||
|
public function itsResponseDataShouldBe(): void
|
||||||
|
{
|
||||||
|
Assert::same($this->showPage->getFieldText('response_data'), json_encode([]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -80,6 +80,14 @@ final class ManagingPaymentsContext implements Context
|
||||||
$this->indexPage->chooseChannelFilter($channelName);
|
$this->indexPage->chooseChannelFilter($channelName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @When I want to view the payment requests of the first payment
|
||||||
|
*/
|
||||||
|
public function iWantToViewThePaymentRequestsOfTheFirstPayment(): void
|
||||||
|
{
|
||||||
|
$this->indexPage->showPaymentRequestOfNthPayment(1);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Then I should see :count payments in the list
|
* @Then I should see :count payments in the list
|
||||||
* @Then I should see a single payment in the list
|
* @Then I should see a single payment in the list
|
||||||
|
|
|
||||||
0
src/Sylius/Behat/Context/Ui/PaypalContext.php
Normal file
0
src/Sylius/Behat/Context/Ui/PaypalContext.php
Normal file
|
|
@ -48,6 +48,17 @@ class IndexPage extends BaseIndexPage implements IndexPageInterface
|
||||||
$this->getOrderLinkForRow($position)->clickLink('#');
|
$this->getOrderLinkForRow($position)->clickLink('#');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function showPaymentRequestOfNthPayment(int $position): void
|
||||||
|
{
|
||||||
|
$tableAccessor = $this->getTableAccessor();
|
||||||
|
$table = $this->getElement('table');
|
||||||
|
|
||||||
|
$row = $tableAccessor->getRowsWithFields($table, [])[$position];
|
||||||
|
$field = $tableAccessor->getFieldFromRow($table, $row, 'actions');
|
||||||
|
|
||||||
|
$field->find('css', '[data-test-show-action="List payment requests"]')->click();
|
||||||
|
}
|
||||||
|
|
||||||
public function chooseChannelFilter(string $channelName): void
|
public function chooseChannelFilter(string $channelName): void
|
||||||
{
|
{
|
||||||
$this->getElement('filter_channel')->selectOption($channelName);
|
$this->getElement('filter_channel')->selectOption($channelName);
|
||||||
|
|
|
||||||
|
|
@ -27,5 +27,7 @@ interface IndexPageInterface extends BaseIndexPageInterface
|
||||||
|
|
||||||
public function showOrderPageForNthPayment(int $position): void;
|
public function showOrderPageForNthPayment(int $position): void;
|
||||||
|
|
||||||
|
public function showPaymentRequestOfNthPayment(int $position): void;
|
||||||
|
|
||||||
public function chooseChannelFilter(string $channelName): void;
|
public function chooseChannelFilter(string $channelName): void;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,74 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Sylius package.
|
||||||
|
*
|
||||||
|
* (c) Sylius Sp. z o.o.
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Sylius\Behat\Page\Admin\Payment\PaymentRequest;
|
||||||
|
|
||||||
|
use Behat\Mink\Element\NodeElement;
|
||||||
|
use Behat\Mink\Session;
|
||||||
|
use Sylius\Behat\Page\Admin\Crud\IndexPage as BaseIndexPage;
|
||||||
|
use Sylius\Behat\Service\Accessor\TableAccessorInterface;
|
||||||
|
use Sylius\Behat\Service\Helper\AutocompleteHelperInterface;
|
||||||
|
use Symfony\Component\Routing\RouterInterface;
|
||||||
|
|
||||||
|
class IndexPage extends BaseIndexPage implements IndexPageInterface
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
Session $session,
|
||||||
|
$minkParameters,
|
||||||
|
RouterInterface $router,
|
||||||
|
TableAccessorInterface $tableAccessor,
|
||||||
|
string $routeName,
|
||||||
|
private readonly AutocompleteHelperInterface $autocompleteHelper,
|
||||||
|
) {
|
||||||
|
parent::__construct($session, $minkParameters, $router, $tableAccessor, $routeName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function choosePaymentMethodToFilter(string $paymentMethodName): void
|
||||||
|
{
|
||||||
|
$this->specifyAutocompleteFilter($this->getElement('filter_payment_method'), $paymentMethodName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function chooseActionToFilter(string $action): void
|
||||||
|
{
|
||||||
|
$this->getElement('filter_action')->selectOption($action);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function chooseStateToFilter(string $state): void
|
||||||
|
{
|
||||||
|
$this->getElement('filter_state')->selectOption($state);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getDefinedElements(): array
|
||||||
|
{
|
||||||
|
return array_merge(parent::getDefinedElements(), [
|
||||||
|
'filter_action' => '#criteria_action',
|
||||||
|
'filter_payment_method' => '#criteria_payment_method',
|
||||||
|
'filter_state' => '#criteria_state',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function specifyAutocompleteFilter(NodeElement $autocomplete, string $value): void
|
||||||
|
{
|
||||||
|
if (!$this->areFiltersVisible()) {
|
||||||
|
$this->toggleFilters();
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->autocompleteHelper->selectByName(
|
||||||
|
$this->getDriver(),
|
||||||
|
$autocomplete->getXpath(),
|
||||||
|
$value,
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->waitForFormUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Sylius package.
|
||||||
|
*
|
||||||
|
* (c) Sylius Sp. z o.o.
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Sylius\Behat\Page\Admin\Payment\PaymentRequest;
|
||||||
|
|
||||||
|
use Sylius\Behat\Page\Admin\Crud\IndexPageInterface as BaseIndexPageInterface;
|
||||||
|
|
||||||
|
interface IndexPageInterface extends BaseIndexPageInterface
|
||||||
|
{
|
||||||
|
public function choosePaymentMethodToFilter(string $paymentMethodName): void;
|
||||||
|
|
||||||
|
public function chooseActionToFilter(string $action): void;
|
||||||
|
|
||||||
|
public function chooseStateToFilter(string $state): void;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Sylius package.
|
||||||
|
*
|
||||||
|
* (c) Sylius Sp. z o.o.
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Sylius\Behat\Page\Admin\Payment\PaymentRequest;
|
||||||
|
|
||||||
|
use FriendsOfBehat\PageObjectExtension\Page\SymfonyPage;
|
||||||
|
|
||||||
|
class ShowPage extends SymfonyPage implements ShowPageInterface
|
||||||
|
{
|
||||||
|
public function getRouteName(): string
|
||||||
|
{
|
||||||
|
return 'sylius_admin_payment_request_show';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFieldText(string $fieldName): string
|
||||||
|
{
|
||||||
|
return $this->getElement($fieldName)->getText();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getDefinedElements(): array
|
||||||
|
{
|
||||||
|
return array_merge(parent::getDefinedElements(), [
|
||||||
|
'action' => '[data-test-action]',
|
||||||
|
'method' => '[data-test-method]',
|
||||||
|
'payload' => '[data-test-payload]',
|
||||||
|
'response_data' => '[data-test-response-data]',
|
||||||
|
'state' => '[data-test-state]',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Sylius package.
|
||||||
|
*
|
||||||
|
* (c) Sylius Sp. z o.o.
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Sylius\Behat\Page\Admin\Payment\PaymentRequest;
|
||||||
|
|
||||||
|
use FriendsOfBehat\PageObjectExtension\Page\SymfonyPageInterface;
|
||||||
|
|
||||||
|
interface ShowPageInterface extends SymfonyPageInterface
|
||||||
|
{
|
||||||
|
public function getFieldText(string $fieldName): string;
|
||||||
|
}
|
||||||
|
|
@ -302,5 +302,12 @@
|
||||||
<argument type="service" id="api_platform.symfony.iri_converter" />
|
<argument type="service" id="api_platform.symfony.iri_converter" />
|
||||||
<argument type="service" id="sylius.behat.shared_storage" />
|
<argument type="service" id="sylius.behat.shared_storage" />
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
|
<service id="sylius.behat.context.api.admin.managing_payment_requests" class="Sylius\Behat\Context\Api\Admin\ManagingPaymentRequestsContext">
|
||||||
|
<argument type="service" id="sylius.behat.api_platform_client.admin" />
|
||||||
|
<argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />
|
||||||
|
<argument type="service" id="api_platform.symfony.iri_converter" />
|
||||||
|
<argument type="service" id="sylius.repository.payment_request" />
|
||||||
|
</service>
|
||||||
</services>
|
</services>
|
||||||
</container>
|
</container>
|
||||||
|
|
|
||||||
|
|
@ -161,6 +161,13 @@
|
||||||
<argument type="service" id="sylius.behat.shared_storage" />
|
<argument type="service" id="sylius.behat.shared_storage" />
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
|
<service id="sylius.behat.context.api.shop.payment_request" class="Sylius\Behat\Context\Api\Shop\PaymentRequestContext">
|
||||||
|
<argument type="service" id="sylius.behat.shared_storage" />
|
||||||
|
<argument type="service" id="sylius.behat.api_platform_client.shop" />
|
||||||
|
<argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />
|
||||||
|
<argument type="service" id="sylius.behat.request_factory" />
|
||||||
|
</service>
|
||||||
|
|
||||||
<service id="sylius.behat.context.api.shop.payment" class="Sylius\Behat\Context\Api\Shop\PaymentContext">
|
<service id="sylius.behat.context.api.shop.payment" class="Sylius\Behat\Context\Api\Shop\PaymentContext">
|
||||||
<argument type="service" id="sylius.behat.api_platform_client.shop" />
|
<argument type="service" id="sylius.behat.api_platform_client.shop" />
|
||||||
<argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />
|
<argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />
|
||||||
|
|
@ -191,6 +198,12 @@
|
||||||
<argument type="service" id="sylius.behat.api_platform_client.shop" />
|
<argument type="service" id="sylius.behat.api_platform_client.shop" />
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
|
<service id="sylius.behat.context.api.shop.checkout.order_details" class="Sylius\Behat\Context\Api\Shop\Checkout\CheckoutOrderDetailsContext">
|
||||||
|
<argument type="service" id="sylius.behat.shared_storage" />
|
||||||
|
<argument type="service" id="sylius.behat.api_platform_client.shop" />
|
||||||
|
<argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />
|
||||||
|
</service>
|
||||||
|
|
||||||
<service id="sylius.behat.context.api.shop.taxon" class="Sylius\Behat\Context\Api\Shop\TaxonContext">
|
<service id="sylius.behat.context.api.shop.taxon" class="Sylius\Behat\Context\Api\Shop\TaxonContext">
|
||||||
<argument type="service" id="sylius.behat.api_platform_client.shop" />
|
<argument type="service" id="sylius.behat.api_platform_client.shop" />
|
||||||
<argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />
|
<argument type="service" id="Sylius\Behat\Client\ResponseCheckerInterface" />
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,6 @@
|
||||||
<argument type="collection">
|
<argument type="collection">
|
||||||
<argument key="offline">Offline</argument>
|
<argument key="offline">Offline</argument>
|
||||||
</argument>
|
</argument>
|
||||||
|
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
<service id="Sylius\Behat\Context\Setup\PriceHistoryContext">
|
<service id="Sylius\Behat\Context\Setup\PriceHistoryContext">
|
||||||
|
|
@ -320,5 +319,9 @@
|
||||||
<argument type="service" id="sylius.event_bus" />
|
<argument type="service" id="sylius.event_bus" />
|
||||||
<argument type="service" id="sylius.behat.shared_storage" />
|
<argument type="service" id="sylius.behat.shared_storage" />
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
|
<service id="sylius.behat.context.setup.payment_request" class="Sylius\Behat\Context\Setup\PaymentRequestContext">
|
||||||
|
<argument type="service" id="sylius.command_bus" />
|
||||||
|
</service>
|
||||||
</services>
|
</services>
|
||||||
</container>
|
</container>
|
||||||
|
|
|
||||||
|
|
@ -613,5 +613,11 @@
|
||||||
<service id="sylius.behat.context.ui.admin.search_filter" class="Sylius\Behat\Context\Ui\Admin\SearchFilterContext">
|
<service id="sylius.behat.context.ui.admin.search_filter" class="Sylius\Behat\Context\Ui\Admin\SearchFilterContext">
|
||||||
<argument type="service" id="sylius.behat.element.admin.crud.index.search_filter" />
|
<argument type="service" id="sylius.behat.element.admin.crud.index.search_filter" />
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
|
<service id="sylius.behat.context.ui.admin.managing_payment_requests" class="Sylius\Behat\Context\Ui\Admin\ManagingPaymentRequestsContext">
|
||||||
|
<argument type="service" id="sylius.behat.page.admin.payment.payment_request.index" />
|
||||||
|
<argument type="service" id="sylius.behat.page.admin.payment.payment_request.show"/>
|
||||||
|
<argument type="service" id="sylius.repository.payment_request"/>
|
||||||
|
</service>
|
||||||
</services>
|
</services>
|
||||||
</container>
|
</container>
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@
|
||||||
<container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
|
<container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
|
||||||
<parameters>
|
<parameters>
|
||||||
<parameter key="sylius.behat.page.admin.payment.index.class">Sylius\Behat\Page\Admin\Payment\IndexPage</parameter>
|
<parameter key="sylius.behat.page.admin.payment.index.class">Sylius\Behat\Page\Admin\Payment\IndexPage</parameter>
|
||||||
|
<parameter key="sylius.behat.page.admin.payment.payment_request.index.class">Sylius\Behat\Page\Admin\Payment\PaymentRequest\IndexPage</parameter>
|
||||||
|
<parameter key="sylius.behat.page.admin.payment.payment_request.show.class">Sylius\Behat\Page\Admin\Payment\PaymentRequest\ShowPage</parameter>
|
||||||
</parameters>
|
</parameters>
|
||||||
|
|
||||||
<services>
|
<services>
|
||||||
|
|
@ -22,5 +24,21 @@
|
||||||
<service id="sylius.behat.page.admin.payment.index" class="%sylius.behat.page.admin.payment.index.class%" parent="sylius.behat.page.admin.crud.index" public="false">
|
<service id="sylius.behat.page.admin.payment.index" class="%sylius.behat.page.admin.payment.index.class%" parent="sylius.behat.page.admin.crud.index" public="false">
|
||||||
<argument type="string">sylius_admin_payment_index</argument>
|
<argument type="string">sylius_admin_payment_index</argument>
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
|
<service
|
||||||
|
id="sylius.behat.page.admin.payment.payment_request.index"
|
||||||
|
class="%sylius.behat.page.admin.payment.payment_request.index.class%"
|
||||||
|
parent="sylius.behat.page.admin.crud.index"
|
||||||
|
>
|
||||||
|
<argument type="string">sylius_admin_payment_request_index</argument>
|
||||||
|
<argument type="service" id="Sylius\Behat\Service\Helper\AutocompleteHelperInterface" />
|
||||||
|
</service>
|
||||||
|
|
||||||
|
<service
|
||||||
|
id="sylius.behat.page.admin.payment.payment_request.show"
|
||||||
|
class="%sylius.behat.page.admin.payment.payment_request.show.class%"
|
||||||
|
parent="sylius.behat.symfony_page"
|
||||||
|
>
|
||||||
|
</service>
|
||||||
</services>
|
</services>
|
||||||
</container>
|
</container>
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,10 @@ default:
|
||||||
- sylius.behat.context.transform.cart
|
- sylius.behat.context.transform.cart
|
||||||
- sylius.behat.context.transform.channel
|
- sylius.behat.context.transform.channel
|
||||||
- sylius.behat.context.transform.country
|
- sylius.behat.context.transform.country
|
||||||
|
- sylius.behat.context.transform.customer
|
||||||
- sylius.behat.context.transform.lexical
|
- sylius.behat.context.transform.lexical
|
||||||
- sylius.behat.context.transform.locale
|
- sylius.behat.context.transform.locale
|
||||||
|
- sylius.behat.context.transform.order
|
||||||
- sylius.behat.context.transform.payment
|
- sylius.behat.context.transform.payment
|
||||||
- sylius.behat.context.transform.product
|
- sylius.behat.context.transform.product
|
||||||
- sylius.behat.context.transform.product_variant
|
- sylius.behat.context.transform.product_variant
|
||||||
|
|
@ -25,6 +27,7 @@ default:
|
||||||
|
|
||||||
- sylius.behat.context.setup.cart
|
- sylius.behat.context.setup.cart
|
||||||
- sylius.behat.context.setup.channel
|
- sylius.behat.context.setup.channel
|
||||||
|
- sylius.behat.context.setup.currency
|
||||||
- sylius.behat.context.setup.checkout
|
- sylius.behat.context.setup.checkout
|
||||||
- sylius.behat.context.setup.checkout.address
|
- sylius.behat.context.setup.checkout.address
|
||||||
- sylius.behat.context.setup.geographical
|
- sylius.behat.context.setup.geographical
|
||||||
|
|
@ -35,12 +38,15 @@ default:
|
||||||
- sylius.behat.context.setup.shipping
|
- sylius.behat.context.setup.shipping
|
||||||
- sylius.behat.context.setup.shop_api_security
|
- sylius.behat.context.setup.shop_api_security
|
||||||
- sylius.behat.context.setup.taxation
|
- sylius.behat.context.setup.taxation
|
||||||
|
- sylius.behat.context.setup.user
|
||||||
- sylius.behat.context.setup.zone
|
- sylius.behat.context.setup.zone
|
||||||
|
|
||||||
- sylius.behat.context.api.shop.cart
|
- sylius.behat.context.api.shop.cart
|
||||||
- sylius.behat.context.api.shop.checkout
|
- sylius.behat.context.api.shop.checkout
|
||||||
- sylius.behat.context.api.shop.checkout.complete
|
- sylius.behat.context.api.shop.checkout.complete
|
||||||
|
- sylius.behat.context.api.shop.checkout.order_details
|
||||||
- sylius.behat.context.api.shop.order
|
- sylius.behat.context.api.shop.order
|
||||||
|
- sylius.behat.context.api.shop.payment_request
|
||||||
- sylius.behat.context.api.shop.response
|
- sylius.behat.context.api.shop.response
|
||||||
|
|
||||||
filters:
|
filters:
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ default:
|
||||||
- sylius.behat.context.transform.customer
|
- sylius.behat.context.transform.customer
|
||||||
- sylius.behat.context.transform.lexical
|
- sylius.behat.context.transform.lexical
|
||||||
- sylius.behat.context.transform.order
|
- sylius.behat.context.transform.order
|
||||||
|
- sylius.behat.context.transform.payment
|
||||||
- sylius.behat.context.transform.product
|
- sylius.behat.context.transform.product
|
||||||
- sylius.behat.context.transform.shared_storage
|
- sylius.behat.context.transform.shared_storage
|
||||||
|
|
||||||
|
|
@ -18,10 +19,12 @@ default:
|
||||||
- sylius.behat.context.setup.channel
|
- sylius.behat.context.setup.channel
|
||||||
- sylius.behat.context.setup.order
|
- sylius.behat.context.setup.order
|
||||||
- sylius.behat.context.setup.payment
|
- sylius.behat.context.setup.payment
|
||||||
|
- sylius.behat.context.setup.payment_request
|
||||||
- sylius.behat.context.setup.product
|
- sylius.behat.context.setup.product
|
||||||
- sylius.behat.context.setup.shipping
|
- sylius.behat.context.setup.shipping
|
||||||
|
|
||||||
- sylius.behat.context.api.admin.managing_payments
|
- sylius.behat.context.api.admin.managing_payments
|
||||||
|
- sylius.behat.context.api.admin.managing_payment_requests
|
||||||
|
|
||||||
filters:
|
filters:
|
||||||
tags: "@managing_payments&&@api"
|
tags: "@managing_payments&&@api"
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ default:
|
||||||
- sylius.behat.context.setup.geographical
|
- sylius.behat.context.setup.geographical
|
||||||
- sylius.behat.context.setup.order
|
- sylius.behat.context.setup.order
|
||||||
- sylius.behat.context.setup.payment
|
- sylius.behat.context.setup.payment
|
||||||
|
- sylius.behat.context.setup.payment_request
|
||||||
- sylius.behat.context.setup.product
|
- sylius.behat.context.setup.product
|
||||||
- sylius.behat.context.setup.shipping
|
- sylius.behat.context.setup.shipping
|
||||||
- sylius.behat.context.setup.zone
|
- sylius.behat.context.setup.zone
|
||||||
|
|
@ -30,6 +31,7 @@ default:
|
||||||
- sylius.behat.context.ui.email
|
- sylius.behat.context.ui.email
|
||||||
|
|
||||||
- sylius.behat.context.ui.admin.managing_payments
|
- sylius.behat.context.ui.admin.managing_payments
|
||||||
|
- sylius.behat.context.ui.admin.managing_payment_requests
|
||||||
- sylius.behat.context.ui.shop.cart
|
- sylius.behat.context.ui.shop.cart
|
||||||
filters:
|
filters:
|
||||||
tags: "@managing_payments&&@ui"
|
tags: "@managing_payments&&@ui"
|
||||||
|
|
|
||||||
|
|
@ -124,6 +124,8 @@ twig_hooks:
|
||||||
template: '@SyliusAdmin/order/show/content/sections/payments/item/actions.html.twig'
|
template: '@SyliusAdmin/order/show/content/sections/payments/item/actions.html.twig'
|
||||||
|
|
||||||
'sylius_admin.order.show.content.sections.payments.item.actions':
|
'sylius_admin.order.show.content.sections.payments.item.actions':
|
||||||
|
list_payment_requests:
|
||||||
|
template: '@SyliusAdmin/order/show/content/sections/payments/item/actions/list_payment_requests.html.twig'
|
||||||
complete:
|
complete:
|
||||||
template: '@SyliusAdmin/order/show/content/sections/payments/item/actions/complete.html.twig'
|
template: '@SyliusAdmin/order/show/content/sections/payments/item/actions/complete.html.twig'
|
||||||
refund:
|
refund:
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
twig_hooks:
|
||||||
|
hooks:
|
||||||
|
'sylius_admin.payment_request.index.content.header':
|
||||||
|
breadcrumbs:
|
||||||
|
template: '@SyliusAdmin/payment_request/index/content/header/breadcrumbs.html.twig'
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
twig_hooks:
|
||||||
|
hooks:
|
||||||
|
'sylius_admin.payment_request.show.content':
|
||||||
|
sections:
|
||||||
|
template: '@SyliusAdmin/payment_request/show/content/sections.html.twig'
|
||||||
|
|
||||||
|
'sylius_admin.payment_request.show.content.header':
|
||||||
|
breadcrumbs:
|
||||||
|
template: '@SyliusAdmin/payment_request/show/content/header/breadcrumbs.html.twig'
|
||||||
|
|
||||||
|
'sylius_admin.payment_request.show.content.sections':
|
||||||
|
general:
|
||||||
|
template: '@SyliusAdmin/payment_request/show/content/sections/general.html.twig'
|
||||||
|
|
||||||
|
'sylius_admin.payment_request.show.content.sections#left':
|
||||||
|
payload:
|
||||||
|
template: '@SyliusAdmin/payment_request/show/content/sections/payload.html.twig'
|
||||||
|
|
||||||
|
'sylius_admin.payment_request.show.content.sections#right':
|
||||||
|
response_data:
|
||||||
|
template: '@SyliusAdmin/payment_request/show/content/sections/response_data.html.twig'
|
||||||
|
|
||||||
|
'sylius_admin.payment_request.show.content.sections.general':
|
||||||
|
hash:
|
||||||
|
template: '@SyliusAdmin/payment_request/show/content/sections/general/hash.html.twig'
|
||||||
|
method:
|
||||||
|
template: '@SyliusAdmin/payment_request/show/content/sections/general/method.html.twig'
|
||||||
|
action:
|
||||||
|
template: '@SyliusAdmin/payment_request/show/content/sections/general/action.html.twig'
|
||||||
|
state:
|
||||||
|
template: '@SyliusAdmin/payment_request/show/content/sections/general/state.html.twig'
|
||||||
|
created_at:
|
||||||
|
template: '@SyliusAdmin/payment_request/show/content/sections/general/created_at.html.twig'
|
||||||
|
updated_at:
|
||||||
|
template: '@SyliusAdmin/payment_request/show/content/sections/general/updated_at.html.twig'
|
||||||
|
|
@ -69,6 +69,15 @@ sylius_grid:
|
||||||
class: "%sylius.model.channel.class%"
|
class: "%sylius.model.channel.class%"
|
||||||
actions:
|
actions:
|
||||||
item:
|
item:
|
||||||
|
list_payment_requests:
|
||||||
|
type: show
|
||||||
|
icon: list_letters
|
||||||
|
label: sylius.ui.list_payment_requests
|
||||||
|
options:
|
||||||
|
link:
|
||||||
|
route: sylius_admin_payment_request_index
|
||||||
|
parameters:
|
||||||
|
paymentId: resource.id
|
||||||
complete:
|
complete:
|
||||||
type: apply_transition
|
type: apply_transition
|
||||||
label: sylius.ui.complete
|
label: sylius.ui.complete
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,93 @@
|
||||||
|
sylius_grid:
|
||||||
|
grids:
|
||||||
|
sylius_admin_payment_request:
|
||||||
|
driver:
|
||||||
|
name: doctrine/orm
|
||||||
|
options:
|
||||||
|
class: "%sylius.model.payment_request.class%"
|
||||||
|
repository:
|
||||||
|
method: createQueryBuilderForPayment
|
||||||
|
arguments:
|
||||||
|
paymentId: $paymentId
|
||||||
|
sorting:
|
||||||
|
createdAt: desc
|
||||||
|
fields:
|
||||||
|
hash:
|
||||||
|
type: string
|
||||||
|
label: sylius.ui.hash
|
||||||
|
sortable: ~
|
||||||
|
method:
|
||||||
|
type: twig
|
||||||
|
label: sylius.ui.payment_method
|
||||||
|
path: .
|
||||||
|
options:
|
||||||
|
template: "@SyliusAdmin/payment_request/grid/field/method.html.twig"
|
||||||
|
action:
|
||||||
|
type: twig
|
||||||
|
label: sylius.ui.action
|
||||||
|
options:
|
||||||
|
template: "@SyliusAdmin/payment_request/grid/field/action.html.twig"
|
||||||
|
state:
|
||||||
|
type: twig
|
||||||
|
label: sylius.ui.state
|
||||||
|
options:
|
||||||
|
template: "@SyliusAdmin/payment_request/grid/field/state.html.twig"
|
||||||
|
createdAt:
|
||||||
|
type: twig
|
||||||
|
label: sylius.ui.creation_date
|
||||||
|
sortable: ~
|
||||||
|
options:
|
||||||
|
template: "@SyliusAdmin/shared/grid/field/date.html.twig"
|
||||||
|
vars:
|
||||||
|
th_class: "w-1 text-center"
|
||||||
|
updatedAt:
|
||||||
|
type: twig
|
||||||
|
label: sylius.ui.updating_date
|
||||||
|
sortable: ~
|
||||||
|
options:
|
||||||
|
template: "@SyliusAdmin/shared/grid/field/date.html.twig"
|
||||||
|
vars:
|
||||||
|
th_class: "w-1 text-center"
|
||||||
|
filters:
|
||||||
|
payment_method:
|
||||||
|
type: ux_translatable_autocomplete
|
||||||
|
label: sylius.ui.payment_method
|
||||||
|
form_options:
|
||||||
|
extra_options:
|
||||||
|
class: "%sylius.model.payment_method.class%"
|
||||||
|
translation_fields: [ name ]
|
||||||
|
choice_label: name
|
||||||
|
options:
|
||||||
|
fields: [ method.id ]
|
||||||
|
action:
|
||||||
|
type: select
|
||||||
|
label: sylius.ui.action
|
||||||
|
form_options:
|
||||||
|
choices:
|
||||||
|
sylius.ui.authorize: !php/const Sylius\Component\Payment\Model\PaymentRequestInterface::ACTION_AUTHORIZE
|
||||||
|
sylius.ui.cancel: !php/const Sylius\Component\Payment\Model\PaymentRequestInterface::ACTION_CANCEL
|
||||||
|
sylius.ui.capture: !php/const Sylius\Component\Payment\Model\PaymentRequestInterface::ACTION_CAPTURE
|
||||||
|
sylius.ui.payout: !php/const Sylius\Component\Payment\Model\PaymentRequestInterface::ACTION_PAYOUT
|
||||||
|
sylius.ui.refund: !php/const Sylius\Component\Payment\Model\PaymentRequestInterface::ACTION_REFUND
|
||||||
|
sylius.ui.status: !php/const Sylius\Component\Payment\Model\PaymentRequestInterface::ACTION_STATUS
|
||||||
|
sylius.ui.sync: !php/const Sylius\Component\Payment\Model\PaymentRequestInterface::ACTION_SYNC
|
||||||
|
state:
|
||||||
|
type: select
|
||||||
|
label: sylius.ui.state
|
||||||
|
form_options:
|
||||||
|
choices:
|
||||||
|
sylius.ui.cancelled: !php/const Sylius\Component\Payment\Model\PaymentRequestInterface::STATE_CANCELLED
|
||||||
|
sylius.ui.completed: !php/const Sylius\Component\Payment\Model\PaymentRequestInterface::STATE_COMPLETED
|
||||||
|
sylius.ui.failed: !php/const Sylius\Component\Payment\Model\PaymentRequestInterface::STATE_FAILED
|
||||||
|
sylius.ui.new: !php/const Sylius\Component\Payment\Model\PaymentRequestInterface::STATE_NEW
|
||||||
|
sylius.ui.processing: !php/const Sylius\Component\Payment\Model\PaymentRequestInterface::STATE_PROCESSING
|
||||||
|
actions:
|
||||||
|
item:
|
||||||
|
show:
|
||||||
|
type: show
|
||||||
|
options:
|
||||||
|
link:
|
||||||
|
route: sylius_admin_payment_request_show
|
||||||
|
parameters:
|
||||||
|
hash: resource.hash
|
||||||
|
paymentId: resource.payment.id
|
||||||
|
|
@ -53,6 +53,10 @@ sylius_admin_payment:
|
||||||
sylius_admin_payment_method:
|
sylius_admin_payment_method:
|
||||||
resource: "@SyliusAdminBundle/Resources/config/routing/payment_method.yml"
|
resource: "@SyliusAdminBundle/Resources/config/routing/payment_method.yml"
|
||||||
|
|
||||||
|
sylius_admin_payment_request:
|
||||||
|
resource: "@SyliusAdminBundle/Resources/config/routing/payment_request.yaml"
|
||||||
|
prefix: /payments/{paymentId}/payment-requests/
|
||||||
|
|
||||||
sylius_admin_product:
|
sylius_admin_product:
|
||||||
resource: "@SyliusAdminBundle/Resources/config/routing/product.yml"
|
resource: "@SyliusAdminBundle/Resources/config/routing/product.yml"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
sylius_admin_payment_request_index:
|
||||||
|
path: /
|
||||||
|
methods: [GET]
|
||||||
|
defaults:
|
||||||
|
_controller: sylius.controller.payment_request::indexAction
|
||||||
|
_sylius:
|
||||||
|
section: admin
|
||||||
|
permission: true
|
||||||
|
template: "@SyliusAdmin/shared/crud/index.html.twig"
|
||||||
|
grid: sylius_admin_payment_request
|
||||||
|
|
||||||
|
sylius_admin_payment_request_show:
|
||||||
|
path: /{hash}
|
||||||
|
methods: [GET]
|
||||||
|
defaults:
|
||||||
|
_controller: sylius.controller.payment_request::showAction
|
||||||
|
_sylius:
|
||||||
|
section: admin
|
||||||
|
permission: true
|
||||||
|
template: "@SyliusAdmin/shared/crud/show.html.twig"
|
||||||
|
repository:
|
||||||
|
method: findOneByPaymentId
|
||||||
|
arguments:
|
||||||
|
hash: $hash
|
||||||
|
paymentId: $paymentId
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<td>
|
<td>
|
||||||
<div class="d-flex justify-content-end">
|
<div class="d-flex gap-1 justify-content-end">
|
||||||
{% hook 'actions' %}
|
{% hook 'actions' %}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{% from '@SyliusAdmin/shared/helper/icon.html.twig' import icon %}
|
||||||
|
|
||||||
|
{% set payment = hookable_metadata.context.payment %}
|
||||||
|
|
||||||
|
<a title="details" href="{{ path('sylius_admin_payment_request_index', {'paymentId': payment.id}) }}" class="btn btn-icon" data-bs-toggle="tooltip" data-bs-title="{{ 'sylius.ui.list_payment_requests'|trans }}" {{ sylius_test_html_attribute('list_payment_requests') }}>
|
||||||
|
{{ icon({ icon: 'list_letters', class: 'icon icon-tabler' }) }}
|
||||||
|
</a>
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
<span class="badge bg-red-lt">
|
||||||
|
{{ 'sylius.ui.cancelled'|trans }}
|
||||||
|
</span>
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
<span class="badge bg-green-lt">
|
||||||
|
{{ 'sylius.ui.completed'|trans }}
|
||||||
|
</span>
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
<span class="badge bg-red-lt">
|
||||||
|
{{ 'sylius.ui.failed'|trans }}
|
||||||
|
</span>
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
<span class="badge">
|
||||||
|
{{ 'sylius.ui.new'|trans }}
|
||||||
|
</span>
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
<span class="badge bg-blue-lt">
|
||||||
|
{{ 'sylius.ui.processing'|trans }}
|
||||||
|
</span>
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
{{ ('sylius.ui.' ~ data)|trans }}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
<a class="fw-medium" href="{{ path('sylius_admin_payment_method_update', {'id' : data.method.id }) }}">{{ data.method.name }}</a>
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
{{ include('@SyliusAdmin/payment_request/common/label/state/' ~ data ~ '.html.twig') }}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
{% from '@SyliusAdmin/shared/helper/breadcrumbs.html.twig' import breadcrumbs %}
|
||||||
|
|
||||||
|
{% set configuration = hookable_metadata.context.resources.requestConfiguration %}
|
||||||
|
|
||||||
|
{{ breadcrumbs([
|
||||||
|
{ name: 'sylius.ui.dashboard', url: path('sylius_admin_dashboard'), active: false },
|
||||||
|
{ name: 'sylius.ui.payments'|trans, url: path('sylius_admin_payment_index'), active: false },
|
||||||
|
{ name: configuration.request.get('id'), active: false },
|
||||||
|
{ name: 'sylius.ui.payment_requests'|trans, active: true },
|
||||||
|
]) }}
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
{% from '@SyliusAdmin/shared/helper/breadcrumbs.html.twig' import breadcrumbs %}
|
||||||
|
|
||||||
|
{% set payment_request = hookable_metadata.context.resource %}
|
||||||
|
{% set payment_id = payment_request.payment.id %}
|
||||||
|
|
||||||
|
{{ breadcrumbs([
|
||||||
|
{ name: 'sylius.ui.dashboard', url: path('sylius_admin_dashboard'), active: false },
|
||||||
|
{ name: 'sylius.ui.payments'|trans, url: path('sylius_admin_payment_index'), active: false },
|
||||||
|
{ name: payment_id, active: false },
|
||||||
|
{ name: 'sylius.ui.payment_requests'|trans, url: path('sylius_admin_payment_request_index', {'paymentId': payment_id}), active: false },
|
||||||
|
{ name: payment_request.hash, active: true },
|
||||||
|
]) }}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
<div class="page-body">
|
||||||
|
<div class="container-xl">
|
||||||
|
{% hook 'sections' %}
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12 col-lg-6">
|
||||||
|
{% hook 'sections#left' %}
|
||||||
|
</div>
|
||||||
|
<div class="col-12 col-lg-6">
|
||||||
|
{% hook 'sections#right' %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
<div class="card mb-3">
|
||||||
|
<div class="card-header">
|
||||||
|
<div class="card-title">
|
||||||
|
{{ 'sylius.ui.general'|trans }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="divide-y">
|
||||||
|
{% hook 'general' %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12 col-md-4 fw-bold">{{ 'sylius.ui.action'|trans }}</div>
|
||||||
|
<div class="col-12 col-md-8" {{ sylius_test_html_attribute('action') }}>
|
||||||
|
{{ ('sylius.ui.' ~ hookable_metadata.context.resource.action)|trans }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
{% set date_format = hookable_metadata.configuration.date_format|default('YYYY-MM-dd HH:mm:ss') %}
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12 col-md-4 fw-bold">{{ 'sylius.ui.created_at'|trans }}</div>
|
||||||
|
<div class="col-12 col-md-8" {{ sylius_test_html_attribute('created-at') }}>
|
||||||
|
{{ hookable_metadata.context.resource.createdAt|format_datetime(pattern=date_format) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12 col-md-4 fw-bold">{{ 'sylius.ui.hash'|trans }}</div>
|
||||||
|
<div class="col-12 col-md-8" {{ sylius_test_html_attribute('hash') }}>{{ hookable_metadata.context.resource.hash }}</div>
|
||||||
|
</div>
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
{% set payment_method = hookable_metadata.context.resource.method %}
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12 col-md-4 fw-bold">{{ 'sylius.ui.payment_method'|trans }}</div>
|
||||||
|
<div class="col-12 col-md-8" {{ sylius_test_html_attribute('method') }}>
|
||||||
|
<a href="{{ path('sylius_admin_payment_method_update', {'id' : payment_method.id }) }}">{{ payment_method.name }}</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12 col-md-4 fw-bold">{{ 'sylius.ui.state'|trans }}</div>
|
||||||
|
<div class="col-12 col-md-8" {{ sylius_test_html_attribute('state') }}>
|
||||||
|
{{ include('@SyliusAdmin/payment_request/common/label/state/' ~ hookable_metadata.context.resource.state ~ '.html.twig') }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
{% set date_format = hookable_metadata.configuration.date_format|default('YYYY-MM-dd HH:mm:ss') %}
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12 col-md-4 fw-bold">{{ 'sylius.ui.updated_at'|trans }}</div>
|
||||||
|
<div class="col-12 col-md-8" {{ sylius_test_html_attribute('updated-at') }}>
|
||||||
|
{{ hookable_metadata.context.resource.updatedAt|format_datetime(pattern=date_format) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
<div class="card mb-3">
|
||||||
|
<div class="card-header">
|
||||||
|
<div class="card-title">
|
||||||
|
{{ 'sylius.ui.payload'|trans }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<pre {{ sylius_test_html_attribute('payload') }}>{{ hookable_metadata.context.resource.payload|json_encode(constant('JSON_PRETTY_PRINT')) }}</pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
<div class="card mb-3">
|
||||||
|
<div class="card-header">
|
||||||
|
<div class="card-title">
|
||||||
|
{{ 'sylius.ui.response_data'|trans }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<pre {{ sylius_test_html_attribute('response-data') }}>{{ hookable_metadata.context.resource.responseData|json_encode(constant('JSON_PRETTY_PRINT')) }}</pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Sylius package.
|
||||||
|
*
|
||||||
|
* (c) Sylius Sp. z o.o.
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Sylius\Bundle\ApiBundle\Attribute;
|
||||||
|
|
||||||
|
#[\Attribute(\Attribute::TARGET_CLASS)]
|
||||||
|
final class PaymentRequestHashAware
|
||||||
|
{
|
||||||
|
public const DEFAULT_ARGUMENT_NAME = 'hash';
|
||||||
|
|
||||||
|
public function __construct(public string $constructorArgumentName = self::DEFAULT_ARGUMENT_NAME)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Sylius package.
|
||||||
|
*
|
||||||
|
* (c) Sylius Sp. z o.o.
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Sylius\Bundle\ApiBundle\Checker;
|
||||||
|
|
||||||
|
use Sylius\Component\Payment\Model\PaymentRequestInterface;
|
||||||
|
|
||||||
|
final class UpdatePaymentRequestEligibilityChecker implements UpdatePaymentRequestEligibilityCheckerInterface
|
||||||
|
{
|
||||||
|
public function isEligible(PaymentRequestInterface $paymentRequest): bool
|
||||||
|
{
|
||||||
|
return in_array($paymentRequest->getState(), [PaymentRequestInterface::STATE_NEW, PaymentRequestInterface::STATE_PROCESSING]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Sylius package.
|
||||||
|
*
|
||||||
|
* (c) Sylius Sp. z o.o.
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Sylius\Bundle\ApiBundle\Checker;
|
||||||
|
|
||||||
|
use Sylius\Component\Payment\Model\PaymentRequestInterface;
|
||||||
|
|
||||||
|
interface UpdatePaymentRequestEligibilityCheckerInterface
|
||||||
|
{
|
||||||
|
public function isEligible(PaymentRequestInterface $paymentRequest): bool;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Sylius package.
|
||||||
|
*
|
||||||
|
* (c) Sylius Sp. z o.o.
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Sylius\Bundle\ApiBundle\Command\Payment;
|
||||||
|
|
||||||
|
use Sylius\Bundle\ApiBundle\Command\IriToIdentifierConversionAwareInterface;
|
||||||
|
|
||||||
|
class AddPaymentRequest implements IriToIdentifierConversionAwareInterface
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
public readonly int|string $paymentId,
|
||||||
|
public readonly string $paymentMethodCode,
|
||||||
|
public readonly ?string $action = null,
|
||||||
|
public readonly mixed $payload = null,
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Sylius package.
|
||||||
|
*
|
||||||
|
* (c) Sylius Sp. z o.o.
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Sylius\Bundle\ApiBundle\Command\Payment;
|
||||||
|
|
||||||
|
use Sylius\Bundle\ApiBundle\Attribute\PaymentRequestHashAware;
|
||||||
|
use Sylius\Bundle\ApiBundle\Command\IriToIdentifierConversionAwareInterface;
|
||||||
|
|
||||||
|
#[PaymentRequestHashAware]
|
||||||
|
class UpdatePaymentRequest implements IriToIdentifierConversionAwareInterface
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
public readonly string $hash,
|
||||||
|
public mixed $payload = null,
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,83 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Sylius package.
|
||||||
|
*
|
||||||
|
* (c) Sylius Sp. z o.o.
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Sylius\Bundle\ApiBundle\CommandHandler\Payment;
|
||||||
|
|
||||||
|
use Sylius\Bundle\ApiBundle\Command\Payment\AddPaymentRequest;
|
||||||
|
use Sylius\Bundle\ApiBundle\Exception\PaymentMethodNotFoundException;
|
||||||
|
use Sylius\Bundle\ApiBundle\Exception\PaymentNotFoundException;
|
||||||
|
use Sylius\Bundle\CoreBundle\PaymentRequest\Provider\DefaultActionProviderInterface;
|
||||||
|
use Sylius\Bundle\CoreBundle\PaymentRequest\Provider\DefaultPayloadProviderInterface;
|
||||||
|
use Sylius\Component\Core\Model\PaymentInterface;
|
||||||
|
use Sylius\Component\Core\Model\PaymentMethodInterface;
|
||||||
|
use Sylius\Component\Core\Repository\PaymentMethodRepositoryInterface;
|
||||||
|
use Sylius\Component\Core\Repository\PaymentRepositoryInterface;
|
||||||
|
use Sylius\Component\Payment\Factory\PaymentRequestFactoryInterface;
|
||||||
|
use Sylius\Component\Payment\Model\PaymentRequestInterface;
|
||||||
|
use Sylius\Component\Payment\Repository\PaymentRequestRepositoryInterface;
|
||||||
|
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
|
||||||
|
|
||||||
|
#[AsMessageHandler]
|
||||||
|
final class AddPaymentRequestHandler
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param PaymentMethodRepositoryInterface<PaymentMethodInterface> $paymentMethodRepository
|
||||||
|
* @param PaymentRepositoryInterface<PaymentInterface> $paymentRepository
|
||||||
|
* @param PaymentRequestFactoryInterface<PaymentRequestInterface> $paymentRequestFactory
|
||||||
|
* @param PaymentRequestRepositoryInterface<PaymentRequestInterface> $paymentRequestRepository
|
||||||
|
*/
|
||||||
|
public function __construct(
|
||||||
|
private PaymentMethodRepositoryInterface $paymentMethodRepository,
|
||||||
|
private PaymentRepositoryInterface $paymentRepository,
|
||||||
|
private PaymentRequestFactoryInterface $paymentRequestFactory,
|
||||||
|
private PaymentRequestRepositoryInterface $paymentRequestRepository,
|
||||||
|
private DefaultActionProviderInterface $defaultActionProvider,
|
||||||
|
private DefaultPayloadProviderInterface $defaultPayloadProvider,
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __invoke(AddPaymentRequest $addPaymentRequest): PaymentRequestInterface
|
||||||
|
{
|
||||||
|
$paymentRequest = $this->createPaymentRequest($addPaymentRequest);
|
||||||
|
|
||||||
|
$this->paymentRequestRepository->add($paymentRequest);
|
||||||
|
|
||||||
|
return $paymentRequest;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function createPaymentRequest(AddPaymentRequest $addPaymentRequest): PaymentRequestInterface
|
||||||
|
{
|
||||||
|
/** @var PaymentMethodInterface|null $paymentMethod */
|
||||||
|
$paymentMethod = $this->paymentMethodRepository->findOneBy([
|
||||||
|
'code' => $addPaymentRequest->paymentMethodCode,
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (null === $paymentMethod) {
|
||||||
|
throw new PaymentMethodNotFoundException();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @var PaymentInterface|null $payment */
|
||||||
|
$payment = $this->paymentRepository->find($addPaymentRequest->paymentId);
|
||||||
|
|
||||||
|
if (null === $payment) {
|
||||||
|
throw new PaymentNotFoundException();
|
||||||
|
}
|
||||||
|
|
||||||
|
$paymentRequest = $this->paymentRequestFactory->create($payment, $paymentMethod);
|
||||||
|
$paymentRequest->setAction($addPaymentRequest->action ?? $this->defaultActionProvider->getAction($paymentRequest));
|
||||||
|
$paymentRequest->setPayload($addPaymentRequest->payload ?? $this->defaultPayloadProvider->getPayload($paymentRequest));
|
||||||
|
|
||||||
|
return $paymentRequest;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Sylius package.
|
||||||
|
*
|
||||||
|
* (c) Sylius Sp. z o.o.
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Sylius\Bundle\ApiBundle\CommandHandler\Payment;
|
||||||
|
|
||||||
|
use Sylius\Bundle\ApiBundle\Command\Payment\UpdatePaymentRequest;
|
||||||
|
use Sylius\Component\Payment\Exception\PaymentRequestNotFoundException;
|
||||||
|
use Sylius\Component\Payment\Model\PaymentRequestInterface;
|
||||||
|
use Sylius\Component\Payment\Repository\PaymentRequestRepositoryInterface;
|
||||||
|
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
|
||||||
|
|
||||||
|
#[AsMessageHandler]
|
||||||
|
final class UpdatePaymentRequestHandler
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param PaymentRequestRepositoryInterface<PaymentRequestInterface> $paymentRequestRepository
|
||||||
|
*/
|
||||||
|
public function __construct(
|
||||||
|
private PaymentRequestRepositoryInterface $paymentRequestRepository,
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __invoke(UpdatePaymentRequest $updatePaymentRequest): PaymentRequestInterface
|
||||||
|
{
|
||||||
|
$paymentRequest = $this->paymentRequestRepository->find($updatePaymentRequest->hash);
|
||||||
|
if (null === $paymentRequest) {
|
||||||
|
throw new PaymentRequestNotFoundException();
|
||||||
|
}
|
||||||
|
|
||||||
|
$paymentRequest->setPayload($updatePaymentRequest->payload);
|
||||||
|
|
||||||
|
return $paymentRequest;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Sylius package.
|
||||||
|
*
|
||||||
|
* (c) Sylius Sp. z o.o.
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Sylius\Bundle\ApiBundle\EventSubscriber;
|
||||||
|
|
||||||
|
use ApiPlatform\Symfony\EventListener\EventPriorities;
|
||||||
|
use Sylius\Bundle\CoreBundle\PaymentRequest\Announcer\PaymentRequestAnnouncerInterface;
|
||||||
|
use Sylius\Component\Payment\Model\PaymentRequestInterface;
|
||||||
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use Symfony\Component\HttpKernel\Event\ViewEvent;
|
||||||
|
use Symfony\Component\HttpKernel\KernelEvents;
|
||||||
|
|
||||||
|
final class PaymentRequestEventSubscriber implements EventSubscriberInterface
|
||||||
|
{
|
||||||
|
public function __construct(private PaymentRequestAnnouncerInterface $paymentRequestAnnouncer)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getSubscribedEvents(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
KernelEvents::VIEW => ['postWrite', EventPriorities::POST_WRITE],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function postWrite(ViewEvent $event): void
|
||||||
|
{
|
||||||
|
$paymentRequest = $event->getControllerResult();
|
||||||
|
|
||||||
|
if (!$paymentRequest instanceof PaymentRequestInterface) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$method = $event->getRequest()->getMethod();
|
||||||
|
if ($method === Request::METHOD_POST) {
|
||||||
|
$this->paymentRequestAnnouncer->dispatchPaymentRequestCommand($paymentRequest);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array($method, [Request::METHOD_PUT, Request::METHOD_PATCH], true)) {
|
||||||
|
$this->paymentRequestAnnouncer->dispatchPaymentRequestCommand($paymentRequest);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Sylius package.
|
||||||
|
*
|
||||||
|
* (c) Sylius Sp. z o.o.
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Sylius\Bundle\ApiBundle\Exception;
|
||||||
|
|
||||||
|
/** @experimental */
|
||||||
|
final class PaymentMethodNotFoundException extends \RuntimeException
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
string $message = 'Payment method not found.',
|
||||||
|
int $code = 0,
|
||||||
|
\Throwable $previous = null,
|
||||||
|
) {
|
||||||
|
parent::__construct($message, $code, $previous);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
|
||||||
|
This file is part of the Sylius package.
|
||||||
|
|
||||||
|
(c) Sylius Sp. z o.o.
|
||||||
|
|
||||||
|
For the full copyright and license information, please view the LICENSE
|
||||||
|
file that was distributed with this source code.
|
||||||
|
|
||||||
|
-->
|
||||||
|
|
||||||
|
<properties xmlns="https://api-platform.com/schema/metadata/properties-3.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="https://api-platform.com/schema/metadata/properties-3.0 https://api-platform.com/schema/metadata/properties-3.0.xsd"
|
||||||
|
>
|
||||||
|
<property resource="%sylius.model.payment_request.class%" name="hash" identifier="true" />
|
||||||
|
</properties>
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue