payplug/payplug-sylius 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

payplug/payplug-sylius

Composer 安装命令:

composer require payplug/payplug-sylius

包简介

PayPlug payment plugin for Sylius applications.

README 文档

README

License Quality Gate Status Duplicated Lines (%) Code Smells Version Total Downloads

Sylius Logo.

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

Version
PHP ^8.2
Sylius ^2.0

With Symfony Flex

1. Allow contrib recipes and require the plugin

composer config extra.symfony.allow-contrib true
composer require payplug/sylius-payplug-plugin

2. Install the Flex recipe

composer recipes:install payplug/sylius-payplug-plugin --force

This automatically registers the bundle, copies configuration files, and sets up assets (on Sylius 2.1+).

3. Apply migrations to your database

bin/console doctrine:migrations:migrate

4. Add Payplug to refundable payment methods 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

5. 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\CardsOwnerInterface;
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 implements CardsOwnerInterface
{
  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;
}

6. Process translations

php bin/console translation:extract en PayPlugSyliusPayPlugPlugin --dump-messages
php bin/console translation:extract fr PayPlugSyliusPayPlugPlugin --dump-messages

7. Clear cache

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

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.

Authorized Payment

Since 1.11.0, the plugin supports the authorized payment feature. You can check the Authorized Payment documentation.

Doc

统计信息

  • 总下载量: 435
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 8
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 8
  • Watchers: 8
  • Forks: 19
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-07-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固