File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
src/main/java/com/bitpay/sdk Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -897,6 +897,33 @@ public Refund cancelRefund(String refundId) throws RefundCancellationException,
897897 return refund ;
898898 }
899899
900+ /**
901+ * Cancel a previously submitted refund request on a BitPay invoice.
902+ *
903+ * @param guid The refund Guid for the refund to be canceled.
904+ * @return An updated Refund Object.
905+ * @throws RefundCancellationException RefundCancellationException class
906+ * @throws BitPayException BitPayException class
907+ * @since 8.7.0
908+ */
909+ public Refund cancelRefundByGuid (String guid ) throws RefundCancellationException , BitPayException {
910+ Refund refund ;
911+
912+ final List <BasicNameValuePair > params = new ArrayList <BasicNameValuePair >();
913+ params .add (new BasicNameValuePair ("token" , this .getAccessToken (Facade .Merchant )));
914+
915+ try {
916+ HttpResponse response = this .delete ("refunds/guid/" + guid , params );
917+ refund = new ObjectMapper ().readValue (this .responseToJsonString (response ), Refund .class );
918+ } catch (BitPayException ex ) {
919+ throw new RefundCancellationException (ex .getStatusCode (), ex .getReasonPhrase ());
920+ } catch (Exception e ) {
921+ throw new RefundCancellationException (null , "failed to deserialize BitPay server response (Refund) : " + e .getMessage ());
922+ }
923+
924+ return refund ;
925+ }
926+
900927 /**
901928 * Create a BitPay bill using the POS facade.
902929 *
You can’t perform that action at this time.
0 commit comments