1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Srmklive\PayPal\Traits\PayPalAPI; |
4
|
|
|
|
5
|
|
|
trait Payouts |
6
|
|
|
{ |
7
|
|
|
/** |
8
|
|
|
* Create a Batch Payout. |
9
|
|
|
* |
10
|
|
|
* @param array $data |
11
|
|
|
* |
12
|
|
|
* @throws \Throwable |
13
|
|
|
* |
14
|
|
|
* @return array|\Psr\Http\Message\StreamInterface|string |
15
|
|
|
* |
16
|
|
|
* @see https://developer.paypal.com/docs/api/payments.payouts-batch/v1/#payouts_post |
17
|
|
|
*/ |
18
|
|
|
public function createBatchPayout(array $data) |
19
|
|
|
{ |
20
|
|
|
$this->apiEndPoint = 'v1/payments/payouts'; |
21
|
|
|
|
22
|
|
|
$this->options['json'] = $data; |
23
|
|
|
|
24
|
|
|
$this->verb = 'post'; |
25
|
|
|
|
26
|
|
|
return $this->doPayPalRequest(); |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* Show Batch Payout details by ID. |
31
|
|
|
* |
32
|
|
|
* @param string $payout_id |
33
|
|
|
* |
34
|
|
|
* @throws \Throwable |
35
|
|
|
* |
36
|
|
|
* @return array|\Psr\Http\Message\StreamInterface|string |
37
|
|
|
* |
38
|
|
|
* @see https://developer.paypal.com/docs/api/payments.payouts-batch/v1/#payouts_get |
39
|
|
|
*/ |
40
|
|
|
public function showBatchPayoutDetails(string $payout_id) |
41
|
|
|
{ |
42
|
|
|
$this->apiEndPoint = "v1/payments/payouts/{$payout_id}"; |
43
|
|
|
|
44
|
|
|
$this->verb = 'get'; |
45
|
|
|
|
46
|
|
|
return $this->doPayPalRequest(); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Show Payout Item details by ID. |
51
|
|
|
* |
52
|
|
|
* @param string $payout_item_id |
53
|
|
|
* |
54
|
|
|
* @throws \Throwable |
55
|
|
|
* |
56
|
|
|
* @return array|\Psr\Http\Message\StreamInterface|string |
57
|
|
|
* |
58
|
|
|
* @see https://developer.paypal.com/docs/api/payments.payouts-batch/v1/#payouts-item_get |
59
|
|
|
*/ |
60
|
|
|
public function showPayoutItemDetails(string $payout_item_id) |
61
|
|
|
{ |
62
|
|
|
$this->apiEndPoint = "v1/payments/payouts-item/{$payout_item_id}"; |
63
|
|
|
|
64
|
|
|
$this->verb = 'get'; |
65
|
|
|
|
66
|
|
|
return $this->doPayPalRequest(); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* Show Payout Item details by ID. |
71
|
|
|
* |
72
|
|
|
* @param string $payout_item_id |
73
|
|
|
* |
74
|
|
|
* @throws \Throwable |
75
|
|
|
* |
76
|
|
|
* @return array|\Psr\Http\Message\StreamInterface|string |
77
|
|
|
* |
78
|
|
|
* @see https://developer.paypal.com/docs/api/payments.payouts-batch/v1/#payouts-item_cancel |
79
|
|
|
*/ |
80
|
|
|
public function cancelUnclaimedPayoutItem(string $payout_item_id) |
81
|
|
|
{ |
82
|
|
|
$this->apiEndPoint = "v1/payments/payouts-item/{$payout_item_id}/cancel"; |
83
|
|
|
|
84
|
|
|
$this->verb = 'post'; |
85
|
|
|
|
86
|
|
|
return $this->doPayPalRequest(); |
87
|
|
|
} |
88
|
|
|
} |
89
|
|
|
|