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
+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']);