Skip to content

webgriffe/SyliusNexiPlugin

Repository files navigation

Sylius Nexi Plugin

The SyliusNexiPlugin provides an integration between Sylius and Nexi XPay payment gateway. This plugin implements the Hosted Payment Page integration method.

Note! This plugin is only compatible with the Nexi configuration which allows only one payment per request. It is therefore not possible to retry the payment several times on the Nexi checkout, so make sure that your Nexi gateway is configured to not allow payment retry (you'll have to ask to Nexi customer care for this)!

Installation

  1. Run

    composer require webgriffe/sylius-nexi-plugin
  2. Add Webgriffe\SyliusNexiPlugin\WebgriffeSyliusNexiPlugin::class => ['all' => true] to your config/bundles.php.

  3. (Optional) It's suggested to also install the Payum Lock Request Extension Bundle:

    composer require webgriffe/payum-lock-request-extension-bundle

    and add Webgriffe\PayumLockRequestExtensionBundle\WebgriffePayumLockRequestExtensionBundle::class => ['all' => true] to your config/bundles.php. This Payum extension avoids issues when concurrent requests are made by the buyer and the Nexi gateway for the same payment.

Configuration

Go in your Sylius admin panel and create a new payment method. Choose Nexi Gateway as the payment gateway and fill the required fields. You can also enable the Sandbox mode if you want to test the integration with the Nexi test environment.

Contributing

Running plugin tests

  • PHPUnit

    vendor/bin/phpunit
  • PHPSpec

    vendor/bin/phpspec run
  • Behat (non-JS scenarios)

    vendor/bin/behat --strict --tags="~@javascript"
  • Behat (JS scenarios)

    1. Install Symfony CLI command.

    2. Start Headless Chrome:

    google-chrome-stable --enable-automation --disable-background-networking --no-default-browser-check --no-first-run --disable-popup-blocking --disable-default-apps --allow-insecure-localhost --disable-translate --disable-extensions --no-sandbox --enable-features=Metal --headless --remote-debugging-port=9222 --window-size=2880,1800 --proxy-server='direct://' --proxy-bypass-list='*' http://127.0.0.1
    1. Install SSL certificates (only once needed) and run test application's webserver on 127.0.0.1:8080:
    symfony server:ca:install
    APP_ENV=test symfony server:start --port=8080 --dir=tests/Application/public --daemon
    1. Run Behat:
    vendor/bin/behat --strict --tags="@javascript"
  • Static Analysis

    • Psalm

      vendor/bin/psalm
    • PHPStan

      vendor/bin/phpstan analyse -c phpstan.neon -l max src/  
  • Coding Standard

    vendor/bin/ecs check src

Opening Sylius with your plugin

  • Using test environment:

    (cd tests/Application && APP_ENV=test bin/console sylius:fixtures:load)
    (cd tests/Application && APP_ENV=test bin/console server:run -d public)
  • Using dev environment:

    (cd tests/Application && APP_ENV=dev bin/console sylius:fixtures:load)
    (cd tests/Application && APP_ENV=dev bin/console server:run -d public)

License

This plugin is under the MIT license. See the complete license in the LICENSE file.

Credits

Developed by Webgriffe®.