1 | <?php |
||
7 | class PaymentSummary implements \JsonSerializable |
||
8 | { |
||
9 | public const PAYMENT_TYPE_FIXED_AMOUNT = 'FIXED_AMOUNT'; |
||
10 | public const PAYMENT_TYPE_FLEXIBLE_AMOUNT = 'FLEXIBLE_AMOUNT'; |
||
11 | |||
12 | public const USER_INFO_SHIPPING_ADDRESS = 'shipping_address'; |
||
13 | public const USER_INFO_CONTACT_NAME = 'contact_name'; |
||
14 | public const USER_INFO_CONTACT_PHONE = 'contact_phone'; |
||
15 | public const USER_INFO_CONTACT_EMAIL = 'contact_email'; |
||
16 | |||
17 | /** |
||
18 | * @var string |
||
19 | */ |
||
20 | protected $currency; |
||
21 | |||
22 | /** |
||
23 | * @var null|bool |
||
24 | */ |
||
25 | protected $isTestPayment; |
||
26 | |||
27 | /** |
||
28 | * @var string |
||
29 | */ |
||
30 | protected $paymentType; |
||
31 | |||
32 | /** |
||
33 | * @var string |
||
34 | */ |
||
35 | protected $merchantName; |
||
36 | |||
37 | /** |
||
38 | * @var array |
||
39 | */ |
||
40 | protected $requestedUserInfo = []; |
||
41 | |||
42 | /** |
||
43 | * @var array |
||
44 | */ |
||
45 | protected $priceList = []; |
||
46 | |||
47 | /** |
||
48 | * PaymentSummary constructor. |
||
49 | * |
||
50 | * @param string $currency |
||
51 | * @param string $paymentType |
||
52 | * @param string $merchantName |
||
53 | * @param array $requestedUserInfo |
||
54 | * @param PriceList[] $priceList |
||
55 | */ |
||
56 | 2 | public function __construct( |
|
72 | |||
73 | /** |
||
74 | * @param bool $isTestPayment |
||
75 | * |
||
76 | * @return PaymentSummary |
||
77 | */ |
||
78 | 1 | public function isTestPayment(bool $isTestPayment): self |
|
84 | |||
85 | /** |
||
86 | * @param string $label |
||
87 | * @param string $amount |
||
88 | * |
||
89 | * @return PaymentSummary |
||
90 | */ |
||
91 | 1 | public function addPriceList(string $label, string $amount): self |
|
97 | |||
98 | /** |
||
99 | * @param string $paymentType |
||
100 | * |
||
101 | * @throws \InvalidArgumentException |
||
102 | */ |
||
103 | 2 | private function isValidPaymentType(string $paymentType): void |
|
112 | |||
113 | /** |
||
114 | * @return array |
||
115 | */ |
||
116 | 2 | private function getAllowedPaymentType(): array |
|
123 | |||
124 | /** |
||
125 | * @param array $requestedUserInfo |
||
126 | * |
||
127 | * @throws \InvalidArgumentException |
||
128 | */ |
||
129 | 1 | private function isValidRequestedUserInfo(array $requestedUserInfo): void |
|
140 | |||
141 | /** |
||
142 | * @return array |
||
143 | */ |
||
144 | 1 | private function getAllowedUserInfo(): array |
|
153 | |||
154 | /** |
||
155 | * @return array |
||
156 | */ |
||
157 | 1 | public function jsonSerialize(): array |
|
170 | } |
||
171 |