1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Srmklive\PayPal\Traits\PayPalAPI; |
4
|
|
|
|
5
|
|
|
trait PartnerReferrals |
6
|
|
|
{ |
7
|
|
|
/** |
8
|
|
|
* Create a Partner Referral. |
9
|
|
|
* |
10
|
|
|
* @param array $partner_data |
11
|
|
|
* |
12
|
|
|
* @throws \Throwable |
13
|
|
|
* |
14
|
|
|
* @return array|\Psr\Http\Message\StreamInterface|string |
15
|
|
|
* |
16
|
|
|
* @see https://developer.paypal.com/docs/api/partner-referrals/v2/#partner-referrals_create |
17
|
|
|
*/ |
18
|
|
|
public function createPartnerReferral(array $partner_data) |
19
|
|
|
{ |
20
|
|
|
$this->apiEndPoint = 'v2/customer/partner-referrals'; |
21
|
|
|
|
22
|
|
|
$this->options['json'] = $partner_data; |
23
|
|
|
|
24
|
|
|
$this->verb = 'post'; |
25
|
|
|
|
26
|
|
|
return $this->doPayPalRequest(); |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* Get Partner Referral Details. |
31
|
|
|
* |
32
|
|
|
* @param string $partner_referral_id |
33
|
|
|
* |
34
|
|
|
* @throws \Throwable |
35
|
|
|
* |
36
|
|
|
* @return array|\Psr\Http\Message\StreamInterface|string |
37
|
|
|
* |
38
|
|
|
* @see https://developer.paypal.com/docs/api/partner-referrals/v2/#partner-referrals_read |
39
|
|
|
*/ |
40
|
|
|
public function showReferralData(string $partner_referral_id) |
41
|
|
|
{ |
42
|
|
|
$this->apiEndPoint = "v2/customer/partner-referrals/{$partner_referral_id}"; |
43
|
|
|
|
44
|
|
|
$this->verb = 'get'; |
45
|
|
|
|
46
|
|
|
return $this->doPayPalRequest(); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* List Seller Tracking Information. |
51
|
|
|
* |
52
|
|
|
* @param string $partner_id |
53
|
|
|
* @param string $tracking_id |
54
|
|
|
* |
55
|
|
|
* @throws \Throwable |
56
|
|
|
* |
57
|
|
|
* @return array|\Psr\Http\Message\StreamInterface|string |
58
|
|
|
* |
59
|
|
|
* @see https://developer.paypal.com/docs/api/partner-referrals/v1/#merchant-integration_find |
60
|
|
|
*/ |
61
|
|
|
public function listSellerTrackingInformation(string $partner_id, string $tracking_id) |
62
|
|
|
{ |
63
|
|
|
$this->apiEndPoint = "v1/customer/partners/{$partner_id}/merchant-integrations?tracking_id={$tracking_id}"; |
64
|
|
|
|
65
|
|
|
$this->verb = 'get'; |
66
|
|
|
|
67
|
|
|
return $this->doPayPalRequest(); |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* Show Seller Status. |
72
|
|
|
* |
73
|
|
|
* @param string $partner_id |
74
|
|
|
* @param string $merchant_id |
75
|
|
|
* |
76
|
|
|
* @throws \Throwable |
77
|
|
|
* |
78
|
|
|
* @return array|\Psr\Http\Message\StreamInterface|string |
79
|
|
|
* |
80
|
|
|
* @see https://developer.paypal.com/docs/api/partner-referrals/v1/#merchant-integration_status |
81
|
|
|
*/ |
82
|
|
|
public function showSellerStatus(string $partner_id, string $merchant_id) |
83
|
|
|
{ |
84
|
|
|
$this->apiEndPoint = "v1/customer/partners/{$partner_id}/merchant-integrations/{$merchant_id}"; |
85
|
|
|
|
86
|
|
|
$this->verb = 'get'; |
87
|
|
|
|
88
|
|
|
return $this->doPayPalRequest(); |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* List Merchant Credentials. |
93
|
|
|
* |
94
|
|
|
* @param string $partner_id |
95
|
|
|
* |
96
|
|
|
* @throws \Throwable |
97
|
|
|
* |
98
|
|
|
* @return array|\Psr\Http\Message\StreamInterface|string |
99
|
|
|
* |
100
|
|
|
* @see https://developer.paypal.com/docs/api/partner-referrals/v1/#merchant-integration_credentials |
101
|
|
|
*/ |
102
|
|
|
public function listMerchantCredentials(string $partner_id) |
103
|
|
|
{ |
104
|
|
|
$this->apiEndPoint = "v1/customer/partners/{$partner_id}/merchant-integrations/credentials"; |
105
|
|
|
|
106
|
|
|
$this->verb = 'get'; |
107
|
|
|
|
108
|
|
|
return $this->doPayPalRequest(); |
109
|
|
|
} |
110
|
|
|
} |
111
|
|
|
|