hraph/sylius-paygreen-plugin

Sylius integration for Paygreen.io payment provider

Installs: 508

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 4

Forks: 1

Open Issues: 1

Type:sylius-plugin


README

Latest Version on Packagist Software License

Sylius plugin for Paygreen.io payment provider

Installation

Requirements

Package Version
PHP ^7.4
sylius/sylius ^1.8 || ^1.9

Instructions

  1. Install plugin using composer:

    $ composer require hraph/sylius-paygreen-plugin 
  2. Import config:

    # config/packages/_sylius.yaml
    imports:
        # ...
        - { resource: "@SyliusPaygreenPlugin/Resources/config/app/config.yaml" }
  3. Import routing:

    # config/routes.yaml
    hraph_sylius_paygreen_plugin_admin:
        resource: "@SyliusPaygreenPlugin/Resources/config/admin_routing.yaml"
        prefix: /admin
    
  4. Update your schema (for existing project):

    # Generate and edit migration
    bin/console doctrine:migrations:diff
    
    # Then apply migration
    bin/console doctrine:migrations:migrate

Plugin configuration

# config/packages/sylius_paygreen.yaml
sylius_paygreen:
    api:
        username: PaygreenUsername
        api_key: API_KEY
        sandbox: true
    force_use_authorize: true # All payments will be executed using authorize (fingerprint)
    use_insite_mode: true # Use iframe mode

Views customization

You can customize the payment view by creating a custom file in templates/bundles/SyliusPaygreenPlugin/Checkout/payment.html.twig:

{% block content %}
    <iframe src="{{ execute_url ~ "?display=insite" }}" style="border: 0;width: 100%; height: 600px"></iframe>
{% endblock %}

Plugin extension

The following plugin entities can be extended using Sylius documentation guidelines:

  • paygreen_shop
  • paygreen_transfer

Example:

sylius_paygreen:
    resources:
        paygreen_shop:
            classes:
                interface: App\Entity\PaymentProvider\CustomPaymentProviderShopInterface
                model: App\Entity\PaymentProvider\CustomPaymentProviderShop
                factory: App\Entity\PaymentProvider\CustomPaymentProviderShopFactory

Contribution

Installation:

$ (cd tests/Application && yarn install)
$ (cd tests/Application && yarn build)
$ (cd tests/Application && APP_ENV=test bin/console assets:install public)

$ (cd tests/Application && APP_ENV=test bin/console doctrine:database:create)
$ (cd tests/Application && APP_ENV=test bin/console doctrine:schema:create)

To be able to setup a plugin's database, remember to configure you database credentials in tests/Application/.env and tests/Application/.env.test.

Running plugin tests

  • PHPSpec

    $ composer phpspec
  • Behat

    $ composer behat
  • All tests (phpspec & behat)

    $ composer test