Exemplo n.º 1
0
        /// <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));
        }