Ejemplo n.º 1
0
        public void SimpleTokenWithApplepay()
        {
            var registerTokenRequest = new registerTokenRequestType
            {
                orderId = "12344",
                reportGroup = "Planets",
                applepay = new applepayType
                {
                    data = "user",
                    signature = "sign",
                    version = "1",
                    header = new applepayHeaderType
                    {
                        applicationData = "454657413164",
                        ephemeralPublicKey = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
                        publicKeyHash = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
                        transactionId = "1234"
                    }
                }
            };

            var rtokenResponse = _litle.RegisterToken(registerTokenRequest);

            StringAssert.AreEqualIgnoringCase("Account number was successfully registered", rtokenResponse.message);
            Assert.AreEqual("0", rtokenResponse.applepayResponse.transactionAmount);
        }
        public void TestSimpleRequestWithApplepay()
        {
            var register = new registerTokenRequestType
            {
                orderId = "12344",
                applepay = new applepayType
                {
                    data = "user",
                    signature = "sign",
                    version = "1",
                    header = new applepayHeaderType
                    {
                        applicationData = "454657413164",
                        ephemeralPublicKey = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
                        publicKeyHash = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
                        transactionId = "1234"
                    }
                }
            };

            var mock = new Mock<Communications>();

            mock.Setup(communications => communications.HttpPost(It.IsRegex(".*<registerTokenRequest.*<applepay>.*?<data>user</data>.*?</applepay>.*?</registerTokenRequest>.*", RegexOptions.Singleline), It.IsAny<Dictionary<string, string>>()))
                .Returns("<litleOnlineResponse version='9.10' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><registerTokenResponse><litleTxnId>4</litleTxnId><response>801</response><message>Token Successfully Registered</message><responseTime>2012-10-10T10:17:03</responseTime></registerTokenResponse></litleOnlineResponse>");

            var mockedCommunication = mock.Object;
            _litle.setCommunication(mockedCommunication);
            _litle.RegisterToken(register);
        }
Ejemplo n.º 3
0
 public void SimpleToken()
 {
     var registerTokenRequest = new registerTokenRequestType();
     registerTokenRequest.orderId = "12344";
     registerTokenRequest.accountNumber = "1233456789103801";
     registerTokenRequest.reportGroup = "Planets";
     var rtokenResponse = litle.RegisterToken(registerTokenRequest);
     StringAssert.AreEqualIgnoringCase("Account number was successfully registered", rtokenResponse.message);
 }
        public void test51()
        {
            var request = new registerTokenRequestType();
            request.orderId = "51";
            request.accountNumber = "4457119999999999";

            var response = litle.RegisterToken(request);
            Assert.AreEqual("820", response.response);
            Assert.AreEqual("Credit card number was invalid", response.message);
        }
Ejemplo n.º 5
0
 public void SimpleTokenWithEcheck()
 {
     var registerTokenRequest = new registerTokenRequestType();
     registerTokenRequest.orderId = "12344";
     var echeckObj = new echeckForTokenType();
     echeckObj.accNum = "12344565";
     echeckObj.routingNum = "123476545";
     registerTokenRequest.echeckForToken = echeckObj;
     registerTokenRequest.reportGroup = "Planets";
     var rtokenResponse = litle.RegisterToken(registerTokenRequest);
     StringAssert.AreEqualIgnoringCase("Account number was successfully registered", rtokenResponse.message);
 }
        public void test52()
        {
            var request = new registerTokenRequestType();
            request.orderId = "52";
            request.accountNumber = "4457119922390123";

            var response = litle.RegisterToken(request);
            Assert.AreEqual("445711", response.bin);
            Assert.AreEqual(methodOfPaymentTypeEnum.VI, response.type);
            Assert.AreEqual("802", response.response);
            Assert.AreEqual("1111222233330123", response.litleToken);
            Assert.AreEqual("Account number was previously registered", response.message);
        }
        public void TestSimpleRegisterTokenRequest()
        {
            var tokenRequest = new registerTokenRequestType
            {
                orderId = "androidpay",
                accountNumber = "4100000000000001",
                paypageRegistrationId = "558987412"
            };

            var tokenResponse = _litle.RegisterToken(tokenRequest);
            Assert.AreEqual("01", tokenResponse.androidpayResponse.expMonth);
            Assert.AreEqual("2050", tokenResponse.androidpayResponse.expYear);
            Assert.NotNull(tokenResponse.androidpayResponse.cryptogram);
        }
Ejemplo n.º 8
0
        public void Test52()
        {
            registerTokenRequestType request = new registerTokenRequestType();

            request.id            = "1";
            request.orderId       = "52";
            request.accountNumber = "4457119922390123";

            registerTokenResponse response = cnp.RegisterToken(request);

            Assert.AreEqual("445711", response.bin);
            Assert.AreEqual(methodOfPaymentTypeEnum.VI, response.type);
            Assert.AreEqual("802", response.response);
            Assert.AreEqual("1111000276870123", response.cnpToken);
            Assert.AreEqual("Account number was previously registered", response.message);
        }
Ejemplo n.º 9
0
        public void TestSimpleTokenWithNullableTypeField()
        {
            var registerTokenRequest = new registerTokenRequestType
            {
                id            = "1",
                reportGroup   = "Planets",
                orderId       = "12344",
                accountNumber = "1233456789103801",
            };


            var rtokenResponse = _cnp.RegisterToken(registerTokenRequest);

            StringAssert.AreEqualIgnoringCase("Account number was successfully registered", rtokenResponse.message);
            Assert.IsNull(rtokenResponse.type);
        }
        public void test54()
        {
            registerTokenRequestType request = new registerTokenRequestType();

            request.orderId = "54";
            echeckForTokenType echeck = new echeckForTokenType();

            echeck.accNum          = "1022222102";
            echeck.routingNum      = "1145_7895";
            request.echeckForToken = echeck;;

            registerTokenResponse response = litle.RegisterToken(request);

            Assert.AreEqual("900", response.response);
            Assert.AreEqual("Invalid bank routing number", response.message);
        }
Ejemplo n.º 11
0
        public void Test54()
        {
            registerTokenRequestType request = new registerTokenRequestType();

            request.id      = "1";
            request.orderId = "54";
            echeckForTokenType echeck = new echeckForTokenType();

            echeck.accNum          = "1022222102";
            echeck.routingNum      = "1145_7895";
            request.echeckForToken = echeck;;

            registerTokenResponse response = cnp.RegisterToken(request);

            Assert.AreEqual("900", response.response);
        }
Ejemplo n.º 12
0
        public void test50()
        {
            registerTokenRequestType request = new registerTokenRequestType();

            request.id            = "1";
            request.orderId       = "50";
            request.accountNumber = "4457119922390123";

            registerTokenResponse response = litle.RegisterToken(request);

            Assert.AreEqual("445711", response.bin);
            Assert.AreEqual(methodOfPaymentTypeEnum.VI, response.type);
            Assert.AreEqual("801", response.response);
            Assert.AreEqual("1111222233330123", response.litleToken);
            Assert.AreEqual("Account number was successfully registered", response.message);
        }
Ejemplo n.º 13
0
        public void TestSimpleRequest()
        {
            registerTokenRequestType register = new registerTokenRequestType();

            register.orderId       = "12344";
            register.accountNumber = "4100000000000001";

            var mock = new Mock <Communications>();

            mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<registerTokenRequest.*<accountNumber>4100000000000001</accountNumber>.*</registerTokenRequest>.*", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >()))
            .Returns("<cnpOnlineResponse version='8.14' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><registerTokenResponse><cnpTxnId>4</cnpTxnId><response>801</response><message>Token Successfully Registered</message><responseTime>2012-10-10T10:17:03</responseTime></registerTokenResponse></cnpOnlineResponse>");

            Communications mockedCommunication = mock.Object;

            cnp.SetCommunication(mockedCommunication);
            cnp.RegisterToken(register);
        }
        public void TestSimpleRequest()
        {
            var register = new registerTokenRequestType
            {
                orderId = "12344",
                accountNumber = "4100000000000001"
            };

            var mock = new Mock<Communications>();

            mock.Setup(communications => communications.HttpPost(It.IsRegex(".*<registerTokenRequest.*<accountNumber>4100000000000001</accountNumber>.*</registerTokenRequest>.*", RegexOptions.Singleline), It.IsAny<Dictionary<string, string>>()))
                .Returns("<litleOnlineResponse version='9.10' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><registerTokenResponse><litleTxnId>4</litleTxnId><response>801</response><message>Token Successfully Registered</message><responseTime>2012-10-10T10:17:03</responseTime></registerTokenResponse></litleOnlineResponse>");

            var mockedCommunication = mock.Object;
            _litle.setCommunication(mockedCommunication);
            _litle.RegisterToken(register);
        }
        public void Test50()
        {
            registerTokenRequestType request = new registerTokenRequestType();

            request.id            = "1";
            request.orderId       = "50";
            request.accountNumber = "4457119922390123";

            registerTokenResponse response = cnp.RegisterToken(request);

            Assert.AreEqual("445711", response.bin);
            Assert.AreEqual(methodOfPaymentTypeEnum.VI, response.type);
            //TODO: //Getting 802 instead
            //Assert.AreEqual("801", response.response);
            Assert.AreEqual("1111000276870123", response.cnpToken);
            //Assert.AreEqual("Account number was successfully registered", response.message);
        }
        public void testToken()
        {
            var token = new registerTokenRequestType();

            token.orderId       = "12344";
            token.accountNumber = "1233456789103801";

            batchRequest.addRegisterTokenRequest(token);

            Assert.AreEqual(1, batchRequest.getNumRegisterTokenRequest());

            mockLitleFile.Verify(
                litleFile =>
                litleFile.createRandomFile(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(),
                                           mockLitleTime.Object));
            mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, token.Serialize()));
        }
Ejemplo n.º 17
0
        public void SimpleTokenWithEcheck()
        {
            var registerTokenRequest = new registerTokenRequestType
            {
                orderId        = "12344",
                reportGroup    = "Planets",
                echeckForToken = new echeckForTokenType
                {
                    accNum     = "12344565",
                    routingNum = "123476545"
                }
            };

            var rtokenResponse = _litle.RegisterToken(registerTokenRequest);

            StringAssert.AreEqualIgnoringCase("Account number was successfully registered", rtokenResponse.message);
        }
        public void TestSimpleRequest()
        {
            var register = new registerTokenRequestType
            {
                orderId       = "12344",
                accountNumber = "4100000000000001"
            };

            var mock = new Mock <Communications>();

            mock.Setup(communications => communications.HttpPost(It.IsRegex(".*<registerTokenRequest.*<accountNumber>4100000000000001</accountNumber>.*</registerTokenRequest>.*", RegexOptions.Singleline), It.IsAny <Dictionary <string, string> >()))
            .Returns("<litleOnlineResponse version='9.10' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><registerTokenResponse><litleTxnId>4</litleTxnId><response>801</response><message>Token Successfully Registered</message><responseTime>2012-10-10T10:17:03</responseTime></registerTokenResponse></litleOnlineResponse>");

            var mockedCommunication = mock.Object;

            _litle.setCommunication(mockedCommunication);
            _litle.RegisterToken(register);
        }
        public void test53()
        {
            registerTokenRequestType request = new registerTokenRequestType();

            request.orderId = "53";
            echeckForTokenType echeck = new echeckForTokenType();

            echeck.accNum          = "1099999998";
            echeck.routingNum      = "114567895";
            request.echeckForToken = echeck;;

            registerTokenResponse response = litle.RegisterToken(request);

            Assert.AreEqual(methodOfPaymentTypeEnum.EC, response.type);
            Assert.AreEqual("998", response.eCheckAccountSuffix);
            Assert.AreEqual("801", response.response);
            Assert.AreEqual("Account number was successfully registered", response.message);
            Assert.AreEqual("111922223333000998", response.litleToken);
        }
Ejemplo n.º 20
0
        public void testToken()
        {
            registerTokenRequestType token = new registerTokenRequestType();

            token.orderId       = "12344";
            token.accountNumber = "1233456789103801";


            var mock = new Mock <Communications>();

            mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*?<litleOnlineRequest.*?<registerTokenRequest.*?<accountNumber>1233456789103801</accountNumber>.*?</registerTokenRequest>.*?", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >()))
            .Returns("<litleOnlineResponse version='8.10' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><registerTokenResponse><litleTxnId>123</litleTxnId></registerTokenResponse></litleOnlineResponse>");

            Communications mockedCommunication = mock.Object;

            litle.setCommunication(mockedCommunication);
            registerTokenResponse registertokenresponse = litle.RegisterToken(token);

            Assert.AreEqual(123, registertokenresponse.litleTxnId);
        }
Ejemplo n.º 21
0
        public void TokenEcheckMissingRequiredField()
        {
            registerTokenRequestType registerTokenRequest = new registerTokenRequestType();

            registerTokenRequest.orderId = "12344";
            echeckForTokenType echeckObj = new echeckForTokenType();

            echeckObj.routingNum = "123476545";
            registerTokenRequest.echeckForToken = echeckObj;
            registerTokenRequest.reportGroup    = "Planets";
            try
            {
                //expected exception;
                registerTokenResponse rtokenResponse = litle.RegisterToken(registerTokenRequest);
            }
            catch (LitleOnlineException e)
            {
                Assert.True(e.Message.StartsWith("Error validating xml data against the schema"));
            }
        }
Ejemplo n.º 22
0
        public void TokenEcheckMissingRequiredField()
        {
            var registerTokenRequest = new registerTokenRequestType
            {
                orderId        = "12344",
                reportGroup    = "Planets",
                echeckForToken = new echeckForTokenType {
                    routingNum = "123476545"
                }
            };

            try
            {
                _litle.RegisterToken(registerTokenRequest);
                Assert.Fail("Exception expected!");
            }
            catch (LitleOnlineException e)
            {
                Assert.True(e.Message.StartsWith("Error validating xml data against the schema"));
            }
        }
Ejemplo n.º 23
0
        public void TestToken()
        {
            registerTokenRequestType token = new registerTokenRequestType();

            token.orderId       = "12344";
            token.accountNumber = "1233456789103801";


            var mock = new Mock <Communications>();

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

            Communications mockedCommunication = mock.Object;

            cnp.SetCommunication(mockedCommunication);
            registerTokenResponse registertokenresponse = cnp.RegisterToken(token);

            Assert.AreEqual(123, registertokenresponse.cnpTxnId);
            Assert.IsNull(registertokenresponse.type);
        }
        public void TestCanContainCardValidationNum()
        {
            var register = new registerTokenRequestType();
            register.orderId = "12344";
            register.accountNumber = "4100000000000001";
            register.cardValidationNum = "123";

            var mock = new Mock<Communications>(_memoryStreams);

            mock.Setup(
                Communications =>
                    Communications.HttpPost(
                        It.IsRegex(
                            ".*<registerTokenRequest.*<accountNumber>4100000000000001</accountNumber>.*<cardValidationNum>123</cardValidationNum>.*</registerTokenRequest>.*",
                            RegexOptions.Singleline), It.IsAny<Dictionary<string, string>>()))
                .Returns(
                    "<litleOnlineResponse version='8.14' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><registerTokenResponse><litleTxnId>4</litleTxnId><response>801</response><message>Token Successfully Registered</message><responseTime>2012-10-10T10:17:03</responseTime></registerTokenResponse></litleOnlineResponse>");

            var mockedCommunication = mock.Object;
            litle.setCommunication(mockedCommunication);
            litle.RegisterToken(register);
        }
        public void Test53()
        {
            registerTokenRequestType request = new registerTokenRequestType();

            request.id      = "1";
            request.orderId = "53";
            echeckForTokenType echeck = new echeckForTokenType();

            echeck.accNum          = "1099999998";
            echeck.routingNum      = "114567895";
            request.echeckForToken = echeck;;

            registerTokenResponse response = cnp.RegisterToken(request);
            //TODO: //getting null as response type
            //Assert.AreEqual(methodOfPaymentTypeEnum.EC, response.type);
            //TODO: //getting null as eCheckAccountSuffix
            //Assert.AreEqual("998", response.eCheckAccountSuffix);
            //TODO: //getting 900 as response and corresponding message
            //Assert.AreEqual("801", response.response);
            //Assert.AreEqual("Account number was successfully registered", response.message);
            //TODO: //getting null as cnptoken
            //Assert.AreEqual("111922223333000998", response.cnpToken);
        }
Ejemplo n.º 26
0
        public void SimpleTokenWithApplepay()
        {
            registerTokenRequestType registerTokenRequest = new registerTokenRequestType();

            registerTokenRequest.orderId     = "12344";
            registerTokenRequest.reportGroup = "Planets";
            applepayType       applepay           = new applepayType();
            applepayHeaderType applepayHeaderType = new applepayHeaderType();

            applepayHeaderType.applicationData    = "454657413164";
            applepayHeaderType.ephemeralPublicKey = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
            applepayHeaderType.publicKeyHash      = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
            applepayHeaderType.transactionId      = "1234";
            applepay.header               = applepayHeaderType;
            applepay.data                 = "user";
            applepay.signature            = "sign";
            applepay.version              = "1";
            registerTokenRequest.applepay = applepay;
            registerTokenResponse rtokenResponse = litle.RegisterToken(registerTokenRequest);

            StringAssert.AreEqualIgnoringCase("Account number was successfully registered", rtokenResponse.message);
            Assert.AreEqual("0", rtokenResponse.applepayResponse.transactionAmount);
        }
Ejemplo n.º 27
0
        public void TokenEcheckMissingRequiredField()
        {
            var registerTokenRequest = new registerTokenRequestType
            {
                id             = "1",
                reportGroup    = "Planets",
                orderId        = "12344",
                echeckForToken = new echeckForTokenType
                {
                    routingNum = "123476545"
                }
            };

            try
            {
                //expected exception;
                var rtokenResponse = _cnp.RegisterToken(registerTokenRequest);
            }
            catch (CnpOnlineException e)
            {
                Assert.True(e.Message.StartsWith("Error validating xml data against the schema"));
            }
        }
        public void TestCanContainCardValidationNum()
        {
            var register = new registerTokenRequestType();

            register.orderId           = "12344";
            register.accountNumber     = "4100000000000001";
            register.cardValidationNum = "123";

            var mock = new Mock <Communications>(_memoryStreams);

            mock.Setup(
                Communications =>
                Communications.HttpPost(
                    It.IsRegex(
                        ".*<registerTokenRequest.*<accountNumber>4100000000000001</accountNumber>.*<cardValidationNum>123</cardValidationNum>.*</registerTokenRequest>.*",
                        RegexOptions.Singleline), It.IsAny <Dictionary <string, string> >()))
            .Returns(
                "<litleOnlineResponse version='8.14' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><registerTokenResponse><litleTxnId>4</litleTxnId><response>801</response><message>Token Successfully Registered</message><responseTime>2012-10-10T10:17:03</responseTime></registerTokenResponse></litleOnlineResponse>");

            var mockedCommunication = mock.Object;

            litle.setCommunication(mockedCommunication);
            litle.RegisterToken(register);
        }
        public void test54()
        {
            var request = new registerTokenRequestType();
            request.orderId = "54";
            var echeck = new echeckForTokenType();
            echeck.accNum = "1022222102";
            echeck.routingNum = "1145_7895";
            request.echeckForToken = echeck;
            ;

            var response = litle.RegisterToken(request);
            Assert.AreEqual("900", response.response);
            Assert.AreEqual("Invalid bank routing number", response.message);
        }
Ejemplo n.º 30
0
        public void SimpleTokenWithEcheck()
        {
            var registerTokenRequest = new registerTokenRequestType
            {
                orderId = "12344",
                reportGroup = "Planets",
                echeckForToken = new echeckForTokenType
                {
                    accNum = "12344565",
                    routingNum = "123476545"
                }
            };

            var rtokenResponse = _litle.RegisterToken(registerTokenRequest);

            StringAssert.AreEqualIgnoringCase("Account number was successfully registered", rtokenResponse.message);
        }
Ejemplo n.º 31
0
        public void InvalidCredientialsBatch()
        {
            var litleIc = new litleRequest(_invalidConfig);

            var litleBatchRequest = new batchRequest();

            var card = new cardType
            {
                type = methodOfPaymentTypeEnum.VI,
                number = "4100000000000001",
                expDate = "1210"
            };

            var card2 = new cardType
            {
                type = methodOfPaymentTypeEnum.VI,
                number = "4242424242424242",
                expDate = "1210"
            };

            var authorization = new authorization
            {
                reportGroup = "Planets",
                orderId = "12344",
                amount = 106,
                orderSource = orderSourceType.ecommerce,
                card = card
            };

            litleBatchRequest.addAuthorization(authorization);

            var authorization2 = new authorization
            {
                reportGroup = "Planets",
                orderId = "12345",
                amount = 106,
                orderSource = orderSourceType.ecommerce,
                card = card2
            };

              litleBatchRequest.addAuthorization(authorization2);

            var reversal = new authReversal
            {
                litleTxnId = 12345678000L,
                amount = 106,
                payPalNotes = "Notes"
            };

            litleBatchRequest.addAuthReversal(reversal);

            var reversal2 = new authReversal
            {
                litleTxnId = 12345678900L,
                amount = 106,
                payPalNotes = "Notes"
            };

            litleBatchRequest.addAuthReversal(reversal2);

            var capture = new capture
            {
                litleTxnId = 123456000,
                amount = 106,
                payPalNotes = "Notes"
            };

            litleBatchRequest.addCapture(capture);

            var capture2 = new capture
            {
                litleTxnId = 123456700,
                amount = 106,
                payPalNotes = "Notes"
            };

            litleBatchRequest.addCapture(capture2);

            var authInfo = new authInformation
            {
                authDate = new DateTime(2002, 10, 9),
                authCode = "543216",
                authAmount = 12345
            };

            var capturegivenauth = new captureGivenAuth
            {
                amount = 106,
                orderId = "12344",
                orderSource = orderSourceType.ecommerce,
                authInformation = authInfo,
                card = card
            };

            litleBatchRequest.addCaptureGivenAuth(capturegivenauth);

            var capturegivenauth2 = new captureGivenAuth
            {
                amount = 106,
                orderId = "12344",
                authInformation = authInfo,
                orderSource = orderSourceType.ecommerce,
                card = card2
            };

            litleBatchRequest.addCaptureGivenAuth(capturegivenauth2);

            var creditObj = new credit
            {
                amount = 106,
                orderId = "2111",
                orderSource = orderSourceType.ecommerce,
                card = card
            };

            litleBatchRequest.addCredit(creditObj);

            var creditObj2 = new credit
            {
                amount = 106,
                orderId = "2111",
                orderSource = orderSourceType.ecommerce,
                card = card2
            };

            litleBatchRequest.addCredit(creditObj2);

            var echeck = new echeckType
            {
                accType = echeckAccountTypeEnum.Checking,
                accNum = "1099999903",
                routingNum = "011201995",
                checkNum = "123455"
            };

            var billToAddress = new contact
            {
                name = "Bob",
                city = "Lowell",
                state = "MA",
                email = "litle.com"
            };

            var echeckcredit = new echeckCredit
            {
                amount = 12L,
                orderId = "12345",
                orderSource = orderSourceType.ecommerce,
                echeck = echeck,
                billToAddress = billToAddress
            };

            litleBatchRequest.addEcheckCredit(echeckcredit);

            var echeck2 = new echeckType
            {
                accType = echeckAccountTypeEnum.Checking,
                accNum = "1099999903",
                routingNum = "011201995",
                checkNum = "123456"
            };

            var billToAddress2 = new contact
            {
                name = "Mike",
                city = "Lowell",
                state = "MA",
                email = "litle.com"
            };

            var echeckcredit2 = new echeckCredit
            {
                amount = 12L,
                orderId = "12346",
                orderSource = orderSourceType.ecommerce,
                echeck = echeck2,
                billToAddress = billToAddress2
            };

            litleBatchRequest.addEcheckCredit(echeckcredit2);

            var echeckredeposit = new echeckRedeposit
            {
                litleTxnId = 123456,
                echeck = echeck
            };

            litleBatchRequest.addEcheckRedeposit(echeckredeposit);

            var echeckredeposit2 = new echeckRedeposit
            {
                litleTxnId = 123457,
                echeck = echeck2
            };

            litleBatchRequest.addEcheckRedeposit(echeckredeposit2);

            var echeckSaleObj = new echeckSale
            {
                amount = 123456,
                orderId = "12345",
                orderSource = orderSourceType.ecommerce,
                echeck = echeck,
                billToAddress = billToAddress
            };

            litleBatchRequest.addEcheckSale(echeckSaleObj);

            var echeckSaleObj2 = new echeckSale
            {
                amount = 123456,
                orderId = "12346",
                orderSource = orderSourceType.ecommerce,
                echeck = echeck2,
                billToAddress = billToAddress2
            };

            litleBatchRequest.addEcheckSale(echeckSaleObj2);

            var echeckVerificationObject = new echeckVerification
            {
                amount = 123456,
                orderId = "12345",
                orderSource = orderSourceType.ecommerce,
                echeck = echeck,
                billToAddress = billToAddress
            };

            litleBatchRequest.addEcheckVerification(echeckVerificationObject);

            var echeckVerificationObject2 = new echeckVerification
            {
                amount = 123456,
                orderId = "12346",
                orderSource = orderSourceType.ecommerce,
                echeck = echeck2,
                billToAddress = billToAddress2
            };

            litleBatchRequest.addEcheckVerification(echeckVerificationObject2);

            var forcecapture = new forceCapture
            {
                amount = 106,
                orderId = "12344",
                orderSource = orderSourceType.ecommerce,
                card = card
            };

            litleBatchRequest.addForceCapture(forcecapture);

            var forcecapture2 = new forceCapture
            {
                amount = 106,
                orderId = "12345",
                orderSource = orderSourceType.ecommerce,
                card = card2
            };

            litleBatchRequest.addForceCapture(forcecapture2);

            var saleObj = new sale
            {
                amount = 106,
                litleTxnId = 123456,
                orderId = "12344",
                orderSource = orderSourceType.ecommerce,
                card = card
            };

            litleBatchRequest.addSale(saleObj);

            var saleObj2 = new sale
            {
                amount = 106,
                litleTxnId = 123456,
                orderId = "12345",
                orderSource = orderSourceType.ecommerce,
                card = card2
            };

            litleBatchRequest.addSale(saleObj2);

            var registerTokenRequest = new registerTokenRequestType
            {
                orderId = "12344",
                accountNumber = "1233456789103801",
                reportGroup = "Planets"
            };

            litleBatchRequest.addRegisterTokenRequest(registerTokenRequest);

            var registerTokenRequest2 = new registerTokenRequestType
            {
                orderId = "12345",
                accountNumber = "1233456789103801",
                reportGroup = "Planets"
            };

            litleBatchRequest.addRegisterTokenRequest(registerTokenRequest2);

            litleIc.addBatch(litleBatchRequest);

            var batchName = litleIc.sendToLitle();

            litleIc.blockAndWaitForResponse(batchName, 60*1000*5);

            try
            {
                litleIc.receiveFromLitle(batchName);
                Assert.Fail("Fail to throw a connection exception");
            }
            catch (LitleOnlineException e)
            {
                Assert.AreEqual("Error occured while attempting to retrieve and save the file from SFTP", e.Message);
            }
        }
Ejemplo n.º 32
0
 public Task <registerTokenResponse> RegisterTokenAsync(registerTokenRequestType tokenRequest, CancellationToken cancellationToken)
 {
     return(SendRequestAsync(response => response.registerTokenResponse, tokenRequest, cancellationToken));
 }
Ejemplo n.º 33
0
        public void TokenEcheckMissingRequiredField()
        {
            var registerTokenRequest = new registerTokenRequestType
            {
                orderId = "12344",
                reportGroup = "Planets",
                echeckForToken = new echeckForTokenType { routingNum = "123476545" }
            };

            try
            {
                _litle.RegisterToken(registerTokenRequest);
                Assert.Fail("Exception expected!");
            }
            catch (LitleOnlineException e)
            {
                Assert.True(e.Message.StartsWith("Error validating xml data against the schema"));
            }
        }
Ejemplo n.º 34
0
        public void TestSimpleBatchPgp()
        {
            _cnp = new cnpRequest(_config);
            batchRequest cnpBatchRequest = new batchRequest(_config);

            Console.WriteLine("Merchant Id:" + cnpBatchRequest.config["merchantId"]);
            Console.WriteLine("Merchant Username:"******"username"]);
            Console.WriteLine("Merchant Password:"******"password"]);
            Console.WriteLine("Length of Password:"******"password"].Length);
            var authorization = new authorization
            {
                reportGroup = "Planets",
                orderId     = "12344",
                amount      = 106,
                orderSource = orderSourceType.ecommerce
            };
            var card = new cardType
            {
                type    = methodOfPaymentTypeEnum.VI,
                number  = "4100000000000001",
                expDate = "1210"
            };

            authorization.card = card;
            authorization.id   = "id";

            cnpBatchRequest.addAuthorization(authorization);

            var authorization2 = new authorization();

            authorization2.reportGroup = "Planets";
            authorization2.orderId     = "12345";
            authorization2.amount      = 106;
            authorization2.orderSource = orderSourceType.ecommerce;
            var card2 = new cardType();

            card2.type          = methodOfPaymentTypeEnum.VI;
            card2.number        = "4242424242424242";
            card2.expDate       = "1210";
            authorization2.card = card2;
            authorization2.id   = "id";

            cnpBatchRequest.addAuthorization(authorization2);

            var reversal = new authReversal();

            reversal.cnpTxnId    = 12345678000L;
            reversal.amount      = 106;
            reversal.payPalNotes = "Notes";
            reversal.id          = "id";

            cnpBatchRequest.addAuthReversal(reversal);

            var reversal2 = new authReversal();

            reversal2.cnpTxnId    = 12345678900L;
            reversal2.amount      = 106;
            reversal2.payPalNotes = "Notes";
            reversal2.id          = "id";

            cnpBatchRequest.addAuthReversal(reversal2);

            var giftCardAuthReversal = new giftCardAuthReversal();

            giftCardAuthReversal.id       = "id";
            giftCardAuthReversal.cnpTxnId = 12345678000L;
            var giftCardCardTypeAuthReversal = new giftCardCardType();

            giftCardCardTypeAuthReversal.type           = methodOfPaymentTypeEnum.GC;
            giftCardCardTypeAuthReversal.number         = "4100000000000001";
            giftCardCardTypeAuthReversal.expDate        = "1210";
            giftCardAuthReversal.card                   = giftCardCardTypeAuthReversal;
            giftCardAuthReversal.originalRefCode        = "123456";
            giftCardAuthReversal.originalAmount         = 1000;
            giftCardAuthReversal.originalTxnTime        = DateTime.Now;
            giftCardAuthReversal.originalSystemTraceId  = 123;
            giftCardAuthReversal.originalSequenceNumber = "123456";

            cnpBatchRequest.addGiftCardAuthReversal(giftCardAuthReversal);

            var capture = new capture();

            capture.cnpTxnId    = 123456000;
            capture.amount      = 106;
            capture.payPalNotes = "Notes";
            capture.id          = "id";

            cnpBatchRequest.addCapture(capture);

            var capture2 = new capture();

            capture2.cnpTxnId    = 123456700;
            capture2.amount      = 106;
            capture2.payPalNotes = "Notes";
            capture2.id          = "id";

            cnpBatchRequest.addCapture(capture2);

            var giftCardCapture = new giftCardCapture();

            giftCardCapture.id            = "id";
            giftCardCapture.cnpTxnId      = 12345678000L;
            giftCardCapture.captureAmount = 123456;
            var giftCardCardTypeCapture = new giftCardCardType();

            giftCardCardTypeCapture.type    = methodOfPaymentTypeEnum.GC;
            giftCardCardTypeCapture.number  = "4100000000000001";
            giftCardCardTypeCapture.expDate = "1210";
            giftCardCapture.card            = giftCardCardTypeCapture;
            giftCardCapture.originalRefCode = "123456";
            giftCardCapture.originalAmount  = 1000;
            giftCardCapture.originalTxnTime = DateTime.Now;

            cnpBatchRequest.addGiftCardCapture(giftCardCapture);

            var capturegivenauth = new captureGivenAuth();

            capturegivenauth.amount  = 106;
            capturegivenauth.orderId = "12344";
            var authInfo = new authInformation();
            var authDate = new DateTime(2002, 10, 9);

            authInfo.authDate   = authDate;
            authInfo.authCode   = "543216";
            authInfo.authAmount = 12345;
            capturegivenauth.authInformation = authInfo;
            capturegivenauth.orderSource     = orderSourceType.ecommerce;
            capturegivenauth.card            = card;
            capturegivenauth.id = "id";

            cnpBatchRequest.addCaptureGivenAuth(capturegivenauth);

            var capturegivenauth2 = new captureGivenAuth();

            capturegivenauth2.amount  = 106;
            capturegivenauth2.orderId = "12344";
            var authInfo2 = new authInformation();

            authDate             = new DateTime(2003, 10, 9);
            authInfo2.authDate   = authDate;
            authInfo2.authCode   = "543216";
            authInfo2.authAmount = 12345;
            capturegivenauth2.authInformation = authInfo;
            capturegivenauth2.orderSource     = orderSourceType.ecommerce;
            capturegivenauth2.card            = card2;
            capturegivenauth2.id = "id";

            cnpBatchRequest.addCaptureGivenAuth(capturegivenauth2);

            var creditObj = new credit();

            creditObj.amount      = 106;
            creditObj.orderId     = "2111";
            creditObj.orderSource = orderSourceType.ecommerce;
            creditObj.card        = card;
            creditObj.id          = "id";

            cnpBatchRequest.addCredit(creditObj);

            var creditObj2 = new credit();

            creditObj2.amount      = 106;
            creditObj2.orderId     = "2111";
            creditObj2.orderSource = orderSourceType.ecommerce;
            creditObj2.card        = card2;
            creditObj2.id          = "id";

            cnpBatchRequest.addCredit(creditObj2);

            var giftCardCredit = new giftCardCredit();

            giftCardCredit.id           = "id";
            giftCardCredit.cnpTxnId     = 12345678000L;
            giftCardCredit.creditAmount = 123456;
            var giftCardCardTypeCredit = new giftCardCardType();

            giftCardCardTypeCredit.type    = methodOfPaymentTypeEnum.GC;
            giftCardCardTypeCredit.number  = "4100000000000001";
            giftCardCardTypeCredit.expDate = "1210";
            giftCardCredit.card            = giftCardCardTypeCredit;
            giftCardCredit.orderId         = "123456";
            giftCardCredit.orderSource     = orderSourceType.ecommerce;

            cnpBatchRequest.addGiftCardCredit(giftCardCredit);

            var echeckcredit = new echeckCredit();

            echeckcredit.amount      = 12L;
            echeckcredit.orderId     = "12345";
            echeckcredit.orderSource = orderSourceType.ecommerce;
            var echeck = new echeckType();

            echeck.accType      = echeckAccountTypeEnum.Checking;
            echeck.accNum       = "1099999903";
            echeck.routingNum   = "011201995";
            echeck.checkNum     = "123455";
            echeckcredit.echeck = echeck;
            var billToAddress = new contact();

            billToAddress.name         = "Bob";
            billToAddress.city         = "Lowell";
            billToAddress.state        = "MA";
            billToAddress.email        = "cnp.com";
            echeckcredit.billToAddress = billToAddress;
            echeckcredit.id            = "id";

            cnpBatchRequest.addEcheckCredit(echeckcredit);

            var echeckcredit2 = new echeckCredit();

            echeckcredit2.amount      = 12L;
            echeckcredit2.orderId     = "12346";
            echeckcredit2.orderSource = orderSourceType.ecommerce;
            var echeck2 = new echeckType();

            echeck2.accType      = echeckAccountTypeEnum.Checking;
            echeck2.accNum       = "1099999903";
            echeck2.routingNum   = "011201995";
            echeck2.checkNum     = "123456";
            echeckcredit2.echeck = echeck2;
            var billToAddress2 = new contact();

            billToAddress2.name         = "Mike";
            billToAddress2.city         = "Lowell";
            billToAddress2.state        = "MA";
            billToAddress2.email        = "cnp.com";
            echeckcredit2.billToAddress = billToAddress2;
            echeckcredit2.id            = "id";

            cnpBatchRequest.addEcheckCredit(echeckcredit2);

            var echeckredeposit = new echeckRedeposit();

            echeckredeposit.cnpTxnId = 123456;
            echeckredeposit.echeck   = echeck;
            echeckredeposit.id       = "id";

            cnpBatchRequest.addEcheckRedeposit(echeckredeposit);

            var echeckredeposit2 = new echeckRedeposit();

            echeckredeposit2.cnpTxnId = 123457;
            echeckredeposit2.echeck   = echeck2;
            echeckredeposit2.id       = "id";

            cnpBatchRequest.addEcheckRedeposit(echeckredeposit2);

            var echeckSaleObj = new echeckSale();

            echeckSaleObj.amount        = 123456;
            echeckSaleObj.orderId       = "12345";
            echeckSaleObj.orderSource   = orderSourceType.ecommerce;
            echeckSaleObj.echeck        = echeck;
            echeckSaleObj.billToAddress = billToAddress;
            echeckSaleObj.id            = "id";

            cnpBatchRequest.addEcheckSale(echeckSaleObj);

            var echeckSaleObj2 = new echeckSale();

            echeckSaleObj2.amount        = 123456;
            echeckSaleObj2.orderId       = "12346";
            echeckSaleObj2.orderSource   = orderSourceType.ecommerce;
            echeckSaleObj2.echeck        = echeck2;
            echeckSaleObj2.billToAddress = billToAddress2;
            echeckSaleObj2.id            = "id";

            cnpBatchRequest.addEcheckSale(echeckSaleObj2);

            var echeckPreNoteSaleObj1 = new echeckPreNoteSale();

            echeckPreNoteSaleObj1.orderId       = "12345";
            echeckPreNoteSaleObj1.orderSource   = orderSourceType.ecommerce;
            echeckPreNoteSaleObj1.echeck        = echeck;
            echeckPreNoteSaleObj1.billToAddress = billToAddress;
            echeckPreNoteSaleObj1.id            = "id";

            cnpBatchRequest.addEcheckPreNoteSale(echeckPreNoteSaleObj1);

            var echeckPreNoteSaleObj2 = new echeckPreNoteSale();

            echeckPreNoteSaleObj2.orderId       = "12345";
            echeckPreNoteSaleObj2.orderSource   = orderSourceType.ecommerce;
            echeckPreNoteSaleObj2.echeck        = echeck2;
            echeckPreNoteSaleObj2.billToAddress = billToAddress2;
            echeckPreNoteSaleObj2.id            = "id";

            cnpBatchRequest.addEcheckPreNoteSale(echeckPreNoteSaleObj2);

            var echeckPreNoteCreditObj1 = new echeckPreNoteCredit();

            echeckPreNoteCreditObj1.orderId       = "12345";
            echeckPreNoteCreditObj1.orderSource   = orderSourceType.ecommerce;
            echeckPreNoteCreditObj1.echeck        = echeck;
            echeckPreNoteCreditObj1.billToAddress = billToAddress;
            echeckPreNoteCreditObj1.id            = "id";

            cnpBatchRequest.addEcheckPreNoteCredit(echeckPreNoteCreditObj1);

            var echeckPreNoteCreditObj2 = new echeckPreNoteCredit();

            echeckPreNoteCreditObj2.orderId       = "12345";
            echeckPreNoteCreditObj2.orderSource   = orderSourceType.ecommerce;
            echeckPreNoteCreditObj2.echeck        = echeck2;
            echeckPreNoteCreditObj2.billToAddress = billToAddress2;
            echeckPreNoteCreditObj2.id            = "id";

            var echeckVerificationObject = new echeckVerification();

            echeckVerificationObject.amount        = 123456;
            echeckVerificationObject.orderId       = "12345";
            echeckVerificationObject.orderSource   = orderSourceType.ecommerce;
            echeckVerificationObject.echeck        = echeck;
            echeckVerificationObject.billToAddress = billToAddress;
            echeckVerificationObject.id            = "id";

            cnpBatchRequest.addEcheckVerification(echeckVerificationObject);

            var echeckVerificationObject2 = new echeckVerification();

            echeckVerificationObject2.amount        = 123456;
            echeckVerificationObject2.orderId       = "12346";
            echeckVerificationObject2.orderSource   = orderSourceType.ecommerce;
            echeckVerificationObject2.echeck        = echeck2;
            echeckVerificationObject2.billToAddress = billToAddress2;
            echeckVerificationObject2.id            = "id";

            cnpBatchRequest.addEcheckVerification(echeckVerificationObject2);

            var forcecapture = new forceCapture();

            forcecapture.amount      = 106;
            forcecapture.orderId     = "12344";
            forcecapture.orderSource = orderSourceType.ecommerce;
            forcecapture.card        = card;
            forcecapture.id          = "id";

            cnpBatchRequest.addForceCapture(forcecapture);

            var forcecapture2 = new forceCapture();

            forcecapture2.amount      = 106;
            forcecapture2.orderId     = "12345";
            forcecapture2.orderSource = orderSourceType.ecommerce;
            forcecapture2.card        = card2;
            forcecapture2.id          = "id";

            cnpBatchRequest.addForceCapture(forcecapture2);

            var saleObj = new sale();

            saleObj.amount      = 106;
            saleObj.cnpTxnId    = 123456;
            saleObj.orderId     = "12344";
            saleObj.orderSource = orderSourceType.ecommerce;
            saleObj.card        = card;
            saleObj.id          = "id";

            cnpBatchRequest.addSale(saleObj);

            var saleObj2 = new sale();

            saleObj2.amount      = 106;
            saleObj2.cnpTxnId    = 123456;
            saleObj2.orderId     = "12345";
            saleObj2.orderSource = orderSourceType.ecommerce;
            saleObj2.card        = card2;
            saleObj2.id          = "id";

            cnpBatchRequest.addSale(saleObj2);

            var registerTokenRequest = new registerTokenRequestType();

            registerTokenRequest.orderId       = "12344";
            registerTokenRequest.accountNumber = "1233456789103801";
            registerTokenRequest.reportGroup   = "Planets";
            registerTokenRequest.id            = "id";

            cnpBatchRequest.addRegisterTokenRequest(registerTokenRequest);

            var registerTokenRequest2 = new registerTokenRequestType();

            registerTokenRequest2.orderId       = "12345";
            registerTokenRequest2.accountNumber = "1233456789103801";
            registerTokenRequest2.reportGroup   = "Planets";
            registerTokenRequest2.id            = "id";

            cnpBatchRequest.addRegisterTokenRequest(registerTokenRequest2);

            var updateCardValidationNumOnToken = new updateCardValidationNumOnToken();

            updateCardValidationNumOnToken.orderId           = "12344";
            updateCardValidationNumOnToken.cardValidationNum = "123";
            updateCardValidationNumOnToken.cnpToken          = "4100000000000001";
            updateCardValidationNumOnToken.id = "id";

            cnpBatchRequest.addUpdateCardValidationNumOnToken(updateCardValidationNumOnToken);

            var updateCardValidationNumOnToken2 = new updateCardValidationNumOnToken();

            updateCardValidationNumOnToken2.orderId           = "12345";
            updateCardValidationNumOnToken2.cardValidationNum = "123";
            updateCardValidationNumOnToken2.cnpToken          = "4242424242424242";
            updateCardValidationNumOnToken2.id = "id";

            cnpBatchRequest.addUpdateCardValidationNumOnToken(updateCardValidationNumOnToken2);
            _cnp.addBatch(cnpBatchRequest);


            string batchName = _cnp.sendToCnp();

            //Check if the .xml batch request file exists inside "Requests" directory
            var requestDir  = _cnp.getRequestDirectory();
            var entries     = Directory.EnumerateFiles(requestDir);
            var targetEntry = Path.Combine(requestDir, batchName.Replace(".encrypted", ""));

            Assert.True(entries.Contains(targetEntry));

            // check if "encrypted" directory is present inside "Requests" directory
            var encryptedRequestDir = Path.Combine(requestDir, "encrypted");

            Assert.True(Directory.Exists(encryptedRequestDir));

            //Check if the .xml.encrypted batch request file exists inside "Requests/encrypted" directory
            entries     = Directory.EnumerateFiles(encryptedRequestDir);
            targetEntry = Path.Combine(encryptedRequestDir, batchName);
            Assert.True(entries.Contains(targetEntry));

            _cnp.blockAndWaitForResponse(batchName, estimatedResponseTime(2 * 2, 10 * 2));

            cnpResponse cnpResponse = _cnp.receiveFromCnp(batchName);

            //Check if the .xml batch response file exists inside "Responses" directory
            var responseDir = _cnp.getResponseDirectory();

            entries     = Directory.EnumerateFiles(responseDir);
            targetEntry = Path.Combine(responseDir, batchName.Replace(".encrypted", ""));
            Assert.True(entries.Contains(targetEntry));

            // check if "encrypted" directory is present inside "Responses" directory
            var encryptedResponseDir = Path.Combine(responseDir, "encrypted");

            Assert.True(Directory.Exists(encryptedResponseDir));

            //Check if the .xml.encrypted batch response file exists inside "Responses/encrypted" directory
            entries     = Directory.EnumerateFiles(encryptedResponseDir);
            targetEntry = Path.Combine(encryptedResponseDir, batchName);
            Assert.True(entries.Contains(targetEntry));

            Assert.NotNull(cnpResponse);
            Assert.AreEqual("0", cnpResponse.response);
            Assert.AreEqual("Valid Format", cnpResponse.message);

            var cnpBatchResponse = cnpResponse.nextBatchResponse();

            while (cnpBatchResponse != null)
            {
                var authorizationResponse = cnpBatchResponse.nextAuthorizationResponse();
                while (authorizationResponse != null)
                {
                    Assert.AreEqual("000", authorizationResponse.response);

                    authorizationResponse = cnpBatchResponse.nextAuthorizationResponse();
                }

                var authReversalResponse = cnpBatchResponse.nextAuthReversalResponse();
                while (authReversalResponse != null)
                {
                    Assert.AreEqual("000", authReversalResponse.response);

                    authReversalResponse = cnpBatchResponse.nextAuthReversalResponse();
                }

                var giftCardAuthReversalResponse = cnpBatchResponse.nextGiftCardAuthReversalResponse();
                while (giftCardAuthReversalResponse != null)
                {
                    Assert.NotNull(giftCardAuthReversalResponse.response);

                    giftCardAuthReversalResponse = cnpBatchResponse.nextGiftCardAuthReversalResponse();
                }

                var captureResponse = cnpBatchResponse.nextCaptureResponse();
                while (captureResponse != null)
                {
                    Assert.AreEqual("000", captureResponse.response);

                    captureResponse = cnpBatchResponse.nextCaptureResponse();
                }

                var giftCardCaptureResponse = cnpBatchResponse.nextGiftCardCaptureResponse();
                while (giftCardCaptureResponse != null)
                {
                    Assert.NotNull(giftCardCaptureResponse.response);

                    giftCardCaptureResponse = cnpBatchResponse.nextGiftCardCaptureResponse();
                }


                var captureGivenAuthResponse = cnpBatchResponse.nextCaptureGivenAuthResponse();
                while (captureGivenAuthResponse != null)
                {
                    Assert.AreEqual("000", captureGivenAuthResponse.response);

                    captureGivenAuthResponse = cnpBatchResponse.nextCaptureGivenAuthResponse();
                }

                var creditResponse = cnpBatchResponse.nextCreditResponse();
                while (creditResponse != null)
                {
                    Assert.AreEqual("000", creditResponse.response);

                    creditResponse = cnpBatchResponse.nextCreditResponse();
                }

                var giftCardCreditResponse = cnpBatchResponse.nextGiftCardCreditResponse();
                while (giftCardCreditResponse != null)
                {
                    Assert.NotNull(giftCardCreditResponse.response);

                    giftCardCreditResponse = cnpBatchResponse.nextGiftCardCreditResponse();
                }

                var echeckCreditResponse = cnpBatchResponse.nextEcheckCreditResponse();
                while (echeckCreditResponse != null)
                {
                    Assert.AreEqual("000", echeckCreditResponse.response);

                    echeckCreditResponse = cnpBatchResponse.nextEcheckCreditResponse();
                }

                var echeckRedepositResponse = cnpBatchResponse.nextEcheckRedepositResponse();
                while (echeckRedepositResponse != null)
                {
                    Assert.AreEqual("000", echeckRedepositResponse.response);

                    echeckRedepositResponse = cnpBatchResponse.nextEcheckRedepositResponse();
                }

                var echeckSalesResponse = cnpBatchResponse.nextEcheckSalesResponse();
                while (echeckSalesResponse != null)
                {
                    Assert.AreEqual("000", echeckSalesResponse.response);

                    echeckSalesResponse = cnpBatchResponse.nextEcheckSalesResponse();
                }

                var echeckPreNoteSaleResponse = cnpBatchResponse.nextEcheckPreNoteSaleResponse();
                while (echeckPreNoteSaleResponse != null)
                {
                    Assert.AreEqual("000", echeckPreNoteSaleResponse.response);

                    echeckPreNoteSaleResponse = cnpBatchResponse.nextEcheckPreNoteSaleResponse();
                }

                var echeckPreNoteCreditResponse = cnpBatchResponse.nextEcheckPreNoteCreditResponse();
                while (echeckPreNoteCreditResponse != null)
                {
                    Assert.AreEqual("000", echeckPreNoteCreditResponse.response);

                    echeckPreNoteCreditResponse = cnpBatchResponse.nextEcheckPreNoteCreditResponse();
                }

                var echeckVerificationResponse = cnpBatchResponse.nextEcheckVerificationResponse();
                while (echeckVerificationResponse != null)
                {
                    Assert.AreEqual("957", echeckVerificationResponse.response);

                    echeckVerificationResponse = cnpBatchResponse.nextEcheckVerificationResponse();
                }

                var forceCaptureResponse = cnpBatchResponse.nextForceCaptureResponse();
                while (forceCaptureResponse != null)
                {
                    Assert.AreEqual("000", forceCaptureResponse.response);

                    forceCaptureResponse = cnpBatchResponse.nextForceCaptureResponse();
                }

                var registerTokenResponse = cnpBatchResponse.nextRegisterTokenResponse();
                while (registerTokenResponse != null)
                {
                    Assert.AreEqual("820", registerTokenResponse.response);

                    registerTokenResponse = cnpBatchResponse.nextRegisterTokenResponse();
                }

                var saleResponse = cnpBatchResponse.nextSaleResponse();
                while (saleResponse != null)
                {
                    Assert.AreEqual("000", saleResponse.response);

                    saleResponse = cnpBatchResponse.nextSaleResponse();
                }
                cnpBatchResponse = cnpResponse.nextBatchResponse();
            }
        }
Ejemplo n.º 35
0
        public void NullBatchData()
        {
            var litleBatchRequest = new batchRequest();

            var card = new cardType
            {
                type = methodOfPaymentTypeEnum.VI,
                number = "414100000000000000",
                expDate = "1210"
            };
            var authorization = new authorization
            {
                reportGroup = "Planets",
                orderId = "12344",
                amount = 106,
                orderSource = orderSourceType.ecommerce,
                card = card
            };

            litleBatchRequest.addAuthorization(authorization);
            try
            {
                litleBatchRequest.addAuthorization(null);
            }
            catch (NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            var reversal = new authReversal
            {
                litleTxnId = 12345678000L,
                amount = 106,
                payPalNotes = "Notes"
            };

            litleBatchRequest.addAuthReversal(reversal);
            try
            {
                litleBatchRequest.addAuthReversal(null);
            }
            catch (NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            var capture = new capture
            {
                litleTxnId = 123456000,
                amount = 106,
                payPalNotes = "Notes"
            };

            litleBatchRequest.addCapture(capture);
            try
            {
                litleBatchRequest.addCapture(null);
            }
            catch (NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            var capturegivenauth = new captureGivenAuth
            {
                amount = 106,
                orderId = "12344",
                orderSource = orderSourceType.ecommerce,
                authInformation = new authInformation
                {
                    authDate = new DateTime(2002, 10, 9),
                    authCode = "543216",
                    authAmount = 12345
                },
                card = card
            };

            litleBatchRequest.addCaptureGivenAuth(capturegivenauth);
            try
            {
                litleBatchRequest.addCaptureGivenAuth(null);
            }
            catch (NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            var creditObj = new credit
            {
                amount = 106,
                orderId = "2111",
                orderSource = orderSourceType.ecommerce,
                card = card
            };

            litleBatchRequest.addCredit(creditObj);
            try
            {
                litleBatchRequest.addCredit(null);
            }
            catch (NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            var echeck = new echeckType
            {
                accType = echeckAccountTypeEnum.Checking,
                accNum = "12345657890",
                routingNum = "011201995",
                checkNum = "123455"
            };

            var billToAddress = new contact
            {
                name = "Bob",
                city = "Lowell",
                state = "MA",
                email = "litle.com"
            };

            var echeckcredit = new echeckCredit
            {
                amount = 12L,
                orderId = "12345",
                orderSource = orderSourceType.ecommerce,
                echeck = echeck,
                billToAddress = billToAddress
            };

            litleBatchRequest.addEcheckCredit(echeckcredit);
            try
            {
                litleBatchRequest.addEcheckCredit(null);
            }
            catch (NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            var echeckredeposit = new echeckRedeposit
            {
                litleTxnId = 123456,
                echeck = echeck
            };

            litleBatchRequest.addEcheckRedeposit(echeckredeposit);
            try
            {
                litleBatchRequest.addEcheckRedeposit(null);
            }
            catch (NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            var echeckSaleObj = new echeckSale
            {
                amount = 123456,
                orderId = "12345",
                orderSource = orderSourceType.ecommerce,
                echeck = echeck,
                billToAddress = billToAddress
            };

            litleBatchRequest.addEcheckSale(echeckSaleObj);
            try
            {
                litleBatchRequest.addEcheckSale(null);
            }
            catch (NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            var echeckVerificationObject = new echeckVerification
            {
                amount = 123456,
                orderId = "12345",
                orderSource = orderSourceType.ecommerce,
                echeck = echeck,
                billToAddress = billToAddress
            };

            litleBatchRequest.addEcheckVerification(echeckVerificationObject);
            try
            {
                litleBatchRequest.addEcheckVerification(null);
            }
            catch (NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            var forcecapture = new forceCapture
            {
                amount = 106,
                orderId = "12344",
                orderSource = orderSourceType.ecommerce,
                card = card
            };

            litleBatchRequest.addForceCapture(forcecapture);
            try
            {
                litleBatchRequest.addForceCapture(null);
            }
            catch (NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            var saleObj = new sale
            {
                amount = 106,
                litleTxnId = 123456,
                orderId = "12344",
                orderSource = orderSourceType.ecommerce,
                card = card
            };

            litleBatchRequest.addSale(saleObj);
            try
            {
                litleBatchRequest.addSale(null);
            }
            catch (NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            var registerTokenRequest = new registerTokenRequestType
            {
                orderId = "12344",
                accountNumber = "1233456789103801",
                reportGroup = "Planets"
            };

            litleBatchRequest.addRegisterTokenRequest(registerTokenRequest);
            try
            {
                litleBatchRequest.addRegisterTokenRequest(null);
            }
            catch (NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            try
            {
                _litle.addBatch(litleBatchRequest);
            }
            catch (NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }
        }
Ejemplo n.º 36
0
 public Task <registerTokenResponse> RegisterTokenAsync(registerTokenRequestType transaction, CancellationToken cancellationToken)
 {
     return(this.SendTransactionAsync <registerTokenResponse>(transaction, cancellationToken));
 }
        public void test53()
        {
            var request = new registerTokenRequestType();
            request.orderId = "53";
            var echeck = new echeckForTokenType();
            echeck.accNum = "1099999998";
            echeck.routingNum = "114567895";
            request.echeckForToken = echeck;
            ;

            var response = litle.RegisterToken(request);
            Assert.AreEqual(methodOfPaymentTypeEnum.EC, response.type);
            Assert.AreEqual("998", response.eCheckAccountSuffix);
            Assert.AreEqual("801", response.response);
            Assert.AreEqual("Account number was successfully registered", response.message);
            Assert.AreEqual("111922223333000998", response.litleToken);
        }
Ejemplo n.º 38
0
        public void InvalidCredientialsBatch()
        {
            batchRequest litleBatchRequest = new batchRequest();

            authorization authorization = new authorization();

            authorization.reportGroup = "Planets";
            authorization.orderId     = "12344";
            authorization.amount      = 106;
            authorization.orderSource = orderSourceType.ecommerce;
            cardType card = new cardType();

            card.type          = methodOfPaymentTypeEnum.VI;
            card.number        = "4100000000000001";
            card.expDate       = "1210";
            authorization.card = card;

            litleBatchRequest.addAuthorization(authorization);

            authorization authorization2 = new authorization();

            authorization2.reportGroup = "Planets";
            authorization2.orderId     = "12345";
            authorization2.amount      = 106;
            authorization2.orderSource = orderSourceType.ecommerce;
            cardType card2 = new cardType();

            card2.type          = methodOfPaymentTypeEnum.VI;
            card2.number        = "4242424242424242";
            card2.expDate       = "1210";
            authorization2.card = card2;

            litleBatchRequest.addAuthorization(authorization2);

            authReversal reversal = new authReversal();

            reversal.litleTxnId  = 12345678000L;
            reversal.amount      = 106;
            reversal.payPalNotes = "Notes";

            litleBatchRequest.addAuthReversal(reversal);

            authReversal reversal2 = new authReversal();

            reversal2.litleTxnId  = 12345678900L;
            reversal2.amount      = 106;
            reversal2.payPalNotes = "Notes";

            litleBatchRequest.addAuthReversal(reversal2);

            capture capture = new capture();

            capture.litleTxnId  = 123456000;
            capture.amount      = 106;
            capture.payPalNotes = "Notes";

            litleBatchRequest.addCapture(capture);

            capture capture2 = new capture();

            capture2.litleTxnId  = 123456700;
            capture2.amount      = 106;
            capture2.payPalNotes = "Notes";

            litleBatchRequest.addCapture(capture2);

            captureGivenAuth capturegivenauth = new captureGivenAuth();

            capturegivenauth.amount  = 106;
            capturegivenauth.orderId = "12344";
            authInformation authInfo = new authInformation();
            DateTime        authDate = new DateTime(2002, 10, 9);

            authInfo.authDate   = authDate;
            authInfo.authCode   = "543216";
            authInfo.authAmount = 12345;
            capturegivenauth.authInformation = authInfo;
            capturegivenauth.orderSource     = orderSourceType.ecommerce;
            capturegivenauth.card            = card;

            litleBatchRequest.addCaptureGivenAuth(capturegivenauth);

            captureGivenAuth capturegivenauth2 = new captureGivenAuth();

            capturegivenauth2.amount  = 106;
            capturegivenauth2.orderId = "12344";
            authInformation authInfo2 = new authInformation();

            authDate             = new DateTime(2003, 10, 9);
            authInfo2.authDate   = authDate;
            authInfo2.authCode   = "543216";
            authInfo2.authAmount = 12345;
            capturegivenauth2.authInformation = authInfo;
            capturegivenauth2.orderSource     = orderSourceType.ecommerce;
            capturegivenauth2.card            = card2;

            litleBatchRequest.addCaptureGivenAuth(capturegivenauth2);

            credit creditObj = new credit();

            creditObj.amount      = 106;
            creditObj.orderId     = "2111";
            creditObj.orderSource = orderSourceType.ecommerce;
            creditObj.card        = card;

            litleBatchRequest.addCredit(creditObj);

            credit creditObj2 = new credit();

            creditObj2.amount      = 106;
            creditObj2.orderId     = "2111";
            creditObj2.orderSource = orderSourceType.ecommerce;
            creditObj2.card        = card2;

            litleBatchRequest.addCredit(creditObj2);

            echeckCredit echeckcredit = new echeckCredit();

            echeckcredit.amount      = 12L;
            echeckcredit.orderId     = "12345";
            echeckcredit.orderSource = orderSourceType.ecommerce;
            echeckType echeck = new echeckType();

            echeck.accType      = echeckAccountTypeEnum.Checking;
            echeck.accNum       = "1099999903";
            echeck.routingNum   = "011201995";
            echeck.checkNum     = "123455";
            echeckcredit.echeck = echeck;
            contact billToAddress = new contact();

            billToAddress.name         = "Bob";
            billToAddress.city         = "Lowell";
            billToAddress.state        = "MA";
            billToAddress.email        = "litle.com";
            echeckcredit.billToAddress = billToAddress;

            litleBatchRequest.addEcheckCredit(echeckcredit);

            echeckCredit echeckcredit2 = new echeckCredit();

            echeckcredit2.amount      = 12L;
            echeckcredit2.orderId     = "12346";
            echeckcredit2.orderSource = orderSourceType.ecommerce;
            echeckType echeck2 = new echeckType();

            echeck2.accType      = echeckAccountTypeEnum.Checking;
            echeck2.accNum       = "1099999903";
            echeck2.routingNum   = "011201995";
            echeck2.checkNum     = "123456";
            echeckcredit2.echeck = echeck2;
            contact billToAddress2 = new contact();

            billToAddress2.name         = "Mike";
            billToAddress2.city         = "Lowell";
            billToAddress2.state        = "MA";
            billToAddress2.email        = "litle.com";
            echeckcredit2.billToAddress = billToAddress2;

            litleBatchRequest.addEcheckCredit(echeckcredit2);

            echeckRedeposit echeckredeposit = new echeckRedeposit();

            echeckredeposit.litleTxnId = 123456;
            echeckredeposit.echeck     = echeck;

            litleBatchRequest.addEcheckRedeposit(echeckredeposit);

            echeckRedeposit echeckredeposit2 = new echeckRedeposit();

            echeckredeposit2.litleTxnId = 123457;
            echeckredeposit2.echeck     = echeck2;

            litleBatchRequest.addEcheckRedeposit(echeckredeposit2);

            echeckSale echeckSaleObj = new echeckSale();

            echeckSaleObj.amount        = 123456;
            echeckSaleObj.orderId       = "12345";
            echeckSaleObj.orderSource   = orderSourceType.ecommerce;
            echeckSaleObj.echeck        = echeck;
            echeckSaleObj.billToAddress = billToAddress;

            litleBatchRequest.addEcheckSale(echeckSaleObj);

            echeckSale echeckSaleObj2 = new echeckSale();

            echeckSaleObj2.amount        = 123456;
            echeckSaleObj2.orderId       = "12346";
            echeckSaleObj2.orderSource   = orderSourceType.ecommerce;
            echeckSaleObj2.echeck        = echeck2;
            echeckSaleObj2.billToAddress = billToAddress2;

            litleBatchRequest.addEcheckSale(echeckSaleObj2);

            echeckVerification echeckVerificationObject = new echeckVerification();

            echeckVerificationObject.amount        = 123456;
            echeckVerificationObject.orderId       = "12345";
            echeckVerificationObject.orderSource   = orderSourceType.ecommerce;
            echeckVerificationObject.echeck        = echeck;
            echeckVerificationObject.billToAddress = billToAddress;

            litleBatchRequest.addEcheckVerification(echeckVerificationObject);

            echeckVerification echeckVerificationObject2 = new echeckVerification();

            echeckVerificationObject2.amount        = 123456;
            echeckVerificationObject2.orderId       = "12346";
            echeckVerificationObject2.orderSource   = orderSourceType.ecommerce;
            echeckVerificationObject2.echeck        = echeck2;
            echeckVerificationObject2.billToAddress = billToAddress2;

            litleBatchRequest.addEcheckVerification(echeckVerificationObject2);

            forceCapture forcecapture = new forceCapture();

            forcecapture.amount      = 106;
            forcecapture.orderId     = "12344";
            forcecapture.orderSource = orderSourceType.ecommerce;
            forcecapture.card        = card;

            litleBatchRequest.addForceCapture(forcecapture);

            forceCapture forcecapture2 = new forceCapture();

            forcecapture2.amount      = 106;
            forcecapture2.orderId     = "12345";
            forcecapture2.orderSource = orderSourceType.ecommerce;
            forcecapture2.card        = card2;

            litleBatchRequest.addForceCapture(forcecapture2);

            sale saleObj = new sale();

            saleObj.amount      = 106;
            saleObj.litleTxnId  = 123456;
            saleObj.orderId     = "12344";
            saleObj.orderSource = orderSourceType.ecommerce;
            saleObj.card        = card;

            litleBatchRequest.addSale(saleObj);

            sale saleObj2 = new sale();

            saleObj2.amount      = 106;
            saleObj2.litleTxnId  = 123456;
            saleObj2.orderId     = "12345";
            saleObj2.orderSource = orderSourceType.ecommerce;
            saleObj2.card        = card2;

            litleBatchRequest.addSale(saleObj2);

            registerTokenRequestType registerTokenRequest = new registerTokenRequestType();

            registerTokenRequest.orderId       = "12344";
            registerTokenRequest.accountNumber = "1233456789103801";
            registerTokenRequest.reportGroup   = "Planets";

            litleBatchRequest.addRegisterTokenRequest(registerTokenRequest);

            registerTokenRequestType registerTokenRequest2 = new registerTokenRequestType();

            registerTokenRequest2.orderId       = "12345";
            registerTokenRequest2.accountNumber = "1233456789103801";
            registerTokenRequest2.reportGroup   = "Planets";

            litleBatchRequest.addRegisterTokenRequest(registerTokenRequest2);

            litle.addBatch(litleBatchRequest);

            try
            {
                litleResponse litleResponse = litle.sendToLitleWithStream();
            }
            catch (LitleOnlineException e)
            {
                Assert.AreEqual("Error establishing a network connection", e.Message);
            }
        }
Ejemplo n.º 39
0
        public void TestSimpleTokenWithNullableTypeField()
        {
            var registerTokenRequest = new registerTokenRequestType
            {
                orderId = "12344",
                accountNumber = "1233456789103801",
                reportGroup = "Planets"
            };

            var rtokenResponse = _litle.RegisterToken(registerTokenRequest);

            StringAssert.AreEqualIgnoringCase("Account number was successfully registered", rtokenResponse.message);
            Assert.IsNull(rtokenResponse.type);
        }
Ejemplo n.º 40
0
 public registerTokenResponse RegisterToken(registerTokenRequestType tokenRequest)
 {
     return(SendRequest(response => response.registerTokenResponse, tokenRequest));
 }
Ejemplo n.º 41
0
        public void nullBatchData()
        {
            batchRequest litleBatchRequest = new batchRequest();

            authorization authorization = new authorization();

            authorization.reportGroup = "Planets";
            authorization.orderId     = "12344";
            authorization.amount      = 106;
            authorization.orderSource = orderSourceType.ecommerce;
            cardType card = new cardType();

            card.type          = methodOfPaymentTypeEnum.VI;
            card.number        = "414100000000000000";
            card.expDate       = "1210";
            authorization.card = card; //This needs to compile

            litleBatchRequest.addAuthorization(authorization);
            try
            {
                litleBatchRequest.addAuthorization(null);
            }
            catch (System.NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            authReversal reversal = new authReversal();

            reversal.litleTxnId  = 12345678000L;
            reversal.amount      = 106;
            reversal.payPalNotes = "Notes";

            litleBatchRequest.addAuthReversal(reversal);
            try
            {
                litleBatchRequest.addAuthReversal(null);
            }
            catch (System.NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            capture capture = new capture();

            capture.litleTxnId  = 123456000;
            capture.amount      = 106;
            capture.payPalNotes = "Notes";

            litleBatchRequest.addCapture(capture);
            try
            {
                litleBatchRequest.addCapture(null);
            }
            catch (System.NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            captureGivenAuth capturegivenauth = new captureGivenAuth();

            capturegivenauth.amount  = 106;
            capturegivenauth.orderId = "12344";
            authInformation authInfo = new authInformation();
            DateTime        authDate = new DateTime(2002, 10, 9);

            authInfo.authDate   = authDate;
            authInfo.authCode   = "543216";
            authInfo.authAmount = 12345;
            capturegivenauth.authInformation = authInfo;
            capturegivenauth.orderSource     = orderSourceType.ecommerce;
            capturegivenauth.card            = card;

            litleBatchRequest.addCaptureGivenAuth(capturegivenauth);
            try
            {
                litleBatchRequest.addCaptureGivenAuth(null);
            }
            catch (System.NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            credit creditObj = new credit();

            creditObj.amount      = 106;
            creditObj.orderId     = "2111";
            creditObj.orderSource = orderSourceType.ecommerce;
            creditObj.card        = card;

            litleBatchRequest.addCredit(creditObj);
            try
            {
                litleBatchRequest.addCredit(null);
            }
            catch (System.NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            echeckCredit echeckcredit = new echeckCredit();

            echeckcredit.amount      = 12L;
            echeckcredit.orderId     = "12345";
            echeckcredit.orderSource = orderSourceType.ecommerce;
            echeckType echeck = new echeckType();

            echeck.accType      = echeckAccountTypeEnum.Checking;
            echeck.accNum       = "12345657890";
            echeck.routingNum   = "011201995";
            echeck.checkNum     = "123455";
            echeckcredit.echeck = echeck;
            contact billToAddress = new contact();

            billToAddress.name         = "Bob";
            billToAddress.city         = "Lowell";
            billToAddress.state        = "MA";
            billToAddress.email        = "litle.com";
            echeckcredit.billToAddress = billToAddress;

            litleBatchRequest.addEcheckCredit(echeckcredit);
            try
            {
                litleBatchRequest.addEcheckCredit(null);
            }
            catch (System.NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            echeckRedeposit echeckredeposit = new echeckRedeposit();

            echeckredeposit.litleTxnId = 123456;
            echeckredeposit.echeck     = echeck;

            litleBatchRequest.addEcheckRedeposit(echeckredeposit);
            try
            {
                litleBatchRequest.addEcheckRedeposit(null);
            }
            catch (System.NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            echeckSale echeckSaleObj = new echeckSale();

            echeckSaleObj.amount        = 123456;
            echeckSaleObj.orderId       = "12345";
            echeckSaleObj.orderSource   = orderSourceType.ecommerce;
            echeckSaleObj.echeck        = echeck;
            echeckSaleObj.billToAddress = billToAddress;

            litleBatchRequest.addEcheckSale(echeckSaleObj);
            try
            {
                litleBatchRequest.addEcheckSale(null);
            }
            catch (System.NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            echeckVerification echeckVerificationObject = new echeckVerification();

            echeckVerificationObject.amount        = 123456;
            echeckVerificationObject.orderId       = "12345";
            echeckVerificationObject.orderSource   = orderSourceType.ecommerce;
            echeckVerificationObject.echeck        = echeck;
            echeckVerificationObject.billToAddress = billToAddress;

            litleBatchRequest.addEcheckVerification(echeckVerificationObject);
            try
            {
                litleBatchRequest.addEcheckVerification(null);
            }
            catch (System.NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            forceCapture forcecapture = new forceCapture();

            forcecapture.amount      = 106;
            forcecapture.orderId     = "12344";
            forcecapture.orderSource = orderSourceType.ecommerce;
            forcecapture.card        = card;

            litleBatchRequest.addForceCapture(forcecapture);
            try
            {
                litleBatchRequest.addForceCapture(null);
            }
            catch (System.NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            sale saleObj = new sale();

            saleObj.amount      = 106;
            saleObj.litleTxnId  = 123456;
            saleObj.orderId     = "12344";
            saleObj.orderSource = orderSourceType.ecommerce;
            saleObj.card        = card;

            litleBatchRequest.addSale(saleObj);
            try
            {
                litleBatchRequest.addSale(null);
            }
            catch (System.NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            registerTokenRequestType registerTokenRequest = new registerTokenRequestType();

            registerTokenRequest.orderId       = "12344";
            registerTokenRequest.accountNumber = "1233456789103801";
            registerTokenRequest.reportGroup   = "Planets";

            litleBatchRequest.addRegisterTokenRequest(registerTokenRequest);
            try
            {
                litleBatchRequest.addRegisterTokenRequest(null);
            }
            catch (System.NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            try
            {
                litle.addBatch(litleBatchRequest);
            }
            catch (System.NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }
        }
Ejemplo n.º 42
0
        public void SimpleBatch()
        {
            batchRequest litleBatchRequest = new batchRequest();

            authorization authorization = new authorization();

            authorization.reportGroup = "Planets";
            authorization.orderId     = "12344";
            authorization.amount      = 106;
            authorization.orderSource = orderSourceType.ecommerce;
            cardType card = new cardType();

            card.type          = methodOfPaymentTypeEnum.VI;
            card.number        = "4100000000000001";
            card.expDate       = "1210";
            authorization.card = card;

            litleBatchRequest.addAuthorization(authorization);

            authorization authorization2 = new authorization();

            authorization2.reportGroup = "Planets";
            authorization2.orderId     = "12345";
            authorization2.amount      = 106;
            authorization2.orderSource = orderSourceType.ecommerce;
            cardType card2 = new cardType();

            card2.type          = methodOfPaymentTypeEnum.VI;
            card2.number        = "4242424242424242";
            card2.expDate       = "1210";
            authorization2.card = card2;

            litleBatchRequest.addAuthorization(authorization2);

            authReversal reversal = new authReversal();

            reversal.litleTxnId  = 12345678000L;
            reversal.amount      = 106;
            reversal.payPalNotes = "Notes";

            litleBatchRequest.addAuthReversal(reversal);

            authReversal reversal2 = new authReversal();

            reversal2.litleTxnId  = 12345678900L;
            reversal2.amount      = 106;
            reversal2.payPalNotes = "Notes";

            litleBatchRequest.addAuthReversal(reversal2);

            capture capture = new capture();

            capture.litleTxnId  = 123456000;
            capture.amount      = 106;
            capture.payPalNotes = "Notes";

            litleBatchRequest.addCapture(capture);

            capture capture2 = new capture();

            capture2.litleTxnId  = 123456700;
            capture2.amount      = 106;
            capture2.payPalNotes = "Notes";

            litleBatchRequest.addCapture(capture2);

            captureGivenAuth capturegivenauth = new captureGivenAuth();

            capturegivenauth.amount  = 106;
            capturegivenauth.orderId = "12344";
            authInformation authInfo = new authInformation();
            DateTime        authDate = new DateTime(2002, 10, 9);

            authInfo.authDate   = authDate;
            authInfo.authCode   = "543216";
            authInfo.authAmount = 12345;
            capturegivenauth.authInformation = authInfo;
            capturegivenauth.orderSource     = orderSourceType.ecommerce;
            capturegivenauth.card            = card;

            litleBatchRequest.addCaptureGivenAuth(capturegivenauth);

            captureGivenAuth capturegivenauth2 = new captureGivenAuth();

            capturegivenauth2.amount  = 106;
            capturegivenauth2.orderId = "12344";
            authInformation authInfo2 = new authInformation();

            authDate             = new DateTime(2003, 10, 9);
            authInfo2.authDate   = authDate;
            authInfo2.authCode   = "543216";
            authInfo2.authAmount = 12345;
            capturegivenauth2.authInformation = authInfo;
            capturegivenauth2.orderSource     = orderSourceType.ecommerce;
            capturegivenauth2.card            = card2;

            litleBatchRequest.addCaptureGivenAuth(capturegivenauth2);

            credit creditObj = new credit();

            creditObj.amount      = 106;
            creditObj.orderId     = "2111";
            creditObj.orderSource = orderSourceType.ecommerce;
            creditObj.card        = card;

            litleBatchRequest.addCredit(creditObj);

            credit creditObj2 = new credit();

            creditObj2.amount      = 106;
            creditObj2.orderId     = "2111";
            creditObj2.orderSource = orderSourceType.ecommerce;
            creditObj2.card        = card2;

            litleBatchRequest.addCredit(creditObj2);

            echeckCredit echeckcredit = new echeckCredit();

            echeckcredit.amount      = 12L;
            echeckcredit.orderId     = "12345";
            echeckcredit.orderSource = orderSourceType.ecommerce;
            echeckType echeck = new echeckType();

            echeck.accType      = echeckAccountTypeEnum.Checking;
            echeck.accNum       = "1099999903";
            echeck.routingNum   = "011201995";
            echeck.checkNum     = "123455";
            echeckcredit.echeck = echeck;
            contact billToAddress = new contact();

            billToAddress.name         = "Bob";
            billToAddress.city         = "Lowell";
            billToAddress.state        = "MA";
            billToAddress.email        = "litle.com";
            echeckcredit.billToAddress = billToAddress;

            litleBatchRequest.addEcheckCredit(echeckcredit);

            echeckCredit echeckcredit2 = new echeckCredit();

            echeckcredit2.amount      = 12L;
            echeckcredit2.orderId     = "12346";
            echeckcredit2.orderSource = orderSourceType.ecommerce;
            echeckType echeck2 = new echeckType();

            echeck2.accType      = echeckAccountTypeEnum.Checking;
            echeck2.accNum       = "1099999903";
            echeck2.routingNum   = "011201995";
            echeck2.checkNum     = "123456";
            echeckcredit2.echeck = echeck2;
            contact billToAddress2 = new contact();

            billToAddress2.name         = "Mike";
            billToAddress2.city         = "Lowell";
            billToAddress2.state        = "MA";
            billToAddress2.email        = "litle.com";
            echeckcredit2.billToAddress = billToAddress2;

            litleBatchRequest.addEcheckCredit(echeckcredit2);

            echeckRedeposit echeckredeposit = new echeckRedeposit();

            echeckredeposit.litleTxnId = 123456;
            echeckredeposit.echeck     = echeck;

            litleBatchRequest.addEcheckRedeposit(echeckredeposit);

            echeckRedeposit echeckredeposit2 = new echeckRedeposit();

            echeckredeposit2.litleTxnId = 123457;
            echeckredeposit2.echeck     = echeck2;

            litleBatchRequest.addEcheckRedeposit(echeckredeposit2);

            echeckSale echeckSaleObj = new echeckSale();

            echeckSaleObj.amount        = 123456;
            echeckSaleObj.orderId       = "12345";
            echeckSaleObj.orderSource   = orderSourceType.ecommerce;
            echeckSaleObj.echeck        = echeck;
            echeckSaleObj.billToAddress = billToAddress;

            litleBatchRequest.addEcheckSale(echeckSaleObj);

            echeckSale echeckSaleObj2 = new echeckSale();

            echeckSaleObj2.amount        = 123456;
            echeckSaleObj2.orderId       = "12346";
            echeckSaleObj2.orderSource   = orderSourceType.ecommerce;
            echeckSaleObj2.echeck        = echeck2;
            echeckSaleObj2.billToAddress = billToAddress2;

            litleBatchRequest.addEcheckSale(echeckSaleObj2);

            echeckVerification echeckVerificationObject = new echeckVerification();

            echeckVerificationObject.amount        = 123456;
            echeckVerificationObject.orderId       = "12345";
            echeckVerificationObject.orderSource   = orderSourceType.ecommerce;
            echeckVerificationObject.echeck        = echeck;
            echeckVerificationObject.billToAddress = billToAddress;

            litleBatchRequest.addEcheckVerification(echeckVerificationObject);

            echeckVerification echeckVerificationObject2 = new echeckVerification();

            echeckVerificationObject2.amount        = 123456;
            echeckVerificationObject2.orderId       = "12346";
            echeckVerificationObject2.orderSource   = orderSourceType.ecommerce;
            echeckVerificationObject2.echeck        = echeck2;
            echeckVerificationObject2.billToAddress = billToAddress2;

            litleBatchRequest.addEcheckVerification(echeckVerificationObject2);

            forceCapture forcecapture = new forceCapture();

            forcecapture.amount      = 106;
            forcecapture.orderId     = "12344";
            forcecapture.orderSource = orderSourceType.ecommerce;
            forcecapture.card        = card;

            litleBatchRequest.addForceCapture(forcecapture);

            forceCapture forcecapture2 = new forceCapture();

            forcecapture2.amount      = 106;
            forcecapture2.orderId     = "12345";
            forcecapture2.orderSource = orderSourceType.ecommerce;
            forcecapture2.card        = card2;

            litleBatchRequest.addForceCapture(forcecapture2);

            sale saleObj = new sale();

            saleObj.amount      = 106;
            saleObj.litleTxnId  = 123456;
            saleObj.orderId     = "12344";
            saleObj.orderSource = orderSourceType.ecommerce;
            saleObj.card        = card;

            litleBatchRequest.addSale(saleObj);

            sale saleObj2 = new sale();

            saleObj2.amount      = 106;
            saleObj2.litleTxnId  = 123456;
            saleObj2.orderId     = "12345";
            saleObj2.orderSource = orderSourceType.ecommerce;
            saleObj2.card        = card2;

            litleBatchRequest.addSale(saleObj2);

            registerTokenRequestType registerTokenRequest = new registerTokenRequestType();

            registerTokenRequest.orderId       = "12344";
            registerTokenRequest.accountNumber = "1233456789103801";
            registerTokenRequest.reportGroup   = "Planets";

            litleBatchRequest.addRegisterTokenRequest(registerTokenRequest);

            registerTokenRequestType registerTokenRequest2 = new registerTokenRequestType();

            registerTokenRequest2.orderId       = "12345";
            registerTokenRequest2.accountNumber = "1233456789103801";
            registerTokenRequest2.reportGroup   = "Planets";

            litleBatchRequest.addRegisterTokenRequest(registerTokenRequest2);

            updateCardValidationNumOnToken updateCardValidationNumOnToken = new updateCardValidationNumOnToken();

            updateCardValidationNumOnToken.orderId           = "12344";
            updateCardValidationNumOnToken.cardValidationNum = "123";
            updateCardValidationNumOnToken.litleToken        = "4100000000000001";

            litleBatchRequest.addUpdateCardValidationNumOnToken(updateCardValidationNumOnToken);

            updateCardValidationNumOnToken updateCardValidationNumOnToken2 = new updateCardValidationNumOnToken();

            updateCardValidationNumOnToken2.orderId           = "12345";
            updateCardValidationNumOnToken2.cardValidationNum = "123";
            updateCardValidationNumOnToken2.litleToken        = "4242424242424242";

            litleBatchRequest.addUpdateCardValidationNumOnToken(updateCardValidationNumOnToken2);
            litle.addBatch(litleBatchRequest);

            litleResponse litleResponse = litle.sendToLitleWithStream();

            Assert.NotNull(litleResponse);
            Assert.AreEqual("0", litleResponse.response);
            Assert.AreEqual("Valid Format", litleResponse.message);

            batchResponse litleBatchResponse = litleResponse.nextBatchResponse();

            while (litleBatchResponse != null)
            {
                authorizationResponse authorizationResponse = litleBatchResponse.nextAuthorizationResponse();
                while (authorizationResponse != null)
                {
                    Assert.AreEqual("000", authorizationResponse.response);

                    authorizationResponse = litleBatchResponse.nextAuthorizationResponse();
                }

                authReversalResponse authReversalResponse = litleBatchResponse.nextAuthReversalResponse();
                while (authReversalResponse != null)
                {
                    Assert.AreEqual("360", authReversalResponse.response);

                    authReversalResponse = litleBatchResponse.nextAuthReversalResponse();
                }

                captureResponse captureResponse = litleBatchResponse.nextCaptureResponse();
                while (captureResponse != null)
                {
                    Assert.AreEqual("360", captureResponse.response);

                    captureResponse = litleBatchResponse.nextCaptureResponse();
                }

                captureGivenAuthResponse captureGivenAuthResponse = litleBatchResponse.nextCaptureGivenAuthResponse();
                while (captureGivenAuthResponse != null)
                {
                    Assert.AreEqual("000", captureGivenAuthResponse.response);

                    captureGivenAuthResponse = litleBatchResponse.nextCaptureGivenAuthResponse();
                }

                creditResponse creditResponse = litleBatchResponse.nextCreditResponse();
                while (creditResponse != null)
                {
                    Assert.AreEqual("000", creditResponse.response);

                    creditResponse = litleBatchResponse.nextCreditResponse();
                }

                echeckCreditResponse echeckCreditResponse = litleBatchResponse.nextEcheckCreditResponse();
                while (echeckCreditResponse != null)
                {
                    Assert.AreEqual("000", echeckCreditResponse.response);

                    echeckCreditResponse = litleBatchResponse.nextEcheckCreditResponse();
                }

                echeckRedepositResponse echeckRedepositResponse = litleBatchResponse.nextEcheckRedepositResponse();
                while (echeckRedepositResponse != null)
                {
                    Assert.AreEqual("360", echeckRedepositResponse.response);

                    echeckRedepositResponse = litleBatchResponse.nextEcheckRedepositResponse();
                }

                echeckSalesResponse echeckSalesResponse = litleBatchResponse.nextEcheckSalesResponse();
                while (echeckSalesResponse != null)
                {
                    Assert.AreEqual("000", echeckSalesResponse.response);

                    echeckSalesResponse = litleBatchResponse.nextEcheckSalesResponse();
                }

                echeckVerificationResponse echeckVerificationResponse = litleBatchResponse.nextEcheckVerificationResponse();
                while (echeckVerificationResponse != null)
                {
                    Assert.AreEqual("957", echeckVerificationResponse.response);

                    echeckVerificationResponse = litleBatchResponse.nextEcheckVerificationResponse();
                }

                forceCaptureResponse forceCaptureResponse = litleBatchResponse.nextForceCaptureResponse();
                while (forceCaptureResponse != null)
                {
                    Assert.AreEqual("000", forceCaptureResponse.response);

                    forceCaptureResponse = litleBatchResponse.nextForceCaptureResponse();
                }

                registerTokenResponse registerTokenResponse = litleBatchResponse.nextRegisterTokenResponse();
                while (registerTokenResponse != null)
                {
                    Assert.AreEqual("820", registerTokenResponse.response);

                    registerTokenResponse = litleBatchResponse.nextRegisterTokenResponse();
                }

                saleResponse saleResponse = litleBatchResponse.nextSaleResponse();
                while (saleResponse != null)
                {
                    Assert.AreEqual("000", saleResponse.response);

                    saleResponse = litleBatchResponse.nextSaleResponse();
                }

                updateCardValidationNumOnTokenResponse updateCardValidationNumOnTokenResponse = litleBatchResponse.nextUpdateCardValidationNumOnTokenResponse();
                while (updateCardValidationNumOnTokenResponse != null)
                {
                    Assert.AreEqual("823", updateCardValidationNumOnTokenResponse.response);

                    updateCardValidationNumOnTokenResponse = litleBatchResponse.nextUpdateCardValidationNumOnTokenResponse();
                }

                litleBatchResponse = litleResponse.nextBatchResponse();
            }
        }
Ejemplo n.º 43
0
 public void TokenEcheckMissingRequiredField()
 {
     var registerTokenRequest = new registerTokenRequestType();
     registerTokenRequest.orderId = "12344";
     var echeckObj = new echeckForTokenType();
     echeckObj.routingNum = "123476545";
     registerTokenRequest.echeckForToken = echeckObj;
     registerTokenRequest.reportGroup = "Planets";
     try
     {
         //expected exception;
         var rtokenResponse = litle.RegisterToken(registerTokenRequest);
     }
     catch (LitleOnlineException e)
     {
         Assert.True(e.Message.StartsWith("Error validating xml data against the schema"));
     }
 }
Ejemplo n.º 44
0
        public void SimpleTokenWithPayPage()
        {
            var registerTokenRequest = new registerTokenRequestType
            {
                orderId = "12344",
                paypageRegistrationId = "1233456789101112",
                reportGroup = "Planets"
            };

            var rtokenResponse = _litle.RegisterToken(registerTokenRequest);

            StringAssert.AreEqualIgnoringCase("Account number was successfully registered", rtokenResponse.message);
        }
Ejemplo n.º 45
0
        public void testToken()
        {
            var token = new registerTokenRequestType();
            token.orderId = "12344";
            token.accountNumber = "1233456789103801";

            var mockLitleResponse = new Mock<litleResponse>();
            var mockLitleXmlSerializer = new Mock<litleXmlSerializer>();

            mockXmlReader.SetupSequence(XmlReader => XmlReader.ReadOuterXml())
                .Returns(
                    "<registerTokenResponse xmlns='http://www.litle.com/schema'><litleTxnId>123</litleTxnId></registerTokenResponse>")
                .Returns(
                    "<registerTokenResponse xmlns='http://www.litle.com/schema'><litleTxnId>124</litleTxnId></registerTokenResponse>");

            var mockedLitleBatchResponse = new batchResponse();
            mockedLitleBatchResponse.setRegisterTokenResponseReader(mockXmlReader.Object);

            mockLitleResponse.Setup(litleResponse => litleResponse.nextBatchResponse())
                .Returns(mockedLitleBatchResponse);
            var mockedLitleResponse = mockLitleResponse.Object;

            var mockedCommunications = mockCommunications.Object;

            mockLitleXmlSerializer.Setup(
                litleXmlSerializer =>
                    litleXmlSerializer.DeserializeObjectFromString(It.IsAny<string>()))
                .Returns(mockedLitleResponse);
            var mockedLitleXmlSerializer = mockLitleXmlSerializer.Object;

            var mockedLitleFile = mockLitleFile.Object;

            litle.setCommunication(mockedCommunications);
            litle.setLitleXmlSerializer(mockedLitleXmlSerializer);
            litle.setLitleFile(mockedLitleFile);
            litle.setLitleTime(mockLitleTime.Object);

            var litleBatchRequest = new batchRequest(_mockCache.Object);
            litleBatchRequest.setLitleFile(mockedLitleFile);
            litleBatchRequest.setLitleTime(mockLitleTime.Object);
            litleBatchRequest.addRegisterTokenRequest(token);
            litleBatchRequest.addRegisterTokenRequest(token);
            litle.addBatch(litleBatchRequest);

            var batchFileName = litle.sendToLitle();

            var actualLitleResponse = litle.receiveFromLitle(batchFileName);
            var actualLitleBatchResponse = actualLitleResponse.nextBatchResponse();
            var actualRegisterTokenResponse1 = actualLitleBatchResponse.nextRegisterTokenResponse();
            var actualRegisterTokenResponse2 = actualLitleBatchResponse.nextRegisterTokenResponse();
            var nullRegisterTokenResponse = actualLitleBatchResponse.nextRegisterTokenResponse();

            Assert.AreEqual(123, actualRegisterTokenResponse1.litleTxnId);
            Assert.AreEqual(124, actualRegisterTokenResponse2.litleTxnId);
            Assert.IsNull(nullRegisterTokenResponse);

            mockCommunications.Verify(
                Communications =>
                    Communications.FtpDropOff(It.IsAny<string>(), mockFileName, It.IsAny<Dictionary<string, string>>()));
            mockCommunications.Verify(
                Communications =>
                    Communications.FtpPickUp(It.IsAny<string>(), It.IsAny<Dictionary<string, string>>(), mockFileName));
        }
        public void testToken()
        {
            var token = new registerTokenRequestType();
            token.orderId = "12344";
            token.accountNumber = "1233456789103801";

            var mock = new Mock<Communications>(_memoryStreams);

            mock.Setup(
                Communications =>
                    Communications.HttpPost(
                        It.IsRegex(
                            ".*?<litleOnlineRequest.*?<registerTokenRequest.*?<accountNumber>1233456789103801</accountNumber>.*?</registerTokenRequest>.*?",
                            RegexOptions.Singleline), It.IsAny<Dictionary<string, string>>()))
                .Returns(
                    "<litleOnlineResponse version='8.10' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><registerTokenResponse><litleTxnId>123</litleTxnId></registerTokenResponse></litleOnlineResponse>");

            var mockedCommunication = mock.Object;
            litle.setCommunication(mockedCommunication);
            var registertokenresponse = litle.RegisterToken(token);
            Assert.AreEqual(123, registertokenresponse.litleTxnId);
            Assert.IsNull(registertokenresponse.type);
        }
        public void InvalidCredientialsBatch()
        {
            var litleBatchRequest = new batchRequest(memoryStreams);

            var authorization = new authorization();
            authorization.reportGroup = "Planets";
            authorization.orderId = "12344";
            authorization.amount = 106;
            authorization.orderSource = orderSourceType.ecommerce;
            var card = new cardType();
            card.type = methodOfPaymentTypeEnum.VI;
            card.number = "4100000000000001";
            card.expDate = "1210";
            authorization.card = card;

            litleBatchRequest.addAuthorization(authorization);

            var authorization2 = new authorization();
            authorization2.reportGroup = "Planets";
            authorization2.orderId = "12345";
            authorization2.amount = 106;
            authorization2.orderSource = orderSourceType.ecommerce;
            var card2 = new cardType();
            card2.type = methodOfPaymentTypeEnum.VI;
            card2.number = "4242424242424242";
            card2.expDate = "1210";
            authorization2.card = card2;

            litleBatchRequest.addAuthorization(authorization2);

            var reversal = new authReversal();
            reversal.litleTxnId = 12345678000L;
            reversal.amount = 106;
            reversal.payPalNotes = "Notes";

            litleBatchRequest.addAuthReversal(reversal);

            var reversal2 = new authReversal();
            reversal2.litleTxnId = 12345678900L;
            reversal2.amount = 106;
            reversal2.payPalNotes = "Notes";

            litleBatchRequest.addAuthReversal(reversal2);

            var capture = new capture();
            capture.litleTxnId = 123456000;
            capture.amount = 106;
            capture.payPalNotes = "Notes";

            litleBatchRequest.addCapture(capture);

            var capture2 = new capture();
            capture2.litleTxnId = 123456700;
            capture2.amount = 106;
            capture2.payPalNotes = "Notes";

            litleBatchRequest.addCapture(capture2);

            var capturegivenauth = new captureGivenAuth();
            capturegivenauth.amount = 106;
            capturegivenauth.orderId = "12344";
            var authInfo = new authInformation();
            var authDate = new DateTime(2002, 10, 9);
            authInfo.authDate = authDate;
            authInfo.authCode = "543216";
            authInfo.authAmount = 12345;
            capturegivenauth.authInformation = authInfo;
            capturegivenauth.orderSource = orderSourceType.ecommerce;
            capturegivenauth.card = card;

            litleBatchRequest.addCaptureGivenAuth(capturegivenauth);

            var capturegivenauth2 = new captureGivenAuth();
            capturegivenauth2.amount = 106;
            capturegivenauth2.orderId = "12344";
            var authInfo2 = new authInformation();
            authDate = new DateTime(2003, 10, 9);
            authInfo2.authDate = authDate;
            authInfo2.authCode = "543216";
            authInfo2.authAmount = 12345;
            capturegivenauth2.authInformation = authInfo;
            capturegivenauth2.orderSource = orderSourceType.ecommerce;
            capturegivenauth2.card = card2;

            litleBatchRequest.addCaptureGivenAuth(capturegivenauth2);

            var creditObj = new credit();
            creditObj.amount = 106;
            creditObj.orderId = "2111";
            creditObj.orderSource = orderSourceType.ecommerce;
            creditObj.card = card;

            litleBatchRequest.addCredit(creditObj);

            var creditObj2 = new credit();
            creditObj2.amount = 106;
            creditObj2.orderId = "2111";
            creditObj2.orderSource = orderSourceType.ecommerce;
            creditObj2.card = card2;

            litleBatchRequest.addCredit(creditObj2);

            var echeckcredit = new echeckCredit();
            echeckcredit.amount = 12L;
            echeckcredit.orderId = "12345";
            echeckcredit.orderSource = orderSourceType.ecommerce;
            var echeck = new echeckType();
            echeck.accType = echeckAccountTypeEnum.Checking;
            echeck.accNum = "1099999903";
            echeck.routingNum = "011201995";
            echeck.checkNum = "123455";
            echeckcredit.echeck = echeck;
            var billToAddress = new contact();
            billToAddress.name = "Bob";
            billToAddress.city = "Lowell";
            billToAddress.state = "MA";
            billToAddress.email = "litle.com";
            echeckcredit.billToAddress = billToAddress;

            litleBatchRequest.addEcheckCredit(echeckcredit);

            var echeckcredit2 = new echeckCredit();
            echeckcredit2.amount = 12L;
            echeckcredit2.orderId = "12346";
            echeckcredit2.orderSource = orderSourceType.ecommerce;
            var echeck2 = new echeckType();
            echeck2.accType = echeckAccountTypeEnum.Checking;
            echeck2.accNum = "1099999903";
            echeck2.routingNum = "011201995";
            echeck2.checkNum = "123456";
            echeckcredit2.echeck = echeck2;
            var billToAddress2 = new contact();
            billToAddress2.name = "Mike";
            billToAddress2.city = "Lowell";
            billToAddress2.state = "MA";
            billToAddress2.email = "litle.com";
            echeckcredit2.billToAddress = billToAddress2;

            litleBatchRequest.addEcheckCredit(echeckcredit2);

            var echeckredeposit = new echeckRedeposit();
            echeckredeposit.litleTxnId = 123456;
            echeckredeposit.echeck = echeck;

            litleBatchRequest.addEcheckRedeposit(echeckredeposit);

            var echeckredeposit2 = new echeckRedeposit();
            echeckredeposit2.litleTxnId = 123457;
            echeckredeposit2.echeck = echeck2;

            litleBatchRequest.addEcheckRedeposit(echeckredeposit2);

            var echeckSaleObj = new echeckSale();
            echeckSaleObj.amount = 123456;
            echeckSaleObj.orderId = "12345";
            echeckSaleObj.orderSource = orderSourceType.ecommerce;
            echeckSaleObj.echeck = echeck;
            echeckSaleObj.billToAddress = billToAddress;

            litleBatchRequest.addEcheckSale(echeckSaleObj);

            var echeckSaleObj2 = new echeckSale();
            echeckSaleObj2.amount = 123456;
            echeckSaleObj2.orderId = "12346";
            echeckSaleObj2.orderSource = orderSourceType.ecommerce;
            echeckSaleObj2.echeck = echeck2;
            echeckSaleObj2.billToAddress = billToAddress2;

            litleBatchRequest.addEcheckSale(echeckSaleObj2);

            var echeckVerificationObject = new echeckVerification();
            echeckVerificationObject.amount = 123456;
            echeckVerificationObject.orderId = "12345";
            echeckVerificationObject.orderSource = orderSourceType.ecommerce;
            echeckVerificationObject.echeck = echeck;
            echeckVerificationObject.billToAddress = billToAddress;

            litleBatchRequest.addEcheckVerification(echeckVerificationObject);

            var echeckVerificationObject2 = new echeckVerification();
            echeckVerificationObject2.amount = 123456;
            echeckVerificationObject2.orderId = "12346";
            echeckVerificationObject2.orderSource = orderSourceType.ecommerce;
            echeckVerificationObject2.echeck = echeck2;
            echeckVerificationObject2.billToAddress = billToAddress2;

            litleBatchRequest.addEcheckVerification(echeckVerificationObject2);

            var forcecapture = new forceCapture();
            forcecapture.amount = 106;
            forcecapture.orderId = "12344";
            forcecapture.orderSource = orderSourceType.ecommerce;
            forcecapture.card = card;

            litleBatchRequest.addForceCapture(forcecapture);

            var forcecapture2 = new forceCapture();
            forcecapture2.amount = 106;
            forcecapture2.orderId = "12345";
            forcecapture2.orderSource = orderSourceType.ecommerce;
            forcecapture2.card = card2;

            litleBatchRequest.addForceCapture(forcecapture2);

            var saleObj = new sale();
            saleObj.amount = 106;
            saleObj.litleTxnId = 123456;
            saleObj.orderId = "12344";
            saleObj.orderSource = orderSourceType.ecommerce;
            saleObj.card = card;

            litleBatchRequest.addSale(saleObj);

            var saleObj2 = new sale();
            saleObj2.amount = 106;
            saleObj2.litleTxnId = 123456;
            saleObj2.orderId = "12345";
            saleObj2.orderSource = orderSourceType.ecommerce;
            saleObj2.card = card2;

            litleBatchRequest.addSale(saleObj2);

            var registerTokenRequest = new registerTokenRequestType();
            registerTokenRequest.orderId = "12344";
            registerTokenRequest.accountNumber = "1233456789103801";
            registerTokenRequest.reportGroup = "Planets";

            litleBatchRequest.addRegisterTokenRequest(registerTokenRequest);

            var registerTokenRequest2 = new registerTokenRequestType();
            registerTokenRequest2.orderId = "12345";
            registerTokenRequest2.accountNumber = "1233456789103801";
            registerTokenRequest2.reportGroup = "Planets";

            litleBatchRequest.addRegisterTokenRequest(registerTokenRequest2);

            litle.addBatch(litleBatchRequest);

            try
            {
                var litleResponse = litle.sendToLitleWithStream();
            }
            catch (LitleOnlineException e)
            {
                Assert.AreEqual("Error establishing a network connection", e.Message);
            }
        }
        public void nullBatchData()
        {
            var litleBatchRequest = new batchRequest(memoryStreams);

            var authorization = new authorization();
            authorization.reportGroup = "Planets";
            authorization.orderId = "12344";
            authorization.amount = 106;
            authorization.orderSource = orderSourceType.ecommerce;
            var card = new cardType();
            card.type = methodOfPaymentTypeEnum.VI;
            card.number = "414100000000000000";
            card.expDate = "1210";
            authorization.card = card; //This needs to compile

            litleBatchRequest.addAuthorization(authorization);
            try
            {
                litleBatchRequest.addAuthorization(null);
            }
            catch (NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            var reversal = new authReversal();
            reversal.litleTxnId = 12345678000L;
            reversal.amount = 106;
            reversal.payPalNotes = "Notes";

            litleBatchRequest.addAuthReversal(reversal);
            try
            {
                litleBatchRequest.addAuthReversal(null);
            }
            catch (NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            var capture = new capture();
            capture.litleTxnId = 123456000;
            capture.amount = 106;
            capture.payPalNotes = "Notes";

            litleBatchRequest.addCapture(capture);
            try
            {
                litleBatchRequest.addCapture(null);
            }
            catch (NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            var capturegivenauth = new captureGivenAuth();
            capturegivenauth.amount = 106;
            capturegivenauth.orderId = "12344";
            var authInfo = new authInformation();
            var authDate = new DateTime(2002, 10, 9);
            authInfo.authDate = authDate;
            authInfo.authCode = "543216";
            authInfo.authAmount = 12345;
            capturegivenauth.authInformation = authInfo;
            capturegivenauth.orderSource = orderSourceType.ecommerce;
            capturegivenauth.card = card;

            litleBatchRequest.addCaptureGivenAuth(capturegivenauth);
            try
            {
                litleBatchRequest.addCaptureGivenAuth(null);
            }
            catch (NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            var creditObj = new credit();
            creditObj.amount = 106;
            creditObj.orderId = "2111";
            creditObj.orderSource = orderSourceType.ecommerce;
            creditObj.card = card;

            litleBatchRequest.addCredit(creditObj);
            try
            {
                litleBatchRequest.addCredit(null);
            }
            catch (NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            var echeckcredit = new echeckCredit();
            echeckcredit.amount = 12L;
            echeckcredit.orderId = "12345";
            echeckcredit.orderSource = orderSourceType.ecommerce;
            var echeck = new echeckType();
            echeck.accType = echeckAccountTypeEnum.Checking;
            echeck.accNum = "12345657890";
            echeck.routingNum = "011201995";
            echeck.checkNum = "123455";
            echeckcredit.echeck = echeck;
            var billToAddress = new contact();
            billToAddress.name = "Bob";
            billToAddress.city = "Lowell";
            billToAddress.state = "MA";
            billToAddress.email = "litle.com";
            echeckcredit.billToAddress = billToAddress;

            litleBatchRequest.addEcheckCredit(echeckcredit);
            try
            {
                litleBatchRequest.addEcheckCredit(null);
            }
            catch (NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            var echeckredeposit = new echeckRedeposit();
            echeckredeposit.litleTxnId = 123456;
            echeckredeposit.echeck = echeck;

            litleBatchRequest.addEcheckRedeposit(echeckredeposit);
            try
            {
                litleBatchRequest.addEcheckRedeposit(null);
            }
            catch (NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            var echeckSaleObj = new echeckSale();
            echeckSaleObj.amount = 123456;
            echeckSaleObj.orderId = "12345";
            echeckSaleObj.orderSource = orderSourceType.ecommerce;
            echeckSaleObj.echeck = echeck;
            echeckSaleObj.billToAddress = billToAddress;

            litleBatchRequest.addEcheckSale(echeckSaleObj);
            try
            {
                litleBatchRequest.addEcheckSale(null);
            }
            catch (NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            var echeckVerificationObject = new echeckVerification();
            echeckVerificationObject.amount = 123456;
            echeckVerificationObject.orderId = "12345";
            echeckVerificationObject.orderSource = orderSourceType.ecommerce;
            echeckVerificationObject.echeck = echeck;
            echeckVerificationObject.billToAddress = billToAddress;

            litleBatchRequest.addEcheckVerification(echeckVerificationObject);
            try
            {
                litleBatchRequest.addEcheckVerification(null);
            }
            catch (NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            var forcecapture = new forceCapture();
            forcecapture.amount = 106;
            forcecapture.orderId = "12344";
            forcecapture.orderSource = orderSourceType.ecommerce;
            forcecapture.card = card;

            litleBatchRequest.addForceCapture(forcecapture);
            try
            {
                litleBatchRequest.addForceCapture(null);
            }
            catch (NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            var saleObj = new sale();
            saleObj.amount = 106;
            saleObj.litleTxnId = 123456;
            saleObj.orderId = "12344";
            saleObj.orderSource = orderSourceType.ecommerce;
            saleObj.card = card;

            litleBatchRequest.addSale(saleObj);
            try
            {
                litleBatchRequest.addSale(null);
            }
            catch (NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            var registerTokenRequest = new registerTokenRequestType();
            registerTokenRequest.orderId = "12344";
            registerTokenRequest.accountNumber = "1233456789103801";
            registerTokenRequest.reportGroup = "Planets";

            litleBatchRequest.addRegisterTokenRequest(registerTokenRequest);
            try
            {
                litleBatchRequest.addRegisterTokenRequest(null);
            }
            catch (NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            try
            {
                litle.addBatch(litleBatchRequest);
            }
            catch (NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }
        }
        public void SimpleBatch()
        {
            var litleBatchRequest = new batchRequest(memoryStreams);

            var authorization = new authorization();
            authorization.reportGroup = "Planets";
            authorization.orderId = "12344";
            authorization.amount = 106;
            authorization.orderSource = orderSourceType.ecommerce;
            var card = new cardType();
            card.type = methodOfPaymentTypeEnum.VI;
            card.number = "4100000000000001";
            card.expDate = "1210";
            authorization.card = card;

            litleBatchRequest.addAuthorization(authorization);

            var authorization2 = new authorization();
            authorization2.reportGroup = "Planets";
            authorization2.orderId = "12345";
            authorization2.amount = 106;
            authorization2.orderSource = orderSourceType.ecommerce;
            var card2 = new cardType();
            card2.type = methodOfPaymentTypeEnum.VI;
            card2.number = "4242424242424242";
            card2.expDate = "1210";
            authorization2.card = card2;

            litleBatchRequest.addAuthorization(authorization2);

            var reversal = new authReversal();
            reversal.litleTxnId = 12345678000L;
            reversal.amount = 106;
            reversal.payPalNotes = "Notes";

            litleBatchRequest.addAuthReversal(reversal);

            var reversal2 = new authReversal();
            reversal2.litleTxnId = 12345678900L;
            reversal2.amount = 106;
            reversal2.payPalNotes = "Notes";

            litleBatchRequest.addAuthReversal(reversal2);

            var capture = new capture();
            capture.litleTxnId = 123456000;
            capture.amount = 106;
            capture.payPalNotes = "Notes";

            litleBatchRequest.addCapture(capture);

            var capture2 = new capture();
            capture2.litleTxnId = 123456700;
            capture2.amount = 106;
            capture2.payPalNotes = "Notes";

            litleBatchRequest.addCapture(capture2);

            var capturegivenauth = new captureGivenAuth();
            capturegivenauth.amount = 106;
            capturegivenauth.orderId = "12344";
            var authInfo = new authInformation();
            var authDate = new DateTime(2002, 10, 9);
            authInfo.authDate = authDate;
            authInfo.authCode = "543216";
            authInfo.authAmount = 12345;
            capturegivenauth.authInformation = authInfo;
            capturegivenauth.orderSource = orderSourceType.ecommerce;
            capturegivenauth.card = card;

            litleBatchRequest.addCaptureGivenAuth(capturegivenauth);

            var capturegivenauth2 = new captureGivenAuth();
            capturegivenauth2.amount = 106;
            capturegivenauth2.orderId = "12344";
            var authInfo2 = new authInformation();
            authDate = new DateTime(2003, 10, 9);
            authInfo2.authDate = authDate;
            authInfo2.authCode = "543216";
            authInfo2.authAmount = 12345;
            capturegivenauth2.authInformation = authInfo;
            capturegivenauth2.orderSource = orderSourceType.ecommerce;
            capturegivenauth2.card = card2;

            litleBatchRequest.addCaptureGivenAuth(capturegivenauth2);

            var creditObj = new credit();
            creditObj.amount = 106;
            creditObj.orderId = "2111";
            creditObj.orderSource = orderSourceType.ecommerce;
            creditObj.card = card;

            litleBatchRequest.addCredit(creditObj);

            var creditObj2 = new credit();
            creditObj2.amount = 106;
            creditObj2.orderId = "2111";
            creditObj2.orderSource = orderSourceType.ecommerce;
            creditObj2.card = card2;

            litleBatchRequest.addCredit(creditObj2);

            var echeckcredit = new echeckCredit();
            echeckcredit.amount = 12L;
            echeckcredit.orderId = "12345";
            echeckcredit.orderSource = orderSourceType.ecommerce;
            var echeck = new echeckType();
            echeck.accType = echeckAccountTypeEnum.Checking;
            echeck.accNum = "1099999903";
            echeck.routingNum = "011201995";
            echeck.checkNum = "123455";
            echeckcredit.echeck = echeck;
            var billToAddress = new contact();
            billToAddress.name = "Bob";
            billToAddress.city = "Lowell";
            billToAddress.state = "MA";
            billToAddress.email = "litle.com";
            echeckcredit.billToAddress = billToAddress;

            litleBatchRequest.addEcheckCredit(echeckcredit);

            var echeckcredit2 = new echeckCredit();
            echeckcredit2.amount = 12L;
            echeckcredit2.orderId = "12346";
            echeckcredit2.orderSource = orderSourceType.ecommerce;
            var echeck2 = new echeckType();
            echeck2.accType = echeckAccountTypeEnum.Checking;
            echeck2.accNum = "1099999903";
            echeck2.routingNum = "011201995";
            echeck2.checkNum = "123456";
            echeckcredit2.echeck = echeck2;
            var billToAddress2 = new contact();
            billToAddress2.name = "Mike";
            billToAddress2.city = "Lowell";
            billToAddress2.state = "MA";
            billToAddress2.email = "litle.com";
            echeckcredit2.billToAddress = billToAddress2;

            litleBatchRequest.addEcheckCredit(echeckcredit2);

            var echeckredeposit = new echeckRedeposit();
            echeckredeposit.litleTxnId = 123456;
            echeckredeposit.echeck = echeck;

            litleBatchRequest.addEcheckRedeposit(echeckredeposit);

            var echeckredeposit2 = new echeckRedeposit();
            echeckredeposit2.litleTxnId = 123457;
            echeckredeposit2.echeck = echeck2;

            litleBatchRequest.addEcheckRedeposit(echeckredeposit2);

            var echeckSaleObj = new echeckSale();
            echeckSaleObj.amount = 123456;
            echeckSaleObj.orderId = "12345";
            echeckSaleObj.orderSource = orderSourceType.ecommerce;
            echeckSaleObj.echeck = echeck;
            echeckSaleObj.billToAddress = billToAddress;

            litleBatchRequest.addEcheckSale(echeckSaleObj);

            var echeckSaleObj2 = new echeckSale();
            echeckSaleObj2.amount = 123456;
            echeckSaleObj2.orderId = "12346";
            echeckSaleObj2.orderSource = orderSourceType.ecommerce;
            echeckSaleObj2.echeck = echeck2;
            echeckSaleObj2.billToAddress = billToAddress2;

            litleBatchRequest.addEcheckSale(echeckSaleObj2);

            var echeckPreNoteSaleObj1 = new echeckPreNoteSale();
            echeckPreNoteSaleObj1.orderId = "12345";
            echeckPreNoteSaleObj1.orderSource = orderSourceType.ecommerce;
            echeckPreNoteSaleObj1.echeck = echeck;
            echeckPreNoteSaleObj1.billToAddress = billToAddress;

            litleBatchRequest.addEcheckPreNoteSale(echeckPreNoteSaleObj1);

            var echeckPreNoteSaleObj2 = new echeckPreNoteSale();
            echeckPreNoteSaleObj2.orderId = "12345";
            echeckPreNoteSaleObj2.orderSource = orderSourceType.ecommerce;
            echeckPreNoteSaleObj2.echeck = echeck2;
            echeckPreNoteSaleObj2.billToAddress = billToAddress2;

            litleBatchRequest.addEcheckPreNoteSale(echeckPreNoteSaleObj2);

            var echeckPreNoteCreditObj1 = new echeckPreNoteCredit();
            echeckPreNoteCreditObj1.orderId = "12345";
            echeckPreNoteCreditObj1.orderSource = orderSourceType.ecommerce;
            echeckPreNoteCreditObj1.echeck = echeck;
            echeckPreNoteCreditObj1.billToAddress = billToAddress;

            litleBatchRequest.addEcheckPreNoteCredit(echeckPreNoteCreditObj1);

            var echeckPreNoteCreditObj2 = new echeckPreNoteCredit();
            echeckPreNoteCreditObj2.orderId = "12345";
            echeckPreNoteCreditObj2.orderSource = orderSourceType.ecommerce;
            echeckPreNoteCreditObj2.echeck = echeck2;
            echeckPreNoteCreditObj2.billToAddress = billToAddress2;

            litleBatchRequest.addEcheckPreNoteCredit(echeckPreNoteCreditObj2);

            var echeckVerificationObject = new echeckVerification();
            echeckVerificationObject.amount = 123456;
            echeckVerificationObject.orderId = "12345";
            echeckVerificationObject.orderSource = orderSourceType.ecommerce;
            echeckVerificationObject.echeck = echeck;
            echeckVerificationObject.billToAddress = billToAddress;

            litleBatchRequest.addEcheckVerification(echeckVerificationObject);

            var echeckVerificationObject2 = new echeckVerification();
            echeckVerificationObject2.amount = 123456;
            echeckVerificationObject2.orderId = "12346";
            echeckVerificationObject2.orderSource = orderSourceType.ecommerce;
            echeckVerificationObject2.echeck = echeck2;
            echeckVerificationObject2.billToAddress = billToAddress2;

            litleBatchRequest.addEcheckVerification(echeckVerificationObject2);

            var forcecapture = new forceCapture();
            forcecapture.amount = 106;
            forcecapture.orderId = "12344";
            forcecapture.orderSource = orderSourceType.ecommerce;
            forcecapture.card = card;

            litleBatchRequest.addForceCapture(forcecapture);

            var forcecapture2 = new forceCapture();
            forcecapture2.amount = 106;
            forcecapture2.orderId = "12345";
            forcecapture2.orderSource = orderSourceType.ecommerce;
            forcecapture2.card = card2;

            litleBatchRequest.addForceCapture(forcecapture2);

            var saleObj = new sale();
            saleObj.amount = 106;
            saleObj.litleTxnId = 123456;
            saleObj.orderId = "12344";
            saleObj.orderSource = orderSourceType.ecommerce;
            saleObj.card = card;

            litleBatchRequest.addSale(saleObj);

            var saleObj2 = new sale();
            saleObj2.amount = 106;
            saleObj2.litleTxnId = 123456;
            saleObj2.orderId = "12345";
            saleObj2.orderSource = orderSourceType.ecommerce;
            saleObj2.card = card2;

            litleBatchRequest.addSale(saleObj2);

            var registerTokenRequest = new registerTokenRequestType();
            registerTokenRequest.orderId = "12344";
            registerTokenRequest.accountNumber = "1233456789103801";
            registerTokenRequest.reportGroup = "Planets";

            litleBatchRequest.addRegisterTokenRequest(registerTokenRequest);

            var registerTokenRequest2 = new registerTokenRequestType();
            registerTokenRequest2.orderId = "12345";
            registerTokenRequest2.accountNumber = "1233456789103801";
            registerTokenRequest2.reportGroup = "Planets";

            litleBatchRequest.addRegisterTokenRequest(registerTokenRequest2);

            var updateCardValidationNumOnToken = new updateCardValidationNumOnToken();
            updateCardValidationNumOnToken.orderId = "12344";
            updateCardValidationNumOnToken.cardValidationNum = "123";
            updateCardValidationNumOnToken.litleToken = "4100000000000001";

            litleBatchRequest.addUpdateCardValidationNumOnToken(updateCardValidationNumOnToken);

            var updateCardValidationNumOnToken2 = new updateCardValidationNumOnToken();
            updateCardValidationNumOnToken2.orderId = "12345";
            updateCardValidationNumOnToken2.cardValidationNum = "123";
            updateCardValidationNumOnToken2.litleToken = "4242424242424242";

            litleBatchRequest.addUpdateCardValidationNumOnToken(updateCardValidationNumOnToken2);
            litle.addBatch(litleBatchRequest);

            var litleResponse = litle.sendToLitleWithStream();

            Assert.NotNull(litleResponse);
            Assert.AreEqual("0", litleResponse.response);
            Assert.AreEqual("Valid Format", litleResponse.message);

            var litleBatchResponse = litleResponse.nextBatchResponse();
            while (litleBatchResponse != null)
            {
                var authorizationResponse = litleBatchResponse.nextAuthorizationResponse();
                while (authorizationResponse != null)
                {
                    Assert.AreEqual("000", authorizationResponse.response);

                    authorizationResponse = litleBatchResponse.nextAuthorizationResponse();
                }

                var authReversalResponse = litleBatchResponse.nextAuthReversalResponse();
                while (authReversalResponse != null)
                {
                    Assert.AreEqual("360", authReversalResponse.response);

                    authReversalResponse = litleBatchResponse.nextAuthReversalResponse();
                }

                var captureResponse = litleBatchResponse.nextCaptureResponse();
                while (captureResponse != null)
                {
                    Assert.AreEqual("360", captureResponse.response);

                    captureResponse = litleBatchResponse.nextCaptureResponse();
                }

                var captureGivenAuthResponse = litleBatchResponse.nextCaptureGivenAuthResponse();
                while (captureGivenAuthResponse != null)
                {
                    Assert.AreEqual("000", captureGivenAuthResponse.response);

                    captureGivenAuthResponse = litleBatchResponse.nextCaptureGivenAuthResponse();
                }

                var creditResponse = litleBatchResponse.nextCreditResponse();
                while (creditResponse != null)
                {
                    Assert.AreEqual("000", creditResponse.response);

                    creditResponse = litleBatchResponse.nextCreditResponse();
                }

                var echeckCreditResponse = litleBatchResponse.nextEcheckCreditResponse();
                while (echeckCreditResponse != null)
                {
                    Assert.AreEqual("000", echeckCreditResponse.response);

                    echeckCreditResponse = litleBatchResponse.nextEcheckCreditResponse();
                }

                var echeckRedepositResponse = litleBatchResponse.nextEcheckRedepositResponse();
                while (echeckRedepositResponse != null)
                {
                    Assert.AreEqual("360", echeckRedepositResponse.response);

                    echeckRedepositResponse = litleBatchResponse.nextEcheckRedepositResponse();
                }

                var echeckSalesResponse = litleBatchResponse.nextEcheckSalesResponse();
                while (echeckSalesResponse != null)
                {
                    Assert.AreEqual("000", echeckSalesResponse.response);

                    echeckSalesResponse = litleBatchResponse.nextEcheckSalesResponse();
                }

                var echeckPreNoteSaleResponse = litleBatchResponse.nextEcheckPreNoteSaleResponse();
                while (echeckPreNoteSaleResponse != null)
                {
                    Assert.AreEqual("000", echeckPreNoteSaleResponse.response);

                    echeckPreNoteSaleResponse = litleBatchResponse.nextEcheckPreNoteSaleResponse();
                }

                var echeckPreNoteCreditResponse = litleBatchResponse.nextEcheckPreNoteCreditResponse();
                while (echeckPreNoteCreditResponse != null)
                {
                    Assert.AreEqual("000", echeckPreNoteCreditResponse.response);

                    echeckPreNoteCreditResponse = litleBatchResponse.nextEcheckPreNoteCreditResponse();
                }

                var echeckVerificationResponse = litleBatchResponse.nextEcheckVerificationResponse();
                while (echeckVerificationResponse != null)
                {
                    Assert.AreEqual("957", echeckVerificationResponse.response);

                    echeckVerificationResponse = litleBatchResponse.nextEcheckVerificationResponse();
                }

                var forceCaptureResponse = litleBatchResponse.nextForceCaptureResponse();
                while (forceCaptureResponse != null)
                {
                    Assert.AreEqual("000", forceCaptureResponse.response);

                    forceCaptureResponse = litleBatchResponse.nextForceCaptureResponse();
                }

                var registerTokenResponse = litleBatchResponse.nextRegisterTokenResponse();
                while (registerTokenResponse != null)
                {
                    Assert.AreEqual("820", registerTokenResponse.response);

                    registerTokenResponse = litleBatchResponse.nextRegisterTokenResponse();
                }

                var saleResponse = litleBatchResponse.nextSaleResponse();
                while (saleResponse != null)
                {
                    Assert.AreEqual("000", saleResponse.response);

                    saleResponse = litleBatchResponse.nextSaleResponse();
                }

                var updateCardValidationNumOnTokenResponse =
                    litleBatchResponse.nextUpdateCardValidationNumOnTokenResponse();
                while (updateCardValidationNumOnTokenResponse != null)
                {
                    Assert.AreEqual("823", updateCardValidationNumOnTokenResponse.response);

                    updateCardValidationNumOnTokenResponse =
                        litleBatchResponse.nextUpdateCardValidationNumOnTokenResponse();
                }

                litleBatchResponse = litleResponse.nextBatchResponse();
            }
        }
Ejemplo n.º 50
0
 public registerTokenResponse RegisterToken(registerTokenRequestType transaction)
 {
     return(this.SendTransaction <registerTokenResponse>(transaction));
 }
        public void testToken()
        {
            var token = new registerTokenRequestType();
            token.orderId = "12344";
            token.accountNumber = "1233456789103801";

            batchRequest.addRegisterTokenRequest(token);

            Assert.AreEqual(1, batchRequest.getNumRegisterTokenRequest());

            mockLitleFile.Verify(
                litleFile =>
                    litleFile.createRandomFile(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(),
                        mockLitleTime.Object));
            mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, token.Serialize()));
        }
Ejemplo n.º 52
0
        public void SimpleBatch()
        {
            var cnpBatchRequest = new batchRequest();

            var authorization = new authorization
            {
                reportGroup = "Planets",
                orderId     = "12344",
                amount      = 106,
                orderSource = orderSourceType.ecommerce
            };
            var card = new cardType
            {
                type    = methodOfPaymentTypeEnum.VI,
                number  = "4100000000000001",
                expDate = "1210"
            };

            authorization.card = card;
            authorization.id   = "id";

            cnpBatchRequest.addAuthorization(authorization);

            var authorization2 = new authorization();

            authorization2.reportGroup = "Planets";
            authorization2.orderId     = "12345";
            authorization2.amount      = 106;
            authorization2.orderSource = orderSourceType.ecommerce;
            var card2 = new cardType();

            card2.type          = methodOfPaymentTypeEnum.VI;
            card2.number        = "4242424242424242";
            card2.expDate       = "1210";
            authorization2.card = card2;
            authorization2.id   = "id";

            cnpBatchRequest.addAuthorization(authorization2);

            var reversal = new authReversal();

            reversal.cnpTxnId    = 12345678000L;
            reversal.amount      = 106;
            reversal.payPalNotes = "Notes";
            reversal.id          = "id";

            cnpBatchRequest.addAuthReversal(reversal);

            var reversal2 = new authReversal();

            reversal2.cnpTxnId    = 12345678900L;
            reversal2.amount      = 106;
            reversal2.payPalNotes = "Notes";
            reversal2.id          = "id";

            cnpBatchRequest.addAuthReversal(reversal2);

            var giftCardAuthReversal = new giftCardAuthReversal();

            giftCardAuthReversal.id       = "id";
            giftCardAuthReversal.cnpTxnId = 12345678000L;
            var giftCardCardTypeAuthReversal = new giftCardCardType();

            giftCardCardTypeAuthReversal.type           = methodOfPaymentTypeEnum.GC;
            giftCardCardTypeAuthReversal.number         = "4100000000000001";
            giftCardCardTypeAuthReversal.expDate        = "1210";
            giftCardAuthReversal.card                   = giftCardCardTypeAuthReversal;
            giftCardAuthReversal.originalRefCode        = "123456";
            giftCardAuthReversal.originalAmount         = 1000;
            giftCardAuthReversal.originalTxnTime        = DateTime.Now;
            giftCardAuthReversal.originalSystemTraceId  = 123;
            giftCardAuthReversal.originalSequenceNumber = "123456";

            cnpBatchRequest.addGiftCardAuthReversal(giftCardAuthReversal);

            var capture = new capture();

            capture.cnpTxnId    = 123456000;
            capture.amount      = 106;
            capture.payPalNotes = "Notes";
            capture.id          = "id";

            cnpBatchRequest.addCapture(capture);

            var capture2 = new capture();

            capture2.cnpTxnId    = 123456700;
            capture2.amount      = 106;
            capture2.payPalNotes = "Notes";
            capture2.id          = "id";

            cnpBatchRequest.addCapture(capture2);

            var giftCardCapture = new giftCardCapture();

            giftCardCapture.id            = "id";
            giftCardCapture.cnpTxnId      = 12345678000L;
            giftCardCapture.captureAmount = 123456;
            var giftCardCardTypeCapture = new giftCardCardType();

            giftCardCardTypeCapture.type    = methodOfPaymentTypeEnum.GC;
            giftCardCardTypeCapture.number  = "4100000000000001";
            giftCardCardTypeCapture.expDate = "1210";
            giftCardCapture.card            = giftCardCardTypeCapture;
            giftCardCapture.originalRefCode = "123456";
            giftCardCapture.originalAmount  = 1000;
            giftCardCapture.originalTxnTime = DateTime.Now;

            cnpBatchRequest.addGiftCardCapture(giftCardCapture);

            var capturegivenauth = new captureGivenAuth();

            capturegivenauth.amount  = 106;
            capturegivenauth.orderId = "12344";
            var authInfo = new authInformation();
            var authDate = new DateTime(2002, 10, 9);

            authInfo.authDate   = authDate;
            authInfo.authCode   = "543216";
            authInfo.authAmount = 12345;
            capturegivenauth.authInformation = authInfo;
            capturegivenauth.orderSource     = orderSourceType.ecommerce;
            capturegivenauth.card            = card;
            capturegivenauth.id = "id";

            cnpBatchRequest.addCaptureGivenAuth(capturegivenauth);

            var capturegivenauth2 = new captureGivenAuth();

            capturegivenauth2.amount  = 106;
            capturegivenauth2.orderId = "12344";
            var authInfo2 = new authInformation();

            authDate             = new DateTime(2003, 10, 9);
            authInfo2.authDate   = authDate;
            authInfo2.authCode   = "543216";
            authInfo2.authAmount = 12345;
            capturegivenauth2.authInformation = authInfo;
            capturegivenauth2.orderSource     = orderSourceType.ecommerce;
            capturegivenauth2.card            = card2;
            capturegivenauth2.id = "id";

            cnpBatchRequest.addCaptureGivenAuth(capturegivenauth2);

            var creditObj = new credit();

            creditObj.amount      = 106;
            creditObj.orderId     = "2111";
            creditObj.orderSource = orderSourceType.ecommerce;
            creditObj.card        = card;
            creditObj.id          = "id";

            cnpBatchRequest.addCredit(creditObj);

            var creditObj2 = new credit();

            creditObj2.amount      = 106;
            creditObj2.orderId     = "2111";
            creditObj2.orderSource = orderSourceType.ecommerce;
            creditObj2.card        = card2;
            creditObj2.id          = "id";

            cnpBatchRequest.addCredit(creditObj2);

            var giftCardCredit = new giftCardCredit();

            giftCardCredit.id           = "id";
            giftCardCredit.cnpTxnId     = 12345678000L;
            giftCardCredit.creditAmount = 123456;
            var giftCardCardTypeCredit = new giftCardCardType();

            giftCardCardTypeCredit.type    = methodOfPaymentTypeEnum.GC;
            giftCardCardTypeCredit.number  = "4100000000000001";
            giftCardCardTypeCredit.expDate = "1210";
            giftCardCredit.card            = giftCardCardTypeCredit;
            giftCardCredit.orderId         = "123456";
            giftCardCredit.orderSource     = orderSourceType.ecommerce;

            cnpBatchRequest.addGiftCardCredit(giftCardCredit);

            var echeckcredit = new echeckCredit();

            echeckcredit.amount      = 12L;
            echeckcredit.orderId     = "12345";
            echeckcredit.orderSource = orderSourceType.ecommerce;
            var echeck = new echeckType();

            echeck.accType      = echeckAccountTypeEnum.Checking;
            echeck.accNum       = "1099999903";
            echeck.routingNum   = "011201995";
            echeck.checkNum     = "123455";
            echeckcredit.echeck = echeck;
            var billToAddress = new contact();

            billToAddress.name         = "Bob";
            billToAddress.city         = "Lowell";
            billToAddress.state        = "MA";
            billToAddress.email        = "cnp.com";
            echeckcredit.billToAddress = billToAddress;
            echeckcredit.id            = "id";

            cnpBatchRequest.addEcheckCredit(echeckcredit);

            var echeckcredit2 = new echeckCredit();

            echeckcredit2.amount      = 12L;
            echeckcredit2.orderId     = "12346";
            echeckcredit2.orderSource = orderSourceType.ecommerce;
            var echeck2 = new echeckType();

            echeck2.accType      = echeckAccountTypeEnum.Checking;
            echeck2.accNum       = "1099999903";
            echeck2.routingNum   = "011201995";
            echeck2.checkNum     = "123456";
            echeckcredit2.echeck = echeck2;
            var billToAddress2 = new contact();

            billToAddress2.name         = "Mike";
            billToAddress2.city         = "Lowell";
            billToAddress2.state        = "MA";
            billToAddress2.email        = "cnp.com";
            echeckcredit2.billToAddress = billToAddress2;
            echeckcredit2.id            = "id";

            cnpBatchRequest.addEcheckCredit(echeckcredit2);

            var echeckredeposit = new echeckRedeposit();

            echeckredeposit.cnpTxnId = 123456;
            echeckredeposit.echeck   = echeck;
            echeckredeposit.id       = "id";

            cnpBatchRequest.addEcheckRedeposit(echeckredeposit);

            var echeckredeposit2 = new echeckRedeposit();

            echeckredeposit2.cnpTxnId = 123457;
            echeckredeposit2.echeck   = echeck2;
            echeckredeposit2.id       = "id";

            cnpBatchRequest.addEcheckRedeposit(echeckredeposit2);

            var echeckSaleObj = new echeckSale();

            echeckSaleObj.amount        = 123456;
            echeckSaleObj.orderId       = "12345";
            echeckSaleObj.orderSource   = orderSourceType.ecommerce;
            echeckSaleObj.echeck        = echeck;
            echeckSaleObj.billToAddress = billToAddress;
            echeckSaleObj.id            = "id";

            cnpBatchRequest.addEcheckSale(echeckSaleObj);

            var echeckSaleObj2 = new echeckSale();

            echeckSaleObj2.amount        = 123456;
            echeckSaleObj2.orderId       = "12346";
            echeckSaleObj2.orderSource   = orderSourceType.ecommerce;
            echeckSaleObj2.echeck        = echeck2;
            echeckSaleObj2.billToAddress = billToAddress2;
            echeckSaleObj2.id            = "id";

            cnpBatchRequest.addEcheckSale(echeckSaleObj2);

            var echeckPreNoteSaleObj1 = new echeckPreNoteSale();

            echeckPreNoteSaleObj1.orderId       = "12345";
            echeckPreNoteSaleObj1.orderSource   = orderSourceType.ecommerce;
            echeckPreNoteSaleObj1.echeck        = echeck;
            echeckPreNoteSaleObj1.billToAddress = billToAddress;
            echeckPreNoteSaleObj1.id            = "id";

            cnpBatchRequest.addEcheckPreNoteSale(echeckPreNoteSaleObj1);

            var echeckPreNoteSaleObj2 = new echeckPreNoteSale();

            echeckPreNoteSaleObj2.orderId       = "12345";
            echeckPreNoteSaleObj2.orderSource   = orderSourceType.ecommerce;
            echeckPreNoteSaleObj2.echeck        = echeck2;
            echeckPreNoteSaleObj2.billToAddress = billToAddress2;
            echeckPreNoteSaleObj2.id            = "id";

            cnpBatchRequest.addEcheckPreNoteSale(echeckPreNoteSaleObj2);

            var echeckPreNoteCreditObj1 = new echeckPreNoteCredit();

            echeckPreNoteCreditObj1.orderId       = "12345";
            echeckPreNoteCreditObj1.orderSource   = orderSourceType.ecommerce;
            echeckPreNoteCreditObj1.echeck        = echeck;
            echeckPreNoteCreditObj1.billToAddress = billToAddress;
            echeckPreNoteCreditObj1.id            = "id";

            cnpBatchRequest.addEcheckPreNoteCredit(echeckPreNoteCreditObj1);

            var echeckPreNoteCreditObj2 = new echeckPreNoteCredit();

            echeckPreNoteCreditObj2.orderId       = "12345";
            echeckPreNoteCreditObj2.orderSource   = orderSourceType.ecommerce;
            echeckPreNoteCreditObj2.echeck        = echeck2;
            echeckPreNoteCreditObj2.billToAddress = billToAddress2;
            echeckPreNoteCreditObj2.id            = "id";

            var echeckVerificationObject = new echeckVerification();

            echeckVerificationObject.amount        = 123456;
            echeckVerificationObject.orderId       = "12345";
            echeckVerificationObject.orderSource   = orderSourceType.ecommerce;
            echeckVerificationObject.echeck        = echeck;
            echeckVerificationObject.billToAddress = billToAddress;
            echeckVerificationObject.id            = "id";

            cnpBatchRequest.addEcheckVerification(echeckVerificationObject);

            var echeckVerificationObject2 = new echeckVerification();

            echeckVerificationObject2.amount        = 123456;
            echeckVerificationObject2.orderId       = "12346";
            echeckVerificationObject2.orderSource   = orderSourceType.ecommerce;
            echeckVerificationObject2.echeck        = echeck2;
            echeckVerificationObject2.billToAddress = billToAddress2;
            echeckVerificationObject2.id            = "id";

            cnpBatchRequest.addEcheckVerification(echeckVerificationObject2);

            var forcecapture = new forceCapture();

            forcecapture.amount      = 106;
            forcecapture.orderId     = "12344";
            forcecapture.orderSource = orderSourceType.ecommerce;
            forcecapture.card        = card;
            forcecapture.id          = "id";

            cnpBatchRequest.addForceCapture(forcecapture);

            var forcecapture2 = new forceCapture();

            forcecapture2.amount      = 106;
            forcecapture2.orderId     = "12345";
            forcecapture2.orderSource = orderSourceType.ecommerce;
            forcecapture2.card        = card2;
            forcecapture2.id          = "id";

            cnpBatchRequest.addForceCapture(forcecapture2);

            var saleObj = new sale();

            saleObj.amount      = 106;
            saleObj.cnpTxnId    = 123456;
            saleObj.orderId     = "12344";
            saleObj.orderSource = orderSourceType.ecommerce;
            saleObj.card        = card;
            saleObj.id          = "id";

            cnpBatchRequest.addSale(saleObj);

            var saleObj2 = new sale();

            saleObj2.amount      = 106;
            saleObj2.cnpTxnId    = 123456;
            saleObj2.orderId     = "12345";
            saleObj2.orderSource = orderSourceType.ecommerce;
            saleObj2.card        = card2;
            saleObj2.id          = "id";

            cnpBatchRequest.addSale(saleObj2);

            var registerTokenRequest = new registerTokenRequestType();

            registerTokenRequest.orderId       = "12344";
            registerTokenRequest.accountNumber = "1233456789103801";
            registerTokenRequest.reportGroup   = "Planets";
            registerTokenRequest.id            = "id";

            cnpBatchRequest.addRegisterTokenRequest(registerTokenRequest);

            var registerTokenRequest2 = new registerTokenRequestType();

            registerTokenRequest2.orderId       = "12345";
            registerTokenRequest2.accountNumber = "1233456789103801";
            registerTokenRequest2.reportGroup   = "Planets";
            registerTokenRequest2.id            = "id";

            cnpBatchRequest.addRegisterTokenRequest(registerTokenRequest2);

            var updateCardValidationNumOnToken = new updateCardValidationNumOnToken();

            updateCardValidationNumOnToken.orderId           = "12344";
            updateCardValidationNumOnToken.cardValidationNum = "123";
            updateCardValidationNumOnToken.cnpToken          = "4100000000000001";
            updateCardValidationNumOnToken.id = "id";

            cnpBatchRequest.addUpdateCardValidationNumOnToken(updateCardValidationNumOnToken);

            var updateCardValidationNumOnToken2 = new updateCardValidationNumOnToken();

            updateCardValidationNumOnToken2.orderId           = "12345";
            updateCardValidationNumOnToken2.cardValidationNum = "123";
            updateCardValidationNumOnToken2.cnpToken          = "4242424242424242";
            updateCardValidationNumOnToken2.id = "id";

            cnpBatchRequest.addUpdateCardValidationNumOnToken(updateCardValidationNumOnToken2);

//            fastAccessFunding fastAccessFunding = new fastAccessFunding();
//            fastAccessFunding.id = "A123456";
//            fastAccessFunding.reportGroup = "FastPayment";
//            fastAccessFunding.fundingSubmerchantId = "SomeSubMerchant";
//            fastAccessFunding.submerchantName = "Some Merchant Inc.";
//            fastAccessFunding.fundsTransferId = "123e4567e89b12d3";
//            fastAccessFunding.amount = 3000;
//            fastAccessFunding.token = new cardTokenType
//            {
//                cnpToken = "1111000101039449",
//                expDate = "1112",
//                cardValidationNum = "987",
//                type = methodOfPaymentTypeEnum.VI,
//            };
//            cnpBatchRequest.addfastAccessFunding(fastAccessFunding);

            cnp.addBatch(cnpBatchRequest);

            var batchName = cnp.sendToCnp();

            cnp.blockAndWaitForResponse(batchName, estimatedResponseTime(2 * 2, 10 * 2));

            var cnpResponse = cnp.receiveFromCnp(batchName);

            Assert.NotNull(cnpResponse);
            Assert.AreEqual("0", cnpResponse.response);
            Assert.AreEqual("Valid Format", cnpResponse.message);

            var cnpBatchResponse = cnpResponse.nextBatchResponse();

            while (cnpBatchResponse != null)
            {
                var authorizationResponse = cnpBatchResponse.nextAuthorizationResponse();
                while (authorizationResponse != null)
                {
                    Assert.AreEqual("000", authorizationResponse.response);

                    authorizationResponse = cnpBatchResponse.nextAuthorizationResponse();
                }

                var authReversalResponse = cnpBatchResponse.nextAuthReversalResponse();
                while (authReversalResponse != null)
                {
                    Assert.AreEqual("000", authReversalResponse.response);

                    authReversalResponse = cnpBatchResponse.nextAuthReversalResponse();
                }

                var giftCardAuthReversalResponse = cnpBatchResponse.nextGiftCardAuthReversalResponse();
                while (giftCardAuthReversalResponse != null)
                {
                    Assert.NotNull(giftCardAuthReversalResponse.response);

                    giftCardAuthReversalResponse = cnpBatchResponse.nextGiftCardAuthReversalResponse();
                }

                var captureResponse = cnpBatchResponse.nextCaptureResponse();
                while (captureResponse != null)
                {
                    Assert.AreEqual("000", captureResponse.response);

                    captureResponse = cnpBatchResponse.nextCaptureResponse();
                }

                var giftCardCaptureResponse = cnpBatchResponse.nextGiftCardCaptureResponse();
                while (giftCardCaptureResponse != null)
                {
                    Assert.NotNull(giftCardCaptureResponse.response);

                    giftCardCaptureResponse = cnpBatchResponse.nextGiftCardCaptureResponse();
                }


                var captureGivenAuthResponse = cnpBatchResponse.nextCaptureGivenAuthResponse();
                while (captureGivenAuthResponse != null)
                {
                    Assert.AreEqual("000", captureGivenAuthResponse.response);

                    captureGivenAuthResponse = cnpBatchResponse.nextCaptureGivenAuthResponse();
                }

                var creditResponse = cnpBatchResponse.nextCreditResponse();
                while (creditResponse != null)
                {
                    Assert.AreEqual("000", creditResponse.response);

                    creditResponse = cnpBatchResponse.nextCreditResponse();
                }

                var giftCardCreditResponse = cnpBatchResponse.nextGiftCardCreditResponse();
                while (giftCardCreditResponse != null)
                {
                    Assert.NotNull(giftCardCreditResponse.response);

                    giftCardCreditResponse = cnpBatchResponse.nextGiftCardCreditResponse();
                }

                var echeckCreditResponse = cnpBatchResponse.nextEcheckCreditResponse();
                while (echeckCreditResponse != null)
                {
                    Assert.AreEqual("000", echeckCreditResponse.response);

                    echeckCreditResponse = cnpBatchResponse.nextEcheckCreditResponse();
                }

                var echeckRedepositResponse = cnpBatchResponse.nextEcheckRedepositResponse();
                while (echeckRedepositResponse != null)
                {
                    Assert.AreEqual("000", echeckRedepositResponse.response);

                    echeckRedepositResponse = cnpBatchResponse.nextEcheckRedepositResponse();
                }

                var echeckSalesResponse = cnpBatchResponse.nextEcheckSalesResponse();
                while (echeckSalesResponse != null)
                {
                    Assert.AreEqual("000", echeckSalesResponse.response);

                    echeckSalesResponse = cnpBatchResponse.nextEcheckSalesResponse();
                }

                var echeckPreNoteSaleResponse = cnpBatchResponse.nextEcheckPreNoteSaleResponse();
                while (echeckPreNoteSaleResponse != null)
                {
                    Assert.AreEqual("000", echeckPreNoteSaleResponse.response);

                    echeckPreNoteSaleResponse = cnpBatchResponse.nextEcheckPreNoteSaleResponse();
                }

                var echeckPreNoteCreditResponse = cnpBatchResponse.nextEcheckPreNoteCreditResponse();
                while (echeckPreNoteCreditResponse != null)
                {
                    Assert.AreEqual("000", echeckPreNoteCreditResponse.response);

                    echeckPreNoteCreditResponse = cnpBatchResponse.nextEcheckPreNoteCreditResponse();
                }

                var echeckVerificationResponse = cnpBatchResponse.nextEcheckVerificationResponse();
                while (echeckVerificationResponse != null)
                {
                    Assert.AreEqual("957", echeckVerificationResponse.response);

                    echeckVerificationResponse = cnpBatchResponse.nextEcheckVerificationResponse();
                }

                var forceCaptureResponse = cnpBatchResponse.nextForceCaptureResponse();
                while (forceCaptureResponse != null)
                {
                    Assert.AreEqual("000", forceCaptureResponse.response);

                    forceCaptureResponse = cnpBatchResponse.nextForceCaptureResponse();
                }

                var registerTokenResponse = cnpBatchResponse.nextRegisterTokenResponse();
                while (registerTokenResponse != null)
                {
                    Assert.AreEqual("820", registerTokenResponse.response);

                    registerTokenResponse = cnpBatchResponse.nextRegisterTokenResponse();
                }

                var saleResponse = cnpBatchResponse.nextSaleResponse();
                while (saleResponse != null)
                {
                    Assert.AreEqual("000", saleResponse.response);

                    saleResponse = cnpBatchResponse.nextSaleResponse();
                }

                var updateCardValidationNumOnTokenResponse = cnpBatchResponse.nextUpdateCardValidationNumOnTokenResponse();
                while (updateCardValidationNumOnTokenResponse != null)
                {
                    Assert.AreEqual("823", updateCardValidationNumOnTokenResponse.response);

                    updateCardValidationNumOnTokenResponse = cnpBatchResponse.nextUpdateCardValidationNumOnTokenResponse();
                }

                cnpBatchResponse = cnpResponse.nextBatchResponse();
            }
        }
Ejemplo n.º 53
0
        public void SimpleBatch()
        {
            var litleBatchRequest = new batchRequest();
            var card = new cardType
            {
                type = methodOfPaymentTypeEnum.VI,
                number = "4100000000000001",
                expDate = "1210"
            };

            var card2 = new cardType
            {
                type = methodOfPaymentTypeEnum.VI,
                number = "4242424242424242",
                expDate = "1210"
            };

            var authorization = new authorization
            {
                reportGroup = "Planets",
                orderId = "12344",
                amount = 106,
                orderSource = orderSourceType.ecommerce,
                card = card
            };

            litleBatchRequest.addAuthorization(authorization);

            var authorization2 = new authorization
            {
                reportGroup = "Planets",
                orderId = "12345",
                amount = 106,
                orderSource = orderSourceType.ecommerce,
                card = card2
            };

            litleBatchRequest.addAuthorization(authorization2);

            var reversal = new authReversal
            {
                litleTxnId = 12345678000L,
                amount = 106,
                payPalNotes = "Notes"
            };

            litleBatchRequest.addAuthReversal(reversal);

            var reversal2 = new authReversal
            {
                litleTxnId = 12345678900L,
                amount = 106,
                payPalNotes = "Notes"
            };

            litleBatchRequest.addAuthReversal(reversal2);

            var capture = new capture
            {
                litleTxnId = 123456000,
                amount = 106,
                payPalNotes = "Notes"
            };

            litleBatchRequest.addCapture(capture);

            var capture2 = new capture
            {
                litleTxnId = 123456700,
                amount = 106,
                payPalNotes = "Notes"
            };

            litleBatchRequest.addCapture(capture2);

            var capturegivenauth = new captureGivenAuth
            {
                amount = 106,
                orderId = "12344",
                orderSource = orderSourceType.ecommerce,
                authInformation = new authInformation
                {
                    authDate = new DateTime(2002, 10, 9),
                    authCode = "543216",
                    authAmount = 12345
                },
                card = card
            };

            litleBatchRequest.addCaptureGivenAuth(capturegivenauth);

            var capturegivenauth2 = new captureGivenAuth
            {
                amount = 106,
                orderId = "12344",
                orderSource = orderSourceType.ecommerce,
                authInformation = new authInformation
                {
                    authDate = new DateTime(2003, 10, 9),
                    authCode = "543216",
                    authAmount = 12345
                },
                card = card2
            };

            litleBatchRequest.addCaptureGivenAuth(capturegivenauth2);

            var creditObj = new credit
            {
                amount = 106,
                orderId = "2111",
                orderSource = orderSourceType.ecommerce,
                card = card
            };

            litleBatchRequest.addCredit(creditObj);

            var creditObj2 = new credit
            {
                amount = 106,
                orderId = "2111",
                orderSource = orderSourceType.ecommerce,
                card = card2
            };

            litleBatchRequest.addCredit(creditObj2);

            var echeck = new echeckType
            {
                accType = echeckAccountTypeEnum.Checking,
                accNum = "1099999903",
                routingNum = "011201995",
                checkNum = "123455"
            };

            var billToAddress = new contact
            {
                name = "Bob",
                city = "Lowell",
                state = "MA",
                email = "litle.com"
            };

            var echeckcredit = new echeckCredit
            {
                amount = 12L,
                orderId = "12345",
                orderSource = orderSourceType.ecommerce,
                echeck = echeck,
                billToAddress = billToAddress
            };

            litleBatchRequest.addEcheckCredit(echeckcredit);

            var echeck2 = new echeckType
            {
                accType = echeckAccountTypeEnum.Checking,
                accNum = "1099999903",
                routingNum = "011201995",
                checkNum = "123456"
            };

            var billToAddress2 = new contact
            {
                name = "Mike",
                city = "Lowell",
                state = "MA",
                email = "litle.com"
            };

            var echeckcredit2 = new echeckCredit
            {
                amount = 12L,
                orderId = "12346",
                orderSource = orderSourceType.ecommerce,
                echeck = echeck2,
                billToAddress = billToAddress2
            };

            litleBatchRequest.addEcheckCredit(echeckcredit2);

            var echeckredeposit = new echeckRedeposit
            {
                litleTxnId = 123456,
                echeck = echeck
            };

            litleBatchRequest.addEcheckRedeposit(echeckredeposit);

            var echeckredeposit2 = new echeckRedeposit
            {
                litleTxnId = 123457,
                echeck = echeck2
            };

            litleBatchRequest.addEcheckRedeposit(echeckredeposit2);

            var echeckSaleObj = new echeckSale
            {
                amount = 123456,
                orderId = "12345",
                orderSource = orderSourceType.ecommerce,
                echeck = echeck,
                billToAddress = billToAddress
            };

            litleBatchRequest.addEcheckSale(echeckSaleObj);

            var echeckSaleObj2 = new echeckSale
            {
                amount = 123456,
                orderId = "12346",
                orderSource = orderSourceType.ecommerce,
                echeck = echeck2,
                billToAddress = billToAddress2
            };

            litleBatchRequest.addEcheckSale(echeckSaleObj2);

            var echeckPreNoteSaleObj1 = new echeckPreNoteSale
            {
                orderId = "12345",
                orderSource = orderSourceType.ecommerce,
                echeck = echeck,
                billToAddress = billToAddress
            };

            litleBatchRequest.addEcheckPreNoteSale(echeckPreNoteSaleObj1);

            var echeckPreNoteSaleObj2 = new echeckPreNoteSale
            {
                orderId = "12345",
                orderSource = orderSourceType.ecommerce,
                echeck = echeck2,
                billToAddress = billToAddress2
            };

            litleBatchRequest.addEcheckPreNoteSale(echeckPreNoteSaleObj2);

            var echeckPreNoteCreditObj1 = new echeckPreNoteCredit
            {
                orderId = "12345",
                orderSource = orderSourceType.ecommerce,
                echeck = echeck,
                billToAddress = billToAddress
            };

            litleBatchRequest.addEcheckPreNoteCredit(echeckPreNoteCreditObj1);

            //            var echeckPreNoteCreditObj2 = new echeckPreNoteCredit
            //            {
            //                orderId = "12345",
            //                orderSource = orderSourceType.ecommerce,
            //                echeck = echeck2,
            //                billToAddress = billToAddress2
            //            };

            var echeckVerificationObject = new echeckVerification
            {
                amount = 123456,
                orderId = "12345",
                orderSource = orderSourceType.ecommerce,
                echeck = echeck,
                billToAddress = billToAddress
            };

            litleBatchRequest.addEcheckVerification(echeckVerificationObject);

            var echeckVerificationObject2 = new echeckVerification
            {
                amount = 123456,
                orderId = "12346",
                orderSource = orderSourceType.ecommerce,
                echeck = echeck2,
                billToAddress = billToAddress2
            };

            litleBatchRequest.addEcheckVerification(echeckVerificationObject2);

            var forcecapture = new forceCapture
            {
                amount = 106,
                orderId = "12344",
                orderSource = orderSourceType.ecommerce,
                card = card
            };

            litleBatchRequest.addForceCapture(forcecapture);

            var forcecapture2 = new forceCapture
            {
                amount = 106,
                orderId = "12345",
                orderSource = orderSourceType.ecommerce,
                card = card2
            };

            litleBatchRequest.addForceCapture(forcecapture2);

            var saleObj = new sale
            {
                amount = 106,
                litleTxnId = 123456,
                orderId = "12344",
                orderSource = orderSourceType.ecommerce,
                card = card
            };

            litleBatchRequest.addSale(saleObj);

            var saleObj2 = new sale
            {
                amount = 106,
                litleTxnId = 123456,
                orderId = "12345",
                orderSource = orderSourceType.ecommerce,
                card = card2
            };

            litleBatchRequest.addSale(saleObj2);

            var registerTokenRequest = new registerTokenRequestType
            {
                orderId = "12344",
                accountNumber = "1233456789103801",
                reportGroup = "Planets"
            };

            litleBatchRequest.addRegisterTokenRequest(registerTokenRequest);

            var registerTokenRequest2 = new registerTokenRequestType
            {
                orderId = "12345",
                accountNumber = "1233456789103801",
                reportGroup = "Planets"
            };

            litleBatchRequest.addRegisterTokenRequest(registerTokenRequest2);

            var updateCardValidationNumOnToken = new updateCardValidationNumOnToken
            {
                orderId = "12344",
                cardValidationNum = "123",
                litleToken = "4100000000000001"
            };

            litleBatchRequest.addUpdateCardValidationNumOnToken(updateCardValidationNumOnToken);

            var updateCardValidationNumOnToken2 = new updateCardValidationNumOnToken
            {
                orderId = "12345",
                cardValidationNum = "123",
                litleToken = "4242424242424242"
            };

            litleBatchRequest.addUpdateCardValidationNumOnToken(updateCardValidationNumOnToken2);
            _litle.addBatch(litleBatchRequest);

            var batchName = _litle.sendToLitle();

            _litle.blockAndWaitForResponse(batchName, EstimatedResponseTime(2 * 2, 10 * 2));

            var litleResponse = _litle.receiveFromLitle(batchName);

            Assert.NotNull(litleResponse);
            Assert.AreEqual("0", litleResponse.response);
            Assert.AreEqual("Valid Format", litleResponse.message);

            var litleBatchResponse = litleResponse.nextBatchResponse();
            while (litleBatchResponse != null)
            {
                var authorizationResponse = litleBatchResponse.nextAuthorizationResponse();
                while (authorizationResponse != null)
                {
                    Assert.AreEqual("000", authorizationResponse.response);

                    authorizationResponse = litleBatchResponse.nextAuthorizationResponse();
                }

                var authReversalResponse = litleBatchResponse.nextAuthReversalResponse();
                while (authReversalResponse != null)
                {
                    Assert.AreEqual("360", authReversalResponse.response);

                    authReversalResponse = litleBatchResponse.nextAuthReversalResponse();
                }

                var captureResponse = litleBatchResponse.nextCaptureResponse();
                while (captureResponse != null)
                {
                    Assert.AreEqual("360", captureResponse.response);

                    captureResponse = litleBatchResponse.nextCaptureResponse();
                }

                var captureGivenAuthResponse = litleBatchResponse.nextCaptureGivenAuthResponse();
                while (captureGivenAuthResponse != null)
                {
                    Assert.AreEqual("000", captureGivenAuthResponse.response);

                    captureGivenAuthResponse = litleBatchResponse.nextCaptureGivenAuthResponse();
                }

                var creditResponse = litleBatchResponse.nextCreditResponse();
                while (creditResponse != null)
                {
                    Assert.AreEqual("000", creditResponse.response);

                    creditResponse = litleBatchResponse.nextCreditResponse();
                }

                var echeckCreditResponse = litleBatchResponse.nextEcheckCreditResponse();
                while (echeckCreditResponse != null)
                {
                    Assert.AreEqual("000", echeckCreditResponse.response);

                    echeckCreditResponse = litleBatchResponse.nextEcheckCreditResponse();
                }

                var echeckRedepositResponse = litleBatchResponse.nextEcheckRedepositResponse();
                while (echeckRedepositResponse != null)
                {
                    Assert.AreEqual("360", echeckRedepositResponse.response);

                    echeckRedepositResponse = litleBatchResponse.nextEcheckRedepositResponse();
                }

                var echeckSalesResponse = litleBatchResponse.nextEcheckSalesResponse();
                while (echeckSalesResponse != null)
                {
                    Assert.AreEqual("000", echeckSalesResponse.response);

                    echeckSalesResponse = litleBatchResponse.nextEcheckSalesResponse();
                }

                var echeckPreNoteSaleResponse = litleBatchResponse.nextEcheckPreNoteSaleResponse();
                while (echeckPreNoteSaleResponse != null)
                {
                    Assert.AreEqual("000", echeckPreNoteSaleResponse.response);

                    echeckPreNoteSaleResponse = litleBatchResponse.nextEcheckPreNoteSaleResponse();
                }

                var echeckPreNoteCreditResponse = litleBatchResponse.nextEcheckPreNoteCreditResponse();
                while (echeckPreNoteCreditResponse != null)
                {
                    Assert.AreEqual("000", echeckPreNoteCreditResponse.response);

                    echeckPreNoteCreditResponse = litleBatchResponse.nextEcheckPreNoteCreditResponse();
                }

                var echeckVerificationResponse = litleBatchResponse.nextEcheckVerificationResponse();
                while (echeckVerificationResponse != null)
                {
                    Assert.AreEqual("957", echeckVerificationResponse.response);

                    echeckVerificationResponse = litleBatchResponse.nextEcheckVerificationResponse();
                }

                var forceCaptureResponse = litleBatchResponse.nextForceCaptureResponse();
                while (forceCaptureResponse != null)
                {
                    Assert.AreEqual("000", forceCaptureResponse.response);

                    forceCaptureResponse = litleBatchResponse.nextForceCaptureResponse();
                }

                var registerTokenResponse = litleBatchResponse.nextRegisterTokenResponse();
                while (registerTokenResponse != null)
                {
                    Assert.AreEqual("820", registerTokenResponse.response);

                    registerTokenResponse = litleBatchResponse.nextRegisterTokenResponse();
                }

                var saleResponse = litleBatchResponse.nextSaleResponse();
                while (saleResponse != null)
                {
                    Assert.AreEqual("000", saleResponse.response);

                    saleResponse = litleBatchResponse.nextSaleResponse();
                }

                var updateCardValidationNumOnTokenResponse = litleBatchResponse.nextUpdateCardValidationNumOnTokenResponse();
                while (updateCardValidationNumOnTokenResponse != null)
                {
                    Assert.AreEqual("823", updateCardValidationNumOnTokenResponse.response);

                    updateCardValidationNumOnTokenResponse = litleBatchResponse.nextUpdateCardValidationNumOnTokenResponse();
                }

                litleBatchResponse = litleResponse.nextBatchResponse();
            }
        }