@@ 135-151 (lines=17) @@ | ||
132 | * @param array $payload |
|
133 | * @return Model |
|
134 | */ |
|
135 | public function update(Webhook $webhook, array $payload) |
|
136 | { |
|
137 | $this->method = 'PUT'; |
|
138 | $this->payload = $this->convertPayloadAmountsToInteger($payload); |
|
139 | $this->apiUrl = $this->apiUrl . $webhook->id; |
|
140 | ||
141 | $this->formRequestData(); |
|
142 | $this->setOptions([ |
|
143 | 'headers' => [ |
|
144 | 'Accept' => 'application/json', |
|
145 | ], |
|
146 | 'auth' => [config('paymongo.secret_key'), ''], |
|
147 | 'json' => $this->data, |
|
148 | ]); |
|
149 | ||
150 | return $this->request(); |
|
151 | } |
|
152 | ||
153 | /** |
|
154 | * Cancels the payment intent |
|
@@ 181-197 (lines=17) @@ | ||
178 | * @param string $paymentMethodId |
|
179 | * @return Model |
|
180 | */ |
|
181 | public function attach(PaymentIntent $intent, $paymentMethodId) |
|
182 | { |
|
183 | $this->method = 'POST'; |
|
184 | $this->apiUrl = $this->apiUrl . $intent->getId() . '/attach'; |
|
185 | $this->payload = ['payment_method' => $paymentMethodId]; |
|
186 | ||
187 | $this->formRequestData(); |
|
188 | $this->setOptions([ |
|
189 | 'headers' => [ |
|
190 | 'Accept' => 'application/json', |
|
191 | ], |
|
192 | 'json' => $this->data, |
|
193 | 'auth' => [config('paymongo.secret_key'), ''], |
|
194 | ]); |
|
195 | ||
196 | return $this->request(); |
|
197 | } |
|
198 | ||
199 | /** |
|
200 | * Send request to API |