1 | <?php |
||
8 | class ExpressCheckout |
||
9 | { |
||
10 | // Integrate PayPal Request trait |
||
11 | use PayPalAPIRequest; |
||
12 | |||
13 | /** |
||
14 | * PayPal Processor Constructor. |
||
15 | * |
||
16 | * @param array $config |
||
17 | */ |
||
18 | public function __construct(array $config = []) |
||
25 | |||
26 | /** |
||
27 | * Set Http Client request body param. Should only be called when Guzzle version 5 is used. |
||
28 | */ |
||
29 | public function setPreviousHttpBodyParam() |
||
33 | |||
34 | /** |
||
35 | * Set ExpressCheckout API endpoints & options. |
||
36 | * |
||
37 | * @param array $credentials |
||
38 | * |
||
39 | * @return void |
||
40 | */ |
||
41 | public function setExpressCheckoutOptions($credentials) |
||
61 | |||
62 | /** |
||
63 | * Set cart item details for PayPal. |
||
64 | * |
||
65 | * @param array $items |
||
66 | * |
||
67 | * @return \Illuminate\Support\Collection |
||
68 | */ |
||
69 | protected function setCartItems($items) |
||
81 | |||
82 | /** |
||
83 | * Function to perform SetExpressCheckout PayPal API operation. |
||
84 | * |
||
85 | * @param array $data |
||
86 | * @param bool $subscription |
||
87 | * |
||
88 | * @return array |
||
89 | */ |
||
90 | public function setExpressCheckout($data, $subscription = false) |
||
120 | |||
121 | /** |
||
122 | * Function to perform GetExpressCheckoutDetails PayPal API operation. |
||
123 | * |
||
124 | * @param string $token |
||
125 | * |
||
126 | * @return array |
||
127 | */ |
||
128 | public function getExpressCheckoutDetails($token) |
||
136 | |||
137 | /** |
||
138 | * Function to perform DoExpressCheckoutPayment PayPal API operation. |
||
139 | * |
||
140 | * @param array $data |
||
141 | * @param string $token |
||
142 | * @param string $payerid |
||
143 | * |
||
144 | * @return array |
||
145 | */ |
||
146 | public function doExpressCheckoutPayment($data, $token, $payerid) |
||
162 | |||
163 | /** |
||
164 | * Function to perform DoCapture PayPal API operation. |
||
165 | * |
||
166 | * @param string $authorization_id Transaction ID |
||
167 | * @param float $amount Amount to capture |
||
168 | * @param string $complete Indicates whether or not this is the last capture. |
||
169 | * @param array $data Optional request fields |
||
170 | * |
||
171 | * @return array |
||
172 | */ |
||
173 | public function doCapture($authorization_id, $amount, $complete = 'Complete', $data = []) |
||
186 | |||
187 | /** |
||
188 | * Function to perform DoAuthorization PayPal API operation. |
||
189 | * |
||
190 | * @param string $authorization_id Transaction ID |
||
191 | * @param float $amount Amount to capture |
||
192 | * @param array $data Optional request fields |
||
193 | * |
||
194 | * @return array |
||
195 | */ |
||
196 | public function doAuthorization($authorization_id, $amount, $data = []) |
||
207 | |||
208 | /** |
||
209 | * Function to perform DoVoid PayPal API operation. |
||
210 | * |
||
211 | * @param string $authorization_id Transaction ID |
||
212 | * @param array $data Optional request fields |
||
213 | * |
||
214 | * @return array |
||
215 | */ |
||
216 | public function doVoid($authorization_id, $data = []) |
||
226 | |||
227 | /** |
||
228 | * Function to perform CreateBillingAgreement PayPal API operation. |
||
229 | * |
||
230 | * @param string $token |
||
231 | * |
||
232 | * @return array |
||
233 | */ |
||
234 | public function createBillingAgreement($token) |
||
242 | |||
243 | /** |
||
244 | * Function to perform CreateRecurringPaymentsProfile PayPal API operation. |
||
245 | * |
||
246 | * @param array $data |
||
247 | * @param string $token |
||
248 | * |
||
249 | * @return array |
||
250 | */ |
||
251 | public function createRecurringPaymentsProfile($data, $token) |
||
259 | |||
260 | /** |
||
261 | * Function to perform GetRecurringPaymentsProfileDetails PayPal API operation. |
||
262 | * |
||
263 | * @param string $id |
||
264 | * |
||
265 | * @return array |
||
266 | */ |
||
267 | public function getRecurringPaymentsProfileDetails($id) |
||
275 | |||
276 | /** |
||
277 | * Function to perform UpdateRecurringPaymentsProfile PayPal API operation. |
||
278 | * |
||
279 | * @param array $data |
||
280 | * @param string $id |
||
281 | * |
||
282 | * @return array |
||
283 | */ |
||
284 | public function updateRecurringPaymentsProfile($data, $id) |
||
292 | |||
293 | /** |
||
294 | * Function to cancel RecurringPaymentsProfile on PayPal. |
||
295 | * |
||
296 | * @param string $id |
||
297 | * |
||
298 | * @return array |
||
299 | */ |
||
300 | public function cancelRecurringPaymentsProfile($id) |
||
309 | |||
310 | /** |
||
311 | * Function to suspend an active RecurringPaymentsProfile on PayPal. |
||
312 | * |
||
313 | * @param string $id |
||
314 | * |
||
315 | * @return array |
||
316 | */ |
||
317 | public function suspendRecurringPaymentsProfile($id) |
||
326 | |||
327 | /** |
||
328 | * Function to reactivate a suspended RecurringPaymentsProfile on PayPal. |
||
329 | * |
||
330 | * @param string $id |
||
331 | * |
||
332 | * @return array |
||
333 | */ |
||
334 | public function reactivateRecurringPaymentsProfile($id) |
||
343 | } |
||
344 |