Paczka Dotpay do Laravela 5.x. Pozwala przesyłać dane poprzez API zamiast formularza.
src/
tests/
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
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' => '[email protected]',
'phone' => '+48123123123'
],
'recipient' => config('dotpay.options.recipient')
];
return redirect()->to($this->dotpayManager->createPayment($data));
}
}
Please see CHANGELOG for more information on what has changed recently.
$ phpunit vendor/evilnet/dotpay/tests
Please see CONTRIBUTING and CODE_OF_CONDUCT for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.