61 lines
1.6 KiB
PHP
61 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Repos\Payment\Billing;
|
|
|
|
trait HandlesBillingSyncing
|
|
{
|
|
/**
|
|
* Sync with billing
|
|
*/
|
|
public static function syncWithBilling(
|
|
string $uuid,
|
|
string $bank_code,
|
|
string $terminal_id,
|
|
string $account_number,
|
|
string $rrn,
|
|
string $amount,
|
|
string $pay_purpose,
|
|
) {
|
|
$curl = curl_init();
|
|
|
|
curl_setopt_array($curl, [
|
|
CURLOPT_URL => 'http://10.3.158.102:8888/api/paytrn/new',
|
|
CURLOPT_RETURNTRANSFER => true,
|
|
CURLOPT_ENCODING => '',
|
|
CURLOPT_MAXREDIRS => 10,
|
|
CURLOPT_TIMEOUT => 0,
|
|
CURLOPT_FOLLOWLOCATION => true,
|
|
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
|
CURLOPT_CUSTOMREQUEST => 'POST',
|
|
CURLOPT_POSTFIELDS => sprintf(
|
|
'{
|
|
"ecomId" : "%s",
|
|
"agentId" : "%s",
|
|
"eposId" : "%s",
|
|
"account" : "%s",
|
|
"rnn" : "%s",
|
|
"amount" : %s,
|
|
"payPurpose" : "%s"
|
|
}',
|
|
$uuid,
|
|
$bank_code,
|
|
$terminal_id,
|
|
$account_number,
|
|
$rrn,
|
|
$amount,
|
|
$pay_purpose,
|
|
),
|
|
CURLOPT_HTTPHEADER => [
|
|
'Authorization: Basic YWRtaW46UUFad3N4MTIz',
|
|
'Content-Type: application/json',
|
|
],
|
|
]);
|
|
|
|
$response = curl_exec($curl);
|
|
|
|
curl_close($curl);
|
|
|
|
return $response;
|
|
}
|
|
}
|