Updated SuccessfulPayment
This commit is contained in:
parent
7f7f353ed5
commit
22eeeca427
1 changed files with 16 additions and 44 deletions
|
@ -7,40 +7,13 @@
|
||||||
|
|
||||||
class SuccessfulPayment implements ObjectTypeInterface
|
class SuccessfulPayment implements ObjectTypeInterface
|
||||||
{
|
{
|
||||||
/**
|
private string $currency;
|
||||||
* @var string
|
private string $total_amount;
|
||||||
*/
|
private string $invoice_payload;
|
||||||
private $currency;
|
private ?string $shipping_option_id;
|
||||||
|
private ?OrderInfo $order_info;
|
||||||
/**
|
private string $telegram_payment_charge_id;
|
||||||
* @var string
|
private string $provider_payment_charge_id;
|
||||||
*/
|
|
||||||
private $total_amount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $invoice_payload;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string|null
|
|
||||||
*/
|
|
||||||
private $shipping_option_id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var OrderInfo|null
|
|
||||||
*/
|
|
||||||
private $order_info;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $telegram_payment_charge_id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $provider_payment_charge_id;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Three-letter ISO 4217 currency code
|
* Three-letter ISO 4217 currency code
|
||||||
|
@ -117,9 +90,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array representation of the object
|
* @inheritDoc
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
*/
|
||||||
public function toArray(): array
|
public function toArray(): array
|
||||||
{
|
{
|
||||||
|
@ -128,22 +99,23 @@
|
||||||
'total_amount' => $this->total_amount,
|
'total_amount' => $this->total_amount,
|
||||||
'invoice_payload' => $this->invoice_payload,
|
'invoice_payload' => $this->invoice_payload,
|
||||||
'shipping_option_id' => $this->shipping_option_id,
|
'shipping_option_id' => $this->shipping_option_id,
|
||||||
'order_info' => ($this->order_info instanceof ObjectTypeInterface) ? $this->order_info->toArray() : null,
|
'order_info' => $this->order_info?->toArray(),
|
||||||
'telegram_payment_charge_id' => $this->telegram_payment_charge_id,
|
'telegram_payment_charge_id' => $this->telegram_payment_charge_id,
|
||||||
'provider_payment_charge_id' => $this->provider_payment_charge_id,
|
'provider_payment_charge_id' => $this->provider_payment_charge_id,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs object from an array representation
|
* @inheritDoc
|
||||||
*
|
|
||||||
* @param array $data
|
|
||||||
* @return SuccessfulPayment
|
|
||||||
*/
|
*/
|
||||||
public static function fromArray(array $data): self
|
public static function fromArray(?array $data): ?SuccessfulPayment
|
||||||
{
|
{
|
||||||
$object = new self();
|
if($data === null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$object = new self();
|
||||||
$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;
|
||||||
|
|
Loading…
Add table
Reference in a new issue