public void PosWithoutCapabilityAndEntryMode()
        {
            var authorization = new Authorization
            {
                ReportGroup = "Planets",
                OrderId = "12344",
                Amount = 106,
                OrderSource = OrderSourceType.Ecommerce,
                Pos = new Pos {CardholderId = PosCardholderIdTypeEnum.Pin},
                Card = new CardType
                {
                    Type = MethodOfPaymentTypeEnum.VI,
                    Number = "4100000000000002",
                    ExpDate = "1210"
                }
            };

            try
            {
                Litle.Authorize(authorization);
            }
            catch (LitleOnlineException e)
            {
                Assert.True(e.Message.StartsWith("Error validating xml data against the schema"));
            }
        }
 public void AuthWithAmpersand()
 {
     var authorization = new Authorization
     {
         ID = "",
         OrderId = "1",
         Amount = 10010,
         OrderSource = OrderSourceType.Ecommerce,
         BillToAddress = new Contact
         {
             Name = "John & Jane Smith",
             AddressLine1 = "1 Main St.",
             City = "Burlington",
             State = "MA",
             Zip = "01803-3747",
             Country = CountryTypeEnum.US
         },
         Card = new CardType
         {
             Type = MethodOfPaymentTypeEnum.VI,
             Number = "4457010000000009",
             ExpDate = "0112",
             CardValidationNum = "349"
         }
     };
     var response = Litle.Authorize(authorization);
     Assert.AreEqual("000", response.Response);
 }
        public void test12()
        {
            Authorization authorization = new Authorization();
            authorization.OrderId = "12";
            authorization.Amount = 50000;
            authorization.OrderSource = OrderSourceType.Ecommerce;
            CardType card = new CardType();
            card.Type = MethodOfPaymentTypeEnum.AX;
            card.Number = "375001014000009";
            card.ExpDate = "0412";
            authorization.Card = card;
            authorization.AllowPartialAuth = true;

            AuthorizationResponse response = litle.Authorize(authorization);
            Assert.AreEqual("010", response.Response);
            Assert.AreEqual("Partially Approved", response.Message);
            Assert.AreEqual("40000", response.ApprovedAmount);
        }
        public void test15()
        {
            Authorization authorization = new Authorization();
            authorization.OrderId = "15";
            authorization.Amount = 3000;
            authorization.OrderSource = OrderSourceType.Ecommerce;
            CardType card = new CardType();
            card.Type = MethodOfPaymentTypeEnum.MC;
            card.Number = "5500000254444445";
            card.ExpDate = "0312";
            authorization.Card = card;

            AuthorizationResponse response = litle.Authorize(authorization);
            Assert.AreEqual("000", response.Response);
            Assert.AreEqual("Approved", response.Message);
            Assert.AreEqual(FundingSourceTypeEnum.Prepaid, response.EnhancedAuthResponse.FundingSource.Type);
            Assert.AreEqual("2000", response.EnhancedAuthResponse.FundingSource.AvailableBalance);
            Assert.AreEqual("YES", response.EnhancedAuthResponse.FundingSource.Reloadable);
            Assert.AreEqual("PAYROLL", response.EnhancedAuthResponse.FundingSource.PrepaidCardType);
        }
        public void test32()
        {
            Authorization auth = new Authorization();
            auth.OrderId = "32";
            auth.Amount = 10010;
            auth.OrderSource = OrderSourceType.Ecommerce;
            Contact billToAddress = new Contact();
            billToAddress.Name = "John Smith";
            billToAddress.AddressLine1 = "1 Main St.";
            billToAddress.City = "Burlington";
            billToAddress.State = "MA";
            billToAddress.Zip = "01803-3747";
            billToAddress.Country = CountryTypeEnum.US;
            auth.BillToAddress = billToAddress;
            CardType card = new CardType();
            card.Number = "4457010000000009";
            card.ExpDate = "0112";
            card.CardValidationNum = "349";
            card.Type = MethodOfPaymentTypeEnum.VI;
            auth.Card = card;

            AuthorizationResponse authorizeResponse = litle.Authorize(auth);
            Assert.AreEqual("000", authorizeResponse.Response);
            Assert.AreEqual("Approved", authorizeResponse.Message);
            Assert.AreEqual("11111 ", authorizeResponse.AuthCode);
            Assert.AreEqual("01", authorizeResponse.FraudResult.AvsResult);
            Assert.AreEqual("M", authorizeResponse.FraudResult.CardValidationResult);

            Capture capture = new Capture();
            capture.LitleTxnId = authorizeResponse.LitleTxnId;
            capture.Amount = 5005;
            CaptureResponse captureResponse = litle.Capture(capture);
            Assert.AreEqual("000", captureResponse.Response);
            Assert.AreEqual("Approved", captureResponse.Message);

            AuthReversal reversal = new AuthReversal();
            reversal.LitleTxnId = authorizeResponse.LitleTxnId;
            AuthReversalResponse reversalResponse = litle.AuthReversal(reversal);
            Assert.AreEqual("111", reversalResponse.Response);
            Assert.AreEqual("Authorization amount has already been depleted", reversalResponse.Message);
        }
        public void TestAuth()
        {
            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 = "4100000000000002";
            card.ExpDate = "1210";
            authorization.Card = card;

            var mock = new Mock<Communications>();

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

            Communications mockedCommunication = mock.Object;
            litle.SetCommunication(mockedCommunication);
            AuthorizationResponse authorize = litle.Authorize(authorization);
            Assert.AreEqual(123, authorize.LitleTxnId);
        }
        public void test3Auth()
        {
            Authorization authorization = new Authorization();
            authorization.OrderId = "3";
            authorization.Amount = 30030;
            authorization.OrderSource = OrderSourceType.Ecommerce;
            Contact contact = new Contact();
            contact.Name = "Eileen Jones";
            contact.AddressLine1 = "3 Main St.";
            contact.City = "Bloomfield";
            contact.State = "CT";
            contact.Zip = "06002";
            contact.Country = CountryTypeEnum.US;
            authorization.BillToAddress = contact;
            CardType card = new CardType();
            card.Type = MethodOfPaymentTypeEnum.DI;
            card.Number = "6011010000000003";
            card.ExpDate = "0312";
            card.CardValidationNum = "758";
            authorization.Card = card;

            AuthorizationResponse response = litle.Authorize(authorization);
            Assert.AreEqual("000", response.Response);
            Assert.AreEqual("Approved", response.Message);
            Assert.AreEqual("33333", response.AuthCode);
            Assert.AreEqual("10", response.FraudResult.AvsResult);
            Assert.AreEqual("M", response.FraudResult.CardValidationResult);

            Capture capture = new Capture();
            capture.LitleTxnId = response.LitleTxnId;
            CaptureResponse captureResponse = litle.Capture(capture);
            Assert.AreEqual("000", captureResponse.Response);
            Assert.AreEqual("Approved", captureResponse.Message);

            Credit credit = new Credit();
            credit.LitleTxnId = captureResponse.LitleTxnId;
            CreditResponse creditResponse = litle.Credit(credit);
            Assert.AreEqual("000", creditResponse.Response);
            Assert.AreEqual("Approved", creditResponse.Message);

            VoidTxn newvoid = new VoidTxn();
            newvoid.LitleTxnId = creditResponse.LitleTxnId;
            LitleOnlineResponseTransactionResponseVoidResponse voidResponse = litle.DoVoid(newvoid);
            Assert.AreEqual("000", voidResponse.Response);
            Assert.AreEqual("Approved", voidResponse.Message);
        }
        public void test2AVS()
        {
            Authorization authorization = new Authorization();
            authorization.OrderId = "2";
            authorization.Amount = 0;
            authorization.OrderSource = OrderSourceType.Ecommerce;
            Contact contact = new Contact();
            contact.Name = "Mike J. Hammer";
            contact.AddressLine1 = "2 Main St.";
            contact.AddressLine2 = "Apt. 222";
            contact.City = "Riverside";
            contact.State = "RI";
            contact.Zip = "02915";
            contact.Country = CountryTypeEnum.US;
            authorization.BillToAddress = contact;
            CardType card = new CardType();
            card.Type = MethodOfPaymentTypeEnum.MC;
            card.Number = "5112010000000003";
            card.ExpDate = "0212";
            card.CardValidationNum = "261";
            authorization.Card = card;
            FraudCheckType authenticationvalue = new FraudCheckType();
            authenticationvalue.AuthenticationValue = "BwABBJQ1AgAAAAAgJDUCAAAAAAA=";
            authorization.CardholderAuthentication = authenticationvalue;

            AuthorizationResponse response = litle.Authorize(authorization);
            Assert.AreEqual("000", response.Response);
            Assert.AreEqual("Approved", response.Message);
            Assert.AreEqual("22222", response.AuthCode);
            Assert.AreEqual("10", response.FraudResult.AvsResult);
            Assert.AreEqual("M", response.FraudResult.CardValidationResult);
        }
        public void test2Auth()
        {
            Authorization authorization = new Authorization();
            authorization.OrderId = "2";
            authorization.Amount = 20020;
            authorization.OrderSource = OrderSourceType.Ecommerce;
            Contact contact = new Contact();
            contact.Name = "Mike J. Hammer";
            contact.AddressLine1 = "2 Main St.";
            contact.AddressLine2 = "Apt. 222";
            contact.City = "Riverside";
            contact.State = "RI";
            contact.Zip = "02915";
            contact.Country = CountryTypeEnum.US;
            authorization.BillToAddress = contact;
            CardType card = new CardType();
            card.Type = MethodOfPaymentTypeEnum.MC;
            card.Number = "5112010000000003";
            card.ExpDate = "0212";
            card.CardValidationNum = "261";
            authorization.Card = card;
            FraudCheckType authenticationvalue = new FraudCheckType();
            authenticationvalue.AuthenticationValue = "BwABBJQ1AgAAAAAgJDUCAAAAAAA=";
            authorization.CardholderAuthentication = authenticationvalue;

            AuthorizationResponse response = litle.Authorize(authorization);
            Assert.AreEqual("000", response.Response);
            Assert.AreEqual("Approved", response.Message);
            Assert.AreEqual("22222", response.AuthCode);
            Assert.AreEqual("10", response.FraudResult.AvsResult);
            Assert.AreEqual("M", response.FraudResult.CardValidationResult);

            Capture capture = new Capture();
            capture.LitleTxnId = response.LitleTxnId;
            CaptureResponse captureresponse = litle.Capture(capture);
            Assert.AreEqual("000", captureresponse.Response);
            Assert.AreEqual("Approved", captureresponse.Message);

            Credit credit = new Credit();
            credit.LitleTxnId = captureresponse.LitleTxnId;
            CreditResponse creditResponse = litle.Credit(credit);
            Assert.AreEqual("000", creditResponse.Response);
            Assert.AreEqual("Approved", creditResponse.Message);

            VoidTxn newvoid = new VoidTxn();
            newvoid.LitleTxnId = creditResponse.LitleTxnId;
            LitleOnlineResponseTransactionResponseVoidResponse voidResponse = litle.DoVoid(newvoid);
            Assert.AreEqual("000",voidResponse.Response);
            Assert.AreEqual("Approved",voidResponse.Message);
        }
        public void testLitleOnlineException()
        {
            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 = "4100000000000002";
            card.ExpDate = "1210";
            authorization.Card = card;

            var mock = new Mock<Communications>();

            mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*?<litleOnlineRequest.*?<authorization.*?<card>.*?<number>4100000000000002</number>.*?</card>.*?</authorization>.*?", RegexOptions.Singleline), It.IsAny<Dictionary<String, String>>()))
                .Returns("<litleOnlineResponse version='8.10' response='1' message='Error validating xml data against the schema' xmlns='http://www.litle.com/schema'><authorizationResponse><litleTxnId>123</litleTxnId></authorizationResponse></litleOnlineResponse>");

            Communications mockedCommunication = mock.Object;
            litle.SetCommunication(mockedCommunication);
            try
            {
                litle.Authorize(authorization);
            }
            catch (LitleOnlineException e)
            {
                Assert.AreEqual("Error validating xml data against the schema", e.Message);
            }
        }
        public void test7AVS()
        {
            Authorization authorization = new Authorization();
            authorization.OrderId = "7";
            authorization.Amount = 0;
            authorization.OrderSource = OrderSourceType.Ecommerce;
            Contact contact = new Contact();
            contact.Name = "Jane Murray";
            contact.AddressLine1 = "7 Main St.";
            contact.City = "Amesbury";
            contact.State = "MA";
            contact.Zip = "01913";
            contact.Country = CountryTypeEnum.US;
            authorization.BillToAddress = contact;
            CardType card = new CardType();
            card.Type = MethodOfPaymentTypeEnum.MC;
            card.Number = "5112010100000002";
            card.ExpDate = "0712";
            card.CardValidationNum = "251";
            authorization.Card = card;

            AuthorizationResponse response = litle.Authorize(authorization);
            Assert.AreEqual("301", response.Response);
            Assert.AreEqual("Invalid Account Number", response.Message);
            Assert.AreEqual("34", response.FraudResult.AvsResult);
            Assert.AreEqual("N", response.FraudResult.CardValidationResult);
        }
        public void test5AVS()
        {
            Authorization authorization = new Authorization();
            authorization.OrderId = "5";
            authorization.Amount = 0;
            authorization.OrderSource = OrderSourceType.Ecommerce;
            CardType card = new CardType();
            card.Type = MethodOfPaymentTypeEnum.VI;
            card.Number = "4457010200000007";
            card.ExpDate = "0512";
            card.CardValidationNum = "463";
            authorization.Card = card;
            FraudCheckType authenticationvalue = new FraudCheckType();
            authenticationvalue.AuthenticationValue = "BwABBJQ1AgAAAAAgJDUCAAAAAAA=";
            authorization.CardholderAuthentication = authenticationvalue;

            AuthorizationResponse response = litle.Authorize(authorization);
            Assert.AreEqual("000", response.Response);
            Assert.AreEqual("Approved", response.Message);
            Assert.AreEqual("55555 ", response.AuthCode);
            Assert.AreEqual("32", response.FraudResult.AvsResult);
            Assert.AreEqual("N", response.FraudResult.CardValidationResult);
        }
        public void test4AVS()
        {
            Authorization authorization = new Authorization();
            authorization.OrderId = "4";
            authorization.Amount = 0;
            authorization.OrderSource = OrderSourceType.Ecommerce;
            Contact contact = new Contact();
            contact.Name = "Bob Black";
            contact.AddressLine1 = "4 Main St.";
            contact.City = "Laurel";
            contact.State = "MD";
            contact.Zip = "20708";
            contact.Country = CountryTypeEnum.US;
            authorization.BillToAddress = contact;
            CardType card = new CardType();
            card.Type = MethodOfPaymentTypeEnum.AX;
            card.Number = "375001000000005";
            card.ExpDate = "0412";
            card.CardValidationNum = "758";
            authorization.Card = card;

            AuthorizationResponse response = litle.Authorize(authorization);
            Assert.AreEqual("000", response.Response);
            Assert.AreEqual("Approved", response.Message);
            Assert.AreEqual("44444", response.AuthCode);
            Assert.AreEqual("12", response.FraudResult.AvsResult);
        }
        public void test30()
        {
            Authorization authorization = new Authorization();
            authorization.OrderId = "30";
            authorization.Amount = 20000;
            authorization.OrderSource = OrderSourceType.Ecommerce;
            CardType card = new CardType();
            card.Type = MethodOfPaymentTypeEnum.VI;
            card.Number = "4024720001231239";
            card.ExpDate = "1212";
            authorization.Card = card;
            authorization.AllowPartialAuth = true;
            HealthcareIIAS healthcareiias = new HealthcareIIAS();
            HealthcareAmounts healthcareamounts = new HealthcareAmounts();
            healthcareamounts.TotalHealthcareAmount = 20000;
            healthcareamounts.RxAmount = 1000;
            healthcareamounts.VisionAmount = 19901;
            healthcareamounts.ClinicOtherAmount = 9050;
            healthcareamounts.DentalAmount = 1049;
            healthcareiias.HealthcareAmounts = healthcareamounts;
            healthcareiias.IIASFlag = IIASFlagType.Y;
            authorization.HealthcareIIAS = healthcareiias;

            AuthorizationResponse response = litle.Authorize(authorization);
            Assert.AreEqual("341", response.Response);
            Assert.AreEqual("Invalid healthcare amounts", response.Message);
        }
        public void test28()
        {
            Authorization authorization = new Authorization();
            authorization.OrderId = "28";
            authorization.Amount = 15000;
            authorization.OrderSource = OrderSourceType.Ecommerce;
            CardType card = new CardType();
            card.Type = MethodOfPaymentTypeEnum.MC;
            card.Number = "5194560012341234";
            card.ExpDate = "1212";
            authorization.Card = card;
            authorization.AllowPartialAuth = true;
            HealthcareIIAS healthcareiias = new HealthcareIIAS();
            HealthcareAmounts healthcareamounts = new HealthcareAmounts();
            healthcareamounts.TotalHealthcareAmount = 15000;
            healthcareamounts.RxAmount = 3698;
            healthcareiias.HealthcareAmounts = healthcareamounts;
            healthcareiias.IIASFlag = IIASFlagType.Y;
            authorization.HealthcareIIAS = healthcareiias;

            AuthorizationResponse response = litle.Authorize(authorization);
            Assert.AreEqual("000", response.Response);
            Assert.AreEqual("Approved", response.Message);
        }
        public void test25()
        {
            Authorization authorization = new Authorization();
            authorization.OrderId = "25";
            authorization.Amount = 5000;
            authorization.OrderSource = OrderSourceType.Ecommerce;
            CardType card = new CardType();
            card.Type = MethodOfPaymentTypeEnum.VI;
            card.Number = "4100204446270000";
            card.ExpDate = "1112";
            authorization.Card = card;

            AuthorizationResponse response = litle.Authorize(authorization);
            Assert.AreEqual("000", response.Response);
            Assert.AreEqual("Approved", response.Message);
            Assert.AreEqual("BRA", response.EnhancedAuthResponse.IssuerCountry);
        }
        public void test24()
        {
            Authorization authorization = new Authorization();
            authorization.OrderId = "24";
            authorization.Amount = 5000;
            authorization.OrderSource = OrderSourceType.Ecommerce;
            CardType card = new CardType();
            card.Type = MethodOfPaymentTypeEnum.MC;
            card.Number = "5112010202000108";
            card.ExpDate = "0812";
            authorization.Card = card;

            AuthorizationResponse response = litle.Authorize(authorization);
            Assert.AreEqual("000", response.Response);
            Assert.AreEqual("Approved", response.Message);
            Assert.AreEqual(AffluenceTypeEnum.Massaffluent, response.EnhancedAuthResponse.Affluence);
        }
        public AuthorizationResponse Authorize(Authorization auth)
        {
            LitleOnlineRequest request = CreateLitleOnlineRequest();
            FillInReportGroup(auth);
            request.Authorization = auth;

            LitleOnlineResponse response = SendToLitle(request);
            return response.AuthorizationResponse;
        }
        public void test3AVS()
        {
            Authorization authorization = new Authorization();
            authorization.OrderId = "3";
            authorization.Amount = 0;
            authorization.OrderSource = OrderSourceType.Ecommerce;
            Contact contact = new Contact();
            contact.Name = "Eileen Jones";
            contact.AddressLine1 = "3 Main St.";
            contact.City = "Bloomfield";
            contact.State = "CT";
            contact.Zip = "06002";
            contact.Country = CountryTypeEnum.US;
            authorization.BillToAddress = contact;
            CardType card = new CardType();
            card.Type = MethodOfPaymentTypeEnum.DI;
            card.Number = "6011010000000003";
            card.ExpDate = "0312";
            card.CardValidationNum = "758";
            authorization.Card = card;

            AuthorizationResponse response = litle.Authorize(authorization);
            Assert.AreEqual("000", response.Response);
            Assert.AreEqual("Approved", response.Message);
            Assert.AreEqual("33333", response.AuthCode);
            Assert.AreEqual("10", response.FraudResult.AvsResult);
            Assert.AreEqual("M", response.FraudResult.CardValidationResult);
        }
        public void test31()
        {
            Authorization authorization = new Authorization();
            authorization.OrderId = "31";
            authorization.Amount = 25000;
            authorization.OrderSource = OrderSourceType.Ecommerce;
            CardType card = new CardType();
            card.Type = MethodOfPaymentTypeEnum.VI;
            card.Number = "4024720001231239";
            card.ExpDate = "1212";
            authorization.Card = card;
            authorization.AllowPartialAuth = true;
            HealthcareIIAS healthcareiias = new HealthcareIIAS();
            HealthcareAmounts healthcareamounts = new HealthcareAmounts();
            healthcareamounts.TotalHealthcareAmount = 18699;
            healthcareamounts.RxAmount = 1000;
            healthcareamounts.VisionAmount = 15099;
            healthcareiias.HealthcareAmounts = healthcareamounts;
            healthcareiias.IIASFlag = IIASFlagType.Y;
            authorization.HealthcareIIAS = healthcareiias;

            AuthorizationResponse response = litle.Authorize(authorization);
            Assert.AreEqual("010", response.Response);
            Assert.AreEqual("Partially Approved", response.Message);
            Assert.AreEqual("18699", response.ApprovedAmount);
        }
        public void test4Auth()
        {
            Authorization authorization = new Authorization();
            authorization.OrderId = "4";
            authorization.Amount = 40040;
            authorization.OrderSource = OrderSourceType.Ecommerce;
            Contact contact = new Contact();
            contact.Name = "Bob Black";
            contact.AddressLine1 = "4 Main St.";
            contact.City = "Laurel";
            contact.State = "MD";
            contact.Zip = "20708";
            contact.Country = CountryTypeEnum.US;
            authorization.BillToAddress = contact;
            CardType card = new CardType();
            card.Type = MethodOfPaymentTypeEnum.AX;
            card.Number = "375001000000005";
            card.ExpDate = "0412";
            card.CardValidationNum = "758";
            authorization.Card = card;

            AuthorizationResponse response = litle.Authorize(authorization);
            Assert.AreEqual("000", response.Response);
            Assert.AreEqual("Approved", response.Message);
            Assert.AreEqual("44444", response.AuthCode);
            Assert.AreEqual("12", response.FraudResult.AvsResult);

            Capture capture = new Capture();
            capture.LitleTxnId = response.LitleTxnId;
            CaptureResponse captureresponse = litle.Capture(capture);
            Assert.AreEqual("000", captureresponse.Response);
            Assert.AreEqual("Approved", captureresponse.Message);

            Credit credit = new Credit();
            credit.LitleTxnId = captureresponse.LitleTxnId;
            CreditResponse creditResponse = litle.Credit(credit);
            Assert.AreEqual("000", creditResponse.Response);
            Assert.AreEqual("Approved", creditResponse.Message);

            VoidTxn newvoid = new VoidTxn();
            newvoid.LitleTxnId = creditResponse.LitleTxnId;
            LitleOnlineResponseTransactionResponseVoidResponse voidResponse = litle.DoVoid(newvoid);
            Assert.AreEqual("000", voidResponse.Response);
            Assert.AreEqual("Approved", voidResponse.Message);
        }
        public void test8AVS()
        {
            Authorization authorization = new Authorization();
            authorization.OrderId = "8";
            authorization.Amount = 0;
            authorization.OrderSource = OrderSourceType.Ecommerce;
            Contact contact = new Contact();
            contact.Name = "Mark Johnson";
            contact.AddressLine1 = "8 Main St.";
            contact.City = "Manchester";
            contact.State = "NH";
            contact.Zip = "03101";
            contact.Country = CountryTypeEnum.US;
            authorization.BillToAddress = contact;
            CardType card = new CardType();
            card.Type = MethodOfPaymentTypeEnum.DI;
            card.Number = "6011010100000002";
            card.ExpDate = "0812";
            card.CardValidationNum = "184";
            authorization.Card = card;

            AuthorizationResponse response = litle.Authorize(authorization);
            Assert.AreEqual("123", response.Response);
            Assert.AreEqual("Call Discover", response.Message);
            Assert.AreEqual("34", response.FraudResult.AvsResult);
            Assert.AreEqual("P", response.FraudResult.CardValidationResult);
        }
        public void test5Auth()
        {
            Authorization authorization = new Authorization();
            authorization.OrderId = "5";
            authorization.Amount = 50050;
            authorization.OrderSource = OrderSourceType.Ecommerce;
            CardType card = new CardType();
            card.Type = MethodOfPaymentTypeEnum.VI;
            card.Number = "4457010200000007";
            card.ExpDate = "0512";
            card.CardValidationNum = "463";
            authorization.Card = card;
            FraudCheckType authenticationvalue = new FraudCheckType();
            authenticationvalue.AuthenticationValue = "BwABBJQ1AgAAAAAgJDUCAAAAAAA=";
            authorization.CardholderAuthentication = authenticationvalue;

            AuthorizationResponse response = litle.Authorize(authorization);
            Assert.AreEqual("000", response.Response);
            Assert.AreEqual("Approved", response.Message);
            Assert.AreEqual("55555 ", response.AuthCode);
            Assert.AreEqual("32", response.FraudResult.AvsResult);
            Assert.AreEqual("N", response.FraudResult.CardValidationResult);

            Capture capture = new Capture();
            capture.LitleTxnId = response.LitleTxnId;
            CaptureResponse captureresponse = litle.Capture(capture);
            Assert.AreEqual("000", captureresponse.Response);
            Assert.AreEqual("Approved", captureresponse.Message);

            Credit credit = new Credit();
            credit.LitleTxnId = captureresponse.LitleTxnId;
            CreditResponse creditResponse = litle.Credit(credit);
            Assert.AreEqual("000", creditResponse.Response);
            Assert.AreEqual("Approved", creditResponse.Message);

            VoidTxn newvoid = new VoidTxn();
            newvoid.LitleTxnId = creditResponse.LitleTxnId;
            LitleOnlineResponseTransactionResponseVoidResponse voidResponse = litle.DoVoid(newvoid);
            Assert.AreEqual("000", voidResponse.Response);
            Assert.AreEqual("Approved", voidResponse.Message);
        }
        public void InvalidCredientialsBatch()
        {
            LitleRequest litleIC = new LitleRequest(invalidConfig);

            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; //This needs to compile

            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; //This needs to compile

            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);

            litleIC.AddBatch(litleBatchRequest);

            string batchName = litleIC.SendToLitle();

            litleIC.BlockAndWaitForResponse(batchName, 60*1000*5);

            try
            {
                LitleResponse litleResponse = 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);
            }
        }
        public void test6Auth()
        {
            Authorization authorization = new Authorization();
            authorization.OrderId = "6";
            authorization.Amount = 60060;
            authorization.OrderSource = OrderSourceType.Ecommerce;
            Contact contact = new Contact();
            contact.Name = "Joe Green";
            contact.AddressLine1 = "6 Main St.";
            contact.City = "Derry";
            contact.State = "NH";
            contact.Zip = "03038";
            contact.Country = CountryTypeEnum.US;
            authorization.BillToAddress = contact;
            CardType card = new CardType();
            card.Type = MethodOfPaymentTypeEnum.VI;
            card.Number = "4457010100000008";
            card.ExpDate = "0612";
            card.CardValidationNum = "992";
            authorization.Card = card;

            AuthorizationResponse response = litle.Authorize(authorization);
            Assert.AreEqual("110", response.Response);
            Assert.AreEqual("Insufficient Funds", response.Message);
            Assert.AreEqual("34", response.FraudResult.AvsResult);
            Assert.AreEqual("P", response.FraudResult.CardValidationResult);
        }
        public void Test1AVS()
        {
            Authorization authorization = new Authorization();
            authorization.OrderId = "1";
            authorization.Amount = 0;
            authorization.OrderSource = OrderSourceType.Ecommerce;
            Contact contact = new Contact();
            contact.Name = "John Smith";
            contact.AddressLine1 = "1 Main St.";
            contact.City = "Burlington";
            contact.State = "MA";
            contact.Zip = "01803-3747";
            contact.Country = CountryTypeEnum.US;
            authorization.BillToAddress = contact;
            CardType card = new CardType();
            card.Type = MethodOfPaymentTypeEnum.VI;
            card.Number = "4457010000000009";
            card.ExpDate = "0112";
            card.CardValidationNum = "349";
            authorization.Card = card;

            AuthorizationResponse response = litle.Authorize(authorization);
            Assert.AreEqual("000", response.Response);
            Assert.AreEqual("Approved", response.Message);
            Assert.AreEqual("11111 ", response.AuthCode);
            Assert.AreEqual("01", response.FraudResult.AvsResult);
            Assert.AreEqual("M", response.FraudResult.CardValidationResult);
        }
        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;

            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);
            }
        }
        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);

            EcheckPreNoteSale echeckPreNoteSaleObj1 = new EcheckPreNoteSale();
            echeckPreNoteSaleObj1.OrderId = "12345";
            echeckPreNoteSaleObj1.OrderSource = OrderSourceType.Ecommerce;
            echeckPreNoteSaleObj1.Echeck = echeck;
            echeckPreNoteSaleObj1.BillToAddress = billToAddress;

            litleBatchRequest.AddEcheckPreNoteSale(echeckPreNoteSaleObj1);

            EcheckPreNoteSale echeckPreNoteSaleObj2 = new EcheckPreNoteSale();
            echeckPreNoteSaleObj2.OrderId = "12345";
            echeckPreNoteSaleObj2.OrderSource = OrderSourceType.Ecommerce;
            echeckPreNoteSaleObj2.Echeck = echeck2;
            echeckPreNoteSaleObj2.BillToAddress = billToAddress2;

            litleBatchRequest.AddEcheckPreNoteSale(echeckPreNoteSaleObj2);

            EcheckPreNoteCredit echeckPreNoteCreditObj1 = new EcheckPreNoteCredit();
            echeckPreNoteCreditObj1.OrderId = "12345";
            echeckPreNoteCreditObj1.OrderSource = OrderSourceType.Ecommerce;
            echeckPreNoteCreditObj1.Echeck = echeck;
            echeckPreNoteCreditObj1.BillToAddress = billToAddress;

            litleBatchRequest.AddEcheckPreNoteCredit(echeckPreNoteCreditObj1);

            EcheckPreNoteCredit echeckPreNoteCreditObj2 = new EcheckPreNoteCredit();
            echeckPreNoteCreditObj2.OrderId = "12345";
            echeckPreNoteCreditObj2.OrderSource = OrderSourceType.Ecommerce;
            echeckPreNoteCreditObj2.Echeck = echeck2;
            echeckPreNoteCreditObj2.BillToAddress = billToAddress2;

            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);

            string batchName = litle.SendToLitle();

            litle.BlockAndWaitForResponse(batchName, estimatedResponseTime(2 * 2, 10 * 2));

            LitleResponse litleResponse = litle.ReceiveFromLitle(batchName);

            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();
                }

                EcheckPreNoteSaleResponse echeckPreNoteSaleResponse = litleBatchResponse.NextEcheckPreNoteSaleResponse();
                while (echeckPreNoteSaleResponse != null)
                {
                    Assert.AreEqual("000", echeckPreNoteSaleResponse.Response);

                    echeckPreNoteSaleResponse = litleBatchResponse.NextEcheckPreNoteSaleResponse();
                }

                EcheckPreNoteCreditResponse echeckPreNoteCreditResponse = litleBatchResponse.NextEcheckPreNoteCreditResponse();
                while (echeckPreNoteCreditResponse != null)
                {
                    Assert.AreEqual("000", echeckPreNoteCreditResponse.Response);

                    echeckPreNoteCreditResponse = litleBatchResponse.NextEcheckPreNoteCreditResponse();
                }

                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();
            }
        }
        public void test9AVS()
        {
            Authorization authorization = new Authorization();
            authorization.OrderId = "9";
            authorization.Amount = 0;
            authorization.OrderSource = OrderSourceType.Ecommerce;
            Contact contact = new Contact();
            contact.Name = "James Miller";
            contact.AddressLine1 = "9 Main St.";
            contact.City = "Boston";
            contact.State = "MA";
            contact.Zip = "02134";
            contact.Country = CountryTypeEnum.US;
            authorization.BillToAddress = contact;
            CardType card = new CardType();
            card.Type = MethodOfPaymentTypeEnum.AX;
            card.Number = "375001010000003";
            card.ExpDate = "0912";
            card.CardValidationNum = "0421";
            authorization.Card = card;

            AuthorizationResponse response = litle.Authorize(authorization);
            Assert.AreEqual("303", response.Response);
            Assert.AreEqual("Pick Up Card", response.Message);
            Assert.AreEqual("34", response.FraudResult.AvsResult);
        }
        public void Test1Auth()
        {
            Authorization authorization = new Authorization();
            authorization.OrderId = "1";
            authorization.Amount = 10010;
            authorization.OrderSource = OrderSourceType.Ecommerce;
            Contact contact = new Contact();
            contact.Name = "John Smith";
            contact.AddressLine1 = "1 Main St.";
            contact.City = "Burlington";
            contact.State = "MA";
            contact.Zip = "01803-3747";
            contact.Country = CountryTypeEnum.US;
            authorization.BillToAddress = contact;
            CardType card = new CardType();
            card.Type = MethodOfPaymentTypeEnum.VI;
            card.Number = "4457010000000009";
            card.ExpDate = "0112";
            card.CardValidationNum = "349";
            authorization.Card = card;

            AuthorizationResponse response = litle.Authorize(authorization);
            Assert.AreEqual("000", response.Response);
            Assert.AreEqual("Approved", response.Message);
            Assert.AreEqual("11111 ", response.AuthCode);
            Assert.AreEqual("01", response.FraudResult.AvsResult);
            Assert.AreEqual("M", response.FraudResult.CardValidationResult);

            Capture capture = new Capture();
            capture.LitleTxnId = response.LitleTxnId;
            CaptureResponse captureResponse = litle.Capture(capture);
            Assert.AreEqual("000", captureResponse.Response);
            Assert.AreEqual("Approved", captureResponse.Message);

            Credit credit = new Credit();
            credit.LitleTxnId = captureResponse.LitleTxnId;
            CreditResponse creditResponse = litle.Credit(credit);
            Assert.AreEqual("000", creditResponse.Response);
            Assert.AreEqual("Approved", creditResponse.Message);

            VoidTxn newvoid = new VoidTxn();
            newvoid.LitleTxnId = creditResponse.LitleTxnId;
            LitleOnlineResponseTransactionResponseVoidResponse voidResponse = litle.DoVoid(newvoid);
            Assert.AreEqual("000", voidResponse.Response);
            Assert.AreEqual("Approved", voidResponse.Message);
        }