public void Test32()
        {
            authorization auth = new authorization();

            auth.id          = "1";
            auth.orderId     = "32";
            auth.amount      = 10010;
            auth.orderSource = orderSourceType.ecommerce;
            contact billToAddress = new contact();

            billToAddress.name         = "John Smith";
            billToAddress.addressLine1 = "1 Main St.";
            billToAddress.city         = "Burlington";
            billToAddress.state        = "MA";
            billToAddress.zip          = "01803-3747";
            billToAddress.country      = countryTypeEnum.US;
            auth.billToAddress         = billToAddress;
            cardType card = new cardType();

            card.number            = "4457010000000009";
            card.expDate           = "0112";
            card.cardValidationNum = "349";
            card.type = methodOfPaymentTypeEnum.VI;
            auth.card = card;

            authorizationResponse authorizeResponse = cnp.Authorize(auth);

//            Assert.AreEqual("111", authorizeResponse.response);
//            Assert.AreEqual("Authorization amount has already been depleted", authorizeResponse.message);
            Assert.AreEqual("11111 ", authorizeResponse.authCode);
            Assert.AreEqual("01", authorizeResponse.fraudResult.avsResult);
            Assert.AreEqual("M", authorizeResponse.fraudResult.cardValidationResult);

            capture capture = new capture();

            capture.id       = authorizeResponse.id;
            capture.cnpTxnId = authorizeResponse.cnpTxnId;
            capture.amount   = 5005;
            captureResponse captureResponse = cnp.Capture(capture);

            Assert.AreEqual("000", captureResponse.response);
            Assert.AreEqual("Approved", captureResponse.message);

            authReversal reversal = new authReversal();

            reversal.id       = authorizeResponse.id;
            reversal.cnpTxnId = 320000000000000000;
            authReversalResponse reversalResponse = cnp.AuthReversal(reversal);

            Assert.AreEqual("000", reversalResponse.response);
            Assert.AreEqual("Approved", reversalResponse.message);
        }
Пример #2
0
        public void SimpleAuthReversal()
        {
            var reversal = new authReversal
            {
                id          = "1",
                reportGroup = "Planets",
                cnpTxnId    = 12345678000L,
                amount      = 106,
                payPalNotes = "Notes"
            };

            var response = _cnp.AuthReversal(reversal);

            Assert.AreEqual("Approved", response.message);
        }
Пример #3
0
        public void TestSurchargeAmount()
        {
            authReversal reversal = new authReversal();

            reversal.cnpTxnId        = 3;
            reversal.amount          = 2;
            reversal.surchargeAmount = 1;
            reversal.payPalNotes     = "note";
            reversal.reportGroup     = "Planets";

            var mock = new Mock <Communications>();

            mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<amount>2</amount>\r\n<surchargeAmount>1</surchargeAmount>\r\n<payPalNotes>note</payPalNotes>.*", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >()))
            .Returns("<cnpOnlineResponse version='8.14' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><authReversalResponse><cnpTxnId>123</cnpTxnId></authReversalResponse></cnpOnlineResponse>");

            Communications mockedCommunication = mock.Object;

            cnp.SetCommunication(mockedCommunication);
            cnp.AuthReversal(reversal);
        }
Пример #4
0
        public void TestAuthReversal()
        {
            authReversal authreversal = new authReversal();

            authreversal.cnpTxnId    = 12345678000;
            authreversal.amount      = 106;
            authreversal.payPalNotes = "Notes";


            var mock = new Mock <Communications>();

            mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*?<cnpOnlineRequest.*?<authReversal.*?<cnpTxnId>12345678000</cnpTxnId>.*?</authReversal>.*?", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >()))
            .Returns("<cnpOnlineResponse version='8.10' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><authReversalResponse><cnpTxnId>123</cnpTxnId></authReversalResponse></cnpOnlineResponse>");

            Communications mockedCommunication = mock.Object;

            cnp.SetCommunication(mockedCommunication);
            authReversalResponse authreversalresponse = cnp.AuthReversal(authreversal);

            Assert.AreEqual(123, authreversalresponse.cnpTxnId);
        }