예제 #1
0
        public RefundPaymentResponse Process(RefundPaymentRequest request)
        {
            Transaction tx = new Transaction();

            tx.TestMode = request.Test;

            tx.SetRequestParameter("VPSProtocol", "3.00");
            tx.SetRequestParameter("TxType", "REFUND");

            tx.SetRequestParameter("Vendor", request.Vendor);
            tx.SetRequestParameter("VendorTxCode", request.VendorTxCode);

            tx.SetRequestParameter("Amount", request.Amount.ToString());
            tx.SetRequestParameter("Currency", request.Currency);
            tx.SetRequestParameter("Description", request.Description);

            tx.SetRequestParameter("RelatedVPSTxId", request.RelatedVPSTxId);
            tx.SetRequestParameter("RelatedVendorTxCode", request.RelatedVendorTxCode);
            tx.SetRequestParameter("RelatedSecurityKey", request.RelatedSecurityKey);
            tx.SetRequestParameter("RelatedTxAuthNo", request.RelatedTxAuthNo);

            tx.SendRefund();

            // Receive Response
            var response = new RefundPaymentResponse();

            response.VPSProtocol = tx.GetResponseParameter("VPSProtocol");
            response.TxType = "REFUND";

            response.Status = tx.GetResponseParameter("Status");
            response.StatusDetail = tx.GetResponseParameter("StatusDetail");
            response.VpsTxId = tx.GetResponseParameter("VPSTxID");
            response.TxAuthNo = tx.GetResponseParameter("TxAuthNo");

            if (!String.IsNullOrEmpty(response.StatusDetail))
                response.StatusDetail = response.StatusDetail.Replace("'", "`");

            return response;
        }