Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/service-vendor-api' into service…
Browse files Browse the repository at this point in the history
…-vendor-api
  • Loading branch information
mah-shamim committed Apr 3, 2024
2 parents 1cd358b + 9fb4482 commit 25a7f44
Show file tree
Hide file tree
Showing 10 changed files with 318 additions and 12 deletions.
2 changes: 2 additions & 0 deletions src/Http/Requests/IndexBankTransferRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public function rules(): array
'sort' => ['string', 'nullable', 'min:2', 'max:255'],
'dir' => ['string', 'min:3', 'max:4'],
'trashed' => ['boolean', 'nullable'],
'service_id' => ['integer', 'nullable'],
'service_slug' => ['string', 'nullable'],
];
}

Expand Down
2 changes: 2 additions & 0 deletions src/Http/Requests/IndexCashPickupRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public function rules(): array
'sort' => ['string', 'nullable', 'min:2', 'max:255'],
'dir' => ['string', 'min:3', 'max:4'],
'trashed' => ['boolean', 'nullable'],
'service_id' => ['integer', 'nullable'],
'service_slug' => ['string', 'nullable'],
];
}

Expand Down
2 changes: 2 additions & 0 deletions src/Http/Requests/IndexWalletTransferRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public function rules(): array
'sort' => ['string', 'nullable', 'min:2', 'max:255'],
'dir' => ['string', 'min:3', 'max:4'],
'trashed' => ['boolean', 'nullable'],
'service_id' => ['integer', 'nullable'],
'service_slug' => ['string', 'nullable'],
];
}

Expand Down
54 changes: 53 additions & 1 deletion src/Http/Resources/BankTransferCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Fintech\Remit\Http\Resources;

use Fintech\Core\Facades\Core;
use Fintech\Core\Supports\Constant;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\ResourceCollection;
Expand All @@ -16,7 +17,58 @@ class BankTransferCollection extends ResourceCollection
*/
public function toArray($request)
{
return parent::toArray($request);
return $this->collection->map(function ($deposit) {
$data = [
'id' => $deposit->getKey(),
'source_country_id' => $deposit->source_country_id ?? null,
'source_country_name' => null,
'destination_country_id' => $deposit->destination_country_id ?? null,
'destination_country_name' => null,
'parent_id' => $deposit->parent_id ?? null,
'sender_receiver_id' => $deposit->sender_receiver_id ?? null,
'sender_receiver_name' => null,
'user_id' => $deposit->user_id ?? null,
'user_name' => null,
'service_id' => $deposit->service_id ?? null,
'service_name' => null,
'transaction_form_id' => $deposit->transaction_form_id ?? null,
'transaction_form_name' => $deposit->transaction_form_name ?? null,
'ordered_at' => $deposit->ordered_at ?? null,
'amount' => $deposit->amount ?? null,
'currency' => $deposit->currency ?? null,
'converted_amount' => $deposit->converted_amount ?? null,
'converted_currency' => $deposit->converted_currency ?? null,
'order_number' => $deposit->order_number ?? null,
'risk_profile' => $deposit->risk_profile ?? null,
'notes' => $deposit->notes ?? null,
'is_refunded' => $deposit->is_refunded ?? null,
'order_data' => $deposit->order_data ?? new \stdClass(),
'status' => $deposit->status ?? null,
'created_at' => $deposit->created_at ?? null,
'updated_at' => $deposit->updated_at ?? null,
'links' => $deposit->links ?? null,
];

if (Core::packageExists('MetaData')) {
$data['source_country_name'] = $deposit->sourceCountry?->name ?? null;
$data['destination_country_name'] = $deposit->destinationCountry?->name ?? null;
}
if (Core::packageExists('Auth')) {
$data['user_name'] = $deposit->user?->name ?? null;
$data['sender_receiver_name'] = $deposit->senderReceiver?->name ?? null;
}
if (Core::packageExists('Business')) {
$data['service_name'] = $deposit->service?->service_name ?? null;
}
if (Core::packageExists('Business')) {
$data['service_name'] = $deposit->service?->service_name ?? null;
}
if (Core::packageExists('Transaction')) {
$data['transaction_form_name'] = $deposit->transactionForm?->name ?? null;
}

return $data;
})->toArray();
}

/**
Expand Down
48 changes: 45 additions & 3 deletions src/Http/Resources/BankTransferResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,61 @@

namespace Fintech\Remit\Http\Resources;

use Illuminate\Http\Request;
use Fintech\Core\Facades\Core;
use Illuminate\Http\Resources\Json\JsonResource;

class BankTransferResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param Request
* @param \Illuminate\Http\Request
* @return array
*/
public function toArray($request)
{
return parent::toArray($request);
$data = [
'id' => $this->getKey(),
'source_country_id' => $this->source_country_id ?? null,
'source_country_name' => null,
'destination_country_id' => $this->destination_country_id ?? null,
'destination_country_name' => null,
'parent_id' => $this->parent_id ?? null,
'sender_receiver_id' => $this->sender_receiver_id ?? null,
'sender_receiver_name' => null,
'user_id' => $this->user_id ?? null,
'user_name' => null,
'service_id' => $this->service_id ?? null,
'service_name' => null,
'transaction_form_id' => $this->transaction_form_id ?? null,
'ordered_at' => $this->ordered_at ?? null,
'amount' => $this->amount ?? null,
'currency' => $this->currency ?? null,
'converted_amount' => $this->converted_amount ?? null,
'converted_currency' => $this->converted_currency ?? null,
'order_number' => $this->order_number ?? null,
'risk_profile' => $this->risk_profile ?? null,
'notes' => $this->notes ?? null,
'is_refunded' => $this->is_refunded ?? null,
'order_data' => $this->order_data ?? new \stdClass(),
'status' => $this->status ?? null,
'created_at' => $this->created_at ?? null,
'updated_at' => $this->updated_at ?? null,
'links' => $this->links ?? null,
];

if (Core::packageExists('MetaData')) {
$data['source_country_name'] = $this->sourceCountry?->name ?? null;
$data['destination_country_name'] = $this->destinationCountry?->name ?? null;
}
if (Core::packageExists('Auth')) {
$data['user_name'] = $this->user?->name ?? null;
$data['sender_receiver_name'] = $this->senderReceiver?->name ?? null;
}
if (Core::packageExists('Business')) {
$data['service_name'] = $this->service?->service_name ?? null;
}

return $data;
}
}
54 changes: 53 additions & 1 deletion src/Http/Resources/CashPickupCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Fintech\Remit\Http\Resources;

use Fintech\Core\Facades\Core;
use Fintech\Core\Supports\Constant;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\ResourceCollection;
Expand All @@ -16,7 +17,58 @@ class CashPickupCollection extends ResourceCollection
*/
public function toArray($request)
{
return parent::toArray($request);
return $this->collection->map(function ($deposit) {
$data = [
'id' => $deposit->getKey(),
'source_country_id' => $deposit->source_country_id ?? null,
'source_country_name' => null,
'destination_country_id' => $deposit->destination_country_id ?? null,
'destination_country_name' => null,
'parent_id' => $deposit->parent_id ?? null,
'sender_receiver_id' => $deposit->sender_receiver_id ?? null,
'sender_receiver_name' => null,
'user_id' => $deposit->user_id ?? null,
'user_name' => null,
'service_id' => $deposit->service_id ?? null,
'service_name' => null,
'transaction_form_id' => $deposit->transaction_form_id ?? null,
'transaction_form_name' => $deposit->transaction_form_name ?? null,
'ordered_at' => $deposit->ordered_at ?? null,
'amount' => $deposit->amount ?? null,
'currency' => $deposit->currency ?? null,
'converted_amount' => $deposit->converted_amount ?? null,
'converted_currency' => $deposit->converted_currency ?? null,
'order_number' => $deposit->order_number ?? null,
'risk_profile' => $deposit->risk_profile ?? null,
'notes' => $deposit->notes ?? null,
'is_refunded' => $deposit->is_refunded ?? null,
'order_data' => $deposit->order_data ?? new \stdClass(),
'status' => $deposit->status ?? null,
'created_at' => $deposit->created_at ?? null,
'updated_at' => $deposit->updated_at ?? null,
'links' => $deposit->links ?? null,
];

if (Core::packageExists('MetaData')) {
$data['source_country_name'] = $deposit->sourceCountry?->name ?? null;
$data['destination_country_name'] = $deposit->destinationCountry?->name ?? null;
}
if (Core::packageExists('Auth')) {
$data['user_name'] = $deposit->user?->name ?? null;
$data['sender_receiver_name'] = $deposit->senderReceiver?->name ?? null;
}
if (Core::packageExists('Business')) {
$data['service_name'] = $deposit->service?->service_name ?? null;
}
if (Core::packageExists('Business')) {
$data['service_name'] = $deposit->service?->service_name ?? null;
}
if (Core::packageExists('Transaction')) {
$data['transaction_form_name'] = $deposit->transactionForm?->name ?? null;
}

return $data;
})->toArray();
}

/**
Expand Down
48 changes: 45 additions & 3 deletions src/Http/Resources/CashPickupResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,61 @@

namespace Fintech\Remit\Http\Resources;

use Illuminate\Http\Request;
use Fintech\Core\Facades\Core;
use Illuminate\Http\Resources\Json\JsonResource;

class CashPickupResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param Request
* @param \Illuminate\Http\Request
* @return array
*/
public function toArray($request)
{
return parent::toArray($request);
$data = [
'id' => $this->getKey(),
'source_country_id' => $this->source_country_id ?? null,
'source_country_name' => null,
'destination_country_id' => $this->destination_country_id ?? null,
'destination_country_name' => null,
'parent_id' => $this->parent_id ?? null,
'sender_receiver_id' => $this->sender_receiver_id ?? null,
'sender_receiver_name' => null,
'user_id' => $this->user_id ?? null,
'user_name' => null,
'service_id' => $this->service_id ?? null,
'service_name' => null,
'transaction_form_id' => $this->transaction_form_id ?? null,
'ordered_at' => $this->ordered_at ?? null,
'amount' => $this->amount ?? null,
'currency' => $this->currency ?? null,
'converted_amount' => $this->converted_amount ?? null,
'converted_currency' => $this->converted_currency ?? null,
'order_number' => $this->order_number ?? null,
'risk_profile' => $this->risk_profile ?? null,
'notes' => $this->notes ?? null,
'is_refunded' => $this->is_refunded ?? null,
'order_data' => $this->order_data ?? new \stdClass(),
'status' => $this->status ?? null,
'created_at' => $this->created_at ?? null,
'updated_at' => $this->updated_at ?? null,
'links' => $this->links ?? null,
];

if (Core::packageExists('MetaData')) {
$data['source_country_name'] = $this->sourceCountry?->name ?? null;
$data['destination_country_name'] = $this->destinationCountry?->name ?? null;
}
if (Core::packageExists('Auth')) {
$data['user_name'] = $this->user?->name ?? null;
$data['sender_receiver_name'] = $this->senderReceiver?->name ?? null;
}
if (Core::packageExists('Business')) {
$data['service_name'] = $this->service?->service_name ?? null;
}

return $data;
}
}
54 changes: 53 additions & 1 deletion src/Http/Resources/WalletTransferCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Fintech\Remit\Http\Resources;

use Fintech\Core\Facades\Core;
use Fintech\Core\Supports\Constant;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\ResourceCollection;
Expand All @@ -16,7 +17,58 @@ class WalletTransferCollection extends ResourceCollection
*/
public function toArray($request)
{
return parent::toArray($request);
return $this->collection->map(function ($deposit) {
$data = [
'id' => $deposit->getKey(),
'source_country_id' => $deposit->source_country_id ?? null,
'source_country_name' => null,
'destination_country_id' => $deposit->destination_country_id ?? null,
'destination_country_name' => null,
'parent_id' => $deposit->parent_id ?? null,
'sender_receiver_id' => $deposit->sender_receiver_id ?? null,
'sender_receiver_name' => null,
'user_id' => $deposit->user_id ?? null,
'user_name' => null,
'service_id' => $deposit->service_id ?? null,
'service_name' => null,
'transaction_form_id' => $deposit->transaction_form_id ?? null,
'transaction_form_name' => $deposit->transaction_form_name ?? null,
'ordered_at' => $deposit->ordered_at ?? null,
'amount' => $deposit->amount ?? null,
'currency' => $deposit->currency ?? null,
'converted_amount' => $deposit->converted_amount ?? null,
'converted_currency' => $deposit->converted_currency ?? null,
'order_number' => $deposit->order_number ?? null,
'risk_profile' => $deposit->risk_profile ?? null,
'notes' => $deposit->notes ?? null,
'is_refunded' => $deposit->is_refunded ?? null,
'order_data' => $deposit->order_data ?? new \stdClass(),
'status' => $deposit->status ?? null,
'created_at' => $deposit->created_at ?? null,
'updated_at' => $deposit->updated_at ?? null,
'links' => $deposit->links ?? null,
];

if (Core::packageExists('MetaData')) {
$data['source_country_name'] = $deposit->sourceCountry?->name ?? null;
$data['destination_country_name'] = $deposit->destinationCountry?->name ?? null;
}
if (Core::packageExists('Auth')) {
$data['user_name'] = $deposit->user?->name ?? null;
$data['sender_receiver_name'] = $deposit->senderReceiver?->name ?? null;
}
if (Core::packageExists('Business')) {
$data['service_name'] = $deposit->service?->service_name ?? null;
}
if (Core::packageExists('Business')) {
$data['service_name'] = $deposit->service?->service_name ?? null;
}
if (Core::packageExists('Transaction')) {
$data['transaction_form_name'] = $deposit->transactionForm?->name ?? null;
}

return $data;
})->toArray();
}

/**
Expand Down
Loading

0 comments on commit 25a7f44

Please sign in to comment.