1. Go to this page and download the library: Download prinx/sevotransact library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
// File: callback.php
t\Callback;
$callback = new Callback;
// This is just an example.
// Write your controller the way you are used to with your favorite framework.
namespace Controllers;
use Prinx\Sevotransact\Callback;
class MobileMoneyCallbackController extends Controller
{
public function processCallback()
{
$callback = new Callback;
}
}
$callback->success(function (Callback $callback) {
// Transaction was successful. Do stuff.
})->failure(function (Callback $callback) {
// Transaction failed. Do stuff.
})->always(function (Callback $callback) {
// Do stuff whether transaction was successful or not.
});
$callback = new Callback;
$callback->process(function (Callback $callback) {
//
});
use Prinx\Sevotransact\Callback;
$callback = new Callback;
$callback->on('000', function (Callback $callback) {
//
})->on('101', function (Callback $callback) {
//
})->on(['code' => '000', 'phone' => '233...'], function (Callback $callback) {
//
})->success(function (Callback $callback){
// We can still chain the success or failure methods.
})->failure(function (Callback $callback) {
//
})->process();
// SmsService is your own implementation.
$sms = new SmsService();
$callback->success(function (Callback $callback) use ($sms) {
$message = $callback->getMessage();
$phone = $callback->getPhone();
$sms->send($message, $phone);
});
class CallbackHandler
{
public function callbacks(Callback $callback)
{
//
}
}
class CallbackHandler
{
public function callbacks(Callback $callback)
{
return [
['000', function (Callback $callback) {
$message = $callback->getMessage();
}],
['101', function (Callback $callback) {
//
}],
];
}
}
class CallbackHandler
{
public function callbacks(Callback $callback)
{
return [
['000', function (Callback $callback) {
//
}],
['000', function (Callback $callback) {
// Another callback that will be run for the same code.
}],
['101', function (Callback $callback) {
//
}],
];
}
}
class CallbackHandler
{
public function callbacks(Callback $callback)
{
return [
['000', [
function (Callback $callback) {
//
},
function (Callback $callback) {
// Another callback that will be run for the same code.
},
]],
['101', function (Callback $callback) {
//
}],
];
}
}
class CallbackHandler
{
public function callbacks(Callback $callback)
{
return [
['success', function (Callback $callback) {
//
}],
['failure', function (Callback $callback) {
//
}],
['always', function (Callback $callback) {
//
}],
];
}
}
class CallbackHandler
{
public function callbacks(Callback $callback)
{
return [
[['code' => '000', 'phone' => '233...'], function (Callback $callback) {
//
}],
];
}
}
class CallbackHandler
{
public function callbacks(Callback $callback)
{
return [
['000', function (Callback $callback) {
//
}],
[['code' => '000', 'phone' => '233...'], function (Callback $callback) {
//
}],
['success', function (Callback $callback) {
//
}],
['always', function (Callback $callback) {
//
}],
];
}
}
class CallbackHandler
{
public function callbacks(Callback $callback)
{
return [
['000', 'sendSms'],
['101', ['notifyAdmin', 'sendSms']]
['always', 'log'],
];
}
public function notifyAdmin(Callback $callback)
{
// Notify admin...
}
public function sendSms(Callback $callback)
{
//
}
public function log(Callback $callback)
{
//
}
}
// Do not forget to import the class from it namespace
use App\Helpers\CallbackHandler;
$callback = new Callback;
$callback->process(CallbackHandler::class);
$callback->setLogFolder($path);
ini
SEVOTRANSACT_LOCAL_LOG_ENABLED=false
ini
SEVOTRANSACT_SLACK_LOG_WEBHOOK=https://
ini
SEVOTRANSACT_SLACK_LOG_ENABLED=false
ini
SEVOTRANSACT_LOG_ENABLED=false
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.