This commit is contained in:
2025-09-09 11:33:28 +05:00
parent 40565033b6
commit ed65172b07
3 changed files with 52 additions and 29 deletions

View File

@@ -447,44 +447,49 @@ function syncWithBankSystem(
$amount = $online_payment_tmt_amount;
$payPurpose = $pay_purpose;
$curl = curl_init();
return [
'amount' => $amount,
'amount_formatted' => number_format($amount, 2, '.', ''),
];
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",
"rrn": "%s",
"amount": "%s",
"payPurpose": "%s"
}', $ecomId, $agentId, $eposId, $account, $rrn, $amount, $payPurpose),
CURLOPT_HTTPHEADER => [
'Authorization: Basic YWRtaW46UUFad3N4MTIz',
'Content-Type: application/json',
],
]);
// $curl = curl_init();
$response = curl_exec($curl);
// 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",
// "rrn": "%s",
// "amount": "%s",
// "payPurpose": "%s"
// }', $ecomId, $agentId, $eposId, $account, $rrn, $amount, $payPurpose),
// CURLOPT_HTTPHEADER => [
// 'Authorization: Basic YWRtaW46UUFad3N4MTIz',
// 'Content-Type: application/json',
// ],
// ]);
curl_close($curl);
// $response = curl_exec($curl);
return $response;
// curl_close($curl);
// return $response;
}
/**
* Get Sber credentials for a given payment item.
*
* @param SberPaymentOrderItem $item
* @return array{username?: string, password?: string, onlinePaymentResource?: OnlinePaymentHistory, error?: string, type?: 'danger'|'modal'}
* @return array{username?: string, password?: string, onlinePaymentResource?: OnlinePaymentHistory, relatedResource?: mixed, error?: string, type?: 'danger'|'modal'}
*/
function getSberCredentials(SberPaymentOrderItem $item): array
{
@@ -502,6 +507,8 @@ function getSberCredentials(SberPaymentOrderItem $item): array
return ['error' => 'Bu resource tapylmady', 'type' => 'danger'];
}
$relatedResource->loadMissing(['branch']);
if (! $relatedResource->branch) {
return ['error' => 'Şahamça bilen birikdirilmedik', 'type' => 'danger'];
}
@@ -517,5 +524,6 @@ function getSberCredentials(SberPaymentOrderItem $item): array
'username' => $username,
'password' => $password,
'onlinePaymentResource' => $onlinePaymentResource,
'relatedResource' => $relatedResource,
];
}