wip
This commit is contained in:
@@ -2,6 +2,9 @@
|
||||
|
||||
namespace App\Repos\Payment\Billing;
|
||||
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Psr7\Request;
|
||||
|
||||
trait HandlesBillingSyncing
|
||||
{
|
||||
/**
|
||||
@@ -16,16 +19,15 @@ trait HandlesBillingSyncing
|
||||
string $amount,
|
||||
string $pay_purpose,
|
||||
) {
|
||||
return sprintf(
|
||||
'{
|
||||
"ecomId" : "%s",
|
||||
"agentId" : "%s",
|
||||
"eposId" : "%s",
|
||||
"account" : "%s",
|
||||
"rnn" : "%s",
|
||||
"amount" : %s,
|
||||
"payPurpose" : "%s"
|
||||
}',
|
||||
$body = sprintf('{
|
||||
"ecomId": "%s",
|
||||
"agentId": "%s",
|
||||
"eposId": "%s",
|
||||
"account": "%s",
|
||||
"rnn": "%s",
|
||||
"amount": "%s",
|
||||
"payPurpose": "%s"
|
||||
}',
|
||||
$uuid,
|
||||
$bank_code,
|
||||
$terminal_id,
|
||||
@@ -34,45 +36,33 @@ trait HandlesBillingSyncing
|
||||
$amount,
|
||||
$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',
|
||||
$request = new Request(
|
||||
method: 'POST',
|
||||
uri: 'http://10.3.158.102:8888/api/paytrn/new',
|
||||
headers: [
|
||||
'Content-Type' => 'application/json',
|
||||
'Authorization' => 'Basic YWRtaW46UUFad3N4MTIz',
|
||||
],
|
||||
]);
|
||||
body: $body
|
||||
);
|
||||
|
||||
$response = curl_exec($curl);
|
||||
$client = new Client;
|
||||
$response = $client->sendAsync($request)->wait();
|
||||
|
||||
curl_close($curl);
|
||||
// curl --location --request POST 'http://10.3.158.102:8888/api/paytrn/new' \
|
||||
// --header 'Authorization: Basic YWRtaW46UUFad3N4MTIz' \
|
||||
// --header 'Content-Type: application/json' \
|
||||
// --data-raw '{
|
||||
// "ecomId" : "0c406ee2-097d-42f7-86c8-18127bd87e10",
|
||||
// "agentId" : "1307",
|
||||
// "eposId" : "30400225",
|
||||
// "account" : "4324234234",
|
||||
// "rnn" : "002959773584",
|
||||
// "amount" : 0.1,
|
||||
// "payPurpose" : "Mart 2025"
|
||||
// }'
|
||||
|
||||
return $response;
|
||||
return $response->getBody();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user