New button to allow admin to switch e-credit note to normal credit note for customer otped in for e-invoice

This commit is contained in:
Dillon Ngo
2026-06-04 11:24:22 +08:00
parent 77abd7b8d0
commit 20b22e6341
9 changed files with 205 additions and 4 deletions
@@ -40,6 +40,8 @@ class TransactionResource extends JsonResource
//Check if Transaction of type PAYMENT has an override for recipient bank - ends
$eInvoice = false;
$manualOptInNormalCreditNote = false;
if($booking && $this->type === TransactionType::REFUND){
$kvp = $this->attributesKVP()->where('key', KVPKey::TRANSACTION_MODEL_CLASS)->first();
if($kvp){
@@ -51,6 +53,12 @@ class TransactionResource extends JsonResource
}
}
}
$kvp = $this->attributesKVP()->where('key', KVPKey::CREDIT_NOTE_NORMAL_OPT_IN_OVERRIDE)->first();
if($kvp){
if($kvp->value == 1){
$manualOptInNormalCreditNote = true;
}
}
}
$days = $this->created_at->endOfDay()->addWeekdays($booking->service_id === 3 ? 3 : 1);
@@ -90,6 +98,7 @@ class TransactionResource extends JsonResource
'bank' => ((int) $this->type === TransactionType::PAYMENT) ? new BankResource($bank) : null, //When a transaction (of type payment) has an override recipient bank details on booking, this is NOT null
'bank_recipient_edited' => $isEditedBankRecipient,
'e_invoice' => $this->when($this->type === TransactionType::REFUND, $eInvoice),
'manual_opt_in_normal_credit_note' => $this->when($this->type === TransactionType::REFUND, $manualOptInNormalCreditNote),
];
}
}