wip
This commit is contained in:
@@ -447,44 +447,49 @@ function syncWithBankSystem(
|
|||||||
$amount = $online_payment_tmt_amount;
|
$amount = $online_payment_tmt_amount;
|
||||||
$payPurpose = $pay_purpose;
|
$payPurpose = $pay_purpose;
|
||||||
|
|
||||||
$curl = curl_init();
|
return [
|
||||||
|
'amount' => $amount,
|
||||||
|
'amount_formatted' => number_format($amount, 2, '.', ''),
|
||||||
|
];
|
||||||
|
|
||||||
curl_setopt_array($curl, [
|
// $curl = curl_init();
|
||||||
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',
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
|
|
||||||
$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.
|
* Get Sber credentials for a given payment item.
|
||||||
*
|
*
|
||||||
* @param SberPaymentOrderItem $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
|
function getSberCredentials(SberPaymentOrderItem $item): array
|
||||||
{
|
{
|
||||||
@@ -502,6 +507,8 @@ function getSberCredentials(SberPaymentOrderItem $item): array
|
|||||||
return ['error' => 'Bu resource tapylmady', 'type' => 'danger'];
|
return ['error' => 'Bu resource tapylmady', 'type' => 'danger'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$relatedResource->loadMissing(['branch']);
|
||||||
|
|
||||||
if (! $relatedResource->branch) {
|
if (! $relatedResource->branch) {
|
||||||
return ['error' => 'Şahamça bilen birikdirilmedik', 'type' => 'danger'];
|
return ['error' => 'Şahamça bilen birikdirilmedik', 'type' => 'danger'];
|
||||||
}
|
}
|
||||||
@@ -517,5 +524,6 @@ function getSberCredentials(SberPaymentOrderItem $item): array
|
|||||||
'username' => $username,
|
'username' => $username,
|
||||||
'password' => $password,
|
'password' => $password,
|
||||||
'onlinePaymentResource' => $onlinePaymentResource,
|
'onlinePaymentResource' => $onlinePaymentResource,
|
||||||
|
'relatedResource' => $relatedResource,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,10 @@ use Spatie\MediaLibrary\InteractsWithMedia;
|
|||||||
* @property int $user_id
|
* @property int $user_id
|
||||||
* @property string $address
|
* @property string $address
|
||||||
* @property array $sender_datas
|
* @property array $sender_datas
|
||||||
|
* @property ?string $sender_full_name
|
||||||
|
* @property ?string $sender_passport_serie
|
||||||
|
* @property ?string $sender_passport_number
|
||||||
|
* @property ?string $sender_deposit_account
|
||||||
* @property array $payment_reciever
|
* @property array $payment_reciever
|
||||||
* @property string $documents
|
* @property string $documents
|
||||||
* @property string $status
|
* @property string $status
|
||||||
|
|||||||
@@ -44,9 +44,20 @@ class SyncWithSystem extends Action
|
|||||||
/** @var \App\Models\Payment\OnlinePaymentHistory $onlinePaymentResource */
|
/** @var \App\Models\Payment\OnlinePaymentHistory $onlinePaymentResource */
|
||||||
$onlinePaymentResource = $result['onlinePaymentResource'];
|
$onlinePaymentResource = $result['onlinePaymentResource'];
|
||||||
|
|
||||||
|
/** @var \App\Modules\SberPaymentOrder\Models\SberPaymentOrder $sberPaymentOrder */
|
||||||
|
$sberPaymentOrder = $result['relatedResource'];
|
||||||
|
|
||||||
$response = checkOnlinePayment($onlinePaymentResource->orderId, $result['username'], $result['password']);
|
$response = checkOnlinePayment($onlinePaymentResource->orderId, $result['username'], $result['password']);
|
||||||
|
|
||||||
// syncWithBankSystem();
|
info(syncWithBankSystem(
|
||||||
|
online_payment_order_uuid: $onlinePaymentResource->orderId,
|
||||||
|
bank_unique_code: $sberPaymentOrder->branch->unique_code,
|
||||||
|
online_payment_terminal_id: $response['terminalId'],
|
||||||
|
user_deposit_account: $sberPaymentOrder->sender_deposit_account,
|
||||||
|
online_payment_auth_ref_num: $response['authRefNum'],
|
||||||
|
online_payment_tmt_amount: $response['paymentAmountInfo']['depositedAmount'],
|
||||||
|
pay_purpose: $sberPaymentOrder->created_at->translatedFormat('F').' '.$sberPaymentOrder->created_at->format('Y')
|
||||||
|
));
|
||||||
|
|
||||||
return Action::modal('modal-response', [
|
return Action::modal('modal-response', [
|
||||||
'title' => 'HALKBANK API',
|
'title' => 'HALKBANK API',
|
||||||
|
|||||||
Reference in New Issue
Block a user