/// <summary> /// Get the Refund /// </summary> /// <param name="refund">Refund</param> /// <returns>Refund</returns> public Refund get(Refund refund) { refund.setRequiredFields(new List <string> { CardPaymentsConstants.id }); refund.checkRequiredFields(); Request request = new Request( method: RequestType.GET, uri: this.prepareURI("/refunds/" + refund.id()) ); dynamic response = this.client.processRequest(request); return(new Refund(response)); }
/// <summary> /// Cancel Refund /// </summary> /// <param name="refund">Refund</param> /// <returns>Refund</returns> public Refund cancelRefund(Refund refund) { refund.setRequiredFields(new List <string> { CardPaymentsConstants.id }); refund.checkRequiredFields(); Refund tmpRefund = new Refund(); tmpRefund.status("CANCELLED"); Request request = new Request( method: RequestType.PUT, uri: this.prepareURI("/refunds/" + refund.id()), body: tmpRefund ); dynamic response = this.client.processRequest(request); return(new Refund(response)); }
/// <summary> /// Get matching refunds /// </summary> /// <param name="refund"></param> /// <param name="filter"></param> /// <returns></returns> public Pagerator <Refund> getRefunds(Refund refund = null, Filter filter = null) { Dictionary <String, String> queryStr = new Dictionary <String, String>(); if (refund != null && !String.IsNullOrWhiteSpace(refund.merchantRefNum())) { queryStr.Add("merchantRefNum", refund.merchantRefNum()); } if (filter != null) { if (filter.limit != null) { queryStr.Add("limit", filter.limit.ToString()); } if (filter.offset != null) { queryStr.Add("offset", filter.offset.ToString()); } if (!String.IsNullOrWhiteSpace(filter.startDate)) { queryStr.Add("startDate", filter.startDate); } if (!String.IsNullOrWhiteSpace(filter.endDate)) { queryStr.Add("endDate", filter.endDate); } } Request request = new Request( method: RequestType.GET, uri: this.prepareURI("/refunds"), queryString: queryStr ); dynamic response = this.client.processRequest(request); return(new Pagerator <Refund>(this.client, typeof(Refund), response)); }
/// <summary> /// Refund /// </summary> /// <param name="refund">Refund</param> /// <returns>Refund</returns> public Refund refund(Refund newRefund) { newRefund.setRequiredFields(new List <string> { CardPaymentsConstants.settlementId }); newRefund.checkRequiredFields(); newRefund.setRequiredFields(new List <string> { CardPaymentsConstants.merchantRefNum }); newRefund.setOptionalFields(new List <string> { CardPaymentsConstants.amount, CardPaymentsConstants.dupCheck }); Request request = new Request( method: RequestType.POST, uri: this.prepareURI("/settlements/" + newRefund.settlementId() + "/refunds"), body: newRefund ); dynamic response = this.client.processRequest(request); return(new Refund(response)); }