Пример #1
0
        public VoidPaymentResponse Process(VoidPaymentRequest request)
        {
            Transaction tx = new Transaction();

            tx.TestMode = request.Test;

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

            tx.SetRequestParameter("Vendor", request.Vendor);
            tx.SetRequestParameter("VendorTxCode", request.VendorTxCode);
            tx.SetRequestParameter("VPSTxId", request.VPSTxId);
            tx.SetRequestParameter("SecurityKey", request.SecurityKey);
            tx.SetRequestParameter("TxAuthNo", request.TxAuthNo);

            tx.SendVoid();

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

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

            response.Status = tx.GetResponseParameter("Status");
            response.StatusDetail = tx.GetResponseParameter("StatusDetail");

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

            return response;
        }
Пример #2
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;
        }
Пример #3
0
        public NewPaymentResponse Process(NewPaymentRequest request)
        {
            Transaction tx = new Transaction();

            tx.TestMode = request.Test;

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

            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("CardHolder", request.CardHolder);
            tx.SetRequestParameter("CardNumber", request.CardNumber);
            tx.SetRequestParameter("ExpiryDate", request.ExpiryDate);
            tx.SetRequestParameter("CV2", request.CV2);
            tx.SetRequestParameter("CardType", request.CardType);
            tx.SetRequestParameter("CustomerName", request.CustomerName);

            tx.SetRequestParameter("BillingSurname", request.BillingSurname);
            tx.SetRequestParameter("BillingFirstnames", request.BillingFirstnames);            
            tx.SetRequestParameter("BillingAddress1", request.BillingAddress1);
            tx.SetRequestParameter("BillingAddress2", request.BillingAddress2);
            tx.SetRequestParameter("BillingCity", request.BillingCity);
            tx.SetRequestParameter("BillingPostCode", request.BillingPostCode);
            if (request.BillingCountry == "US" & !String.IsNullOrEmpty(request.BillingState))       tx.SetRequestParameter("BillingState", request.BillingState);            
            tx.SetRequestParameter("BillingCountry", request.BillingCountry);
            tx.SetRequestParameter("BillingPhone", request.BillingPhone);

            tx.SetRequestParameter("DeliverySurname", request.DeliverySurname);
            tx.SetRequestParameter("DeliveryFirstnames", request.DeliveryFirstnames);            
            tx.SetRequestParameter("DeliveryAddress1", request.DeliveryAddress1);
            tx.SetRequestParameter("DeliveryAddress2", request.DeliveryAddress2);
            tx.SetRequestParameter("DeliveryCity", request.DeliveryCity);
            tx.SetRequestParameter("DeliveryPostCode", request.DeliveryPostCode);
            if (request.DeliveryCountry == "US" & !String.IsNullOrEmpty(request.DeliveryState))     tx.SetRequestParameter("DeliveryState", request.DeliveryState);            
            tx.SetRequestParameter("DeliveryCountry", request.DeliveryCountry);
            tx.SetRequestParameter("DeliveryPhone", request.DeliveryPhone);

            tx.SetRequestParameter("CustomerEmail", request.CustomerEmail);            
            tx.SetRequestParameter("ApplyAVSCV2", request.ApplyAVSCV2);
            tx.SetRequestParameter("ClientIPAddress", request.ClientIPAddress);
            tx.SetRequestParameter("Apply3DSecure", request.Apply3DSecure);
            tx.SetRequestParameter("AccountType", request.AccountType);
            tx.SetRequestParameter("BillingAgreement", request.BillingAgreement ? "1" : "0");
            tx.SetRequestParameter("CreateToken", request.CreateToken ? "1" : "0");
            tx.SetRequestParameter("StoreToken", request.StoreToken ? "1" : "0");
            tx.SetRequestParameter("Basket", request.BasketXML);
            tx.SetRequestParameter("Website", request.Website);

            tx.SendPayment();

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

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

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

            response.Cavv = tx.GetResponseParameter("CAVV");
            response.Md = tx.GetResponseParameter("MD");
            response.AcsUrl = tx.GetResponseParameter("ACSURL");
            response.PaReq = tx.GetResponseParameter("PAReq");

            response.AvsCv2 = tx.GetResponseParameter("AVSCV2");
            response.AddressResult = tx.GetResponseParameter("AddressResult");
            response.PostCodeResult = tx.GetResponseParameter("PostCodeResult");
            response.Cv2Result = tx.GetResponseParameter("CV2Result");
            response.Status3dSecure = tx.GetResponseParameter("3DSECURESTATUS");

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

            return response;
        }
Пример #4
0
        public RepeatPaymentResponse Process(RepeatPaymentRequest request)
        {
            Transaction tx = new Transaction();

            tx.TestMode = request.Test;

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

            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.SendRepeatPayment();

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

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

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

            response.AvsCv2 = tx.GetResponseParameter("AVSCV2");
            response.AddressResult = tx.GetResponseParameter("AddressResult");
            response.PostCodeResult = tx.GetResponseParameter("PostCodeResult");
            response.Cv2Result = tx.GetResponseParameter("CV2Result");

            response.BankAuthCode = tx.GetResponseParameter("BankAuthCode");
            response.DeclineCode = tx.GetResponseParameter("DeclineCode");

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

            return response;
        }