Completed
Push — master ( 989005...ce143f )
by Camilo
04:43
created

SuccessfulPayment::mapSubObjects()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 0
cts 4
cp 0
rs 9.6666
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 2
crap 6
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace unreal4u\TelegramAPI\Telegram\Types;
6
7
use unreal4u\TelegramAPI\Abstracts\TelegramTypes;
8
9
/**
10
 * This object contains basic information about a successful payment
11
 *
12
 * Objects defined as-is may 2017
13
 *
14
 * @see https://core.telegram.org/bots/api#successfulpayment
15
 */
16
class SuccessfulPayment extends TelegramTypes
17
{
18
    /**
19
     * Three-letter ISO 4217 currency code
20
     * @see https://core.telegram.org/bots/payments#supported-currencies
21
     * @var string
22
     */
23
    public $currency = '';
24
25
    /**
26
     * Total price in the smallest units of the currency (integer, not float/double). For example, for a price of
27
     * US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the
28
     * decimal point for each currency (2 for the majority of currencies).
29
     * @see https://core.telegram.org/bots/payments/currencies.json
30
     * @var int
31
     */
32
    public $total_amount = 0;
33
34
    /**
35
     * Bot specified invoice payload
36
     * @var string
37
     */
38
    public $invoice_payload = '';
39
40
    /**
41
     * Optional. Identifier of the shipping option chosen by the user
42
     * @var string
43
     */
44
    public $shipping_option_id = '';
45
46
    /**
47
     * Optional. Order info provided by the user
48
     * @var OrderInfo
49
     */
50
    public $order_info;
51
52
    /**
53
     * Telegram payment identifier
54
     * @var string
55
     */
56
    public $telegram_payment_charge_id = '';
57
58
    /**
59
     * Provider payment identifier
60
     * @var string
61
     */
62
    public $provider_payment_charge_id = '';
63
64
    protected function mapSubObjects(string $key, array $data): TelegramTypes
65
    {
66
        switch ($key) {
67
            case 'order_info':
68
                return new OrderInfo($data, $this->logger);
69
        }
70
71
        return parent::mapSubObjects($key, $data);
72
    }
73
}
74