This commit is contained in:
2025-03-19 14:26:41 +05:00
parent a3da2126f6
commit 8a6cf2b3b9
3 changed files with 47 additions and 57 deletions

View File

@@ -34,17 +34,17 @@ class OnlinePaymentController extends Controller
/** @var \App\Modules\VisaMasterPaymentOrder\Models\VisaMasterPaymentOrderItem */ /** @var \App\Modules\VisaMasterPaymentOrder\Models\VisaMasterPaymentOrderItem */
$resource = $data['resource']; $resource = $data['resource'];
if ($data['success'] && $paymentHistory && is_array($paymentHistory->api_response)) { // if ($data['success'] && $paymentHistory && is_array($paymentHistory->api_response)) {
info(OnlinePaymentRepo::syncWithBilling( // info(OnlinePaymentRepo::syncWithBilling(
uuid: $paymentHistory->orderId, // uuid: $paymentHistory->orderId,
bank_code: $bank->unique_code, // bank_code: $bank->unique_code,
terminal_id: $paymentHistory->api_response['terminalId'], // terminal_id: $paymentHistory->api_response['terminalId'],
account_number: $resource->parent->sender_datas[0]['deposit_account'], // account_number: $resource->parent->sender_datas[0]['deposit_account'],
rrn: $paymentHistory->api_response['authRefNum'], // rrn: $paymentHistory->api_response['authRefNum'],
amount: $resource->tmt_payment_amount, // amount: $resource->tmt_payment_amount,
pay_purpose: $resource->created_at->translatedFormat('F').' '.$resource->created_at->format('Y'), // pay_purpose: $resource->created_at->translatedFormat('F').' '.$resource->created_at->format('Y'),
)); // ));
} // }
return view(OnlinePaymentRepo::statusView(), $data); return view(OnlinePaymentRepo::statusView(), $data);
} }

View File

@@ -2,6 +2,9 @@
namespace App\Repos\Payment\Billing; namespace App\Repos\Payment\Billing;
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Request;
trait HandlesBillingSyncing trait HandlesBillingSyncing
{ {
/** /**
@@ -16,15 +19,14 @@ trait HandlesBillingSyncing
string $amount, string $amount,
string $pay_purpose, string $pay_purpose,
) { ) {
return sprintf( $body = sprintf('{
'{ "ecomId": "%s",
"ecomId" : "%s", "agentId": "%s",
"agentId" : "%s", "eposId": "%s",
"eposId" : "%s", "account": "%s",
"account" : "%s", "rnn": "%s",
"rnn" : "%s", "amount": "%s",
"amount" : %s, "payPurpose": "%s"
"payPurpose" : "%s"
}', }',
$uuid, $uuid,
$bank_code, $bank_code,
@@ -34,45 +36,33 @@ trait HandlesBillingSyncing
$amount, $amount,
$pay_purpose, $pay_purpose,
); );
$curl = curl_init();
curl_setopt_array($curl, [ $request = new Request(
CURLOPT_URL => 'http://10.3.158.102:8888/api/paytrn/new', method: 'POST',
CURLOPT_RETURNTRANSFER => true, uri: 'http://10.3.158.102:8888/api/paytrn/new',
CURLOPT_ENCODING => '', headers: [
CURLOPT_MAXREDIRS => 10, 'Content-Type' => 'application/json',
CURLOPT_TIMEOUT => 0, 'Authorization' => 'Basic YWRtaW46UUFad3N4MTIz',
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',
], ],
]); 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();
} }
} }

View File

@@ -79,7 +79,7 @@
'{{ $card_month }}/{{ substr($card_year, 2) }}', '{{ $card_month }}/{{ substr($card_year, 2) }}',
'card-history-details', 'card-history-details',
)" )"
>{{ $resource->card_number }}</div> >{{ trim(chunk_split($resource->card_number, 4, ' ')) }}</div>
<div class="expiry-container"> <div class="expiry-container">
<div class="card-holder dark:text-white">{{ $resource->card_name }}</div> <div class="card-holder dark:text-white">{{ $resource->card_name }}</div>
<div class="expiry-date dark:text-white">{{ $card_month }}/{{ $card_year }}</div> <div class="expiry-date dark:text-white">{{ $card_month }}/{{ $card_year }}</div>