mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-28 08:53:59 +00:00
fix bugs
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\StatementTransactionOwnerType;
|
||||
use App\Models\Booking;
|
||||
use App\Models\Group;
|
||||
use App\Models\Transaction;
|
||||
@@ -18,34 +19,28 @@ class BankStatementTransactionOwnerResource extends JsonResource
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
$reference = null;
|
||||
|
||||
$referenceLink = null;
|
||||
if($this->system === 'EXCHANGE') {
|
||||
if($this->owner_type === Transaction::class){
|
||||
$transaction = Transaction::find($this->owner_id);
|
||||
|
||||
if($transaction->owner_type === Booking::class){
|
||||
$reference = $transaction->owner->marking;
|
||||
$referenceLink = route('booking.details', $transaction->owner->marking);
|
||||
if($this->type === StatementTransactionOwnerType::SALES){
|
||||
$referenceLink = route('booking.details', $this->owner_reference);
|
||||
}
|
||||
|
||||
if($transaction->owner_type === Wallet::class) {
|
||||
$reference = $transaction->owner->owner->reference;
|
||||
$referenceLink = route('wallet.details', $transaction->owner->owner->reference);
|
||||
if($this->type === StatementTransactionOwnerType::WALLET_TOP_UP){
|
||||
$referenceLink = route('booking.details', $this->owner_reference);
|
||||
}
|
||||
}
|
||||
|
||||
if($this->owner_type === Group::class){
|
||||
$transaction = Group::find($this->owner_id);
|
||||
$reference = $transaction->reference;
|
||||
// $referenceLink = route('booking.details', $transaction->owner->marking);
|
||||
}
|
||||
}
|
||||
|
||||
if($this->system === 'SHIPPING_PORTAL') {
|
||||
if($this->owner_type === Transaction::class){
|
||||
$transaction = Transaction::find($this->owner_id);
|
||||
|
||||
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';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,8 +50,8 @@ class BankStatementTransactionOwnerResource extends JsonResource
|
||||
'system' => $this->system,
|
||||
'owner_type' => $this->owner_type,
|
||||
'owner_id' => $this->owner_id,
|
||||
'reference' => $this->owner_reference,
|
||||
'reference_link' => $referenceLink,
|
||||
'reference' => $reference,
|
||||
'invoice_reference' => $this->invoice_reference,
|
||||
'receipt_reference' => $this->receipt_reference,
|
||||
'status' => $this->status
|
||||
|
||||
Reference in New Issue
Block a user