2017 © Pedro Peláez
 

library dotpay

dotpay for laravel

image

gerro/dotpay

dotpay for laravel

  • Tuesday, July 11, 2017
  • by gerro
  • Repository
  • 1 Watchers
  • 0 Stars
  • 81 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 7 Versions
  • 7 % Grown

The README.md

dotpay

Dotpay for laravel (5.2, 5.3, 5.4), (*1)

Installation

composer require gerro/dotpay

Add provider to /config/app.php, (*2)

Gerro\Dotpay\GerroDotpayServiceProvider::class,

Add aliases to /config/app.php, (*3)

'Dotpay'=> Gerro\Dotpay\Facades\Dotpay::class,

Copy to command, (*4)

php artisan vendor:publish --provider="Gerro\Dotpay\GerroDotpayServiceProvider"

Config/dotpay.php

return [
    #id,pin
    'Account'=>[
        'dotpayId'=>'123456',
        'dotpayPin'=>'IvvvSbaR8J9YD3MF5nnr67CvTa1KVVVV'
    ],
    #url
    'Services'=>[
        'production'=>'https://ssl.dotpay.pl/t2/',
        'test'=>'https://ssl.dotpay.pl/test_payment/'
    ]
];

Routes.php

If you want to test it to add to the line, (*5)

Route::get('/','DotpayController@start');
Route::post('/dotpay','DotpayController@dotpay');
Route::post('/end','DotpayController@end');

Middleware/VerifyCsrfToken.php

protected $except = [
        '/dotpay',
        '/end'
    ];

DotpayController.php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests;
use Dotpay;
class DotpayController extends Controller
{
    public function start(){

        ##### STEP 1 #####
        //parameters
        $ParametersArray = array(
             "api_version" => "dev",
             "amount" => "11.07",
             "currency" => "PLN",
             "description" => "Platnosc za zamowienie 567915976",
             "control" => "12345",
             "url" => "http://example.com/end",
             "type" => "3",
             "buttontext" => "Wroc do poprzedniej strony !",
             "urlc" => "http://example.com/dotpay",
             "firstname" => "Jan",
             "lastname" => "Nowak",
             "email" => "jan.nowak@example.com",
             "street" => "Warszawska",
             "street_n1" => "1",
             "city" => "Krakow",
             "postcode" => "12-345",
             "phone" => "123456789",
             "country" => "POL"
             );
        ##### STEP 2 #####
        //parameters setting
        $ParametersSetArray = Dotpay::parametersSetArray($ParametersArray);
        ##### STEP 3 #####
        //generator chk
        $chkValue = Dotpay::chkValue($ParametersSetArray);
        ##### STEP 3 #####
        //production or test
        $environment = Dotpay::environment('test');
        ##### STEP 4 #####
        //method POST or GET
        $redirectionMethod = Dotpay::redirectionMethod('POST');
        ##### STEP 5 #####  
        //Button automaticy
        $button = Dotpay::buttonDotpay($environment,$redirectionMethod,$chkValue,$ParametersSetArray);

        return view('welcome')
                ->with('button',$button);
    }
    public function dotpay(Request $request){
        
        Dotpay::dotpayCheckServer();
        $id = $request->id;
        $status = $request->operation_status;
        $amount = $request->operation_amount;
        $control = $request->control;

        //check is completed
        if(Dotpay::checkCompleted($status,$id,$amount,$control))
        {
            //$t = new Transakcje();
            //$t->id_transakcji = $id;
            //$t->amount = $amount;
            //$t->control = $control;
            //$t->save();
            
            //must be at the end of
            echo 'OK';
        }
    }
    public function end(Request $request){
        if($request->status == 'OK')
        {
            return 'SUCCESS';
        }
        else{
            return 'FAIL';
        }
    }

}

Warning ! This is not a 100 % guarantee of security is still in the testing phase ., (*6)

License

Gerro/Dotpay is open-sourced software licensed under the MIT license, (*7)

The Versions

11/07 2017

dev-master

9999999-dev

dotpay for laravel

  Sources   Download

MIT

by Krystian Oziembala

11/07 2017

1.0.5

1.0.5.0

dotpay for laravel

  Sources   Download

MIT

by Krystian Oziembala

11/07 2017

1.0.4

1.0.4.0

dotpay for laravel

  Sources   Download

MIT

by Krystian Oziembala

11/07 2017

1.0.3

1.0.3.0

dotpay for laravel

  Sources   Download

MIT

by Krystian Oziembala

02/08 2016

1.0.2

1.0.2.0

dotpay for laravel

  Sources   Download

MIT

by Krystian Oziembala

01/08 2016

1.0.1

1.0.1.0

dotpay for laravel

  Sources   Download

MIT

by Krystian Oziembala

01/08 2016

1.0.0

1.0.0.0

dotpay for laravel

  Sources   Download

MIT

by Krystian Oziembala