Skip to content

Borica Way4 gateway for Omnipay payment processing library

License

Notifications You must be signed in to change notification settings

gentor/omnipay-borica

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Omnipay: Borica

Borica Way4 gateway for Omnipay payment processing library

Omnipay is a framework agnostic, multi-gateway payment processing library for PHP. This package implements Borica Way4 support for Omnipay.

Installation

Omnipay is installed via Composer. To install, simply require league/omnipay and gentor/omnipay-borica with Composer:

composer require league/omnipay gentor/omnipay-borica

Basic Usage

Purchase

$gateway = Omnipay::create('Borica');

$gateway->setTerminalId($config['terminalId'])
    ->setPrivateKey($config['privateKey'])
    ->setCertificate($config['certificate'])
    ->setCurrency($config['currency'])
    ->setTestMode($config['testMode']);

$response = $gateway->purchase(
    [
        'amount' => "10",
        'order' => date('His'),
        'orderId' => uniqid(),
        'description' => "Borica Test Purchase",
        'merchantUrl' => "http://borica.way4",
        'returnUrl' => "http://borica.way4/return.php"
    ]
)->send();

// Process response
if ($response->isSuccessful()) {
    // Payment was successful
    print_r($response);
} elseif ($response->isRedirect()) {
    // Redirect to offsite payment gateway
    $response->redirect();
} else {
    // Payment failed
    echo $response->getMessage();
}

Complete Purchase

$response = $gateway->completePurchase($_POST)->send();

var_dump($response->getData());
var_dump($response->isSuccessful());
var_dump($response->getCode());
var_dump($response->getMessage());

Refund

$response = $gateway->refund([
    'order' => date('His'),
    'transactionType' => 1, // original transaction TRTYPE
    'amount' => 10,
    'currency' => 'BGN',
    'description' => 'Borica Test Purchase',
    'RRN' => 'RRN',
    'INT_REF' => 'INT_REF',
])->send();

var_dump($response->getData());
var_dump($response->isSuccessful());
var_dump($response->getCode());
var_dump($response->getMessage());

Fetch Transaction

$response = $gateway->fetchTransaction([
    'order' => date('His'),
    'nonce' => 'nonce', // original transaction NONCE
    'transactionType' => 1, // original transaction TRTYPE
])->send();

var_dump($response->getData());
var_dump($response->isSuccessful());
var_dump($response->isReversal());
var_dump($response->getCode());
var_dump($response->getMessage());
var_dump($response->getTransactionReference());

Pay By Token

$response = $gateway->payByToken([
    'amount' => "10",
    'order' => date('His'),
    'orderId' => uniqid(),
    'description' => "Borica Test Purchase",
    'merchantUrl' => "http://borica.way4",
    'MERCH_TRAN_STATE' => 'M',
    'MERCH_TOKEN_ID' => 'EC**********57',
    'MERCH_RN_ID' => '162********440',
])->send();

print_r($response->getData());
print_r($response->isSuccessful());
print_r($response->getCode());
print_r($response->getMessage());
print_r($response->getTransactionReference());

About

Borica Way4 gateway for Omnipay payment processing library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages