mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 12:34:18 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f0cb7828c3 | |||
| 7a2ed92147 | |||
| 6427e2996f |
@@ -37,6 +37,7 @@ class MappableTransactionResource extends JsonResource
|
||||
'owner_type' => Transaction::class,
|
||||
'owner_id'=> $this->id,
|
||||
'owner_reference'=> $reference,
|
||||
'created_at'=> $this->created_at, // invoice date
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,16 +27,19 @@ class MappableTransactionWithDetailsResource extends JsonResource
|
||||
'order_reference' => null,
|
||||
'bill_no' => null,
|
||||
'marking' => null,
|
||||
'created_at' => null
|
||||
];
|
||||
|
||||
if ($this->type === TransactionType::PAYMENT) {
|
||||
$order = $this->owner->owner->owner;
|
||||
$data['order_reference'] = $order->reference;
|
||||
$data['debtor_code'] = $order->companyModule->company->debtor;
|
||||
$data['created_at'] = $this->owner->created_at; // invoice date
|
||||
} elseif (in_array($this->type, [TransactionType::GROUP_PAYMENT, TransactionType::TOP_UP])) {
|
||||
$connection = $this->owner->owner->inviters()->withPivot('invitee_reference')->first();
|
||||
$data['marking'] = $connection ? $connection->pivot->invitee_reference : '';
|
||||
$data['bill_no'] = $this->bill_no;
|
||||
$data['created_at'] = $this->created_at;
|
||||
} else {
|
||||
$payments = $this->transactions()
|
||||
->payments()->where('status', ApprovalStatus::APPROVED)
|
||||
@@ -54,6 +57,7 @@ class MappableTransactionWithDetailsResource extends JsonResource
|
||||
'type' => $payment->type,
|
||||
'marking' => null,
|
||||
'amount' => $payment->amount,
|
||||
'created_at' => $this->created_at
|
||||
];
|
||||
})->toArray();
|
||||
} else {
|
||||
@@ -61,6 +65,7 @@ class MappableTransactionWithDetailsResource extends JsonResource
|
||||
$data['amount'] = 'Transaction Type not allowed';
|
||||
$data['transaction_type'] = $this->type;
|
||||
$data['payment_transactions'] = null;
|
||||
$data['created_at'] = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user