Giter Site home page Giter Site logo

hraph / syliuspaygreenplugin Goto Github PK

View Code? Open in Web Editor NEW
1.0 4.0 1.0 311 KB

Sylius plugin for Paygreen.io payment provider

License: Apache License 2.0

PHP 96.22% Twig 0.43% Shell 0.84% JavaScript 2.50%
paygreen sylius sylius-plugin payment-module payment-gateway

syliuspaygreenplugin's Introduction

Sylius Paygreen Plugin

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.