1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Tgallice\FBMessenger\Model\Button\Payment; |
4
|
|
|
|
5
|
|
|
class PaymentSummary implements \JsonSerializable |
6
|
|
|
{ |
7
|
|
|
// Payment Type |
8
|
|
|
const PAYMENT_FIXED_AMOUNT = 'FIXED_AMOUNT'; |
9
|
|
|
const PAYMENT_FLEXIBLE_AMOUNT = 'FLEXIBLE_AMOUNT'; |
10
|
|
|
|
11
|
|
|
// Requested user info |
12
|
|
|
const USER_SHIPPING_ADDRESS = 'shipping_address'; |
13
|
|
|
const USER_CONTACT_NAME = 'contact_name'; |
14
|
|
|
const USER_CONTACT_PHONE = 'contact_phone'; |
15
|
|
|
const USER_CONTACT_EMAIL = 'contact_email'; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @var string |
19
|
|
|
*/ |
20
|
|
|
private $currency; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @var string |
24
|
|
|
*/ |
25
|
|
|
private $paymentType; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @var string |
29
|
|
|
*/ |
30
|
|
|
private $merchantName; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @var array |
34
|
|
|
*/ |
35
|
|
|
private $requestedUserInfo; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @var array |
39
|
|
|
*/ |
40
|
|
|
private $priceList; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* PaymentSummary constructor. |
44
|
|
|
* |
45
|
|
|
* @param string $currency |
46
|
|
|
* @param string $paymentType |
47
|
|
|
* @param string $merchantName |
48
|
|
|
* @param array $requestedUserInfo |
49
|
|
|
* @param PriceItem[] $priceList |
50
|
|
|
*/ |
51
|
7 |
|
public function __construct($currency, $paymentType, $merchantName, array $requestedUserInfo, array $priceList) |
52
|
|
|
{ |
53
|
7 |
|
$this->currency = $currency; |
54
|
7 |
|
$this->paymentType = $paymentType; |
55
|
7 |
|
$this->merchantName = $merchantName; |
56
|
7 |
|
$this->requestedUserInfo = $requestedUserInfo; |
57
|
7 |
|
$this->priceList = $priceList; |
58
|
7 |
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @return string |
62
|
|
|
*/ |
63
|
1 |
|
public function getCurrency() |
64
|
|
|
{ |
65
|
1 |
|
return $this->currency; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @return string |
70
|
|
|
*/ |
71
|
1 |
|
public function getPaymentType() |
72
|
|
|
{ |
73
|
1 |
|
return $this->paymentType; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @return string |
78
|
|
|
*/ |
79
|
1 |
|
public function getMerchantName() |
80
|
|
|
{ |
81
|
1 |
|
return $this->merchantName; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @return array |
86
|
|
|
*/ |
87
|
1 |
|
public function getRequestedUserInfo() |
88
|
|
|
{ |
89
|
1 |
|
return $this->requestedUserInfo; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* @return array |
94
|
|
|
*/ |
95
|
1 |
|
public function getPriceList() |
96
|
|
|
{ |
97
|
1 |
|
return $this->priceList; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* @inheritdoc |
102
|
|
|
*/ |
103
|
1 |
|
public function jsonSerialize() |
104
|
|
|
{ |
105
|
|
|
return [ |
106
|
1 |
|
'currency' => $this->currency, |
107
|
1 |
|
'payment_type' => $this->paymentType, |
108
|
1 |
|
'merchant_name' => $this->merchantName, |
109
|
1 |
|
'requested_user_info' => $this->requestedUserInfo, |
110
|
1 |
|
'price_list' => $this->priceList, |
111
|
1 |
|
]; |
112
|
|
|
} |
113
|
|
|
} |
114
|
|
|
|