36 lines
907 B
PHP
36 lines
907 B
PHP
<?php
|
|
|
|
namespace App\Data\Stripe;
|
|
|
|
use App\Contracts\OutputDataTransferObject;
|
|
use App\Enums\Stripe\StripeCurrency;
|
|
|
|
final readonly class StripeLineItemDTO implements OutputDataTransferObject
|
|
{
|
|
public function __construct(
|
|
public StripeCurrency $currency,
|
|
public int $price,
|
|
public string $productName,
|
|
public string $productDescription,
|
|
public int $quantity
|
|
) {}
|
|
|
|
/**
|
|
* @return array<string, int|string>
|
|
*/
|
|
public function toArray(): array
|
|
{
|
|
return [
|
|
'price_data' => [
|
|
'currency' => $this->currency->value,
|
|
'unit_amount' => $this->price,
|
|
'product_data' => [
|
|
'name' => $this->productName,
|
|
'description' => $this->productDescription,
|
|
],
|
|
],
|
|
'quantity' => $this->quantity,
|
|
];
|
|
}
|
|
}
|