1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* |
4
|
|
|
* PayPal Donation extension for the phpBB Forum Software package. |
5
|
|
|
* |
6
|
|
|
* @copyright (c) 2015 Skouat |
7
|
|
|
* @license GNU General Public License, version 2 (GPL-2.0) |
8
|
|
|
* |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace skouat\ppde\entity; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* @property \phpbb\db\driver\driver_interface db phpBB Database object |
15
|
|
|
* @property \phpbb\user user phpBB User object |
16
|
|
|
* @property string lang_key_prefix Prefix for the messages thrown by exceptions |
17
|
|
|
* @property string lang_key_suffix Suffix for the messages thrown by exceptions |
18
|
|
|
*/ |
19
|
|
|
class transactions extends main |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* Data for this entity |
23
|
|
|
* |
24
|
|
|
* @var array |
25
|
|
|
* transaction_id |
26
|
|
|
* txn_id |
27
|
|
|
* txn_type |
28
|
|
|
* confirmed |
29
|
|
|
* user_id |
30
|
|
|
* item_name |
31
|
|
|
* item_number |
32
|
|
|
* business |
33
|
|
|
* receiver_id |
34
|
|
|
* receiver_email |
35
|
|
|
* payment_status |
36
|
|
|
* mc_gross |
37
|
|
|
* mc_fee |
38
|
|
|
* mc_currency |
39
|
|
|
* settle_amount |
40
|
|
|
* settle_currency |
41
|
|
|
* net_amount |
42
|
|
|
* exchange_rate |
43
|
|
|
* payment_type |
44
|
|
|
* payment_date |
45
|
|
|
* payer_id |
46
|
|
|
* payer_email |
47
|
|
|
* payer_status |
48
|
|
|
* first_name |
49
|
|
|
* last_name |
50
|
|
|
* @access protected |
51
|
|
|
*/ |
52
|
|
|
protected $data; |
53
|
|
|
protected $transactions_log_table; |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* Constructor |
57
|
|
|
* |
58
|
|
|
* @param \phpbb\db\driver\driver_interface $db Database object |
59
|
|
|
* @param \phpbb\user $user User object |
60
|
|
|
* @param string $table_name Name of the table used to store data |
61
|
|
|
* |
62
|
|
|
* @access public |
63
|
|
|
*/ |
64
|
|
|
public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\user $user, $table_name) |
65
|
|
|
{ |
66
|
|
|
$this->db = $db; |
67
|
|
|
$this->user = $user; |
68
|
|
|
$this->transactions_log_table = $table_name; |
69
|
|
|
parent::__construct( |
70
|
|
|
$db, |
71
|
|
|
$user, |
72
|
|
|
'PPDE_DT', |
73
|
|
|
'TRANSACTION', |
74
|
|
|
$table_name, |
75
|
|
|
array( |
76
|
|
|
'item_id' => array('name' => 'transaction_id', 'type' => 'integer'), |
77
|
|
|
'item_receiver_id' => array('name' => 'receiver_id', 'type' => 'string'), |
78
|
|
|
'item_receiver_email' => array('name' => 'receiver_email', 'type' => 'string'), |
79
|
|
|
'item_residence_country' => array('name' => 'residence_country', 'type' => 'string'), |
80
|
|
|
'item_business' => array('name' => 'business', 'type' => 'string'), |
81
|
|
|
'item_confirmed' => array('name' => 'confirmed', 'type' => 'boolean'), |
82
|
|
|
'item_test_ipn' => array('name' => 'test_ipn', 'type' => 'boolean'), |
83
|
|
|
'item_txn_id' => array('name' => 'txn_id', 'type' => 'string'), |
84
|
|
|
'item_txn_type' => array('name' => 'txn_type', 'type' => 'string'), |
85
|
|
|
'item_parent_txn_id' => array('name' => 'parent_txn_id', 'type' => 'string'), |
86
|
|
|
'item_payer_email' => array('name' => 'payer_email', 'type' => 'string'), |
87
|
|
|
'item_payer_id' => array('name' => 'payer_id', 'type' => 'string'), |
88
|
|
|
'item_payer_status' => array('name' => 'payer_status', 'type' => 'string'), |
89
|
|
|
'item_first_name' => array('name' => 'first_name', 'type' => 'string'), |
90
|
|
|
'item_last_name' => array('name' => 'last_name', 'type' => 'string'), |
91
|
|
|
'item_user_id' => array('name' => 'user_id', 'type' => 'integer'), |
92
|
|
|
'item_custom' => array('name' => 'custom', 'type' => 'string'), |
93
|
|
|
'item_item_name' => array('name' => 'item_name', 'type' => 'string'), |
94
|
|
|
'item_item_number' => array('name' => 'item_number', 'type' => 'string'), |
95
|
|
|
'item_mc_currency' => array('name' => 'mc_currency', 'type' => 'string'), |
96
|
|
|
'item_mc_fee' => array('name' => 'mc_fee', 'type' => 'float'), |
97
|
|
|
'item_mc_gross' => array('name' => 'mc_gross', 'type' => 'float'), |
98
|
|
|
'item_net_amount' => array('name' => 'net_amount', 'type' => 'float'), |
99
|
|
|
'item_payment_date' => array('name' => 'payment_date', 'type' => 'integer'), |
100
|
|
|
'item_payment_status' => array('name' => 'payment_status', 'type' => 'string'), |
101
|
|
|
'item_payment_type' => array('name' => 'payment_type', 'type' => 'string'), |
102
|
|
|
'item_settle_amount' => array('name' => 'settle_amount', 'type' => 'float'), |
103
|
|
|
'item_settle_currency' => array('name' => 'settle_currency', 'type' => 'string'), |
104
|
|
|
'item_exchange_rate' => array('name' => 'exchange_rate', 'type' => 'string'), |
105
|
|
|
) |
106
|
|
|
); |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* Check the txn_id exist from the database for this transaction |
111
|
|
|
* |
112
|
|
|
* @return int $this->data['txn_id'] Transaction identifier; 0 if the transaction doesn't exist |
113
|
|
|
* @access public |
114
|
|
|
*/ |
115
|
|
|
public function transaction_exists() |
116
|
|
|
{ |
117
|
|
|
$sql = 'SELECT txn_id |
118
|
|
|
FROM ' . $this->transactions_log_table . " |
119
|
|
|
WHERE txn_id = '" . $this->db->sql_escape($this->data['txn_id']) . "'"; |
120
|
|
|
$this->db->sql_query($sql); |
121
|
|
|
|
122
|
|
|
return $this->db->sql_fetchfield('txn_id'); |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* Get PayPal transaction id |
127
|
|
|
* |
128
|
|
|
* @return string |
129
|
|
|
* @access public |
130
|
|
|
*/ |
131
|
|
|
public function get_txn_id() |
132
|
|
|
{ |
133
|
|
|
return (isset($this->data['txn_id'])) ? (string) $this->data['txn_id'] : ''; |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* Get PayPal receiver ID |
138
|
|
|
* |
139
|
|
|
* @return string |
140
|
|
|
* @access public |
141
|
|
|
*/ |
142
|
|
|
public function get_receiver_id() |
143
|
|
|
{ |
144
|
|
|
return (isset($this->data['receiver_id'])) ? (string) $this->data['receiver_id'] : ''; |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
/** |
148
|
|
|
* Get PayPal receiver e-mail |
149
|
|
|
* |
150
|
|
|
* @return string |
151
|
|
|
* @access public |
152
|
|
|
*/ |
153
|
|
|
public function get_receiver_email() |
154
|
|
|
{ |
155
|
|
|
return (isset($this->data['receiver_email'])) ? (string) $this->data['receiver_email'] : ''; |
156
|
|
|
} |
157
|
|
|
|
158
|
|
|
/** |
159
|
|
|
* Get PayPal receiver ID |
160
|
|
|
* |
161
|
|
|
* @return string |
162
|
|
|
* @access public |
163
|
|
|
*/ |
164
|
|
|
public function get_residence_country() |
165
|
|
|
{ |
166
|
|
|
return (isset($this->data['residence_country'])) ? (string) $this->data['residence_country'] : ''; |
167
|
|
|
} |
168
|
|
|
|
169
|
|
|
/** |
170
|
|
|
* Get PayPal business (same as receiver ID or receiver_email) |
171
|
|
|
* |
172
|
|
|
* @return string |
173
|
|
|
* @access public |
174
|
|
|
*/ |
175
|
|
|
public function get_business() |
176
|
|
|
{ |
177
|
|
|
return (isset($this->data['business'])) ? (string) $this->data['business'] : ''; |
178
|
|
|
} |
179
|
|
|
|
180
|
|
|
/** |
181
|
|
|
* Get PayPal transaction status |
182
|
|
|
* |
183
|
|
|
* @return bool |
184
|
|
|
* @access public |
185
|
|
|
*/ |
186
|
|
|
public function get_confirmed() |
187
|
|
|
{ |
188
|
|
|
return (isset($this->data['confirmed'])) ? (bool) $this->data['confirmed'] : false; |
189
|
|
|
} |
190
|
|
|
|
191
|
|
|
/** |
192
|
|
|
* Get Test IPN status |
193
|
|
|
* |
194
|
|
|
* @return bool |
195
|
|
|
* @access public |
196
|
|
|
*/ |
197
|
|
|
public function get_test_ipn() |
198
|
|
|
{ |
199
|
|
|
return (isset($this->data['test_ipn'])) ? (bool) $this->data['test_ipn'] : false; |
200
|
|
|
} |
201
|
|
|
|
202
|
|
|
/** |
203
|
|
|
* Get PayPal transaction type |
204
|
|
|
* |
205
|
|
|
* @return string |
206
|
|
|
* @access public |
207
|
|
|
*/ |
208
|
|
|
public function get_txn_type() |
209
|
|
|
{ |
210
|
|
|
return (isset($this->data['txn_type'])) ? (string) $this->data['txn_type'] : ''; |
211
|
|
|
} |
212
|
|
|
|
213
|
|
|
/** |
214
|
|
|
* Get PayPal parent transaction ID (in case of refund) |
215
|
|
|
* |
216
|
|
|
* @return string |
217
|
|
|
* @access public |
218
|
|
|
*/ |
219
|
|
|
public function get_parent_txn_id() |
220
|
|
|
{ |
221
|
|
|
return (isset($this->data['parent_txn_id'])) ? (string) $this->data['parent_txn_id'] : ''; |
222
|
|
|
} |
223
|
|
|
|
224
|
|
|
/** |
225
|
|
|
* Get PayPal payer e-mail |
226
|
|
|
* |
227
|
|
|
* @return string |
228
|
|
|
* @access public |
229
|
|
|
*/ |
230
|
|
|
public function get_payer_email() |
231
|
|
|
{ |
232
|
|
|
return (isset($this->data['payer_email'])) ? (string) $this->data['payer_email'] : ''; |
233
|
|
|
} |
234
|
|
|
|
235
|
|
|
/** |
236
|
|
|
* Get PayPal payer account ID |
237
|
|
|
* |
238
|
|
|
* @return string |
239
|
|
|
* @access public |
240
|
|
|
*/ |
241
|
|
|
public function get_payer_id() |
242
|
|
|
{ |
243
|
|
|
return (isset($this->data['payer_id'])) ? (string) $this->data['payer_id'] : ''; |
244
|
|
|
} |
245
|
|
|
|
246
|
|
|
/** |
247
|
|
|
* Get PayPal payer Status (such as unverified/verified) |
248
|
|
|
* |
249
|
|
|
* @return string |
250
|
|
|
* @access public |
251
|
|
|
*/ |
252
|
|
|
public function get_payer_status() |
253
|
|
|
{ |
254
|
|
|
return (isset($this->data['payer_status'])) ? (string) $this->data['payer_status'] : ''; |
255
|
|
|
} |
256
|
|
|
|
257
|
|
|
/** |
258
|
|
|
* Get PayPal payer first name |
259
|
|
|
* |
260
|
|
|
* @return string |
261
|
|
|
* @access public |
262
|
|
|
*/ |
263
|
|
|
public function get_first_name() |
264
|
|
|
{ |
265
|
|
|
return (isset($this->data['first_name'])) ? (string) $this->data['first_name'] : ''; |
266
|
|
|
} |
267
|
|
|
|
268
|
|
|
/** |
269
|
|
|
* Get PayPal payer last name |
270
|
|
|
* |
271
|
|
|
* @return string |
272
|
|
|
* @access public |
273
|
|
|
*/ |
274
|
|
|
public function get_last_name() |
275
|
|
|
{ |
276
|
|
|
return (isset($this->data['last_name'])) ? (string) $this->data['last_name'] : ''; |
277
|
|
|
} |
278
|
|
|
|
279
|
|
|
/** |
280
|
|
|
* Get member user_id |
281
|
|
|
* |
282
|
|
|
* @return integer |
283
|
|
|
* @access public |
284
|
|
|
*/ |
285
|
|
|
public function get_user_id() |
286
|
|
|
{ |
287
|
|
|
return (isset($this->data['user_id'])) ? (integer) $this->data['user_id'] : 0; |
288
|
|
|
} |
289
|
|
|
|
290
|
|
|
/** |
291
|
|
|
* Get PayPal payer last name |
292
|
|
|
* |
293
|
|
|
* @return string |
294
|
|
|
* @access public |
295
|
|
|
*/ |
296
|
|
|
public function get_custom() |
297
|
|
|
{ |
298
|
|
|
return (isset($this->data['custom'])) ? (string) $this->data['custom'] : ''; |
299
|
|
|
} |
300
|
|
|
|
301
|
|
|
/** |
302
|
|
|
* Get PayPal item name |
303
|
|
|
* |
304
|
|
|
* @return string |
305
|
|
|
* @access public |
306
|
|
|
*/ |
307
|
|
|
public function get_item_name() |
308
|
|
|
{ |
309
|
|
|
return (isset($this->data['item_name'])) ? (string) $this->data['item_name'] : ''; |
310
|
|
|
} |
311
|
|
|
|
312
|
|
|
/** |
313
|
|
|
* Get PayPal item number (contains user_id) |
314
|
|
|
* |
315
|
|
|
* @return string |
316
|
|
|
* @access public |
317
|
|
|
*/ |
318
|
|
|
public function get_item_number() |
319
|
|
|
{ |
320
|
|
|
return (isset($this->data['item_number'])) ? (string) $this->data['item_number'] : ''; |
321
|
|
|
} |
322
|
|
|
|
323
|
|
|
/** |
324
|
|
|
* Get PayPal currency name (eg: USD, EUR, etc.) |
325
|
|
|
* |
326
|
|
|
* @return string |
327
|
|
|
* @access public |
328
|
|
|
*/ |
329
|
|
|
public function get_mc_currency() |
330
|
|
|
{ |
331
|
|
|
return (isset($this->data['mc_currency'])) ? (string) $this->data['mc_currency'] : ''; |
332
|
|
|
} |
333
|
|
|
|
334
|
|
|
/** |
335
|
|
|
* Get PayPal fees |
336
|
|
|
* |
337
|
|
|
* @return float |
338
|
|
|
* @access public |
339
|
|
|
*/ |
340
|
|
|
public function get_mc_fee() |
341
|
|
|
{ |
342
|
|
|
return (isset($this->data['mc_fee'])) ? (float) $this->data['mc_fee'] : 0; |
343
|
|
|
} |
344
|
|
|
|
345
|
|
|
/** |
346
|
|
|
* Get PayPal amount |
347
|
|
|
* This is the amount of donation received before fees |
348
|
|
|
* |
349
|
|
|
* @return float |
350
|
|
|
* @access public |
351
|
|
|
*/ |
352
|
|
|
public function get_mc_gross() |
353
|
|
|
{ |
354
|
|
|
return (isset($this->data['mc_gross'])) ? (float) $this->data['mc_gross'] : 0; |
355
|
|
|
} |
356
|
|
|
|
357
|
|
|
/** |
358
|
|
|
* Get Net amount |
359
|
|
|
* This is the amount of donation received after fees |
360
|
|
|
* |
361
|
|
|
* @return float |
362
|
|
|
* @access public |
363
|
|
|
*/ |
364
|
|
|
public function get_net_amount() |
365
|
|
|
{ |
366
|
|
|
return (isset($this->data['net_amount'])) ? (float) $this->data['net_amount'] : 0; |
367
|
|
|
} |
368
|
|
|
|
369
|
|
|
/** |
370
|
|
|
* Get PayPal payment date |
371
|
|
|
* |
372
|
|
|
* @return integer |
373
|
|
|
* @access public |
374
|
|
|
*/ |
375
|
|
|
public function get_payment_date() |
376
|
|
|
{ |
377
|
|
|
return (isset($this->data['payment_date'])) ? (int) $this->data['payment_date'] : ''; |
378
|
|
|
} |
379
|
|
|
|
380
|
|
|
/** |
381
|
|
|
* Get PayPal payment status |
382
|
|
|
* |
383
|
|
|
* @return string |
384
|
|
|
* @access public |
385
|
|
|
*/ |
386
|
|
|
public function get_payment_status() |
387
|
|
|
{ |
388
|
|
|
return (isset($this->data['payment_status'])) ? (string) $this->data['payment_status'] : ''; |
389
|
|
|
} |
390
|
|
|
|
391
|
|
|
/** |
392
|
|
|
* Get PayPal payment type |
393
|
|
|
* |
394
|
|
|
* @return string |
395
|
|
|
* @access public |
396
|
|
|
*/ |
397
|
|
|
public function get_payment_type() |
398
|
|
|
{ |
399
|
|
|
return (isset($this->data['payment_type'])) ? (string) $this->data['payment_type'] : ''; |
400
|
|
|
} |
401
|
|
|
|
402
|
|
|
/** |
403
|
|
|
* Get PayPal settle amount |
404
|
|
|
* This is in case or the currency of the Payer is not in the same currency of the Receiver |
405
|
|
|
* |
406
|
|
|
* @return float |
407
|
|
|
* @access public |
408
|
|
|
*/ |
409
|
|
|
public function get_settle_amount() |
410
|
|
|
{ |
411
|
|
|
return (isset($this->data['settle_amount'])) ? (float) $this->data['settle_amount'] : 0; |
412
|
|
|
} |
413
|
|
|
|
414
|
|
|
/** |
415
|
|
|
* Get PayPal settle currency |
416
|
|
|
* |
417
|
|
|
* @return string |
418
|
|
|
* @access public |
419
|
|
|
*/ |
420
|
|
|
public function get_settle_currency() |
421
|
|
|
{ |
422
|
|
|
return (isset($this->data['settle_currency'])) ? (string) $this->data['settle_currency'] : ''; |
423
|
|
|
} |
424
|
|
|
|
425
|
|
|
/** |
426
|
|
|
* Get PayPal exchange rate |
427
|
|
|
* This is when the donation don’t use the same currency defined by the receiver |
428
|
|
|
* |
429
|
|
|
* @return string |
430
|
|
|
* @access public |
431
|
|
|
*/ |
432
|
|
|
public function get_exchange_rate() |
433
|
|
|
{ |
434
|
|
|
return (isset($this->data['exchange_rate'])) ? (string) $this->data['exchange_rate'] : ''; |
435
|
|
|
} |
436
|
|
|
|
437
|
|
|
/** |
438
|
|
|
* Set PayPal transaction id |
439
|
|
|
* |
440
|
|
|
* @param string $txn_id |
441
|
|
|
* |
442
|
|
|
* @return transactions $this object for chaining calls; load()->set()->save() |
443
|
|
|
* @access public |
444
|
|
|
*/ |
445
|
|
|
public function set_txn_id($txn_id) |
446
|
|
|
{ |
447
|
|
|
$this->data['txn_id'] = (string) $txn_id; |
448
|
|
|
|
449
|
|
|
return $this; |
450
|
|
|
} |
451
|
|
|
|
452
|
|
|
/** |
453
|
|
|
* Set PayPal receiver ID |
454
|
|
|
* |
455
|
|
|
* @param string $receiver_id |
456
|
|
|
* |
457
|
|
|
* @return transactions $this object for chaining calls; load()->set()->save() |
458
|
|
|
* @access public |
459
|
|
|
*/ |
460
|
|
|
public function set_receiver_id($receiver_id) |
461
|
|
|
{ |
462
|
|
|
$this->data['receiver_id'] = (string) $receiver_id; |
463
|
|
|
|
464
|
|
|
return $this; |
465
|
|
|
} |
466
|
|
|
|
467
|
|
|
/** |
468
|
|
|
* Set PayPal receiver e-mail |
469
|
|
|
* |
470
|
|
|
* @param string $receiver_email |
471
|
|
|
* |
472
|
|
|
* @return transactions $this object for chaining calls; load()->set()->save() |
473
|
|
|
* @access public |
474
|
|
|
*/ |
475
|
|
|
public function set_receiver_email($receiver_email) |
476
|
|
|
{ |
477
|
|
|
$this->data['receiver_email'] = (string) $receiver_email; |
478
|
|
|
|
479
|
|
|
return $this; |
480
|
|
|
} |
481
|
|
|
|
482
|
|
|
/** |
483
|
|
|
* Set PayPal receiver ID |
484
|
|
|
* |
485
|
|
|
* @param string $residence_country |
486
|
|
|
* |
487
|
|
|
* @return transactions $this object for chaining calls; load()->set()->save() |
488
|
|
|
* @access public |
489
|
|
|
*/ |
490
|
|
|
public function set_residence_country($residence_country) |
491
|
|
|
{ |
492
|
|
|
$this->data['residence_country'] = (string) $residence_country; |
493
|
|
|
|
494
|
|
|
return $this; |
495
|
|
|
} |
496
|
|
|
|
497
|
|
|
/** |
498
|
|
|
* Set PayPal business (same as receiver ID or receiver_email) |
499
|
|
|
* |
500
|
|
|
* @param string $business |
501
|
|
|
* |
502
|
|
|
* @return transactions $this object for chaining calls; load()->set()->save() |
503
|
|
|
* @access public |
504
|
|
|
*/ |
505
|
|
|
public function set_business($business) |
506
|
|
|
{ |
507
|
|
|
$this->data['business'] = (string) $business; |
508
|
|
|
|
509
|
|
|
return $this; |
510
|
|
|
} |
511
|
|
|
|
512
|
|
|
/** |
513
|
|
|
* Set PayPal transaction status |
514
|
|
|
* |
515
|
|
|
* @param bool $confirmed |
516
|
|
|
* |
517
|
|
|
* @return transactions $this object for chaining calls; load()->set()->save() |
518
|
|
|
* @access public |
519
|
|
|
*/ |
520
|
|
|
public function set_confirmed($confirmed) |
521
|
|
|
{ |
522
|
|
|
$this->data['confirmed'] = (bool) $confirmed; |
523
|
|
|
|
524
|
|
|
return $this; |
525
|
|
|
} |
526
|
|
|
|
527
|
|
|
/** |
528
|
|
|
* Set Test IPN status |
529
|
|
|
* |
530
|
|
|
* @param bool $test_ipn |
531
|
|
|
* |
532
|
|
|
* @return transactions $this object for chaining calls; load()->set()->save() |
533
|
|
|
* @access public |
534
|
|
|
*/ |
535
|
|
|
public function set_test_ipn($test_ipn) |
536
|
|
|
{ |
537
|
|
|
$this->data['test_ipn'] = (bool) $test_ipn; |
538
|
|
|
|
539
|
|
|
return $this; |
540
|
|
|
} |
541
|
|
|
|
542
|
|
|
/** |
543
|
|
|
* Set PayPal transaction type |
544
|
|
|
* |
545
|
|
|
* @param string $txn_type |
546
|
|
|
* |
547
|
|
|
* @return transactions $this object for chaining calls; load()->set()->save() |
548
|
|
|
* @access public |
549
|
|
|
*/ |
550
|
|
|
public function set_txn_type($txn_type) |
551
|
|
|
{ |
552
|
|
|
$this->data['txn_type'] = (string) $txn_type; |
553
|
|
|
|
554
|
|
|
return $this; |
555
|
|
|
} |
556
|
|
|
|
557
|
|
|
/** |
558
|
|
|
* Set PayPal parent transaction ID (in case of refund) |
559
|
|
|
* |
560
|
|
|
* @param string $parent_txn_id |
561
|
|
|
* |
562
|
|
|
* @return transactions $this object for chaining calls; load()->set()->save() |
563
|
|
|
* @access public |
564
|
|
|
*/ |
565
|
|
|
public function set_parent_txn_id($parent_txn_id) |
566
|
|
|
{ |
567
|
|
|
$this->data['parent_txn_id'] = (string) $parent_txn_id; |
568
|
|
|
|
569
|
|
|
return $this; |
570
|
|
|
} |
571
|
|
|
|
572
|
|
|
/** |
573
|
|
|
* Set PayPal payer e-mail |
574
|
|
|
* |
575
|
|
|
* @param string $payer_email |
576
|
|
|
* |
577
|
|
|
* @return transactions $this object for chaining calls; load()->set()->save() |
578
|
|
|
* @access public |
579
|
|
|
*/ |
580
|
|
|
public function set_payer_email($payer_email) |
581
|
|
|
{ |
582
|
|
|
$this->data['payer_email'] = (string) $payer_email; |
583
|
|
|
|
584
|
|
|
return $this; |
585
|
|
|
} |
586
|
|
|
|
587
|
|
|
/** |
588
|
|
|
* Set PayPal payer account ID |
589
|
|
|
* |
590
|
|
|
* @param string $payer_id |
591
|
|
|
* |
592
|
|
|
* @return transactions $this object for chaining calls; load()->set()->save() |
593
|
|
|
* @access public |
594
|
|
|
*/ |
595
|
|
|
public function set_payer_id($payer_id) |
596
|
|
|
{ |
597
|
|
|
$this->data['payer_id'] = (string) $payer_id; |
598
|
|
|
|
599
|
|
|
return $this; |
600
|
|
|
} |
601
|
|
|
|
602
|
|
|
/** |
603
|
|
|
* Set PayPal payer Status (such as unverified/verified) |
604
|
|
|
* |
605
|
|
|
* @param string $payer_status |
606
|
|
|
* |
607
|
|
|
* @return transactions $this object for chaining calls; load()->set()->save() |
608
|
|
|
* @access public |
609
|
|
|
*/ |
610
|
|
|
public function set_payer_status($payer_status) |
611
|
|
|
{ |
612
|
|
|
$this->data['payer_status'] = (string) $payer_status; |
613
|
|
|
|
614
|
|
|
return $this; |
615
|
|
|
} |
616
|
|
|
|
617
|
|
|
/** |
618
|
|
|
* Set PayPal payer first name |
619
|
|
|
* |
620
|
|
|
* @param string $first_name |
621
|
|
|
* |
622
|
|
|
* @return transactions $this object for chaining calls; load()->set()->save() |
623
|
|
|
* @access public |
624
|
|
|
*/ |
625
|
|
|
public function set_first_name($first_name) |
626
|
|
|
{ |
627
|
|
|
$this->data['first_name'] = (string) $first_name; |
628
|
|
|
|
629
|
|
|
return $this; |
630
|
|
|
} |
631
|
|
|
|
632
|
|
|
/** |
633
|
|
|
* Set PayPal payer last name |
634
|
|
|
* |
635
|
|
|
* @param string $last_name |
636
|
|
|
* |
637
|
|
|
* @return transactions $this object for chaining calls; load()->set()->save() |
638
|
|
|
* @access public |
639
|
|
|
*/ |
640
|
|
|
public function set_last_name($last_name) |
641
|
|
|
{ |
642
|
|
|
$this->data['last_name'] = (string) $last_name; |
643
|
|
|
|
644
|
|
|
return $this; |
645
|
|
|
} |
646
|
|
|
|
647
|
|
|
/** |
648
|
|
|
* Set member user_id |
649
|
|
|
* |
650
|
|
|
* @param integer $user_id |
651
|
|
|
* |
652
|
|
|
* @return transactions $this object for chaining calls; load()->set()->save() |
653
|
|
|
* @access public |
654
|
|
|
*/ |
655
|
|
|
public function set_user_id($user_id) |
656
|
|
|
{ |
657
|
|
|
$this->data['user_id'] = (integer) $user_id; |
658
|
|
|
|
659
|
|
|
return $this; |
660
|
|
|
} |
661
|
|
|
|
662
|
|
|
/** |
663
|
|
|
* Set PayPal payer last name |
664
|
|
|
* |
665
|
|
|
* @param string $custom |
666
|
|
|
* |
667
|
|
|
* @return transactions $this object for chaining calls; load()->set()->save() |
668
|
|
|
* @access public |
669
|
|
|
*/ |
670
|
|
|
public function set_custom($custom) |
671
|
|
|
{ |
672
|
|
|
$this->data['custom'] = (string) $custom; |
673
|
|
|
|
674
|
|
|
return $this; |
675
|
|
|
} |
676
|
|
|
|
677
|
|
|
/** |
678
|
|
|
* Set PayPal item name |
679
|
|
|
* |
680
|
|
|
* @param string $item_name |
681
|
|
|
* |
682
|
|
|
* @return transactions $this object for chaining calls; load()->set()->save() |
683
|
|
|
* @access public |
684
|
|
|
*/ |
685
|
|
|
public function set_item_name($item_name) |
686
|
|
|
{ |
687
|
|
|
$this->data['item_name'] = (string) $item_name; |
688
|
|
|
|
689
|
|
|
return $this; |
690
|
|
|
} |
691
|
|
|
|
692
|
|
|
/** |
693
|
|
|
* Set PayPal item number (contains user_id) |
694
|
|
|
* |
695
|
|
|
* @param string $item_number |
696
|
|
|
* |
697
|
|
|
* @return transactions $this object for chaining calls; load()->set()->save() |
698
|
|
|
* @access public |
699
|
|
|
*/ |
700
|
|
|
public function set_item_number($item_number) |
701
|
|
|
{ |
702
|
|
|
$this->data['item_number'] = (string) $item_number; |
703
|
|
|
|
704
|
|
|
return $this; |
705
|
|
|
} |
706
|
|
|
|
707
|
|
|
/** |
708
|
|
|
* Set PayPal currency name (eg: USD, EUR, etc.) |
709
|
|
|
* |
710
|
|
|
* @param string $mc_currency |
711
|
|
|
* |
712
|
|
|
* @return transactions $this object for chaining calls; load()->set()->save() |
713
|
|
|
* @access public |
714
|
|
|
*/ |
715
|
|
|
public function set_mc_currency($mc_currency) |
716
|
|
|
{ |
717
|
|
|
$this->data['mc_currency'] = (string) $mc_currency; |
718
|
|
|
|
719
|
|
|
return $this; |
720
|
|
|
} |
721
|
|
|
|
722
|
|
|
/** |
723
|
|
|
* Set PayPal fees |
724
|
|
|
* |
725
|
|
|
* @param float $mc_fee |
726
|
|
|
* |
727
|
|
|
* @return transactions $this object for chaining calls; load()->set()->save() |
728
|
|
|
* @access public |
729
|
|
|
*/ |
730
|
|
|
public function set_mc_fee($mc_fee) |
731
|
|
|
{ |
732
|
|
|
$this->data['mc_fee'] = (float) $mc_fee; |
733
|
|
|
|
734
|
|
|
return $this; |
735
|
|
|
} |
736
|
|
|
|
737
|
|
|
/** |
738
|
|
|
* Set PayPal amount |
739
|
|
|
* This is the amount of donation received before fees |
740
|
|
|
* |
741
|
|
|
* @param float $mc_gross |
742
|
|
|
* |
743
|
|
|
* @return transactions $this object for chaining calls; load()->set()->save() |
744
|
|
|
* @access public |
745
|
|
|
*/ |
746
|
|
|
public function set_mc_gross($mc_gross) |
747
|
|
|
{ |
748
|
|
|
$this->data['mc_gross'] = (float) $mc_gross; |
749
|
|
|
|
750
|
|
|
return $this; |
751
|
|
|
} |
752
|
|
|
|
753
|
|
|
/** |
754
|
|
|
* Set Net amount |
755
|
|
|
* This is the amount of donation received after fees |
756
|
|
|
* |
757
|
|
|
* @param float $net_amount |
758
|
|
|
* |
759
|
|
|
* @return transactions $this object for chaining calls; load()->set()->save() |
760
|
|
|
* @access public |
761
|
|
|
*/ |
762
|
|
|
public function set_net_amount($net_amount) |
763
|
|
|
{ |
764
|
|
|
$this->data['net_amount'] = (float) $net_amount; |
765
|
|
|
|
766
|
|
|
return $this; |
767
|
|
|
} |
768
|
|
|
|
769
|
|
|
/** |
770
|
|
|
* Set PayPal payment date |
771
|
|
|
* |
772
|
|
|
* @param integer $payment_date |
773
|
|
|
* |
774
|
|
|
* @return transactions $this object for chaining calls; load()->set()->save() |
775
|
|
|
* @access public |
776
|
|
|
*/ |
777
|
|
|
public function set_payment_date($payment_date) |
778
|
|
|
{ |
779
|
|
|
$this->data['payment_date'] = (int) $payment_date; |
780
|
|
|
|
781
|
|
|
return $this; |
782
|
|
|
} |
783
|
|
|
|
784
|
|
|
/** |
785
|
|
|
* Set PayPal payment status |
786
|
|
|
* |
787
|
|
|
* @param string $payment_status |
788
|
|
|
* |
789
|
|
|
* @return transactions $this object for chaining calls; load()->set()->save() |
790
|
|
|
* @access public |
791
|
|
|
*/ |
792
|
|
|
public function set_payment_status($payment_status) |
793
|
|
|
{ |
794
|
|
|
$this->data['payment_status'] = (string) $payment_status; |
795
|
|
|
|
796
|
|
|
return $this; |
797
|
|
|
} |
798
|
|
|
|
799
|
|
|
/** |
800
|
|
|
* Set PayPal payment type |
801
|
|
|
* |
802
|
|
|
* @param string $payment_type |
803
|
|
|
* |
804
|
|
|
* @return transactions $this object for chaining calls; load()->set()->save() |
805
|
|
|
* @access public |
806
|
|
|
*/ |
807
|
|
|
public function set_payment_type($payment_type) |
808
|
|
|
{ |
809
|
|
|
$this->data['payment_type'] = (string) $payment_type; |
810
|
|
|
|
811
|
|
|
return $this; |
812
|
|
|
} |
813
|
|
|
|
814
|
|
|
/** |
815
|
|
|
* Set PayPal settle amount |
816
|
|
|
* This is in case or the currency of the Payer is not in the same currency of the Receiver |
817
|
|
|
* |
818
|
|
|
* @param float $settle_amount |
819
|
|
|
* |
820
|
|
|
* @return transactions $this object for chaining calls; load()->set()->save() |
821
|
|
|
* @access public |
822
|
|
|
*/ |
823
|
|
|
public function set_settle_amount($settle_amount) |
824
|
|
|
{ |
825
|
|
|
$this->data['settle_amount'] = (float) $settle_amount; |
826
|
|
|
|
827
|
|
|
return $this; |
828
|
|
|
} |
829
|
|
|
|
830
|
|
|
/** |
831
|
|
|
* Set PayPal settle currency |
832
|
|
|
* |
833
|
|
|
* @param string $settle_currency |
834
|
|
|
* |
835
|
|
|
* @return transactions $this object for chaining calls; load()->set()->save() |
836
|
|
|
* @access public |
837
|
|
|
*/ |
838
|
|
|
public function set_settle_currency($settle_currency) |
839
|
|
|
{ |
840
|
|
|
$this->data['settle_currency'] = (string) $settle_currency; |
841
|
|
|
|
842
|
|
|
return $this; |
843
|
|
|
} |
844
|
|
|
|
845
|
|
|
/** |
846
|
|
|
* Set PayPal exchange rate |
847
|
|
|
* This is when the donation don’t use the same currency defined by the receiver |
848
|
|
|
* |
849
|
|
|
* @param string $exchange_rate |
850
|
|
|
* |
851
|
|
|
* @return transactions $this object for chaining calls; load()->set()->save() |
852
|
|
|
* @access public |
853
|
|
|
*/ |
854
|
|
|
public function set_exchange_rate($exchange_rate) |
855
|
|
|
{ |
856
|
|
|
$this->data['exchange_rate'] = (string) $exchange_rate; |
857
|
|
|
|
858
|
|
|
return $this; |
859
|
|
|
} |
860
|
|
|
} |
861
|
|
|
|