| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <?php
- namespace App\Http\Resources;
- use App\Models\PaymentTransfer;
- use Illuminate\Http\Request;
- use Illuminate\Http\Resources\Json\AnonymousResourceCollection;
- use Illuminate\Http\Resources\Json\JsonResource;
- class PaymentTransferResource extends JsonResource
- {
- /**
- * Transform the resource into an array.
- *
- * @return array<string, mixed>
- */
- public function toArray(Request $request): array
- {
- return [
- 'id' => $this->id,
- 'payment_id' => $this->payment_id,
- 'provider_id' => $this->provider_id,
- 'gateway_provider' => $this->gateway_provider,
- 'gateway_entity_reference' => $this->gateway_entity_reference,
- 'gateway_entity_label' => $this->gateway_entity_label,
- 'gateway_operation_reference' => $this->gateway_operation_reference,
- 'gateway_operation_label' => $this->gateway_operation_label,
- 'gateway_parent_reference' => $this->gateway_parent_reference,
- 'gateway_parent_label' => $this->gateway_parent_label,
- 'gateway_transfer_target_reference' => $this->gateway_transfer_target_reference,
- 'gateway_transfer_target_label' => $this->gateway_transfer_target_label,
- 'status' => $this->status,
- 'gross_amount' => $this->gross_amount,
- 'gateway_fee_amount' => $this->gateway_fee_amount,
- 'net_amount' => $this->net_amount,
- 'transferred_at' => $this->transferred_at?->toISOString(),
- 'failed_at' => $this->failed_at?->toISOString(),
- 'failure_code' => $this->failure_code,
- 'failure_message' => $this->failure_message,
- 'gateway_payload' => $this->gateway_payload,
- 'metadata' => $this->metadata,
- 'created_at' => $this->created_at?->toISOString(),
- 'updated_at' => $this->updated_at?->toISOString(),
- ];
- }
- /**
- * @param \Illuminate\Database\Eloquent\Collection<PaymentTransfer> $resource
- * @return \Illuminate\Http\Resources\Json\AnonymousResourceCollection<PaymentTransferResource>
- */
- public static function collection($resource): AnonymousResourceCollection
- {
- return parent::collection($resource);
- }
- }
|