tmconsulting/payum-uniteller-gateway

This package is abandoned and no longer maintained. No replacement package was suggested.

The Payum Uniteller extension.

0.1.5 2017-05-12 15:08 UTC

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


68747470733a2f2f7777772e756e6974656c6c65722e72752f2f6c6f63616c2f74656d706c617465732f696e6465782f696d672f626173652f6c6f676f2e737667


68747470733a2f2f7472617669732d63692e6f72672f746d636f6e73756c74696e672f706179756d2d756e6974656c6c65722d676174657761792e7376673f6272616e63683d6d6173746572 Coverage Status 68747470733a2f2f706f7365722e707567782e6f72672f746d636f6e73756c74696e672f706179756d2d756e6974656c6c65722d676174657761792f762f737461626c65 68747470733a2f2f706f7365722e707567782e6f72672f746d636f6e73756c74696e672f706179756d2d756e6974656c6c65722d676174657761792f762f756e737461626c65 68747470733a2f2f706f7365722e707567782e6f72672f746d636f6e73756c74696e672f706179756d2d756e6974656c6c65722d676174657761792f6c6963656e7365 68747470733a2f2f706f7365722e707567782e6f72672f746d636f6e73756c74696e672f706179756d2d756e6974656c6c65722d676174657761792f636f6d706f7365726c6f636b


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.