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