mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
Merge branch 'master' of gitlab.com:CIEFWorldwideSdnBhd/exchange-2.0 into dillon/voucherify-35
# Conflicts: # routes/api.php
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\StatementTransactionOwnerType;
|
||||
use App\Models\Booking;
|
||||
use App\Models\Group;
|
||||
use App\Models\Transaction;
|
||||
use App\Models\Wallet;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class BankStatementTransactionOwnerResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
|
||||
$referenceLink = null;
|
||||
if($this->system === 'EXCHANGE') {
|
||||
if($this->owner_type === Transaction::class){
|
||||
if($this->type === StatementTransactionOwnerType::SALES){
|
||||
$referenceLink = route('booking.details', $this->owner_reference);
|
||||
}
|
||||
|
||||
if($this->type === StatementTransactionOwnerType::WALLET_TOP_UP){
|
||||
$referenceLink = route('booking.details', $this->owner_reference);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($this->system === 'SHIPPING_PORTAL') {
|
||||
if($this->owner_type === Transaction::class){
|
||||
if($this->type === StatementTransactionOwnerType::SALES){
|
||||
$referenceLink = 'https://izyim.cief-malaysia.com/order/show/'. $this->owner_reference;
|
||||
}
|
||||
if($this->type === StatementTransactionOwnerType::WALLET_TOP_UP){
|
||||
$referenceLink = 'https://izyim.cief-malaysia.com/wallet/'. $this->owner_reference .'/details';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'type' => $this->type,
|
||||
'system' => $this->system,
|
||||
'owner_type' => $this->owner_type,
|
||||
'owner_id' => $this->owner_id,
|
||||
'reference' => $this->owner_reference,
|
||||
'reference_link' => $referenceLink,
|
||||
'invoice_reference' => $this->invoice_reference,
|
||||
'receipt_reference' => $this->receipt_reference,
|
||||
'status' => $this->status
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class BankStatementTransactionResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'account_number' => $this->statement->account->number,
|
||||
'account_type' => $this->statement->account->type,
|
||||
'account_name' => $this->statement->account->name,
|
||||
'account_statement_id' => $this->statement->id,
|
||||
'account_statement_date_from' => $this->statement->date_from,
|
||||
'account_statement_date_to' => $this->statement->date_to,
|
||||
'posting_date' => $this->posting_date->format('d-m-Y g:i A'),
|
||||
'amount' => $this->amount,
|
||||
'transaction_description_1' => $this->transaction_description,
|
||||
'transaction_description_2' => $this->transaction_description_2,
|
||||
'transaction_description_3' => $this->transaction_description_3,
|
||||
'transaction_description_4' => $this->transaction_description_4,
|
||||
'transaction_description_5' => $this->transaction_description_5,
|
||||
'owners' => [
|
||||
'approved' => BankStatementTransactionOwnerResource::collection($this->owners()->whereIn('status', [ApprovalStatus::APPROVED])->get()),
|
||||
'pending_verification' => BankStatementTransactionOwnerResource::collection($this->owners()->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION])->get()),
|
||||
'rejected' => BankStatementTransactionOwnerResource::collection($this->owners()->whereIn('status', [ApprovalStatus::REJECTED])->get())
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user