1 | <?php |
||
12 | class Payment_Adaptive_Simple extends Payment_Adaptive { |
||
13 | |||
14 | const WEBAPPS_ENDPOINT_END = 'paypal.com/webapps/adaptivepayment/flow/pay'; |
||
15 | |||
16 | const API_OPERATION_PAY = 'Pay'; |
||
17 | |||
18 | const API_OPERATION_EXECUTE_PAYMENT = 'ExecutePayment'; |
||
19 | |||
20 | /** |
||
21 | * Use this option if you are not using the Pay request |
||
22 | * in combination with ExecutePayment |
||
23 | */ |
||
24 | const ACTION_TYPE_PAY = 'PAY'; |
||
25 | |||
26 | /** |
||
27 | * Use this option to set up the payment instructions with SetPaymentOptions |
||
28 | * and then execute the payment at a later time with the ExecutePayment. |
||
29 | */ |
||
30 | const ACTION_TYPE_CREATE = 'CREATE'; |
||
31 | |||
32 | /** |
||
33 | * For chained payments only, specify this value to delay payments to |
||
34 | * the secondary receivers. |
||
35 | * Only the payment to the primary receiver is processed. |
||
36 | */ |
||
37 | const ACTION_TYPE_PAY_PRIMARY = 'PAY_PRIMARY'; |
||
38 | |||
39 | /** |
||
40 | * Sender pays all fees (for personal, implicit simple/parallel payments; do not use for chained or unilateral payments) |
||
41 | */ |
||
42 | const FEES_PAYER_SENDER = 'SENDER'; |
||
43 | |||
44 | /** |
||
45 | * Primary receiver pays all fees (chained payments only) |
||
46 | */ |
||
47 | const FEES_PAYER_PRIMARYRECEIVER = 'PRIMARYRECEIVER'; |
||
48 | |||
49 | /** |
||
50 | * Each receiver pays their own fee (default, personal and unilateral payments) |
||
51 | */ |
||
52 | const FEES_PAYER_EACHRECEIVER = 'EACHRECEIVER'; |
||
53 | |||
54 | /** |
||
55 | * Secondary receivers pay all fees |
||
56 | * (use only for chained payments with one secondary receiver) |
||
57 | */ |
||
58 | const FEES_PAYER_SECONDARYONLY = 'SECONDARYONLY'; |
||
59 | |||
60 | // This is a payment for non-digital goods |
||
61 | const PAYMENT_TYPE_GOODS = 'GOODS'; |
||
62 | |||
63 | // This is a payment for services (default) |
||
64 | const PAYMENT_TYPE_SERVICE = 'SERVICE'; |
||
65 | |||
66 | // This is a person-to-person payment |
||
67 | // Person-to-person payments are valid only for parallel payments |
||
68 | // that have the feesPayer field set to EACHRECEIVER or SENDER |
||
69 | const PAYMENT_TYPE_PERSONAL = 'PERSONAL'; |
||
70 | |||
71 | // This is a person-to-person payment for a cash advance |
||
72 | const PAYMENT_TYPE_CASHADVANCE = 'CASHADVANCE'; |
||
73 | |||
74 | // This is a payment for digital goods |
||
75 | const PAYMENT_TYPE_DIGITALGOODS = 'DIGITALGOODS'; |
||
76 | |||
77 | // This is a person-to-person payment for bank withdrawals, |
||
78 | // available only with special permission |
||
79 | const PAYMENT_TYPE_BANK_MANAGED_WITHDRAWAL = 'BANK_MANAGED_WITHDRAWAL'; |
||
80 | |||
81 | protected static $_allowed_action_types = array( |
||
82 | self::ACTION_TYPE_PAY, |
||
83 | self::ACTION_TYPE_CREATE, |
||
84 | ); |
||
85 | |||
86 | protected static $_allowed_fees_payer_types = array( |
||
87 | self::FEES_PAYER_SENDER, |
||
88 | self::FEES_PAYER_PRIMARYRECEIVER, |
||
89 | self::FEES_PAYER_EACHRECEIVER, |
||
90 | ); |
||
91 | |||
92 | protected static $_allowed_payment_types = array( |
||
93 | self::PAYMENT_TYPE_GOODS, |
||
94 | self::PAYMENT_TYPE_SERVICE, |
||
95 | self::PAYMENT_TYPE_SERVICE, |
||
96 | self::PAYMENT_TYPE_PERSONAL, |
||
97 | self::PAYMENT_TYPE_CASHADVANCE, |
||
98 | self::PAYMENT_TYPE_DIGITALGOODS, |
||
99 | self::PAYMENT_TYPE_BANK_MANAGED_WITHDRAWAL, |
||
100 | ); |
||
101 | |||
102 | 1 | public static function approve_url($pay_key, $mobile = FALSE) |
|
113 | |||
114 | protected $_implicit_approval = FALSE; |
||
115 | |||
116 | protected $_action_type = 'PAY'; |
||
117 | |||
118 | /** |
||
119 | * Get the NVP fields array fusion from the order and the configuration |
||
120 | * @return array |
||
121 | */ |
||
122 | 4 | public function fields() |
|
178 | |||
179 | protected function _set_payment_type(array $fields) |
||
199 | |||
200 | /** |
||
201 | * Get or set whether this is an implicitly approved payment |
||
202 | * |
||
203 | * @param boolean $implicit_approval |
||
204 | * @return boolean|$this |
||
205 | */ |
||
206 | 1 | public function implicit_approval($implicit_approval = NULL) |
|
215 | |||
216 | /** |
||
217 | * Get or set the action type |
||
218 | * |
||
219 | * @param string $action_type See Payment_Adaptive::$_allowed_action_types |
||
220 | * @return string|$this |
||
221 | */ |
||
222 | 1 | public function action_type($action_type = NULL) |
|
231 | |||
232 | public function do_payment() |
||
245 | |||
246 | /** |
||
247 | * Perform low-level Pay API request. |
||
248 | */ |
||
249 | public function pay($data) |
||
253 | |||
254 | /** |
||
255 | * Perform a low-level ExecutePayment API request. |
||
256 | */ |
||
257 | public function execute_payment($data) |
||
261 | } |
||
262 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: