inkvizytor/dotpay

Package for Dotpay payments via api instead of form

2.1.15 2022-03-14 08:57 UTC

README

Paczka Dotpay do Laravela 5.x. Pozwala przesyłać dane poprzez API zamiast formularza.

Scrutinizer Code Quality Build Status Latest Unstable Version License Total Downloads

Struktura

src/
tests/

Instalacja

Przez composera

$ composer require evilnet/dotpay

lub dodaj do pliku composera

 "require": {
         "evilnet/dotpay": "dev-master"
     },

Potem zarejestruj usługę i ewentualnie alias w config/app.php

'providers' => [

     Evilnet\Dotpay\DotpayServiceProvider::class,
 
 
 'aliases' => [
     'Dotpay' => Evilnet\Dotpay\Facades\Dotpay::class

Opublikuj konfguracje i wprowadź w niej potrzebne dane

php artisan vendor:publish --provider="Evilnet\Dotpay\DotpayServiceProvider"

Dodaj wartości do pliku .env

DOTPAY_USERNAME=
DOTPAY_PASSWORD=
DOTPAY_SHOP_ID=
DOTPAY_PIN=
DOTPAY_BASE_URL=https://ssl.dotpay.pl/test_seller/ 

I dodaj swoją metodę do obsługi callbacku jako wyjątek w VerifyCsrfToken

Przykład użycia

namespace App\Http\Controllers;

use Evilnet\Dotpay\DotpayManager;
use Illuminate\Http\Request;
use Illuminate\Http\Response;

class DotpayController extends Controller
{

    private $dotpayManager;

    public function __construct(DotpayManager $dotpayManager)
    {
        $this->dotpayManager = $dotpayManager;
    }

    public function callback(Request $request)
    {
        $response = $this->dotpayManager->callback($request->all());
        
        //Do whatever you want with this
        
        return new Response('OK');
    }

    public function pay()
    {
        $data = [
            'amount' => '100',
            'currency' => 'PLN',
            'description' => 'Payment for internal_id order',
            'control' => '12345', //ID that dotpay will pong you in the answer
            'language' => 'pl',
            'ch_lock' => '1',
            'url' => config('dotpay.options.url'),
            'urlc' => config('dotpay.options.curl'),
            'expiration_datetime' => '2017-12-01T16:48:00',
            'payer' => [
                'first_name' => 'John',
                'last_name' => 'Smith',
                'email' => 'john.smith@example.com',
                'phone' => '+48123123123'
            ],
            'recipient' => config('dotpay.options.recipient')

        ];

        return redirect()->to($this->dotpayManager->createPayment($data));
    }
}

Change log

Please see CHANGELOG for more information on what has changed recently.

Testing

$ phpunit vendor/evilnet/dotpay/tests

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details.

Security

If you discover any security related issues, please email axotion@linux.pl instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.