File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
src/main/java/com/bitpay/sdk Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -693,6 +693,35 @@ public Refund getRefund(String refundId) throws RefundQueryException, BitPayExce
693693 return refund ;
694694 }
695695
696+ /**
697+ * Retrieve a previously made refund request on a BitPay invoice.
698+ *
699+ * @param guid The BitPay refund Guid.
700+ * @return A BitPay Refund object with the associated Refund object.
701+ * @throws RefundQueryException RefundQueryException class
702+ * @throws BitPayException BitPayException class
703+ * @since 8.7.0
704+ */
705+ public Refund getRefundByGuid (String guid ) throws RefundQueryException , BitPayException {
706+ Refund refund ;
707+
708+ final List <BasicNameValuePair > params = new ArrayList <BasicNameValuePair >();
709+ params .add (new BasicNameValuePair ("token" , this .getAccessToken (Facade .Merchant )));
710+
711+ try {
712+ HttpResponse response = this .get ("refunds/guid/" + guid , params , true );
713+ refund = new ObjectMapper ().readValue (this .responseToJsonString (response ), Refund .class );
714+ } catch (JsonProcessingException e ) {
715+ throw new RefundQueryException (null , "failed to deserialize BitPay server response (Refund) : " + e .getMessage ());
716+ } catch (BitPayException ex ) {
717+ throw new RefundQueryException (ex .getStatusCode (), ex .getReasonPhrase ());
718+ } catch (Exception e ) {
719+ throw new RefundQueryException (null , "failed to deserialize BitPay server response (Refund) : " + e .getMessage ());
720+ }
721+
722+ return refund ;
723+ }
724+
696725 /**
697726 * Retrieve all refund requests on a BitPay invoice.
698727 *
You can’t perform that action at this time.
0 commit comments