1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Srmklive\PayPal\Traits\PayPalAPI; |
4
|
|
|
|
5
|
|
|
trait PaymentExperienceWebProfiles |
6
|
|
|
{ |
7
|
|
|
/** |
8
|
|
|
* List Web Experience Profiles. |
9
|
|
|
* |
10
|
|
|
* @throws \Throwable |
11
|
|
|
* |
12
|
|
|
* @return array|\Psr\Http\Message\StreamInterface|string |
13
|
|
|
* |
14
|
|
|
* @see https://developer.paypal.com/docs/api/payment-experience/v1/#web-profiles_get-list |
15
|
|
|
*/ |
16
|
|
|
public function listWebExperienceProfiles() |
17
|
|
|
{ |
18
|
|
|
$this->apiEndPoint = 'v1/payment-experience/web-profiles'; |
19
|
|
|
|
20
|
|
|
$this->verb = 'get'; |
21
|
|
|
|
22
|
|
|
return $this->doPayPalRequest(); |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Create a Web Experience Profile. |
27
|
|
|
* |
28
|
|
|
* @param array $data |
29
|
|
|
* @param string $request_id |
30
|
|
|
* |
31
|
|
|
* @throws \Throwable |
32
|
|
|
* |
33
|
|
|
* @return array|\Psr\Http\Message\StreamInterface|string |
34
|
|
|
* |
35
|
|
|
* @see https://developer.paypal.com/docs/api/payment-experience/v1/#web-profiles_get-list |
36
|
|
|
*/ |
37
|
|
|
public function createWebExperienceProfile(array $data, $request_id) |
38
|
|
|
{ |
39
|
|
|
$this->apiEndPoint = 'v1/payment-experience/web-profiles'; |
40
|
|
|
|
41
|
|
|
$this->options['headers']['PayPal-Request-Id'] = $request_id; |
42
|
|
|
$this->options['json'] = $data; |
43
|
|
|
|
44
|
|
|
$this->verb = 'post'; |
45
|
|
|
|
46
|
|
|
return $this->doPayPalRequest(); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Delete a Web Experience Profile. |
51
|
|
|
* |
52
|
|
|
* @param string $profile_id |
53
|
|
|
* |
54
|
|
|
* @throws \Throwable |
55
|
|
|
* |
56
|
|
|
* @return array|\Psr\Http\Message\StreamInterface|string |
57
|
|
|
* |
58
|
|
|
* @see https://developer.paypal.com/docs/api/payment-experience/v1/#web-profiles_get-list |
59
|
|
|
*/ |
60
|
|
|
public function deleteWebExperienceProfile($profile_id) |
61
|
|
|
{ |
62
|
|
|
$this->apiEndPoint = "v1/payment-experience/web-profiles/{$profile_id}"; |
63
|
|
|
|
64
|
|
|
$this->verb = 'delete'; |
65
|
|
|
|
66
|
|
|
return $this->doPayPalRequest(); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* Partially update a Web Experience Profile. |
71
|
|
|
* |
72
|
|
|
* @param string $profile_id |
73
|
|
|
* @param array $data |
74
|
|
|
* |
75
|
|
|
* @throws \Throwable |
76
|
|
|
* |
77
|
|
|
* @return array|\Psr\Http\Message\StreamInterface|string |
78
|
|
|
* |
79
|
|
|
* @see https://developer.paypal.com/docs/api/payment-experience/v1/#web-profiles_get-list |
80
|
|
|
*/ |
81
|
|
|
public function patchWebExperienceProfile($profile_id, array $data) |
82
|
|
|
{ |
83
|
|
|
$this->apiEndPoint = "v1/payment-experience/web-profiles/{$profile_id}"; |
84
|
|
|
|
85
|
|
|
$this->options['json'] = $data; |
86
|
|
|
|
87
|
|
|
$this->verb = 'patch'; |
88
|
|
|
|
89
|
|
|
return $this->doPayPalRequest(); |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* Partially update a Web Experience Profile. |
94
|
|
|
* |
95
|
|
|
* @param string $profile_id |
96
|
|
|
* @param array $data |
97
|
|
|
* |
98
|
|
|
* @throws \Throwable |
99
|
|
|
* |
100
|
|
|
* @return array|\Psr\Http\Message\StreamInterface|string |
101
|
|
|
* |
102
|
|
|
* @see https://developer.paypal.com/docs/api/payment-experience/v1/#web-profiles_get-list |
103
|
|
|
*/ |
104
|
|
|
public function updateWebExperienceProfile($profile_id, array $data) |
105
|
|
|
{ |
106
|
|
|
$this->apiEndPoint = "v1/payment-experience/web-profiles/{$profile_id}"; |
107
|
|
|
|
108
|
|
|
$this->options['json'] = $data; |
109
|
|
|
|
110
|
|
|
$this->verb = 'put'; |
111
|
|
|
|
112
|
|
|
return $this->doPayPalRequest(); |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* Delete a Web Experience Profile. |
117
|
|
|
* |
118
|
|
|
* @param string $profile_id |
119
|
|
|
* |
120
|
|
|
* @throws \Throwable |
121
|
|
|
* |
122
|
|
|
* @return array|\Psr\Http\Message\StreamInterface|string |
123
|
|
|
* |
124
|
|
|
* @see https://developer.paypal.com/docs/api/payment-experience/v1/#web-profiles_get-list |
125
|
|
|
*/ |
126
|
|
|
public function showWebExperienceProfileDetails($profile_id) |
127
|
|
|
{ |
128
|
|
|
$this->apiEndPoint = "v1/payment-experience/web-profiles/{$profile_id}"; |
129
|
|
|
|
130
|
|
|
$this->verb = 'get'; |
131
|
|
|
|
132
|
|
|
return $this->doPayPalRequest(); |
133
|
|
|
} |
134
|
|
|
} |
135
|
|
|
|