|
3 | 3 | namespace Vrajroham\LaravelBitpay\Actions;
|
4 | 4 |
|
5 | 5 | use BitPaySDK\Exceptions\BitPayException;
|
6 |
| -use BitPaySDK\Exceptions\RefundCancellationException; |
7 | 6 | use BitPaySDK\Model\Invoice\Buyer;
|
8 | 7 | use BitPaySDK\Model\Invoice\Invoice;
|
9 |
| -use BitPaySDK\Model\Invoice\Refund; |
10 | 8 | use Vrajroham\LaravelBitpay\Constants\WebhookAutoPopulate;
|
11 | 9 |
|
12 | 10 |
|
@@ -103,103 +101,17 @@ public static function getInvoices(
|
103 | 101 | }
|
104 | 102 |
|
105 | 103 | /**
|
106 |
| - * Get BitPay refund instance. |
| 104 | + * Request the last BitPay Invoice webhook to be resent. |
107 | 105 | *
|
108 |
| - * @return Refund |
109 |
| - */ |
110 |
| - public static function Refund(): Refund |
111 |
| - { |
112 |
| - return new Refund(); |
113 |
| - } |
114 |
| - |
115 |
| - /** |
116 |
| - * Create a BitPay refund. |
| 106 | + * @link https://bitpay.com/api/#rest-api-resources-invoices-request-a-webhook-to-be-resent |
117 | 107 | *
|
118 |
| - * @link https://bitpay.com/api/#rest-api-resources-invoices-refund-an-invoice |
| 108 | + * @param string $invoiceId The id of the invoice for which you want the last webhook to be resent. |
119 | 109 | *
|
120 |
| - * @param $invoice Invoice A BitPay invoice object for which a refund request should be made. Must have |
121 |
| - * been obtained using the merchant facade. |
122 |
| - * @param $refundEmail string The email of the buyer to which the refund email will be sent |
123 |
| - * @param $amount float The amount of money to refund. If zero then a request for 100% of the invoice |
124 |
| - * value is created. |
125 |
| - * @param $currency string The three digit currency code specifying the exchange rate to use when |
126 |
| - * calculating the refund bitcoin amount. If this value is "BTC" then no exchange rate |
127 |
| - * calculation is performed. |
128 |
| - * |
129 |
| - * @return bool True if the refund was successfully created, false otherwise. |
130 |
| - * @throws BitPayException BitPayException class |
| 110 | + * @return bool True if the webhook has been resent for the current invoice status, false otherwise. |
| 111 | + * @throws \BitPaySDK\Exceptions\BitPayException BitPayException class |
131 | 112 | */
|
132 |
| - public static function createRefund( |
133 |
| - Invoice $invoice, |
134 |
| - string $refundEmail, |
135 |
| - float $amount, |
136 |
| - string $currency |
137 |
| - ): bool { |
138 |
| - return (new self())->client->createRefund($invoice, $refundEmail, $amount, $currency); |
139 |
| - } |
140 |
| - |
141 |
| - /** |
142 |
| - * Retrieve all refund requests on a BitPay invoice. |
143 |
| - * |
144 |
| - * @link https://bitpay.com/api/#rest-api-resources-invoices-retrieve-all-refund-requests-on-an-invoice |
145 |
| - * |
146 |
| - * @param $invoice Invoice The BitPay invoice having the associated refunds. |
147 |
| - * |
148 |
| - * @return Refund[] An array of BitPay refund object with the associated Refund object updated. |
149 |
| - * @throws BitPayException BitPayException class |
150 |
| - */ |
151 |
| - public static function getRefunds(Invoice $invoice): array |
| 113 | + public static function requestInvoiceWebhook(string $invoiceId): bool |
152 | 114 | {
|
153 |
| - return (new self())->client->getRefunds($invoice); |
| 115 | + return (new self())->client->requestInvoiceNotification($invoiceId); |
154 | 116 | }
|
155 |
| - |
156 |
| - /** |
157 |
| - * Retrieve a previously made refund request on a BitPay invoice. |
158 |
| - * |
159 |
| - * @link https://bitpay.com/api/#rest-api-resources-invoices-retrieve-a-refund-request |
160 |
| - * |
161 |
| - * @param $invoice Invoice The BitPay invoice having the associated refund. |
162 |
| - * @param $refundId string The refund id for the refund to be updated with new status. |
163 |
| - * |
164 |
| - * @return Refund A BitPay refund object with the associated Refund object updated. |
165 |
| - * @throws BitPayException BitPayException class |
166 |
| - */ |
167 |
| - public static function getRefund(Invoice $invoice, string $refundId): Refund |
168 |
| - { |
169 |
| - return (new self())->client->getRefund($invoice, $refundId); |
170 |
| - } |
171 |
| - |
172 |
| - /** |
173 |
| - * Cancel a previously submitted refund request on a BitPay invoice. |
174 |
| - * |
175 |
| - * @link https://bitpay.com/api/#rest-api-resources-invoices-cancel-a-refund-request |
176 |
| - * |
177 |
| - * @param $invoiceId string The refund id for the refund to be canceled. |
178 |
| - * @param $refund Refund The BitPay invoice having the associated refund to be canceled. |
179 |
| - * Must have been obtained using the merchant facade. |
180 |
| - * |
181 |
| - * @return bool True if the refund was successfully canceled, false otherwise. |
182 |
| - * @throws RefundCancellationException RefundCancellationException class |
183 |
| - */ |
184 |
| - public static function cancelRefund(string $invoiceId, Refund $refund): bool |
185 |
| - { |
186 |
| - return (new self())->client->cancelRefund($invoiceId, $refund); |
187 |
| - } |
188 |
| - |
189 |
| - // TODO: Awaiting upstream merge: https://github.com/bitpay/php-bitpay-client-v2/pull/69 |
190 |
| -// /** |
191 |
| -// * Request the last BitPay Invoice webhook to be resent. |
192 |
| -// * |
193 |
| -// * @link https://bitpay.com/api/#rest-api-resources-invoices-request-a-webhook-to-be-resent |
194 |
| -// * |
195 |
| -// * @param string $invoiceId The id of the invoice for which you want the last webhook to be resent. |
196 |
| -// * @param string $invoiceToken The resource token for the `invoiceId` you want the webhook to be resent. |
197 |
| -// * |
198 |
| -// * @return bool True if the webhook has been resent for the current invoice status, false otherwise. |
199 |
| -// * @throws \BitPaySDK\Exceptions\BitPayException BitPayException class |
200 |
| -// */ |
201 |
| -// public static function requestInvoiceWebhook(string $invoiceId, string $invoiceToken): bool |
202 |
| -// { |
203 |
| -// return (new self())->client->requestInvoiceWebhook($invoiceId, $invoiceToken); |
204 |
| -// } |
205 | 117 | }
|
0 commit comments