yproximite / payum-axepta-bnp
Payum的Axepta网关
v0.4.1
2024-03-18 13:02 UTC
Requires
- php: >=7.4
- payum/core: ^1.5
- phpseclib/phpseclib: ^3.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.19.0
- php-http/guzzle6-adapter: ^1.0
- phpstan/phpstan: ^0.12.86
- phpstan/phpstan-strict-rules: ^0.12.9
- phpunit/phpunit: ^9.5.4
- twig/twig: ^2.6
This package is auto-updated.
Last update: 2024-09-18 14:00:27 UTC
README
Payum网关,用于使用Axepta(一个法国支付系统)
需求
- PHP 7.4+
- Payum
- 可选PayumBundle和Symfony 3或4+
安装
$ composer require yproximite/payum-axepta-bnp
配置
使用PayumBundle(Symfony)
首先在服务定义中注册网关工厂
# config/services.yaml or app/config/services.yml services: yproximite.axepta_gateway_factory: class: Payum\Core\Bridge\Symfony\Builder\GatewayFactoryBuilder arguments: [ Yproximite\Payum\Axepta\AxeptaGatewayFactory ] tags: - { name: payum.gateway_factory_builder, factory: axepta }
然后配置网关
# config/packages/payum.yaml or app/config/config.yml payum: gateways: axepta: factory: axepta merchant_id: 'change it' # required hmac: 'change it' # required crypt_key: 'change it' # required
使用Payum
<?php //config.php use Payum\Core\PayumBuilder; use Payum\Core\Payum; /** @var Payum $payum */ $payum = (new PayumBuilder()) ->addDefaultStorages() ->addGateway('gatewayName', [ 'factory' => 'axepta', 'merchant_id' => 'change it', // required 'hmac' => 'change it', // required 'crypt_key' => 'change it', // required ]) ->getPayum() ;
用法
确保您的Payment
实体覆盖getNumber()
方法如下
<?php namespace App\Entity\Payment; use Doctrine\ORM\Mapping as ORM; use Payum\Core\Model\Payment as BasePayment; /** * @ORM\Table * @ORM\Entity */ class Payment extends BasePayment { /** * @ORM\Column(name="id", type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="IDENTITY") * * @var int */ protected $id; /** * {@inheritdoc} */ public function getNumber() { return (string) $this->id; } }
这样做后,库将能够提取付款的ID并将其用于与Axepta的付款。