1 | <?php |
||
5 | class PaymentSummary implements \JsonSerializable |
||
6 | { |
||
7 | |||
8 | const PAYMENT_TYPE_FIXED_AMOUNT = 'FIXED_AMOUNT'; |
||
9 | const PAYMENT_TYPE_FLEXIBLE_AMOUNT = 'FLEXIBLE_AMOUNT'; |
||
10 | |||
11 | const USER_INFO_SHIPPING_ADDRESS = 'shipping_address'; |
||
12 | const USER_INFO_CONTACT_NAME = 'contact_name'; |
||
13 | const USER_INFO_CONTACT_PHONE = 'contact_phone'; |
||
14 | const USER_INFO_CONTACT_EMAIL = 'contact_email'; |
||
15 | |||
16 | /** |
||
17 | * @var string |
||
18 | */ |
||
19 | protected $currency; |
||
20 | |||
21 | /** |
||
22 | * @var null|bool |
||
23 | */ |
||
24 | protected $isTestPayment; |
||
25 | |||
26 | /** |
||
27 | * @var string |
||
28 | */ |
||
29 | protected $paymentType; |
||
30 | |||
31 | /** |
||
32 | * @var string |
||
33 | */ |
||
34 | protected $merchantName; |
||
35 | |||
36 | /** |
||
37 | * @var array |
||
38 | */ |
||
39 | protected $requestedUserInfo = []; |
||
40 | |||
41 | /** |
||
42 | * @var array |
||
43 | */ |
||
44 | protected $priceList = []; |
||
45 | |||
46 | /** |
||
47 | * PaymentSummary constructor. |
||
48 | * |
||
49 | * @param string $currency |
||
50 | * @param string $paymentType |
||
51 | * @param string $merchantName |
||
52 | * @param array $requestedUserInfo |
||
53 | * @param PriceList[] $priceList |
||
54 | */ |
||
55 | public function __construct(string $currency, |
||
71 | |||
72 | /** |
||
73 | * @param bool $isTestPayment |
||
74 | * @return PaymentSummary |
||
75 | */ |
||
76 | public function isTestPayment(bool $isTestPayment): PaymentSummary |
||
82 | |||
83 | /** |
||
84 | * @param string $label |
||
85 | * @param string $amount |
||
86 | * @internal param array $priceList |
||
87 | * @return PaymentSummary |
||
88 | */ |
||
89 | public function addPriceList(string $label, string $amount): PaymentSummary |
||
95 | |||
96 | /** |
||
97 | * @param string $paymentType |
||
98 | * @return void |
||
99 | * @throws \InvalidArgumentException |
||
100 | */ |
||
101 | private function isValidPaymentType(string $paymentType) |
||
108 | |||
109 | /** |
||
110 | * @return array |
||
111 | */ |
||
112 | private function getAllowedPaymentType(): array |
||
119 | |||
120 | /** |
||
121 | * @param array $requestedUserInfo |
||
122 | * @return void |
||
123 | * @throws \InvalidArgumentException |
||
124 | */ |
||
125 | private function isValidRequestedUserInfo(array $requestedUserInfo) |
||
134 | |||
135 | /** |
||
136 | * @return array |
||
137 | */ |
||
138 | private function getAllowedUserInfo(): array |
||
147 | |||
148 | /** |
||
149 | * @return array |
||
150 | */ |
||
151 | public function jsonSerialize(): array |
||
164 | } |
||
165 |