|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Appvise\AppStoreNotifications\Model; |
|
4
|
|
|
|
|
5
|
|
|
class Receipt |
|
6
|
|
|
{ |
|
7
|
|
|
private $originalTransactionId; |
|
8
|
|
|
private $webOrderLineItemId; |
|
9
|
|
|
private $productId; |
|
10
|
|
|
private $purchaseDateMs; |
|
11
|
|
|
private $purchaseDate; |
|
12
|
|
|
private $purchaseDatePst; |
|
13
|
|
|
private $originalPurchaseDate; |
|
14
|
|
|
private $originalPurchaseDateMs; |
|
15
|
|
|
private $originalPurchaseDatePst; |
|
16
|
|
|
private $cancellationReason; |
|
17
|
|
|
private $promotionalOfferId; |
|
18
|
|
|
private $cancellationDate; |
|
19
|
|
|
private $cancellationDateMs; |
|
20
|
|
|
private $cancellationDatePst; |
|
21
|
|
|
private $expiresDate; |
|
22
|
|
|
private $expiresDateMs; |
|
23
|
|
|
private $expiresDateFormatted; |
|
24
|
|
|
private $expiresDateFormattedPst; |
|
25
|
|
|
private $quantity; |
|
26
|
|
|
private $uniqueIdentifier; |
|
27
|
|
|
private $uniqueVendorIdentifier; |
|
28
|
|
|
private $isInIntroOfferPeriod; |
|
29
|
|
|
private $isTrialPeriod; |
|
30
|
|
|
private $isUpgraded; |
|
31
|
|
|
private $itemId; |
|
32
|
|
|
private $appItemId; |
|
33
|
|
|
private $versionExternalIdentifier; |
|
34
|
|
|
private $transactionId; |
|
35
|
|
|
private $bvrs; |
|
36
|
|
|
private $bid; |
|
37
|
|
|
|
|
38
|
|
|
public function __construct() |
|
39
|
|
|
{ |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
public static function createFromArray(array $receiptInfo) |
|
43
|
|
|
{ |
|
44
|
|
|
$instance = new self(); |
|
45
|
|
|
$instance->originalTransactionId = $receiptInfo['original_transaction_id'] ?? null; |
|
46
|
|
|
$instance->webOrderLineItemId = $receiptInfo['web_order_line_item_id'] ?? null; |
|
47
|
|
|
$instance->promotionalOfferId = $receiptInfo['promotional_offer_id'] ?? null; |
|
48
|
|
|
$instance->productId = $receiptInfo['product_id'] ?? null; |
|
49
|
|
|
$instance->purchaseDateMs = $receiptInfo['purchase_date_ms'] ?? null; |
|
50
|
|
|
$instance->purchaseDate = $receiptInfo['purchase_date'] ?? null; |
|
51
|
|
|
$instance->purchaseDatePst = $receiptInfo['purchase_date_pst'] ?? null; |
|
52
|
|
|
$instance->originalPurchaseDate = $receiptInfo['original_purchase_date'] ?? null; |
|
53
|
|
|
$instance->originalPurchaseDateMs = $receiptInfo['original_purchase_date_ms'] ?? null; |
|
54
|
|
|
$instance->originalPurchaseDatePst = $receiptInfo['original_purchase_date_pst'] ?? null; |
|
55
|
|
|
$instance->cancellationReason = $receiptInfo['cancellation_reason'] ?? null; |
|
56
|
|
|
$instance->cancellationDate = $receiptInfo['cancellation_date'] ?? null; |
|
57
|
|
|
$instance->cancellationDateMs = $receiptInfo['cancellation_date_ms'] ?? null; |
|
58
|
|
|
$instance->cancellationDatePst = $receiptInfo['cancellation_date_pst'] ?? null; |
|
59
|
|
|
$instance->expiresDate = $receiptInfo['expires_date'] ?? null; |
|
60
|
|
|
$instance->expiresDateMs = $receiptInfo['expires_date_ms'] ?? null; |
|
61
|
|
|
$instance->expiresDateFormatted = $receiptInfo['expires_date_formatted'] ?? null; |
|
62
|
|
|
$instance->expiresDateFormattedPst = $receiptInfo['expires_date_formatted_pst'] ?? null; |
|
63
|
|
|
$instance->quantity = $receiptInfo['quantity'] ?? null; |
|
64
|
|
|
$instance->uniqueIdentifier = $receiptInfo['unique_identifier'] ?? null; |
|
65
|
|
|
$instance->uniqueVendorIdentifier = $receiptInfo['unique_vendor_identifier'] ?? null; |
|
66
|
|
|
$instance->isInIntroOfferPeriod = $receiptInfo['is_in_intro_offer_period'] ?? null; |
|
67
|
|
|
$instance->isTrialPeriod = $receiptInfo['is_trial_period'] ?? null; |
|
68
|
|
|
$instance->isUpgraded = $receiptInfo['is_upgraded'] ?? null; |
|
69
|
|
|
$instance->itemId = $receiptInfo['item_id'] ?? null; |
|
70
|
|
|
$instance->appItemId = $receiptInfo['app_item_id'] ?? null; |
|
71
|
|
|
$instance->versionExternalIdentifier = $receiptInfo['version_external_identifier'] ?? null; |
|
72
|
|
|
$instance->transactionId = $receiptInfo['transaction_id'] ?? null; |
|
73
|
|
|
$instance->bvrs = $receiptInfo['bvrs'] ?? null; |
|
74
|
|
|
$instance->bid = $receiptInfo['bid'] ?? null; |
|
75
|
|
|
|
|
76
|
|
|
return $instance; |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
/** |
|
80
|
|
|
* Get the value of bid. |
|
81
|
|
|
*/ |
|
82
|
|
|
public function getBid() |
|
83
|
|
|
{ |
|
84
|
|
|
return $this->bid; |
|
85
|
|
|
} |
|
86
|
|
|
|
|
87
|
|
|
/** |
|
88
|
|
|
* Get the value of bvrs. |
|
89
|
|
|
*/ |
|
90
|
|
|
public function getBvrs() |
|
91
|
|
|
{ |
|
92
|
|
|
return $this->bvrs; |
|
93
|
|
|
} |
|
94
|
|
|
|
|
95
|
|
|
/** |
|
96
|
|
|
* Get the value of transactionId. |
|
97
|
|
|
*/ |
|
98
|
|
|
public function getTransactionId() |
|
99
|
|
|
{ |
|
100
|
|
|
return $this->transactionId; |
|
101
|
|
|
} |
|
102
|
|
|
|
|
103
|
|
|
/** |
|
104
|
|
|
* Get the value of versionExternalIdentifier. |
|
105
|
|
|
*/ |
|
106
|
|
|
public function getVersionExternalIdentifier() |
|
107
|
|
|
{ |
|
108
|
|
|
return $this->versionExternalIdentifier; |
|
109
|
|
|
} |
|
110
|
|
|
|
|
111
|
|
|
/** |
|
112
|
|
|
* Get the value of appItemId. |
|
113
|
|
|
*/ |
|
114
|
|
|
public function getAppItemId() |
|
115
|
|
|
{ |
|
116
|
|
|
return $this->appItemId; |
|
117
|
|
|
} |
|
118
|
|
|
|
|
119
|
|
|
/** |
|
120
|
|
|
* Get the value of itemId. |
|
121
|
|
|
*/ |
|
122
|
|
|
public function getItemId() |
|
123
|
|
|
{ |
|
124
|
|
|
return $this->itemId; |
|
125
|
|
|
} |
|
126
|
|
|
|
|
127
|
|
|
/** |
|
128
|
|
|
* Get the value of isTrialPeriod. |
|
129
|
|
|
*/ |
|
130
|
|
|
public function getIsTrialPeriod() |
|
131
|
|
|
{ |
|
132
|
|
|
return $this->isTrialPeriod; |
|
133
|
|
|
} |
|
134
|
|
|
|
|
135
|
|
|
/** |
|
136
|
|
|
* Get the value of isInIntroOfferPeriod. |
|
137
|
|
|
*/ |
|
138
|
|
|
public function getIsInIntroOfferPeriod() |
|
139
|
|
|
{ |
|
140
|
|
|
return $this->isInIntroOfferPeriod; |
|
141
|
|
|
} |
|
142
|
|
|
|
|
143
|
|
|
/** |
|
144
|
|
|
* Get the value of uniqueVendorIdentifier. |
|
145
|
|
|
*/ |
|
146
|
|
|
public function getUniqueVendorIdentifier() |
|
147
|
|
|
{ |
|
148
|
|
|
return $this->uniqueVendorIdentifier; |
|
149
|
|
|
} |
|
150
|
|
|
|
|
151
|
|
|
/** |
|
152
|
|
|
* Get the value of uniqueIdentifier. |
|
153
|
|
|
*/ |
|
154
|
|
|
public function getUniqueIdentifier() |
|
155
|
|
|
{ |
|
156
|
|
|
return $this->uniqueIdentifier; |
|
157
|
|
|
} |
|
158
|
|
|
|
|
159
|
|
|
/** |
|
160
|
|
|
* Get the value of quantity. |
|
161
|
|
|
*/ |
|
162
|
|
|
public function getQuantity() |
|
163
|
|
|
{ |
|
164
|
|
|
return $this->quantity; |
|
165
|
|
|
} |
|
166
|
|
|
|
|
167
|
|
|
/** |
|
168
|
|
|
* Get the value of expiresDateFormattedPst. |
|
169
|
|
|
*/ |
|
170
|
|
|
public function getExpiresDateFormattedPst() |
|
171
|
|
|
{ |
|
172
|
|
|
return $this->expiresDateFormattedPst; |
|
173
|
|
|
} |
|
174
|
|
|
|
|
175
|
|
|
/** |
|
176
|
|
|
* Get the value of expiresDateFormatted. |
|
177
|
|
|
*/ |
|
178
|
|
|
public function getExpiresDateFormatted() |
|
179
|
|
|
{ |
|
180
|
|
|
return $this->expiresDateFormatted; |
|
181
|
|
|
} |
|
182
|
|
|
|
|
183
|
|
|
/** |
|
184
|
|
|
* Get the value of expiresDateMs. |
|
185
|
|
|
*/ |
|
186
|
|
|
public function getExpiresDateMs() |
|
187
|
|
|
{ |
|
188
|
|
|
return $this->expiresDateMs; |
|
189
|
|
|
} |
|
190
|
|
|
|
|
191
|
|
|
/** |
|
192
|
|
|
* Get the value of expiresDate. |
|
193
|
|
|
*/ |
|
194
|
|
|
public function getExpiresDate() |
|
195
|
|
|
{ |
|
196
|
|
|
return $this->expiresDate; |
|
197
|
|
|
} |
|
198
|
|
|
|
|
199
|
|
|
/** |
|
200
|
|
|
* Get the value of cancellationDatePst. |
|
201
|
|
|
*/ |
|
202
|
|
|
public function getCancellationDatePst() |
|
203
|
|
|
{ |
|
204
|
|
|
return $this->cancellationDatePst; |
|
205
|
|
|
} |
|
206
|
|
|
|
|
207
|
|
|
/** |
|
208
|
|
|
* Get the value of cancellationDateMs. |
|
209
|
|
|
*/ |
|
210
|
|
|
public function getCancellationDateMs() |
|
211
|
|
|
{ |
|
212
|
|
|
return $this->cancellationDateMs; |
|
213
|
|
|
} |
|
214
|
|
|
|
|
215
|
|
|
/** |
|
216
|
|
|
* Get the value of cancellationDate. |
|
217
|
|
|
*/ |
|
218
|
|
|
public function getCancellationDate() |
|
219
|
|
|
{ |
|
220
|
|
|
return $this->cancellationDate; |
|
221
|
|
|
} |
|
222
|
|
|
|
|
223
|
|
|
/** |
|
224
|
|
|
* Get the value of cancellationReason. |
|
225
|
|
|
*/ |
|
226
|
|
|
public function getCancellationReason() |
|
227
|
|
|
{ |
|
228
|
|
|
return $this->cancellationReason; |
|
229
|
|
|
} |
|
230
|
|
|
|
|
231
|
|
|
/** |
|
232
|
|
|
* Get the value of originalPurchaseDatePst. |
|
233
|
|
|
*/ |
|
234
|
|
|
public function getOriginalPurchaseDatePst() |
|
235
|
|
|
{ |
|
236
|
|
|
return $this->originalPurchaseDatePst; |
|
237
|
|
|
} |
|
238
|
|
|
|
|
239
|
|
|
/** |
|
240
|
|
|
* Get the value of originalPurchaseDateMs. |
|
241
|
|
|
*/ |
|
242
|
|
|
public function getOriginalPurchaseDateMs() |
|
243
|
|
|
{ |
|
244
|
|
|
return $this->originalPurchaseDateMs; |
|
245
|
|
|
} |
|
246
|
|
|
|
|
247
|
|
|
/** |
|
248
|
|
|
* Get the value of originalPurchaseDate. |
|
249
|
|
|
*/ |
|
250
|
|
|
public function getOriginalPurchaseDate() |
|
251
|
|
|
{ |
|
252
|
|
|
return $this->originalPurchaseDate; |
|
253
|
|
|
} |
|
254
|
|
|
|
|
255
|
|
|
/** |
|
256
|
|
|
* Get the value of purchaseDatePst. |
|
257
|
|
|
*/ |
|
258
|
|
|
public function getPurchaseDatePst() |
|
259
|
|
|
{ |
|
260
|
|
|
return $this->purchaseDatePst; |
|
261
|
|
|
} |
|
262
|
|
|
|
|
263
|
|
|
/** |
|
264
|
|
|
* Get the value of purchaseDate. |
|
265
|
|
|
*/ |
|
266
|
|
|
public function getPurchaseDate() |
|
267
|
|
|
{ |
|
268
|
|
|
return $this->purchaseDate; |
|
269
|
|
|
} |
|
270
|
|
|
|
|
271
|
|
|
/** |
|
272
|
|
|
* Get the value of purchaseDateMs. |
|
273
|
|
|
*/ |
|
274
|
|
|
public function getPurchaseDateMs() |
|
275
|
|
|
{ |
|
276
|
|
|
return $this->purchaseDateMs; |
|
277
|
|
|
} |
|
278
|
|
|
|
|
279
|
|
|
/** |
|
280
|
|
|
* Get the value of productId. |
|
281
|
|
|
*/ |
|
282
|
|
|
public function getProductId() |
|
283
|
|
|
{ |
|
284
|
|
|
return $this->productId; |
|
285
|
|
|
} |
|
286
|
|
|
|
|
287
|
|
|
/** |
|
288
|
|
|
* Get the value of webOrderLineItemId. |
|
289
|
|
|
*/ |
|
290
|
|
|
public function getWebOrderLineItemId() |
|
291
|
|
|
{ |
|
292
|
|
|
return $this->webOrderLineItemId; |
|
293
|
|
|
} |
|
294
|
|
|
|
|
295
|
|
|
/** |
|
296
|
|
|
* Get the value of originalTransactionId. |
|
297
|
|
|
*/ |
|
298
|
|
|
public function getOriginalTransactionId() |
|
299
|
|
|
{ |
|
300
|
|
|
return $this->originalTransactionId; |
|
301
|
|
|
} |
|
302
|
|
|
|
|
303
|
|
|
/** |
|
304
|
|
|
* Get the value of isUpgraded. |
|
305
|
|
|
*/ |
|
306
|
|
|
public function getIsUpgraded() |
|
307
|
|
|
{ |
|
308
|
|
|
return $this->isUpgraded; |
|
309
|
|
|
} |
|
310
|
|
|
|
|
311
|
|
|
/** |
|
312
|
|
|
* Get the value of promotionalOfferId. |
|
313
|
|
|
*/ |
|
314
|
|
|
public function getPromotionalOfferId() |
|
315
|
|
|
{ |
|
316
|
|
|
return $this->promotionalOfferId; |
|
317
|
|
|
} |
|
318
|
|
|
} |
|
319
|
|
|
|