31 lines
742 B
PHP
31 lines
742 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use App\Data\PaymentResponseDTO;
|
|
use App\Models\Payment;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
/**
|
|
* @mixin Payment
|
|
*
|
|
* @property PaymentResponseDTO $resource
|
|
*/
|
|
class PaymentResource extends JsonResource
|
|
{
|
|
public static $wrap = null;
|
|
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'success' => $this->resource->isSuccess,
|
|
'amount' => $this->resource->amount,
|
|
'currency' => $this->resource->currency,
|
|
'method' => $this->resource->method,
|
|
'redirectUrl' => $this->resource->redirectUrl,
|
|
'errorMessage' => $this->resource->errorMessage,
|
|
];
|
|
}
|
|
}
|