| 1 |
<?php |
| 2 |
|
| 3 |
namespace IvyForms\ValueObjects\Payment; |
| 4 |
|
| 5 |
/** |
| 6 |
* Immutable Square order record value object. |
| 7 |
*/ |
| 8 |
final class Order |
| 9 |
{ |
| 10 |
public int $id; |
| 11 |
public int $entryId; |
| 12 |
public string $squareOrderId; |
| 13 |
public string $status; |
| 14 |
public ?string $squareCustomerId; |
| 15 |
public int $amount; |
| 16 |
public string $currency; |
| 17 |
public ?string $dateCreated; |
| 18 |
|
| 19 |
/** |
| 20 |
* @param int $id |
| 21 |
* @param int $entryId |
| 22 |
* @param string $squareOrderId |
| 23 |
* @param string $status |
| 24 |
* @param string|null $squareCustomerId |
| 25 |
* @param int $amount |
| 26 |
* @param string $currency |
| 27 |
* @param string|null $dateCreated |
| 28 |
*/ |
| 29 |
public function __construct( |
| 30 |
int $id, |
| 31 |
int $entryId, |
| 32 |
string $squareOrderId, |
| 33 |
string $status, |
| 34 |
?string $squareCustomerId, |
| 35 |
int $amount, |
| 36 |
string $currency, |
| 37 |
?string $dateCreated = null |
| 38 |
) { |
| 39 |
$this->id = $id; |
| 40 |
$this->entryId = $entryId; |
| 41 |
$this->squareOrderId = $squareOrderId; |
| 42 |
$this->status = $status; |
| 43 |
$this->squareCustomerId = $squareCustomerId; |
| 44 |
$this->amount = $amount; |
| 45 |
$this->currency = $currency; |
| 46 |
$this->dateCreated = $dateCreated; |
| 47 |
} |
| 48 |
|
| 49 |
/** |
| 50 |
* @return mixed[] |
| 51 |
*/ |
| 52 |
public function toArray(): array |
| 53 |
{ |
| 54 |
return [ |
| 55 |
'id' => $this->id, |
| 56 |
'entryId' => $this->entryId, |
| 57 |
'squareOrderId' => $this->squareOrderId, |
| 58 |
'status' => $this->status, |
| 59 |
'squareCustomerId' => $this->squareCustomerId, |
| 60 |
'amount' => $this->amount, |
| 61 |
'currency' => $this->currency, |
| 62 |
'dateCreated' => $this->dateCreated, |
| 63 |
]; |
| 64 |
} |
| 65 |
} |
| 66 |
|