2017 © Pedro Peláez
 

library borica-api

Package that enables the communication with BORICA via their API

image

mirovit/borica-api

Package that enables the communication with BORICA via their API

  • Wednesday, December 13, 2017
  • by mirovit
  • Repository
  • 2 Watchers
  • 12 Stars
  • 149 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 8 Forks
  • 0 Open issues
  • 8 Versions
  • 16 % Grown

The README.md

BORICA API

This is a simple implementation of the BORICA API for adding payments with their service., (*1)

Instalation

Pull from Composer:, (*2)

composer require mirovit/borica-api

How to use

One way would be to new up a version of Mirovit\Borica\Factory, which accepts Mirovit\Borica\Request and Mirovit\Borica\Response as constructor arguments. Or just use the the Request and Response classes individually., (*3)

The Request as its name suggests is responsible for generating the URLs for request to the Borica API - possible requests are: register transaction, check status of transaction, register delayed transaction request, complete a delayed transaction request, reverse delayed transaction request and reverse a partially or the full sum from a registered transaction., (*4)

<?php

require __DIR__ . '/vendor/autoload.php';

$factory = new Factory(
    new Request('<terminal id from BORICA>', '<private key signed from BORICA>', '<private key password (optional)>', '<language (optional - BG or EN)>', '<debug (optional, whether you're testing or accepting payments)>'),
    new Response('<public certificate from BORICA>')
);

Registering of a transaction

$factory->request()
        ->amount('1') // 1 EUR
        ->orderID(1) // Unique identifier in your system
        ->description('testing the process') // Short description of the purchase (up to 125 chars)
        ->currency('EUR') // The currency of the payment
        ->register(); // Type of the request

Check status of a transaction

$factory->request()
        ->amount('1') // 1 EUR
        ->orderID(1) // Unique identifier in your system
        ->description('testing the process') // Short description of the purchase (up to 125 chars)
        ->currency('EUR') // The currency of the payment
        ->status(); // Type of the request

Reverse a transaction

$factory->request()
        ->amount('1') // 1 EUR - partial reversal (amount less than the original), full reversal the original amount
        ->orderID(1) // Unique identifier in your system
        ->reverse(); // Type of the request

Using with Laravel 5

Create a service provider as the one below and register it with the app. You can either add it to the config/app.php or register it in Providers/AppServiceProvider.php., (*5)

<?php

namespace App\Providers;

use Mirovit\Borica\Factory;
use Mirovit\Borica\Request;
use Mirovit\Borica\Response;
use Illuminate\Support\ServiceProvider;

class BoricaServiceProvider extends ServiceProvider
{

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $this->app->bind(Request::class, function(){
            return new Request(env('BORICA_TERMINAL_ID'), 'path/to/private.key', '',  app()->getLocale());
        });

        $this->app->bind(Response::class, function(){
            return new Response('path/to/public.cer');
        });

        $this->app->bind(Factory::class, function(){
            return new Factory(app(Request::class), app(Response::class));
        }, true);
    }
}

Contributing

If you'd like to contribute, feel free to send a pull request!, (*6)

The Versions

13/12 2017

dev-master

9999999-dev

Package that enables the communication with BORICA via their API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Miroslav Vitanov

13/12 2017

1.1

1.1.0.0

Package that enables the communication with BORICA via their API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Miroslav Vitanov

13/12 2017

1.0.5

1.0.5.0

Package that enables the communication with BORICA via their API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Miroslav Vitanov

03/09 2017

1.0.4

1.0.4.0

Package that enables the communication with BORICA via their API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Miroslav Vitanov

25/02 2016

1.0.3

1.0.3.0

Package that enables the communication with BORICA via their API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Miroslav Vitanov

30/01 2016

1.0.2

1.0.2.0

Package that enables the communication with BORICA via their API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Miroslav Vitanov

30/01 2016

1.0.1

1.0.1.0

Package that enables the communication with BORICA via their API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Miroslav Vitanov

30/01 2016

1.0

1.0.0.0

Package that enables the communication with BORICA via their API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Miroslav Vitanov