1 | <?php |
||
10 | class ExpressCheckout |
||
11 | { |
||
12 | // Integrate PayPal Request trait |
||
13 | use PayPalAPIRequest, PayPalTransactions, RecurringProfiles; |
||
14 | |||
15 | /** |
||
16 | * PayPal Processor Constructor. |
||
17 | * |
||
18 | * @param array $config |
||
19 | */ |
||
20 | public function __construct(array $config = []) |
||
29 | |||
30 | /** |
||
31 | * Set Http Client request body param. Should only be called when Guzzle version 5 is used. |
||
32 | */ |
||
33 | public function setPreviousHttpBodyParam() |
||
37 | |||
38 | /** |
||
39 | * Set ExpressCheckout API endpoints & options. |
||
40 | * |
||
41 | * @param array $credentials |
||
42 | * |
||
43 | * @return void |
||
44 | */ |
||
45 | public function setExpressCheckoutOptions($credentials) |
||
65 | |||
66 | /** |
||
67 | * Set cart item details for PayPal. |
||
68 | * |
||
69 | * @param array $items |
||
70 | * |
||
71 | * @return \Illuminate\Support\Collection |
||
72 | */ |
||
73 | protected function setCartItems($items) |
||
85 | |||
86 | /** |
||
87 | * Set Recurring payments details for SetExpressCheckout API call. |
||
88 | * |
||
89 | * @param array $data |
||
90 | * @param bool $subscription |
||
91 | */ |
||
92 | protected function setExpressCheckoutRecurringPaymentConfig($data, $subscription = false) |
||
100 | |||
101 | /** |
||
102 | * Perform a SetExpressCheckout API call on PayPal. |
||
103 | * |
||
104 | * @param array $data |
||
105 | * @param bool $subscription |
||
106 | * |
||
107 | * @return array |
||
108 | */ |
||
109 | public function setExpressCheckout($data, $subscription = false) |
||
132 | |||
133 | /** |
||
134 | * Perform a GetExpressCheckoutDetails API call on PayPal. |
||
135 | * |
||
136 | * @param string $token |
||
137 | * |
||
138 | * @return array |
||
139 | */ |
||
140 | public function getExpressCheckoutDetails($token) |
||
148 | |||
149 | /** |
||
150 | * Perform DoExpressCheckoutPayment API call on PayPal. |
||
151 | * |
||
152 | * @param array $data |
||
153 | * @param string $token |
||
154 | * @param string $payerid |
||
155 | * |
||
156 | * @return array |
||
157 | */ |
||
158 | public function doExpressCheckoutPayment($data, $token, $payerid) |
||
174 | |||
175 | /** |
||
176 | * Perform a DoAuthorization API call on PayPal. |
||
177 | * |
||
178 | * @param string $authorization_id Transaction ID |
||
179 | * @param float $amount Amount to capture |
||
180 | * @param array $data Optional request fields |
||
181 | * |
||
182 | * @return array |
||
183 | */ |
||
184 | public function doAuthorization($authorization_id, $amount, $data = []) |
||
195 | |||
196 | /** |
||
197 | * Perform a DoCapture API call on PayPal. |
||
198 | * |
||
199 | * @param string $authorization_id Transaction ID |
||
200 | * @param float $amount Amount to capture |
||
201 | * @param string $complete Indicates whether or not this is the last capture. |
||
202 | * @param array $data Optional request fields |
||
203 | * |
||
204 | * @return array |
||
205 | */ |
||
206 | public function doCapture($authorization_id, $amount, $complete = 'Complete', $data = []) |
||
219 | |||
220 | /** |
||
221 | * Perform a DoReauthorization API call on PayPal to reauthorize an existing authorization transaction. |
||
222 | * |
||
223 | * @param string $authorization_id |
||
224 | * @param float $amount |
||
225 | * @param array $data |
||
226 | * |
||
227 | * @return array |
||
228 | */ |
||
229 | public function doReAuthorization($authorization_id, $amount, $data = []) |
||
240 | |||
241 | /** |
||
242 | * Perform a DoVoid API call on PayPal. |
||
243 | * |
||
244 | * @param string $authorization_id Transaction ID |
||
245 | * @param array $data Optional request fields |
||
246 | * |
||
247 | * @return array |
||
248 | */ |
||
249 | public function doVoid($authorization_id, $data = []) |
||
259 | |||
260 | /** |
||
261 | * Perform a CreateBillingAgreement API call on PayPal. |
||
262 | * |
||
263 | * @param string $token |
||
264 | * |
||
265 | * @return array |
||
266 | */ |
||
267 | public function createBillingAgreement($token) |
||
275 | |||
276 | /** |
||
277 | * Perform a CreateRecurringPaymentsProfile API call on PayPal. |
||
278 | * |
||
279 | * @param array $data |
||
280 | * @param string $token |
||
281 | * |
||
282 | * @return array |
||
283 | */ |
||
284 | public function createRecurringPaymentsProfile($data, $token) |
||
292 | |||
293 | /** |
||
294 | * Perform a GetRecurringPaymentsProfileDetails API call on PayPal. |
||
295 | * |
||
296 | * @param string $id |
||
297 | * |
||
298 | * @return array |
||
299 | */ |
||
300 | public function getRecurringPaymentsProfileDetails($id) |
||
308 | |||
309 | /** |
||
310 | * Perform a UpdateRecurringPaymentsProfile API call on PayPal. |
||
311 | * |
||
312 | * @param array $data |
||
313 | * @param string $id |
||
314 | * |
||
315 | * @return array |
||
316 | */ |
||
317 | public function updateRecurringPaymentsProfile($data, $id) |
||
325 | |||
326 | /** |
||
327 | * Change Recurring payment profile status on PayPal. |
||
328 | * |
||
329 | * @param string $id |
||
330 | * @param string $status |
||
331 | * |
||
332 | * @return array|\Psr\Http\Message\StreamInterface |
||
333 | */ |
||
334 | protected function manageRecurringPaymentsProfileStatus($id, $status) |
||
343 | |||
344 | /** |
||
345 | * Perform a ManageRecurringPaymentsProfileStatus API call on PayPal to cancel a RecurringPaymentsProfile. |
||
346 | * |
||
347 | * @param string $id |
||
348 | * |
||
349 | * @return array |
||
350 | */ |
||
351 | public function cancelRecurringPaymentsProfile($id) |
||
355 | |||
356 | /** |
||
357 | * Perform a ManageRecurringPaymentsProfileStatus API call on PayPal to suspend a RecurringPaymentsProfile. |
||
358 | * |
||
359 | * @param string $id |
||
360 | * |
||
361 | * @return array |
||
362 | */ |
||
363 | public function suspendRecurringPaymentsProfile($id) |
||
367 | |||
368 | /** |
||
369 | * Perform a ManageRecurringPaymentsProfileStatus API call on PayPal to reactivate a RecurringPaymentsProfile. |
||
370 | * |
||
371 | * @param string $id |
||
372 | * |
||
373 | * @return array |
||
374 | */ |
||
375 | public function reactivateRecurringPaymentsProfile($id) |
||
379 | } |
||
380 |