Fix billplz transaction review not working

This commit is contained in:
Afiq Hamzah
2025-02-16 12:06:50 +08:00
parent fb61604c88
commit 0437442b4d
2 changed files with 20 additions and 6 deletions
@@ -14,8 +14,8 @@ class BillplzTransactionReviewController extends Controller
$date = $request->date ?? Carbon::now()->toDateString();
$companyMapping = [
CompanyStatus::COM_PKB,
// CompanyStatus::COM_KOOPPKB,
'PKB',
'KOPKB',
];
$billplzTransactionReview = array_map(function($company_code) use($date){
@@ -29,8 +29,8 @@ class BillplzTransactionReviewController extends Controller
public function show(Request $request)
{
$companyMapping = [
CompanyStatus::COM_PKB,
// CompanyStatus::COM_KOOPPKB,
'PKB',
'KOPKB',
];
$billplzTransactionReview = array_map(function($company_code) use($request){
+16 -2
View File
@@ -109,7 +109,14 @@ class BillplzService
$billplzID = collect($arrahnTransactions)->pluck('billplz_id')->unique()->values();
$billplzTransactions = collect($billplzID)->map(function ($billId) {
return $this->client->transaction()->get($billId)->toArray();
try {
return $this->client->transaction()->get($billId)->toArray();
} catch (\Exception $e) {
return [];
}
})
->filter(function ($transaction) {
return $transaction !== [];
})
->map(function ($data) {
$latestTransaction = reset($data['transactions']) == false ? [] : reset($data['transactions']);
@@ -126,7 +133,14 @@ class BillplzService
$billplzID = collect([$billId]);
$billplzTransactions = collect($billplzID)->map(function ($billId) {
return $this->client->transaction()->get($billId)->toArray();
try {
return $this->client->transaction()->get($billId)->toArray();
} catch (\Exception $e) {
return [];
}
})
->filter(function ($transaction) {
return $transaction !== [];
})
->map(function ($data) {
$latestTransaction = reset($data['transactions']) == false ? [] : reset($data['transactions']);