1 | <?php |
||
10 | class ExpressCheckout |
||
11 | { |
||
12 | // Integrate PayPal Request trait |
||
13 | use PayPalAPIRequest, PayPalTransactions, RecurringProfiles; |
||
14 | |||
15 | /** |
||
16 | * ExpressCheckout constructor. |
||
17 | * |
||
18 | * @param array $config |
||
19 | * |
||
20 | * @throws \Exception |
||
21 | */ |
||
22 | public function __construct(array $config = []) |
||
31 | |||
32 | /** |
||
33 | * Set ExpressCheckout API endpoints & options. |
||
34 | * |
||
35 | * @param array $credentials |
||
36 | * |
||
37 | * @return void |
||
38 | */ |
||
39 | public function setExpressCheckoutOptions($credentials) |
||
59 | |||
60 | /** |
||
61 | * Set cart item details for PayPal. |
||
62 | * |
||
63 | * @param array $items |
||
64 | * |
||
65 | * @return \Illuminate\Support\Collection |
||
66 | */ |
||
67 | protected function setCartItems($items) |
||
79 | |||
80 | /** |
||
81 | * Set Recurring payments details for SetExpressCheckout API call. |
||
82 | * |
||
83 | * @param array $data |
||
84 | * @param bool $subscription |
||
85 | */ |
||
86 | protected function setExpressCheckoutRecurringPaymentConfig($data, $subscription = false) |
||
104 | |||
105 | /** |
||
106 | * Set item subtotal if available. |
||
107 | * |
||
108 | * @param array $data |
||
109 | */ |
||
110 | protected function setItemSubTotal($data) |
||
114 | |||
115 | /** |
||
116 | * Set shipping amount if available. |
||
117 | * |
||
118 | * @param array $data |
||
119 | */ |
||
120 | protected function setShippingAmount($data) |
||
128 | |||
129 | /** |
||
130 | * Set shipping discount if available. |
||
131 | * |
||
132 | * @param array $data |
||
133 | */ |
||
134 | protected function setShippingDiscount($data) |
||
142 | |||
143 | /** |
||
144 | * Perform a SetExpressCheckout API call on PayPal. |
||
145 | * |
||
146 | * @param array $data |
||
147 | * @param bool $subscription |
||
148 | * |
||
149 | * @throws \Exception |
||
150 | * |
||
151 | * @return array|\Psr\Http\Message\StreamInterface |
||
152 | */ |
||
153 | public function setExpressCheckout($data, $subscription = false) |
||
182 | |||
183 | /** |
||
184 | * Perform a GetExpressCheckoutDetails API call on PayPal. |
||
185 | * |
||
186 | * @param string $token |
||
187 | * |
||
188 | * @throws \Exception |
||
189 | * |
||
190 | * @return array|\Psr\Http\Message\StreamInterface |
||
191 | */ |
||
192 | public function getExpressCheckoutDetails($token) |
||
200 | |||
201 | /** |
||
202 | * Perform DoExpressCheckoutPayment API call on PayPal. |
||
203 | * |
||
204 | * @param array $data |
||
205 | * @param string $token |
||
206 | * @param string $payerid |
||
207 | * |
||
208 | * @throws \Exception |
||
209 | * |
||
210 | * @return array|\Psr\Http\Message\StreamInterface |
||
211 | */ |
||
212 | public function doExpressCheckoutPayment($data, $token, $payerid) |
||
232 | |||
233 | /** |
||
234 | * Perform a DoAuthorization API call on PayPal. |
||
235 | * |
||
236 | * @param string $authorization_id Transaction ID |
||
237 | * @param float $amount Amount to capture |
||
238 | * @param array $data Optional request fields |
||
239 | * |
||
240 | * @throws \Exception |
||
241 | * |
||
242 | * @return array|\Psr\Http\Message\StreamInterface |
||
243 | */ |
||
244 | public function doAuthorization($authorization_id, $amount, $data = []) |
||
255 | |||
256 | /** |
||
257 | * Perform a DoCapture API call on PayPal. |
||
258 | * |
||
259 | * @param string $authorization_id Transaction ID |
||
260 | * @param float $amount Amount to capture |
||
261 | * @param string $complete Indicates whether or not this is the last capture. |
||
262 | * @param array $data Optional request fields |
||
263 | * |
||
264 | * @throws \Exception |
||
265 | * |
||
266 | * @return array|\Psr\Http\Message\StreamInterface |
||
267 | */ |
||
268 | public function doCapture($authorization_id, $amount, $complete = 'Complete', $data = []) |
||
281 | |||
282 | /** |
||
283 | * Perform a DoReauthorization API call on PayPal to reauthorize an existing authorization transaction. |
||
284 | * |
||
285 | * @param string $authorization_id |
||
286 | * @param float $amount |
||
287 | * @param array $data |
||
288 | * |
||
289 | * @throws \Exception |
||
290 | * |
||
291 | * @return array|\Psr\Http\Message\StreamInterface |
||
292 | */ |
||
293 | public function doReAuthorization($authorization_id, $amount, $data = []) |
||
304 | |||
305 | /** |
||
306 | * Perform a DoVoid API call on PayPal. |
||
307 | * |
||
308 | * @param string $authorization_id Transaction ID |
||
309 | * @param array $data Optional request fields |
||
310 | * |
||
311 | * @throws \Exception |
||
312 | * |
||
313 | * @return array|\Psr\Http\Message\StreamInterface |
||
314 | */ |
||
315 | public function doVoid($authorization_id, $data = []) |
||
325 | |||
326 | /** |
||
327 | * Perform a CreateBillingAgreement API call on PayPal. |
||
328 | * |
||
329 | * @param string $token |
||
330 | * |
||
331 | * @throws \Exception |
||
332 | * |
||
333 | * @return array|\Psr\Http\Message\StreamInterface |
||
334 | */ |
||
335 | public function createBillingAgreement($token) |
||
343 | |||
344 | /** |
||
345 | * Perform a CreateRecurringPaymentsProfile API call on PayPal. |
||
346 | * |
||
347 | * @param array $data |
||
348 | * @param string $token |
||
349 | * |
||
350 | * @throws \Exception |
||
351 | * |
||
352 | * @return array|\Psr\Http\Message\StreamInterface |
||
353 | */ |
||
354 | public function createRecurringPaymentsProfile($data, $token) |
||
362 | |||
363 | /** |
||
364 | * Perform a GetRecurringPaymentsProfileDetails API call on PayPal. |
||
365 | * |
||
366 | * @param string $id |
||
367 | * |
||
368 | * @throws \Exception |
||
369 | * |
||
370 | * @return array|\Psr\Http\Message\StreamInterface |
||
371 | */ |
||
372 | public function getRecurringPaymentsProfileDetails($id) |
||
380 | |||
381 | /** |
||
382 | * Perform a UpdateRecurringPaymentsProfile API call on PayPal. |
||
383 | * |
||
384 | * @param array $data |
||
385 | * @param string $id |
||
386 | * |
||
387 | * @throws \Exception |
||
388 | * |
||
389 | * @return array|\Psr\Http\Message\StreamInterface |
||
390 | */ |
||
391 | public function updateRecurringPaymentsProfile($data, $id) |
||
399 | |||
400 | /** |
||
401 | * Change Recurring payment profile status on PayPal. |
||
402 | * |
||
403 | * @param string $id |
||
404 | * @param string $status |
||
405 | * |
||
406 | * @throws \Exception |
||
407 | * |
||
408 | * @return array|\Psr\Http\Message\StreamInterface |
||
409 | */ |
||
410 | protected function manageRecurringPaymentsProfileStatus($id, $status) |
||
419 | |||
420 | /** |
||
421 | * Perform a ManageRecurringPaymentsProfileStatus API call on PayPal to cancel a RecurringPaymentsProfile. |
||
422 | * |
||
423 | * @param string $id |
||
424 | * |
||
425 | * @throws \Exception |
||
426 | * |
||
427 | * @return array|\Psr\Http\Message\StreamInterface |
||
428 | */ |
||
429 | public function cancelRecurringPaymentsProfile($id) |
||
433 | |||
434 | /** |
||
435 | * Perform a ManageRecurringPaymentsProfileStatus API call on PayPal to suspend a RecurringPaymentsProfile. |
||
436 | * |
||
437 | * @param string $id |
||
438 | * |
||
439 | * @throws \Exception |
||
440 | * |
||
441 | * @return array|\Psr\Http\Message\StreamInterface |
||
442 | */ |
||
443 | public function suspendRecurringPaymentsProfile($id) |
||
447 | |||
448 | /** |
||
449 | * Perform a ManageRecurringPaymentsProfileStatus API call on PayPal to reactivate a RecurringPaymentsProfile. |
||
450 | * |
||
451 | * @param string $id |
||
452 | * |
||
453 | * @throws \Exception |
||
454 | * |
||
455 | * @return array|\Psr\Http\Message\StreamInterface |
||
456 | */ |
||
457 | public function reactivateRecurringPaymentsProfile($id) |
||
461 | } |
||
462 |