Fix billplz transaction review not working
This commit is contained in:
@@ -14,8 +14,8 @@ class BillplzTransactionReviewController extends Controller
|
|||||||
$date = $request->date ?? Carbon::now()->toDateString();
|
$date = $request->date ?? Carbon::now()->toDateString();
|
||||||
|
|
||||||
$companyMapping = [
|
$companyMapping = [
|
||||||
CompanyStatus::COM_PKB,
|
'PKB',
|
||||||
// CompanyStatus::COM_KOOPPKB,
|
'KOPKB',
|
||||||
];
|
];
|
||||||
|
|
||||||
$billplzTransactionReview = array_map(function($company_code) use($date){
|
$billplzTransactionReview = array_map(function($company_code) use($date){
|
||||||
@@ -29,8 +29,8 @@ class BillplzTransactionReviewController extends Controller
|
|||||||
public function show(Request $request)
|
public function show(Request $request)
|
||||||
{
|
{
|
||||||
$companyMapping = [
|
$companyMapping = [
|
||||||
CompanyStatus::COM_PKB,
|
'PKB',
|
||||||
// CompanyStatus::COM_KOOPPKB,
|
'KOPKB',
|
||||||
];
|
];
|
||||||
|
|
||||||
$billplzTransactionReview = array_map(function($company_code) use($request){
|
$billplzTransactionReview = array_map(function($company_code) use($request){
|
||||||
|
|||||||
@@ -109,7 +109,14 @@ class BillplzService
|
|||||||
$billplzID = collect($arrahnTransactions)->pluck('billplz_id')->unique()->values();
|
$billplzID = collect($arrahnTransactions)->pluck('billplz_id')->unique()->values();
|
||||||
|
|
||||||
$billplzTransactions = collect($billplzID)->map(function ($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) {
|
->map(function ($data) {
|
||||||
$latestTransaction = reset($data['transactions']) == false ? [] : reset($data['transactions']);
|
$latestTransaction = reset($data['transactions']) == false ? [] : reset($data['transactions']);
|
||||||
@@ -126,7 +133,14 @@ class BillplzService
|
|||||||
$billplzID = collect([$billId]);
|
$billplzID = collect([$billId]);
|
||||||
|
|
||||||
$billplzTransactions = collect($billplzID)->map(function ($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) {
|
->map(function ($data) {
|
||||||
$latestTransaction = reset($data['transactions']) == false ? [] : reset($data['transactions']);
|
$latestTransaction = reset($data['transactions']) == false ? [] : reset($data['transactions']);
|
||||||
|
|||||||
Reference in New Issue
Block a user