UpdateNewPreCheckoutQuery::getTotalAmount()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * This phpFile is auto-generated.
5
 */
6
7
declare(strict_types=1);
8
9
namespace AurimasNiekis\TdLibSchema;
10
11
/**
12
 * A new incoming pre-checkout query; for bots only. Contains full information about a checkout.
13
 */
14
class UpdateNewPreCheckoutQuery extends Update
15
{
16
    public const TYPE_NAME = 'updateNewPreCheckoutQuery';
17
18
    /**
19
     * Unique query identifier.
20
     *
21
     * @var string
22
     */
23
    protected string $id;
24
25
    /**
26
     * Identifier of the user who sent the query.
27
     *
28
     * @var int
29
     */
30
    protected int $senderUserId;
31
32
    /**
33
     * Currency for the product price.
34
     *
35
     * @var string
36
     */
37
    protected string $currency;
38
39
    /**
40
     * Total price for the product, in the minimal quantity of the currency.
41
     *
42
     * @var int
43
     */
44
    protected int $totalAmount;
45
46
    /**
47
     * Invoice payload.
48
     *
49
     * @var string
50
     */
51
    protected string $invoicePayload;
52
53
    /**
54
     * Identifier of a shipping option chosen by the user; may be empty if not applicable.
55
     *
56
     * @var string
57
     */
58
    protected string $shippingOptionId;
59
60
    /**
61
     * Information about the order; may be null.
62
     *
63
     * @var OrderInfo|null
64
     */
65
    protected ?OrderInfo $orderInfo;
66
67
    public function __construct(
68
        string $id,
69
        int $senderUserId,
70
        string $currency,
71
        int $totalAmount,
72
        string $invoicePayload,
73
        string $shippingOptionId,
74
        ?OrderInfo $orderInfo
75
    ) {
76
        parent::__construct();
77
78
        $this->id               = $id;
79
        $this->senderUserId     = $senderUserId;
80
        $this->currency         = $currency;
81
        $this->totalAmount      = $totalAmount;
82
        $this->invoicePayload   = $invoicePayload;
83
        $this->shippingOptionId = $shippingOptionId;
84
        $this->orderInfo        = $orderInfo;
85
    }
86
87
    public static function fromArray(array $array): UpdateNewPreCheckoutQuery
88
    {
89
        return new static(
90
            $array['id'],
91
            $array['sender_user_id'],
92
            $array['currency'],
93
            $array['total_amount'],
94
            $array['invoice_payload'],
95
            $array['shipping_option_id'],
96
            (isset($array['order_info']) ? TdSchemaRegistry::fromArray($array['order_info']) : null),
97
        );
98
    }
99
100
    public function typeSerialize(): array
101
    {
102
        return [
103
            '@type'              => static::TYPE_NAME,
104
            'id'                 => $this->id,
105
            'sender_user_id'     => $this->senderUserId,
106
            'currency'           => $this->currency,
107
            'total_amount'       => $this->totalAmount,
108
            'invoice_payload'    => $this->invoicePayload,
109
            'shipping_option_id' => $this->shippingOptionId,
110
            'order_info'         => (isset($this->orderInfo) ? $this->orderInfo : null),
111
        ];
112
    }
113
114
    public function getId(): string
115
    {
116
        return $this->id;
117
    }
118
119
    public function getSenderUserId(): int
120
    {
121
        return $this->senderUserId;
122
    }
123
124
    public function getCurrency(): string
125
    {
126
        return $this->currency;
127
    }
128
129
    public function getTotalAmount(): int
130
    {
131
        return $this->totalAmount;
132
    }
133
134
    public function getInvoicePayload(): string
135
    {
136
        return $this->invoicePayload;
137
    }
138
139
    public function getShippingOptionId(): string
140
    {
141
        return $this->shippingOptionId;
142
    }
143
144
    public function getOrderInfo(): ?OrderInfo
145
    {
146
        return $this->orderInfo;
147
    }
148
}
149