fix console update status

This commit is contained in:
Hafifie PKB
2025-01-23 16:43:35 +08:00
parent cbd8cc15e1
commit 1bfc38167c
2 changed files with 16 additions and 2 deletions
+1 -1
View File
@@ -51,7 +51,7 @@ class UpdateUnsuccess extends Command
return;
}
$billplzUpdatedTransactionStatus = array_map(fn($x) => $billplzService->getTransactionByBillId($x), $FailedBillplzID);
$billplzUpdatedTransactionStatus = array_map(fn($x) => $billplzService->getTransactionByBillId($x,$company), $FailedBillplzID);
$getCompletedBillplzTransaction = function() use($billplzUpdatedTransactionStatus){
+15 -1
View File
@@ -240,8 +240,22 @@ class BillplzService
return $summarizedBillplzTransactions;
}
public function getTransactionByBillId($billId)
public function getTransactionByBillId($billId,$company)
{
$appEnvironment = config('app.env');
$billplzEnvironments = [
'PKB' => ($appEnvironment === 'production') ? config('services.billplz.production') : config('services.billplz.sandbox'),
'KOPKB' => ($appEnvironment === 'production') ? config('services.billplz.production_kopkb') : config('services.billplz.sandbox_kopkb'),
];
$billplzConfig = $appEnvironment === 'production'
? ($billplzEnvironments[$company] ?? config('services.billplz.production'))
: ($billplzEnvironments[$company] ?? config('services.billplz.sandbox'));
$client = Client::make($billplzConfig['api_key'], ($this->isBase64($billplzConfig['x_signature'])) ? $billplzConfig['x_signature'] : base64_encode($billplzConfig['x_signature']));
$client->useVersion('v4');
try {
return $this->client->bill()->transaction($billId)->toArray();
} catch (\Throwable $th) {