tmconsulting / payum-uniteller-gateway
The Payum Uniteller extension.
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
But uniteller php sdk will be support and it moved to https://github.com/spacetab-io/uniteller-sdk-php
Payum Uniteller Gateway
Payum gateway package for Uniteller. Based on uniteller-php-sdk.
Install
composer require tmconsulting/payum-uniteller
After composer installation, add some gateway to 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, ]);
Since Uniteller does not supports callback urls with dynamic parameters. So, you will should implement notify
action:
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); } }
... or if you're disable comment field in admin panel, you can use "token extra workaround". Just enable token_extra
option.
Resources
Old versions
@fullpipe implement similar package for payum 0.14.*
You can use it.
Tests
./bin/phpunit
License
Library is released under the MIT License.