tmconsulting / payum-uniteller-gateway
此包已被废弃,不再维护。未建议替代包。
Payum Uniteller 扩展。
0.1.5
2017-05-12 15:08 UTC
Requires
- php: ^5.6 || ^7.0
- payum/core: ^1.4
- tmconsulting/uniteller-php-sdk: 0.1.*
Requires (Dev)
- payum/core: ^1.4@dev
- php-http/guzzle6-adapter: ^1.0
- phpunit/phpunit: ~5.7
- symfony/var-dumper: ^3.2
This package is not auto-updated.
Last update: 2020-05-29 19:23:54 UTC
README
但uniteller php sdk将会得到支持,并已迁移至 https://github.com/spacetab-io/uniteller-sdk-php
Payum Uniteller Gateway
Payum gateway 包针对 Uniteller。基于 uniteller-php-sdk。
安装
composer require tmconsulting/payum-uniteller
Composer 安装后,将一些网关添加到 PayumBuilder
use Payum\Core\GatewayFactoryInterface; $builder->addGatewayFactory('uniteller', function(array $config, GatewayFactoryInterface $coreGatewayFactory) { return new \Payum\Uniteller\UnitellerGatewayFactory($config, $coreGatewayFactory); }) ->addGateway('uniteller', [ 'factory' => 'uniteller', 'token_extra' => false, // enable this options, if you want to set token to comment field. 'shop_id' => 'shop_od for production', 'test_shop_id' => 'shop_id for sandbox', 'login' => 'login_digits', 'password' => 'password', 'sandbox' => true, ]);
由于 Uniteller 不支持动态参数的回调 URL。因此,您应该实现 notify
动作
use Payum\Core\Request\Notify; use Payum\Core\Request\GetHumanStatus; class PaymentController extends PayumController { public function notifyAction(Request $request) { $gateway = $this->getPayum()->getPayment('uniteller'); $payment = $this->getPayum() ->getStorage(Payment::class) ->findBy([ // find payum token by Order_ID, when uniteller call you callback url 'number' => $request->get('Order_ID'), ]); if ($reply = $gateway->execute(new Notify($payment), true)) { if ($reply instanceof HttpResponse) { $gateway->execute($status = new GetHumanStatus($payment)); if ($status->isCaptured() || $status->isAuthorized()) { // Payment is done // Notify your app here // Payum library does not update status in the database } throw $reply; } throw new \LogicException('Unsupported reply', null, $reply); } return new Response('', 204); } }
... 或者如果您在管理员面板中禁用了评论字段,可以使用 "token extra workaround"。只需启用 token_extra
选项。
资源
旧版本
@fullpipe 为 payum 0.14.* 实现了类似的包
您可以使用它.
测试
./bin/phpunit
许可
库是在 MIT 许可 下发布的。