Updated PreCheckoutQuery
This commit is contained in:
parent
ac8b629dc5
commit
c4d7fc0f41
1 changed files with 19 additions and 45 deletions
|
@ -8,40 +8,13 @@
|
||||||
|
|
||||||
class PreCheckoutQuery implements ObjectTypeInterface
|
class PreCheckoutQuery implements ObjectTypeInterface
|
||||||
{
|
{
|
||||||
/**
|
private string $id;
|
||||||
* @var string
|
private User $from;
|
||||||
*/
|
private string $currency;
|
||||||
private $id;
|
private int $total_amount;
|
||||||
|
private int $invoice_payload;
|
||||||
/**
|
private ?string $shipping_option_id;
|
||||||
* @var User
|
private ?OrderInfo $order_info;
|
||||||
*/
|
|
||||||
private $from;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $currency;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var int
|
|
||||||
*/
|
|
||||||
private $total_amount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var int
|
|
||||||
*/
|
|
||||||
private $invoice_payload;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string|null
|
|
||||||
*/
|
|
||||||
private $shipping_option_id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var OrderInfo|null
|
|
||||||
*/
|
|
||||||
private $order_info;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unique query identifier
|
* Unique query identifier
|
||||||
|
@ -117,15 +90,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array representation of the object
|
* @inheritDoc
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
*/
|
||||||
public function toArray(): array
|
public function toArray(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
'from' => ($this->from instanceof ObjectTypeInterface) ? $this->from->toArray() : null,
|
'from' => $this->from?->toArray(),
|
||||||
'currency' => $this->currency,
|
'currency' => $this->currency,
|
||||||
'total_amount' => $this->total_amount,
|
'total_amount' => $this->total_amount,
|
||||||
'invoice_payload' => $this->invoice_payload,
|
'invoice_payload' => $this->invoice_payload,
|
||||||
|
@ -135,21 +106,24 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs object from an array representation
|
* @inheritDoc
|
||||||
*
|
|
||||||
* @param array $data
|
|
||||||
* @return PreCheckoutQuery
|
|
||||||
*/
|
*/
|
||||||
public static function fromArray(array $data): self
|
public static function fromArray(?array $data): ?PreCheckoutQuery
|
||||||
{
|
{
|
||||||
|
if($data === null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
$object = new self();
|
$object = new self();
|
||||||
$object->id = $data['id'] ?? null;
|
$object->id = $data['id'] ?? null;
|
||||||
$object->from = isset($data['from']) && is_array($data['from']) ? User::fromArray($data['from']) : null;
|
$object->from = isset($data['from']) ? User::fromArray($data['from']) : null;
|
||||||
$object->currency = $data['currency'] ?? null;
|
$object->currency = $data['currency'] ?? null;
|
||||||
$object->total_amount = $data['total_amount'] ?? null;
|
$object->total_amount = $data['total_amount'] ?? null;
|
||||||
$object->invoice_payload = $data['invoice_payload'] ?? null;
|
$object->invoice_payload = $data['invoice_payload'] ?? null;
|
||||||
$object->shipping_option_id = $data['shipping_option_id'] ?? null;
|
$object->shipping_option_id = $data['shipping_option_id'] ?? null;
|
||||||
$object->order_info = isset($data['order_info']) && is_array($data['order_info']) ? OrderInfo::fromArray($data['order_info']) : null;
|
$object->order_info = isset($data['order_info']) ? OrderInfo::fromArray($data['order_info']) : null;
|
||||||
|
|
||||||
return $object;
|
return $object;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue