From 6ce4af05d9221168653687a449f749f709c02fb5 Mon Sep 17 00:00:00 2001 From: Dillon Ngo Date: Fri, 3 Oct 2025 14:13:37 +0800 Subject: [PATCH] E-Invoice - Fix an error reported by Eileen on a transfer with refund inaccessible --- app/Http/Resources/TransactionResource.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/Http/Resources/TransactionResource.php b/app/Http/Resources/TransactionResource.php index 172c29fd..de3fe122 100644 --- a/app/Http/Resources/TransactionResource.php +++ b/app/Http/Resources/TransactionResource.php @@ -42,11 +42,13 @@ class TransactionResource extends JsonResource $eInvoice = false; if($booking && $this->type === TransactionType::REFUND){ $kvp = $this->attributesKVP()->where('key', KVPKey::TRANSACTION_MODEL_CLASS)->first(); - $transactionCreditNote = Transaction::where('id', $kvp->value)->first(); - if($transactionCreditNote){ - $kvp = $transactionCreditNote->attributesKVP()->where('key', KVPKey::AUTOCOUNT_DOCNO_CREDIT_NOTE)->first(); - if($kvp){ - $eInvoice = true; + if($kvp){ + $transactionCreditNote = Transaction::where('id', $kvp->value)->first(); + if($transactionCreditNote){ + $kvp = $transactionCreditNote->attributesKVP()->where('key', KVPKey::AUTOCOUNT_DOCNO_CREDIT_NOTE)->first(); + if($kvp){ + $eInvoice = true; + } } } }