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 ExpressCheckout API endpoints & options. |
||
32 | * |
||
33 | * @param array $credentials |
||
34 | * |
||
35 | * @return void |
||
36 | */ |
||
37 | public function setExpressCheckoutOptions($credentials) |
||
57 | |||
58 | /** |
||
59 | * Set cart item details for PayPal. |
||
60 | * |
||
61 | * @param array $items |
||
62 | * |
||
63 | * @return \Illuminate\Support\Collection |
||
64 | */ |
||
65 | protected function setCartItems($items) |
||
77 | |||
78 | /** |
||
79 | * Set Recurring payments details for SetExpressCheckout API call. |
||
80 | * |
||
81 | * @param array $data |
||
82 | * @param bool $subscription |
||
83 | */ |
||
84 | protected function setExpressCheckoutRecurringPaymentConfig($data, $subscription = false) |
||
92 | |||
93 | /** |
||
94 | * Perform a SetExpressCheckout API call on PayPal. |
||
95 | * |
||
96 | * @param array $data |
||
97 | * @param bool $subscription |
||
98 | * |
||
99 | * @return array |
||
100 | */ |
||
101 | public function setExpressCheckout($data, $subscription = false) |
||
124 | |||
125 | /** |
||
126 | * Perform a GetExpressCheckoutDetails API call on PayPal. |
||
127 | * |
||
128 | * @param string $token |
||
129 | * |
||
130 | * @return array |
||
131 | */ |
||
132 | public function getExpressCheckoutDetails($token) |
||
140 | |||
141 | /** |
||
142 | * Perform DoExpressCheckoutPayment API call on PayPal. |
||
143 | * |
||
144 | * @param array $data |
||
145 | * @param string $token |
||
146 | * @param string $payerid |
||
147 | * |
||
148 | * @return array |
||
149 | */ |
||
150 | public function doExpressCheckoutPayment($data, $token, $payerid) |
||
166 | |||
167 | /** |
||
168 | * Perform a DoAuthorization API call on PayPal. |
||
169 | * |
||
170 | * @param string $authorization_id Transaction ID |
||
171 | * @param float $amount Amount to capture |
||
172 | * @param array $data Optional request fields |
||
173 | * |
||
174 | * @return array |
||
175 | */ |
||
176 | public function doAuthorization($authorization_id, $amount, $data = []) |
||
187 | |||
188 | /** |
||
189 | * Perform a DoCapture API call on PayPal. |
||
190 | * |
||
191 | * @param string $authorization_id Transaction ID |
||
192 | * @param float $amount Amount to capture |
||
193 | * @param string $complete Indicates whether or not this is the last capture. |
||
194 | * @param array $data Optional request fields |
||
195 | * |
||
196 | * @return array |
||
197 | */ |
||
198 | public function doCapture($authorization_id, $amount, $complete = 'Complete', $data = []) |
||
211 | |||
212 | /** |
||
213 | * Perform a DoReauthorization API call on PayPal to reauthorize an existing authorization transaction. |
||
214 | * |
||
215 | * @param string $authorization_id |
||
216 | * @param float $amount |
||
217 | * @param array $data |
||
218 | * |
||
219 | * @return array |
||
220 | */ |
||
221 | public function doReAuthorization($authorization_id, $amount, $data = []) |
||
232 | |||
233 | /** |
||
234 | * Perform a DoVoid API call on PayPal. |
||
235 | * |
||
236 | * @param string $authorization_id Transaction ID |
||
237 | * @param array $data Optional request fields |
||
238 | * |
||
239 | * @return array |
||
240 | */ |
||
241 | public function doVoid($authorization_id, $data = []) |
||
251 | |||
252 | /** |
||
253 | * Perform a CreateBillingAgreement API call on PayPal. |
||
254 | * |
||
255 | * @param string $token |
||
256 | * |
||
257 | * @return array |
||
258 | */ |
||
259 | public function createBillingAgreement($token) |
||
267 | |||
268 | /** |
||
269 | * Perform a CreateRecurringPaymentsProfile API call on PayPal. |
||
270 | * |
||
271 | * @param array $data |
||
272 | * @param string $token |
||
273 | * |
||
274 | * @return array |
||
275 | */ |
||
276 | public function createRecurringPaymentsProfile($data, $token) |
||
284 | |||
285 | /** |
||
286 | * Perform a GetRecurringPaymentsProfileDetails API call on PayPal. |
||
287 | * |
||
288 | * @param string $id |
||
289 | * |
||
290 | * @return array |
||
291 | */ |
||
292 | public function getRecurringPaymentsProfileDetails($id) |
||
300 | |||
301 | /** |
||
302 | * Perform a UpdateRecurringPaymentsProfile API call on PayPal. |
||
303 | * |
||
304 | * @param array $data |
||
305 | * @param string $id |
||
306 | * |
||
307 | * @return array |
||
308 | */ |
||
309 | public function updateRecurringPaymentsProfile($data, $id) |
||
317 | |||
318 | /** |
||
319 | * Change Recurring payment profile status on PayPal. |
||
320 | * |
||
321 | * @param string $id |
||
322 | * @param string $status |
||
323 | * |
||
324 | * @return array|\Psr\Http\Message\StreamInterface |
||
325 | */ |
||
326 | protected function manageRecurringPaymentsProfileStatus($id, $status) |
||
335 | |||
336 | /** |
||
337 | * Perform a ManageRecurringPaymentsProfileStatus API call on PayPal to cancel a RecurringPaymentsProfile. |
||
338 | * |
||
339 | * @param string $id |
||
340 | * |
||
341 | * @return array |
||
342 | */ |
||
343 | public function cancelRecurringPaymentsProfile($id) |
||
347 | |||
348 | /** |
||
349 | * Perform a ManageRecurringPaymentsProfileStatus API call on PayPal to suspend a RecurringPaymentsProfile. |
||
350 | * |
||
351 | * @param string $id |
||
352 | * |
||
353 | * @return array |
||
354 | */ |
||
355 | public function suspendRecurringPaymentsProfile($id) |
||
359 | |||
360 | /** |
||
361 | * Perform a ManageRecurringPaymentsProfileStatus API call on PayPal to reactivate a RecurringPaymentsProfile. |
||
362 | * |
||
363 | * @param string $id |
||
364 | * |
||
365 | * @return array |
||
366 | */ |
||
367 | public function reactivateRecurringPaymentsProfile($id) |
||
371 | } |
||
372 |