Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/PayGreen/sylius-paygreen-plugin

Sylius payment module with Paygreen
https://github.com/PayGreen/sylius-paygreen-plugin

Last synced: 2 months ago
JSON representation

Sylius payment module with Paygreen

Awesome Lists containing this project

README

        



paygreen logo




sylius logo

Sylius payment module with Paygreen

## Installation

Require the plugin :

```bash
composer require paygreen/sylius-paygreen-plugin
```

1. Your `ProductVariant` entity needs to implement de `MealVoucherAwareInterface` and use the `MealVoucherAwareTrait`.
2. Your `Order` entity needs to implement de `MealVoucherableInterface` and use the `MealVoucherableTrait`.
3. You need to run a diff of your doctrine's migrations: `bin/console doctrine:migrations:diff`. Don't forget to run it! (`bin/console doctrine:migrations:migrate`)
4. Copy the template (we update the Product and ProductVariant forms):
```
mkdir -p templates/bundles/SyliusAdminBundle
cp -Rv vendor/paygreen/sylius-paygreen-plugin/src/Resources/views/SyliusAdminBundle/ templates/bundles/
```

## Configuration

![Gateway configuration](https://github.com/PayGreen/sylius-paygreen-plugin/blob/master/doc/gateway_configuration.png?raw=true)

Connect your Paygreen account with your public key and your private key.

> To activate the in site payment interface, the In Site module must be activated via your PayGreen back office. Moreover, you must be in HTTPS.

In the `.env` file, you have to configure the `PAYGREEN_API_SERVER` (PRODUCTION or SANDBOX) depending on your customer account.

```
PAYGREEN_API_SERVER=PRODUCTION
```

## Cookbook

- [How to display the amount payable in meal voucher in cart?](https://github.com/PayGreen/sylius-paygreen-plugin/blob/master/doc/how-to-display-the-amount-payable-in-meal-voucher-in-cart.md)
- [How to display if the product is payable in meal voucher or not?](https://github.com/PayGreen/sylius-paygreen-plugin/blob/master/doc/how-to-display-if-the-product-is-payable-in-meal-voucher-or-not.md)
- [How to make delivery payable via meal voucher?](https://github.com/PayGreen/sylius-paygreen-plugin/blob/master/doc/how-to-make-delivery-payable-via-meal-voucher.md)
- [How to hide the meal ticket payment if it is not available for this cart?](https://github.com/PayGreen/sylius-paygreen-plugin/blob/master/doc/how-to-hide-the-meal-voucher-payment-method-if-it-is-not-available-for-this-cart.md)
- [How to customize "insite" display mode template?](https://github.com/PayGreen/sylius-paygreen-plugin/blob/master/doc/how-to-customize-insite-display-mode.md)

## Contribution

### Installation:

```bash
$ composer install
$ (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)
$ (cd tests/Application && APP_ENV=test bin/console sylius:fixtures:load)
```

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

### Start local server
```bash
$ (cd tests/Application && APP_ENV=test php -S localhost:8080 -t public)
```

### Running plugin tests

- PHPSpec

```bash
$ composer phpspec
```

- Behat

```bash
$ composer behat
```

- All tests (phpspec & behat)

```bash
$ composer test
```