This commit is contained in:
2025-03-16 14:12:26 +05:00
parent 0b47fe694c
commit e0d876707d
6 changed files with 110 additions and 43 deletions

View File

@@ -7,43 +7,56 @@ trait HandlesBillingSyncing
/**
* Sync with billing
*/
// public static function syncWithBilling(): bool|string
// {
// $curl = curl_init();
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" : "30401238",
// "account" : "130420912769753",
// "rnn" : "110784016238",
// "amount" : 895.46,
// "payPurpose" : "Mart 2025"
// }',
// // $uuid,
// // $bankCode,
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',
],
]);
// ),
// CURLOPT_HTTPHEADER => [
// 'Authorization: Basic YWRtaW46UUFad3N4MTIz',
// 'Content-Type: application/json',
// ],
// ]);
$response = curl_exec($curl);
// $response = curl_exec($curl);
curl_close($curl);
// curl_close($curl);
info($response);
// return $response;
// }
return $response;
}
}