diff --git a/composer.json b/composer.json index 308c0d6b..016d5ef8 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,8 @@ ], "require": { "php": "^8.1", - "sylius/sylius": "1.14.x-dev", + "sylius/paypal-plugin": "1.7.x-dev", + "sylius/sylius": "1.14.0", "symfony/flex": "^2.4", "bugsnag/bugsnag-symfony": "^1.7" }, diff --git a/config/bundles.php b/config/bundles.php index 9e522b39..498a114b 100644 --- a/config/bundles.php +++ b/config/bundles.php @@ -61,4 +61,5 @@ League\FlysystemBundle\FlysystemBundle::class => ['all' => true], Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true], FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle::class => ['test' => true], + Sylius\PayPalPlugin\SyliusPayPalPlugin::class => ['all' => true], ]; diff --git a/config/packages/_sylius.yaml b/config/packages/_sylius.yaml index fa5849c5..dce56876 100644 --- a/config/packages/_sylius.yaml +++ b/config/packages/_sylius.yaml @@ -3,6 +3,7 @@ imports: - { resource: "@SyliusAdminBundle/Resources/config/app/config.yml" } - { resource: "@SyliusShopBundle/Resources/config/app/config.yml" } - { resource: "@SyliusApiBundle/Resources/config/app/config.yaml" } + - { resource: "@SyliusPayPalPlugin/Resources/config/config.yaml" } parameters: fixtures_dir: "%kernel.project_dir%/src/Resources/fixtures" diff --git a/config/packages/http_discovery.yaml b/config/packages/http_discovery.yaml new file mode 100644 index 00000000..2a789e73 --- /dev/null +++ b/config/packages/http_discovery.yaml @@ -0,0 +1,10 @@ +services: + Psr\Http\Message\RequestFactoryInterface: '@http_discovery.psr17_factory' + Psr\Http\Message\ResponseFactoryInterface: '@http_discovery.psr17_factory' + Psr\Http\Message\ServerRequestFactoryInterface: '@http_discovery.psr17_factory' + Psr\Http\Message\StreamFactoryInterface: '@http_discovery.psr17_factory' + Psr\Http\Message\UploadedFileFactoryInterface: '@http_discovery.psr17_factory' + Psr\Http\Message\UriFactoryInterface: '@http_discovery.psr17_factory' + + http_discovery.psr17_factory: + class: Http\Discovery\Psr17Factory diff --git a/config/routes.yaml b/config/routes.yaml index e69de29b..11b00f96 100644 --- a/config/routes.yaml +++ b/config/routes.yaml @@ -0,0 +1,2 @@ +sylius_paypal_webhook: + resource: "@SyliusPayPalPlugin/Resources/config/webhook_routing.yaml" diff --git a/config/routes/sylius_admin.yaml b/config/routes/sylius_admin.yaml index 1ba48d6c..497dccaf 100644 --- a/config/routes/sylius_admin.yaml +++ b/config/routes/sylius_admin.yaml @@ -1,3 +1,7 @@ sylius_admin: resource: "@SyliusAdminBundle/Resources/config/routing.yml" prefix: /admin + +sylius_paypal_admin: + resource: "@SyliusPayPalPlugin/Resources/config/admin_routing.yml" + prefix: /admin diff --git a/config/routes/sylius_shop.yaml b/config/routes/sylius_shop.yaml index 9116420d..3eae22e7 100644 --- a/config/routes/sylius_shop.yaml +++ b/config/routes/sylius_shop.yaml @@ -12,3 +12,9 @@ sylius_shop_default_locale: methods: [GET] defaults: _controller: sylius.controller.shop.locale_switch::switchAction + +sylius_paypal: + resource: "@SyliusPayPalPlugin/Resources/config/shop_routing.yaml" + prefix: /{_locale} + requirements: + _locale: ^[A-Za-z]{2,4}(_([A-Za-z]{4}|[0-9]{3}))?(_([A-Za-z]{2}|[0-9]{3}))?$ diff --git a/symfony.lock b/symfony.lock index 1087d836..5fbcf7b8 100644 --- a/symfony.lock +++ b/symfony.lock @@ -344,6 +344,18 @@ "phar-io/version": { "version": "1.0.1" }, + "php-http/discovery": { + "version": "1.20", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "main", + "version": "1.18", + "ref": "f45b5dd173a27873ab19f5e3180b2f661c21de02" + }, + "files": [ + "config/packages/http_discovery.yaml" + ] + }, "php-http/guzzle6-adapter": { "version": "v1.1.1" }, diff --git a/templates/bundles/SyliusShopBundle/Checkout/SelectPayment/_choice.html.twig b/templates/bundles/SyliusShopBundle/Checkout/SelectPayment/_choice.html.twig index ece6954b..6b23abe8 100644 --- a/templates/bundles/SyliusShopBundle/Checkout/SelectPayment/_choice.html.twig +++ b/templates/bundles/SyliusShopBundle/Checkout/SelectPayment/_choice.html.twig @@ -11,8 +11,8 @@

{{ method.description }}

{% endif %} - {% if method.gatewayConfig.factoryName == 'sylius.pay_pal' %} - {{ render(controller('Sylius\\PayPalPlugin\\Controller\\PayPalButtonsController:renderPaymentPageButtonsAction', {'orderId': order.id})) }} + {% if order.checkoutState != constant('Sylius\\Component\\Core\\OrderCheckoutStates::STATE_COMPLETED') and method.gatewayConfig.factoryName == 'sylius.pay_pal' %} + {{ render(controller('Sylius\\PayPalPlugin\\Controller\\PayPalButtonsController::renderPaymentPageButtonsAction', {'orderId': order.id})) }} {% endif %} diff --git a/templates/bundles/SyliusShopBundle/Common/Order/_addresses.html.twig b/templates/bundles/SyliusShopBundle/Common/Order/_addresses.html.twig new file mode 100644 index 00000000..6d7ee9f4 --- /dev/null +++ b/templates/bundles/SyliusShopBundle/Common/Order/_addresses.html.twig @@ -0,0 +1,23 @@ +
+
+
+
{{ 'sylius.ui.billing_address'|trans }}
+ {% include '@SyliusShop/Common/_address.html.twig' with {'address': order.billingAddress} %} +
+ {% if order.isShippingRequired() %} +
+
{{ 'sylius.ui.shipping_address'|trans }}
+ {% include '@SyliusShop/Common/_address.html.twig' with {'address': order.shippingAddress} %} +
+ {% endif %} +
+
+{% if sylius_is_billing_address_missing(order) %} +
+ +
+
{{ 'sylius.pay_pal.missing_billing_address_header'|trans }}
+

{{ 'sylius.pay_pal.missing_billing_address_content'|trans }}

+
+
+{% endif %}