Skip to content

Commit

Permalink
Merge pull request #299 from Wojdylak/SYL-4030-add-sylius-paypal-plugin
Browse files Browse the repository at this point in the history
[Maintenance] Add sylius/paypal-plugin
  • Loading branch information
GSadee authored Nov 22, 2024
2 parents 8611b99 + 1a7f681 commit 05e1535
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 3 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
1 change: 1 addition & 0 deletions config/bundles.php
Original file line number Diff line number Diff line change
Expand Up @@ -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],
];
1 change: 1 addition & 0 deletions config/packages/_sylius.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
10 changes: 10 additions & 0 deletions config/packages/http_discovery.yaml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions config/routes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sylius_paypal_webhook:
resource: "@SyliusPayPalPlugin/Resources/config/webhook_routing.yaml"
4 changes: 4 additions & 0 deletions config/routes/sylius_admin.yaml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions config/routes/sylius_shop.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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}))?$
12 changes: 12 additions & 0 deletions symfony.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<p>{{ method.description }}</p>
</div>
{% 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 %}
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<div class="ui segment">
<div class="ui {% if order.isShippingRequired() %}two{% else %}one{% endif %} column divided stackable grid">
<div class="column" id="sylius-billing-address" {{ sylius_test_html_attribute('billing-address') }}>
<div class="ui small dividing header">{{ 'sylius.ui.billing_address'|trans }}</div>
{% include '@SyliusShop/Common/_address.html.twig' with {'address': order.billingAddress} %}
</div>
{% if order.isShippingRequired() %}
<div class="column" id="sylius-shipping-address" {{ sylius_test_html_attribute('shipping-address') }}>
<div class="ui small dividing header">{{ 'sylius.ui.shipping_address'|trans }}</div>
{% include '@SyliusShop/Common/_address.html.twig' with {'address': order.shippingAddress} %}
</div>
{% endif %}
</div>
</div>
{% if sylius_is_billing_address_missing(order) %}
<div class="ui icon message">
<i class="address card icon"></i>
<div class="content">
<div class="header">{{ 'sylius.pay_pal.missing_billing_address_header'|trans }}</div>
<p>{{ 'sylius.pay_pal.missing_billing_address_content'|trans }}</p>
</div>
</div>
{% endif %}

0 comments on commit 05e1535

Please sign in to comment.