wip
This commit is contained in:
@@ -56,8 +56,64 @@ class OnlinePaymentController extends Controller
|
||||
{
|
||||
$data = OnlinePaymentRepo::checkPaymentSber($request);
|
||||
|
||||
// OnlinePaymentRepo::syncWithBilling();
|
||||
/** @var \App\Models\Payment\OnlinePaymentHistory */
|
||||
$paymentHistory = $data['paymentHistory'];
|
||||
|
||||
/** @var \App\Models\Branch\Branch */
|
||||
$bank = $data['bank_branch'];
|
||||
|
||||
/** @var \App\Modules\SberPaymentOrder\Models\SberPaymentOrderItem */
|
||||
$resource = $data['resource'];
|
||||
|
||||
$response = $data['response'];
|
||||
|
||||
// if ($data['success'] && $paymentHistory) {
|
||||
// $this->runActions($paymentHistory, $bank, $response, $resource);
|
||||
// }
|
||||
|
||||
return view(OnlinePaymentRepo::statusView(), $data);
|
||||
}
|
||||
|
||||
public function runActions($paymentHistory, $bank, $response, $resource): void
|
||||
{
|
||||
$ecomId = $paymentHistory->orderId;
|
||||
$agentId = $bank->unique_code;
|
||||
$eposId = $response['terminalId'];
|
||||
$account = $resource->parent->sender_datas[0]['deposit_account'];
|
||||
$rrn = $response['authRefNum'];
|
||||
$amount = $resource->tmt_payment_amount;
|
||||
$payPurpose = $resource->created_at->translatedFormat('F').' '.$resource->created_at->format('Y');
|
||||
|
||||
$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",
|
||||
"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_close($curl);
|
||||
|
||||
info($response);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user