infinite-software / sylius-ecommpay-plugin
Sylius 的 Ecommpay 支付插件。
1.0.2
2019-04-23 12:35 UTC
Requires
- php: ^7.1
- infinite-software/ecommpay-payum: *
- sylius/sylius: ^1.0
Requires (Dev)
- behat/behat: ^3.4
- behat/mink: ^1.7@dev
- behat/mink-browserkit-driver: ^1.3
- behat/mink-extension: ^2.2
- behat/mink-selenium2-driver: ^1.3
- friends-of-behat/context-service-extension: ^1.2
- friends-of-behat/cross-container-extension: ^1.1
- friends-of-behat/service-container-extension: ^1.0
- friends-of-behat/symfony-extension: ^1.2.1
- friends-of-behat/variadic-extension: ^1.1
- lakion/mink-debug-extension: ^1.2.3
- phpspec/phpspec: ^5.0
- phpstan/phpstan-doctrine: ^0.10
- phpstan/phpstan-shim: ^0.10
- phpstan/phpstan-symfony: ^0.10
- phpstan/phpstan-webmozart-assert: ^0.10
- phpunit/phpunit: ^6.5
- sylius-labs/coding-standard: ^2.0
- symfony/browser-kit: ^3.4|^4.1
- symfony/debug-bundle: ^3.4|^4.1
- symfony/dotenv: ^3.4|^4.1
- symfony/intl: ^3.4|^4.1
- symfony/web-profiler-bundle: ^3.4|^4.1
- symfony/web-server-bundle: ^3.4|^4.1
This package is not auto-updated.
Last update: 2024-09-19 15:17:46 UTC
README
安装
$ composer require infinite-software/sylius-ecommpay-plugin
将插件依赖项添加到您的 app/AppKernel.php 文件中
public function registerBundles() { return array_merge(parent::registerBundles(), [ ... new IS\SyliusEcommpayPlugin\ISSyliusEcommpayPlugin(), ]); }
在您的项目管理部分添加新的支付方式,使用 Ecommpay 网关,您应该添加提供的 secretkey
和 project_id
。
请 Ecommpay 支持人员将回调 URL 设置为 http://example.com/payment/notify/unsafe/ecommpay
(如果需要,可以将此操作的路线重新分配到另一个位置)
添加支付页面额外参数
如果您需要在发送请求到 Ecommpay 之前添加参数(例如,从 https://developers.ecommpay.com/ru/ru_PP_Parameters.html),将 Payum\Ecommpay\Action\ConvertPaymentAction
类的内容复制到位于 src/Payment/Ecommpay/ConvertPaymentAction
的新文件中
namespace App\Payment\Ecommpay; //use ...; final class ConvertPaymentAction implements ActionInterface, ApiAwareInterface { ... /** * {@inheritDoc} * * @param Convert $request */ public function execute($request) { RequestNotSupportedException::assertSupports($this, $request); /** @var PaymentInterface $payment */ $payment = $request->getSource(); /** @var OrderInterface $order */ $params = [ 'payment_id' => $payment->getNumber(), 'payment_amount' => $payment->getTotalAmount(), 'payment_currency' => $payment->getCurrencyCode(), 'project_id' => $this->api['projectId'], 'customer_id' => $payment->getClientId(), // my extra parameter 'force_payment_method' => 'card' ]; $request->setResult($params); } ... }
最后,在 services.yaml
中将其声明为服务。不要忘记将服务设置为 public
,如下所示
App\Payment\Ecommpay\ConvertPaymentAction: public: true tags: - { name: payum.action, factory: ecommpay, alias: payum.action.convert_payment }