Comments on code

This commit is contained in:
Dillon Ngo
2024-08-12 10:48:35 +08:00
parent 77e314c52b
commit a36b6f5e57
3 changed files with 6 additions and 0 deletions
@@ -18,6 +18,7 @@ class ListTransactionJobResource extends JsonResource
{ {
$booking = null; //cief todo: 66 $booking = null; //cief todo: 66
$bank = null; $bank = null;
//Check if Transaction of type PAYMENT has an override for recipient bank - starts
if(in_array((int)$this->type, [TransactionType::BILL, TransactionType::REFUND])){ if(in_array((int)$this->type, [TransactionType::BILL, TransactionType::REFUND])){
$booking = $this->owner->owner; $booking = $this->owner->owner;
$bank = $this->owner->bank ?? $booking->bank; $bank = $this->owner->bank ?? $booking->bank;
@@ -26,6 +27,7 @@ class ListTransactionJobResource extends JsonResource
$booking = $this->owner; $booking = $this->owner;
$bank = $this->bank ?? $booking->bank; $bank = $this->bank ?? $booking->bank;
} }
//Check if Transaction of type PAYMENT has an override for recipient bank - ends
$days = $this->created_at->endOfDay()->addWeekdays($booking->service_id === 3 ? 3 : 1); $days = $this->created_at->endOfDay()->addWeekdays($booking->service_id === 3 ? 3 : 1);
return [ return [
@@ -20,6 +20,7 @@ class PaymentTransactionResource extends JsonResource
{ {
$booking = null; //cief todo: 66 $booking = null; //cief todo: 66
$bank = null; $bank = null;
//Check if Transaction of type PAYMENT has an override for recipient bank - starts
if(in_array((int)$this->type, [TransactionType::BILL, TransactionType::REFUND])){ if(in_array((int)$this->type, [TransactionType::BILL, TransactionType::REFUND])){
$booking = $this->owner->owner; $booking = $this->owner->owner;
$bank = $this->owner->bank ?? $booking->bank; $bank = $this->owner->bank ?? $booking->bank;
@@ -28,6 +29,7 @@ class PaymentTransactionResource extends JsonResource
$booking = $this->owner; $booking = $this->owner;
$bank = $this->bank ?? $booking->bank; $bank = $this->bank ?? $booking->bank;
} }
//Check if Transaction of type PAYMENT has an override for recipient bank - ends
$booking_marking = ''; $booking_marking = '';
switch ($this->owner_type) { switch ($this->owner_type) {
@@ -21,6 +21,7 @@ class TransactionResource extends JsonResource
{ {
$booking = null; //cief todo: 66 $booking = null; //cief todo: 66
$bank = null; $bank = null;
//Check if Transaction of type PAYMENT has an override for recipient bank - starts
if(in_array((int)$this->type, [TransactionType::BILL, TransactionType::REFUND, TransactionType::SUPPLIER_REFUND])){ if(in_array((int)$this->type, [TransactionType::BILL, TransactionType::REFUND, TransactionType::SUPPLIER_REFUND])){
$booking = $this->owner->owner; $booking = $this->owner->owner;
$bank = $this->owner->bank ?? $booking->bank; $bank = $this->owner->bank ?? $booking->bank;
@@ -29,6 +30,7 @@ class TransactionResource extends JsonResource
$booking = $this->owner; $booking = $this->owner;
$bank = $this->bank ?? $booking->bank; $bank = $this->bank ?? $booking->bank;
} }
//Check if Transaction of type PAYMENT has an override for recipient bank - ends
$days = $this->created_at->endOfDay()->addWeekdays($booking->service_id === 3 ? 3 : 1); $days = $this->created_at->endOfDay()->addWeekdays($booking->service_id === 3 ? 3 : 1);
return [ return [