Total Complexity | 4 |
Total Lines | 105 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
5 | trait PaymentAuthorizations |
||
6 | { |
||
7 | /** |
||
8 | * Show details for authorized payment. |
||
9 | * |
||
10 | * @param string $authorization_id |
||
11 | * |
||
12 | * @throws \Throwable |
||
13 | * |
||
14 | * @return array|\Psr\Http\Message\StreamInterface|string |
||
15 | * |
||
16 | * @see https://developer.paypal.com/docs/api/payments/v2/#authorizations_get |
||
17 | */ |
||
18 | public function showAuthorizedPaymentDetails($authorization_id) |
||
19 | { |
||
20 | $this->apiEndPoint = "v2/payments/authorizations/{$authorization_id}"; |
||
1 ignored issue
–
show
|
|||
21 | $this->apiUrl = collect([$this->apiUrl, $this->apiEndPoint])->implode('/'); |
||
1 ignored issue
–
show
|
|||
22 | |||
23 | $this->verb = 'get'; |
||
1 ignored issue
–
show
|
|||
24 | |||
25 | return $this->doPayPalRequest(); |
||
1 ignored issue
–
show
|
|||
26 | } |
||
27 | |||
28 | /** |
||
29 | * Capture an authorized payment. |
||
30 | * |
||
31 | * @param string $authorization_id |
||
32 | * @param string $invoice_id |
||
33 | * @param float $amount |
||
34 | * @param string $note |
||
35 | * |
||
36 | * @throws \Throwable |
||
37 | * |
||
38 | * @return array|\Psr\Http\Message\StreamInterface|string |
||
39 | * |
||
40 | * @see https://developer.paypal.com/docs/api/payments/v2/#authorizations_capture |
||
41 | */ |
||
42 | public function captureAuthorizedPayment($authorization_id, $invoice_id, $amount, $note) |
||
60 | } |
||
61 | |||
62 | /** |
||
63 | * Reauthorize an authorized payment. |
||
64 | * |
||
65 | * @param string $authorization_id |
||
66 | * @param float $amount |
||
67 | * |
||
68 | * @throws \Throwable |
||
69 | * |
||
70 | * @return array|\Psr\Http\Message\StreamInterface|string |
||
71 | * |
||
72 | * @see https://developer.paypal.com/docs/api/payments/v2/#authorizations_reauthorize |
||
73 | */ |
||
74 | public function reAuthorizeAuthorizedPayment($authorization_id, $amount) |
||
89 | } |
||
90 | |||
91 | /** |
||
92 | * Void an authorized payment. |
||
93 | * |
||
94 | * @param string $authorization_id |
||
95 | * |
||
96 | * @throws \Throwable |
||
97 | * |
||
98 | * @return array|\Psr\Http\Message\StreamInterface|string |
||
99 | * |
||
100 | * @see https://developer.paypal.com/docs/api/payments/v2/#authorizations_void |
||
101 | */ |
||
102 | public function voidAuthorizedPayment($authorization_id) |
||
112 |