payplug / sylius-payplug-plugin
PayPlug payment plugin for Sylius applications.
Installs: 55 892
Dependents: 0
Suggesters: 0
Security: 0
Stars: 10
Watchers: 9
Forks: 18
Open Issues: 3
Type:sylius-plugin
Requires
- php: ^8.0
- ext-json: *
- giggsey/libphonenumber-for-php: ^8.12
- payplug/payplug-php: ^3.1
- php-http/message-factory: ^1.1
- sylius/refund-plugin: ^1.4
- sylius/sylius: ^1.11.0
- symfony/asset: ^4.4|^5.0|^6.0
- symfony/lock: ^4.4|^5.0|^6.0
- symfony/validator: ^4.4|^5.0|^6.0
Requires (Dev)
- behat/behat: ^3.7
- behat/mink-selenium2-driver: ^1.4
- dmore/behat-chrome-extension: ^1.3
- dmore/chrome-mink-driver: ^2.7
- friends-of-behat/mink: ^1.8
- friends-of-behat/mink-browserkit-driver: ^1.4
- friends-of-behat/mink-debug-extension: ^2.0
- friends-of-behat/mink-extension: ^2.4
- friends-of-behat/page-object-extension: ^0.3
- friends-of-behat/suite-settings-extension: ^1.0
- friends-of-behat/symfony-extension: ^2.1
- friends-of-behat/variadic-extension: ^1.3
- friendsoftwig/twigcs: ^5.0
- j13k/yaml-lint: ^1.1
- lakion/mink-debug-extension: ^2.0
- mockery/mockery: ^1.5
- php-parallel-lint/php-parallel-lint: ^1.0
- phpmd/phpmd: ^2.8
- phpspec/phpspec: ^6.1 || ^7.2
- phpstan/extension-installer: 1.1.0
- phpstan/phpstan: 1.8.2
- phpstan/phpstan-doctrine: 1.3.11
- phpstan/phpstan-strict-rules: 1.3.0
- phpstan/phpstan-webmozart-assert: 1.2.0
- phpunit/phpunit: ^9.0
- slevomat/coding-standard: ^6.3.2
- sylius-labs/coding-standard: ^4.0
- symfony/browser-kit: ^5.0|^6.0
- symfony/debug-bundle: ^5.0|^6.0
- symfony/dotenv: ^5.0|^6.0
- symfony/intl: ^5.0|^6.0
- symfony/web-profiler-bundle: ^5.0|^6.0
- webmozart/assert: ^1.8
- dev-master
- 1.9.3
- 1.9.3-rc.0
- 1.9.2
- 1.9.2-rc.1
- 1.9.2-rc.0
- 1.9.1
- 1.9.1-rc.3
- 1.9.1-rc.2
- 1.9.1-rc.1
- 1.9.1-rc.0
- 1.9.0
- 1.9.0-rc.2
- 1.9.0-rc.1
- 1.9.0-rc.0
- 1.8.0
- 1.8.0-rc.0
- 1.7.0
- 1.7.0-rc.4
- 1.7.0-rc.3
- 1.7.0-rc.2
- 1.7.0-rc.1
- 1.7.0-rc.0
- 1.6.0
- 1.6.0-rc.1
- 1.6.0-rc.0
- 1.5.0
- 1.5.0-rc.0
- 1.4.1-rc.0
- 1.4.0
- 1.4.0-rc.5
- 1.4.0-rc.4
- 1.4.0-rc.3
- 1.4.0-rc.2
- 1.4.0-rc.1
- 1.4.0-rc.0
- 1.3.0
- 1.2.0
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.0
- 0.2
- 0.1
- dev-qa
- dev-dependabot/npm_and_yarn/src/Resources/dev/json5-2.2.3
- dev-dependabot/npm_and_yarn/src/Resources/dev/ansi-regex-4.1.1
- dev-qa-fixed-conflicts
- dev-qa-fix-conflicts
- dev-feature/SYL-165
- dev-develop
This package is auto-updated.
Last update: 2024-10-22 08:36:11 UTC
README
Payplug payment plugin for Sylius
This plugin allows you to integrate Payplug payment with Sylius platform app including payment features and refunding orders.
Requirements
In the channel settings, the base currency must be set to EUR because the payment gateway only works in this currency.
In local environment, the plugin will not work properly because you will not be notified of the status of payments from the payment gateway.
⚠️ Refunds requirements
You need to make some adjustments in order to make our plugin worked normally due to a dependency to refund-plugin. Please follow those requirements:
To generate "Credit memos" when refunding, your server need to have the WKHTMLTOPDF binary as explain in refund-pluging documentation # Pre-requirements
Compatibility
Installation
-
Require the payplug/sylius-payplug-plugin :
composer config extra.symfony.allow-contrib true composer require payplug/sylius-payplug-plugin
-
Apply migrations to your database:
bin/console doctrine:migrations:migrate
-
Copy templates that are overridden by Sylius into
templates/bundles/SyliusAdminBundle
mkdir -p templates/bundles/SyliusAdminBundle/ cp -R vendor/payplug/sylius-payplug-plugin/src/Resources/views/SyliusAdminBundle/* templates/bundles/SyliusAdminBundle/
-
Add Payplug to refundable payment method for Sylius Refund Plugin in
config/services.yaml
parameters: locale: fr_FR sylius_refund.supported_gateways: - payplug - payplug_oney - payplug_bancontact - payplug_apple_pay - payplug_american_express
-
Add Payplug routes in
config/routes.yaml
sylius_payplug: resource: "@PayPlugSyliusPayPlugPlugin/Resources/config/routing.yaml"
-
Add Traits for Customer and PaymentMethod entities
-
App\Entity\Customer\Customer
<?php declare(strict_types=1); namespace App\Entity\Customer; use Doctrine\ORM\Mapping as ORM; use PayPlug\SyliusPayPlugPlugin\Entity\Traits\CustomerTrait; use Sylius\Component\Core\Model\Customer as BaseCustomer; /** * @ORM\Entity * @ORM\Table(name="sylius_customer") */ #[ORM\Entity] #[ORM\Table(name: 'sylius_customer')] class Customer extends BaseCustomer { use CustomerTrait; }
-
App\Entity\Payment\PaymentMethod
<?php declare(strict_types=1); namespace App\Entity\Payment; use Doctrine\ORM\Mapping as ORM; use PayPlug\SyliusPayPlugPlugin\Entity\Traits\PaymentMethodTrait; use Sylius\Component\Core\Model\PaymentMethod as BasePaymentMethod; use Sylius\Component\Payment\Model\PaymentMethodTranslationInterface; /** * @ORM\Entity * @ORM\Table(name="sylius_payment_method") */ #[ORM\Entity] #[ORM\Table(name: 'sylius_payment_method')] class PaymentMethod extends BasePaymentMethod { use PaymentMethodTrait; protected function createTranslation(): PaymentMethodTranslationInterface { return new PaymentMethodTranslation(); } }
-
App\Entity\Payment\Payment
<?php declare(strict_types=1); namespace App\Entity\Payment; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\ORM\Mapping as ORM; use PayPlug\SyliusPayPlugPlugin\Entity\Traits\PaymentTrait; use Sylius\Component\Core\Model\Payment as BasePayment; /** * @ORM\Entity * @ORM\Table(name="sylius_payment") */ #[ORM\Entity] #[ORM\Table(name: 'sylius_payment')] class Payment extends BasePayment { use PaymentTrait; }
-
Process translations
php bin/console translation:extract en PayPlugSyliusPayPlugPlugin --dump-messages php bin/console translation:extract fr PayPlugSyliusPayPlugPlugin --dump-messages
-
Clear cache:
php bin/console cache:clear
🎉 You are now ready to add Payplug Payment method.
In your back-office, go to Configuration > Payment methods
, then click on Create
and choose "Payplug".
Logs
If you want to follow the logs in the production environment, you need to add the configuration in config/packages/prod/monolog.yaml
, logs should be in var/log/prod.log
which can be searched after the phrase [Payum]
or [Payplug]
:
monolog: handlers: ... payum: level: debug type: stream path: "%kernel.logs_dir%/%kernel.environment%.log"
Customization
Available services you can decorate and forms you can extend
Run the below command to see what Symfony services are shared with this plugin:
$ bin/console debug:container payplug_sylius_payplug_plugin
Template overriding
This plugin override some sylius templates. If you plan override them also, you should retrieve them in your application.
Copy Sylius templates overridden in plugin to your templates directory (e.g templates/bundles/)
mkdir -p templates/bundles/SyliusAdminBundle/ mkdir -p templates/bundles/SyliusShopBundle/ mkdir -p templates/bundles/SyliusUiBundle/ cp -R vendor/payplug/sylius-payplug-plugin/src/Resources/views/SyliusAdminBundle/* templates/bundles/SyliusAdminBundle/ cp -R vendor/payplug/sylius-payplug-plugin/src/Resources/views/SyliusShopBundle/* templates/bundles/SyliusShopBundle/ cp -R vendor/payplug/sylius-payplug-plugin/src/Resources/views/SyliusUiBundle/* templates/bundles/SyliusUiBundle/
You also need to edit your twig config to add your path to avoid our configuration to be prepended :
twig: paths: '%kernel.project_dir%/templates/bundles/SyliusAdminBundle': SyliusAdmin '%kernel.project_dir%/templates/bundles/SyliusShopBundle': SyliusShop '%kernel.project_dir%/templates/bundles/SyliusUiBundle': SyliusUi
Development
See How to contribute.
License
This library is under the MIT license.
Oney Integration
For better Oney integration, you can check the Oney enhancement documentation.