Skip to content
forked from Fruitware/MaibApi

Moldova Agroindbank php sdk api

Notifications You must be signed in to change notification settings

indrivo/MaibApi

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MaibAPI

Maib online payments php SDK

Installing

composer require indrivo/maib-api

Usage

namespace MyProject;
require_once(__DIR__ . '/vendor/autoload.php');

use Fruitware\MaibApi\MaibClient;
use Fruitware\MaibApi\MaibDescription;
use GuzzleHttp\Client;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Middleware;
use GuzzleHttp\MessageFormatter;
use Monolog\Handler\StreamHandler;
use Monolog\Logger;

//set options
$options = [
	'base_uri' => 'https://ecomm.maib.md:4455',
	'debug'  => false,
	'verify' => true,
	'cert'    => [__DIR__.'/cert/pcert.pem', 'Pem_pass'],
	'ssl_key' => __DIR__.'/cert/key.pem',
	'config'  => [
		'curl'  =>  [
			CURLOPT_SSL_VERIFYHOST => 2,
			CURLOPT_SSL_VERIFYPEER => true,
		]
	]
];

// create a log for client class, if you want (monolog/monolog required)
if ($log_is_required) {
	$log = new Logger('maib_guzzle_request');
	$log->pushHandler(new StreamHandler(__DIR__.'/logs/maib_guzzle_request.log', Logger::DEBUG));
	$stack = HandlerStack::create();
	$stack->push(
		Middleware::log($log, new MessageFormatter(MessageFormatter::DEBUG))
	);
	$options['handler'] = $stack;
}

// init Client
$guzzleClient = new Client($options);
$client = new MaibClient($guzzleClient);

// examples

//register sms transaction
var_dump($client->registerSmsTransaction('1', 498, '127.0.0.1', '', 'ru'));

//register dms authorization
var_dump($client->registerDmsAuthorization('1', 498, '127.0.0.1', '', 'ru'));

//execute dms transaction
var_dump($client->makeDMSTrans('1', '1', 498, '127.0.0.1', '', 'ru'));

//get transaction result
var_dump($client->getTransactionResult('1', '127.0.0.1'));

//revert transaction
var_dump($client->revertTransaction('1', '1'));

//transaction refund
var_dump($client->refundTransaction('1', '1'));

//close business day
var_dump($client->closeDay());

About

Moldova Agroindbank php sdk api

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%