public void testAccountUpdate()
        {
            AccountUpdate accountUpdate = new AccountUpdate();
            accountUpdate.ReportGroup = "Planets";
            accountUpdate.OrderId = "12344";
            CardType card = new CardType();
            card.Type = MethodOfPaymentTypeEnum.VI;
            card.Number = "4100000000000002";
            card.ExpDate = "1210";
            accountUpdate.Card = card;

            var mockLitleResponse = new Mock<LitleResponse>();
            var mockLitleXmlSerializer = new Mock<LitleXmlSerializer>();

            mockXmlReader.SetupSequence(XmlReader => XmlReader.ReadOuterXml())
                .Returns("<accountUpdateResponse reportGroup=\"Merch01ReportGrp\" xmlns=\"http://www.litle.com/schema\"><litleTxnId>123</litleTxnId><orderId>MERCH01-0002</orderId><response>000</response><responseTime>2010-04-11T15:44:26</responseTime><message>Approved</message></accountUpdateResponse>")
                .Returns("<accountUpdateResponse reportGroup=\"Merch01ReportGrp\" xmlns=\"http://www.litle.com/schema\"><litleTxnId>124</litleTxnId><orderId>MERCH01-0002</orderId><response>000</response><responseTime>2010-04-11T15:44:26</responseTime><message>Approved</message></accountUpdateResponse>");

            BatchResponse mockLitleBatchResponse = new BatchResponse();
            mockLitleBatchResponse.SetAccountUpdateResponseReader(mockXmlReader.Object);

            mockLitleResponse.Setup(litleResponse => litleResponse.NextBatchResponse()).Returns(mockLitleBatchResponse);
            LitleResponse mockedLitleResponse = mockLitleResponse.Object;

            mockLitleXmlSerializer.Setup(litleXmlSerializer => litleXmlSerializer.DeserializeObjectFromFile(It.IsAny<String>())).Returns(mockedLitleResponse);

            Communications mockedCommunication = mockCommunications.Object;
            litle.SetCommunication(mockedCommunication);

            LitleXmlSerializer mockedLitleXmlSerializer = mockLitleXmlSerializer.Object;
            litle.SetLitleXmlSerializer(mockedLitleXmlSerializer);

            LitleFile mockedLitleFile = mockLitleFile.Object;
            litle.SetLitleFile(mockedLitleFile);

            litle.SetLitleTime(mockLitleTime.Object);

            BatchRequest litleBatchRequest = new BatchRequest();
            litleBatchRequest.SetLitleFile(mockedLitleFile);
            litleBatchRequest.SetLitleTime(mockLitleTime.Object);
            litleBatchRequest.AddAccountUpdate(accountUpdate);
            litleBatchRequest.AddAccountUpdate(accountUpdate);
            litle.AddBatch(litleBatchRequest);

            string batchFileName = litle.SendToLitle();
            LitleResponse actualLitleResponse = litle.ReceiveFromLitle(batchFileName);
            BatchResponse actualLitleBatchResponse = actualLitleResponse.NextBatchResponse();
            AccountUpdateResponse actualAccountUpdateResponse1 = actualLitleBatchResponse.NextAccountUpdateResponse();
            AccountUpdateResponse actualAccountUpdateResponse2 = actualLitleBatchResponse.NextAccountUpdateResponse();
            AccountUpdateResponse nullAccountUpdateResponse = actualLitleBatchResponse.NextAccountUpdateResponse();

            Assert.AreEqual(123, actualAccountUpdateResponse1.LitleTxnId);
            Assert.AreEqual("000", actualAccountUpdateResponse1.Response);
            Assert.AreEqual(124, actualAccountUpdateResponse2.LitleTxnId);
            Assert.AreEqual("000", actualAccountUpdateResponse2.Response);
            Assert.IsNull(nullAccountUpdateResponse);

            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 authInfo()
 {
     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;
     FraudResult fraudresult = new FraudResult();
     fraudresult.AvsResult = "12";
     fraudresult.CardValidationResult = "123";
     fraudresult.AuthenticationResult = "1";
     fraudresult.AdvancedAVSResult = "123";
     authInfo.FraudResult = fraudresult;
     capturegivenauth.AuthInformation = authInfo;
     capturegivenauth.OrderSource = OrderSourceType.Ecommerce;
     CardType card = new CardType();
     card.Type = MethodOfPaymentTypeEnum.VI;
     card.Number = "4100000000000000";
     card.ExpDate = "1210";
     capturegivenauth.Card=card;
     CaptureGivenAuthResponse response = litle.CaptureGivenAuth(capturegivenauth);
     Assert.AreEqual("Approved", response.Message);
 }
 public void complexCaptureGivenAuth()
 {
     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;
     Contact contact = new Contact();
     contact.Name = "Bob";
     contact.City = "lowell";
     contact.State = "MA";
     contact.Email ="litle.com";
     capturegivenauth.BillToAddress = contact;
     ProcessingInstructions processinginstructions = new ProcessingInstructions();
     processinginstructions.BypassVelocityCheck = true;
     capturegivenauth.ProcessingInstructions = processinginstructions;
     capturegivenauth.OrderSource = OrderSourceType.Ecommerce;
     CardType card = new CardType();
     card.Type = MethodOfPaymentTypeEnum.VI;
     card.Number = "4100000000000000";
     card.ExpDate = "1210";
     capturegivenauth.Card = card;
     CaptureGivenAuthResponse response = litle.CaptureGivenAuth(capturegivenauth);
     Assert.AreEqual("Approved", response.Message);
 }
 public void simpleForceCaptureWithCard()
 {
     ForceCapture forcecapture = new ForceCapture();
     forcecapture.Amount = 106;
     forcecapture.OrderId = "12344";
     forcecapture.OrderSource = OrderSourceType.Ecommerce;
     CardType card = new CardType();
     card.Type = MethodOfPaymentTypeEnum.VI;
     card.Number = "4100000000000001";
     card.ExpDate = "1210";
     forcecapture.Card = card;
     ForceCaptureResponse response = litle.ForceCapture(forcecapture);
     Assert.AreEqual("Approved", response.Message);
 }
        public void SimpleSaleWithCard()
        {
            Sale saleObj = new Sale();
            saleObj.Amount = 106;
            saleObj.LitleTxnId = 123456;
            saleObj.OrderId = "12344";
            saleObj.OrderSource = OrderSourceType.Ecommerce;
            CardType cardObj = new CardType();
            cardObj.Type = MethodOfPaymentTypeEnum.VI;
            cardObj.Number = "4100000000000000";
            cardObj.ExpDate = "1210";
            saleObj.Card = cardObj;

            SaleResponse responseObj = litle.Sale(saleObj);
            StringAssert.AreEqualIgnoringCase("Approved", responseObj.Message);
        }
        public void PaypalNotes()
        {
            Credit creditObj = new Credit();
            creditObj.Amount = 106;
            creditObj.OrderId = "123456";
            creditObj.PayPalNotes = "Hello";
            creditObj.OrderSource = OrderSourceType.Ecommerce;

            CardType card = new CardType();
            card.Type = MethodOfPaymentTypeEnum.VI;
            card.Number = "4100000000000001";
            card.ExpDate = "1210";

            creditObj.Card = card;

            CreditResponse response = litle.Credit(creditObj);
            Assert.AreEqual("Approved", response.Message);
        }
        public void test11()
        {
            Authorization authorization = new Authorization();
            authorization.OrderId = "11";
            authorization.Amount = 60000;
            authorization.OrderSource = OrderSourceType.Ecommerce;
            CardType card = new CardType();
            card.Type = MethodOfPaymentTypeEnum.MC;
            card.Number = "5112010140000004";
            card.ExpDate = "1111";
            authorization.Card = card;
            authorization.AllowPartialAuth = true;

            AuthorizationResponse response = litle.Authorize(authorization);
            Assert.AreEqual("010", response.Response);
            Assert.AreEqual("Partially Approved", response.Message);
            Assert.AreEqual("48000", response.ApprovedAmount);
        }
        public void testAddAccountUpdate()
        {
            AccountUpdate accountUpdate = new AccountUpdate();
            accountUpdate.ReportGroup = "Planets";
            accountUpdate.OrderId = "12344";
            CardType card = new CardType();
            card.Type = MethodOfPaymentTypeEnum.VI;
            card.Number = "4100000000000002";
            card.ExpDate = "1210";
            accountUpdate.Card = card;

            batchRequest.AddAccountUpdate(accountUpdate);

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

            mockLitleFile.Verify(litleFile => litleFile.CreateRandomFile(It.IsAny<String>(), It.IsAny<String>(), It.IsAny<String>(), mockLitleTime.Object));
            mockLitleFile.Verify(litleFile => litleFile.AppendLineToFile(mockFilePath, accountUpdate.Serialize()));
        }
        public void accountUpdateBatch()
        {
            BatchRequest litleBatchRequest = new BatchRequest();

            AccountUpdate accountUpdate1 = new AccountUpdate();
            accountUpdate1.OrderId = "1111";
            CardType card = new CardType();
            card.Type = MethodOfPaymentTypeEnum.VI;
            card.Number = "414100000000000000";
            card.ExpDate = "1210";
            accountUpdate1.Card = card;

            litleBatchRequest.AddAccountUpdate(accountUpdate1);

            AccountUpdate accountUpdate2 = new AccountUpdate();
            accountUpdate2.OrderId = "1112";
            accountUpdate2.Card = card;

            litleBatchRequest.AddAccountUpdate(accountUpdate2);

            litle.AddBatch(litleBatchRequest);
            string batchName = litle.SendToLitle();

            litle.BlockAndWaitForResponse(batchName, estimatedResponseTime(0, 1 * 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)
            {
                AccountUpdateResponse accountUpdateResponse = litleBatchResponse.NextAccountUpdateResponse();
                while (accountUpdateResponse != null)
                {
                    Assert.AreEqual("301", accountUpdateResponse.Response);

                    accountUpdateResponse = litleBatchResponse.NextAccountUpdateResponse();
                }
                litleBatchResponse = litleResponse.NextBatchResponse();
            }
        }
        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 ProcessingInstructionAndAmexData()
        {
            Credit creditObj = new Credit();
            creditObj.Amount = 2000;
            creditObj.OrderId = "12344";
            creditObj.OrderSource = OrderSourceType.Ecommerce;

            ProcessingInstructions processingInstructionsObj = new ProcessingInstructions();
            processingInstructionsObj.BypassVelocityCheck = true;

            creditObj.ProcessingInstructions = processingInstructionsObj;

            CardType card = new CardType();
            card.Type = MethodOfPaymentTypeEnum.VI;
            card.Number = "4100000000000001";
            card.ExpDate = "1210";

            creditObj.Card = card;

            CreditResponse response = litle.Credit(creditObj);
            Assert.AreEqual("Approved", response.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 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 test4Sale()
        {
            Sale sale = new Sale();
            sale.OrderId = "4";
            sale.Amount = 40040;
            sale.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;
            sale.BillToAddress = contact;
            CardType card = new CardType();
            card.Type = MethodOfPaymentTypeEnum.AX;
            card.Number = "375001000000005";
            card.ExpDate = "0412";
            card.CardValidationNum = "758";
            sale.Card = card;

            SaleResponse response = litle.Sale(sale);
            Assert.AreEqual("000", response.Response);
            Assert.AreEqual("Approved", response.Message);
            Assert.AreEqual("44444", response.AuthCode);
            Assert.AreEqual("12", response.FraudResult.AvsResult);

            Credit credit = new Credit();
            credit.LitleTxnId = response.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 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 test3Sale()
        {
            Sale sale = new Sale();
            sale.OrderId = "3";
            sale.Amount = 30030;
            sale.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;
            sale.BillToAddress = contact;
            CardType card = new CardType();
            card.Type = MethodOfPaymentTypeEnum.DI;
            card.Number = "6011010000000003";
            card.ExpDate = "0312";
            card.CardValidationNum = "758";
            sale.Card = card;

            SaleResponse response = litle.Sale(sale);
            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);

            Credit credit = new Credit();
            credit.LitleTxnId = response.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 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 test8Sale()
        {
            Sale sale = new Sale();
            sale.OrderId = "8";
            sale.Amount = 80080;
            sale.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;
            sale.BillToAddress = contact;
            CardType card = new CardType();
            card.Type = MethodOfPaymentTypeEnum.DI;
            card.Number = "6011010100000002";
            card.ExpDate = "0812";
            card.CardValidationNum = "184";
            sale.Card = card;

            SaleResponse response = litle.Sale(sale);
            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 test6Sale()
        {
            Sale sale = new Sale();
            sale.OrderId = "6";
            sale.Amount = 60060;
            sale.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;
            sale.BillToAddress = contact;
            CardType card = new CardType();
            card.Type = MethodOfPaymentTypeEnum.VI;
            card.Number = "4457010100000008";
            card.ExpDate = "0612";
            card.CardValidationNum = "992";
            sale.Card = card;

            SaleResponse response = litle.Sale(sale);
            Assert.AreEqual("110", response.Response);
            Assert.AreEqual("Insufficient Funds", response.Message);
            Assert.AreEqual("34", response.FraudResult.AvsResult);
            Assert.AreEqual("P", response.FraudResult.CardValidationResult);

            VoidTxn newvoid = new VoidTxn();
            newvoid.LitleTxnId = response.LitleTxnId;
            LitleOnlineResponseTransactionResponseVoidResponse voidResponse = litle.DoVoid(newvoid);
            Assert.AreEqual("360", voidResponse.Response);
            Assert.AreEqual("No transaction found with specified litleTxnId", voidResponse.Message);
        }
        public void test5Sale()
        {
            Sale sale = new Sale();
            sale.OrderId = "5";
            sale.Amount = 50050;
            sale.OrderSource = OrderSourceType.Ecommerce;
            CardType card = new CardType();
            card.Type = MethodOfPaymentTypeEnum.VI;
            card.Number = "4457010200000007";
            card.ExpDate = "0512";
            card.CardValidationNum = "463";
            sale.Card = card;
            FraudCheckType authenticationvalue = new FraudCheckType();
            authenticationvalue.AuthenticationValue = "BwABBJQ1AgAAAAAgJDUCAAAAAAA=";
            sale.CardholderAuthentication = authenticationvalue;

            SaleResponse response = litle.Sale(sale);
            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);

            Credit credit = new Credit();
            credit.LitleTxnId = response.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 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 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 test7Sale()
        {
            Sale sale = new Sale();
            sale.OrderId = "7";
            sale.Amount = 70070;
            sale.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;
            sale.BillToAddress = contact;
            CardType card = new CardType();
            card.Type = MethodOfPaymentTypeEnum.MC;
            card.Number = "5112010100000002";
            card.ExpDate = "0712";
            card.CardValidationNum = "251";
            sale.Card = card;

            SaleResponse response = litle.Sale(sale);
            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 test1Sale()
        {
            Sale sale = new Sale();
            sale.OrderId = "1";
            sale.Amount = 10010;
            sale.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;
            sale.BillToAddress = contact;
            CardType card = new CardType();
            card.Type = MethodOfPaymentTypeEnum.VI;
            card.Number = "4457010000000009";
            card.ExpDate = "0112";
            card.CardValidationNum = "349";
            sale.Card = card;

            SaleResponse response = litle.Sale(sale);
            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);

            Credit credit = new Credit();
            credit.LitleTxnId = response.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 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 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 SimpleSaleWithInvalidFraudCheck()
        {
            Sale saleObj = new Sale();
            saleObj.Amount = 106;
            saleObj.LitleTxnId = 123456;
            saleObj.OrderId = "12344";
            saleObj.OrderSource = OrderSourceType.Ecommerce;
            CardType cardObj = new CardType();
            cardObj.Type = MethodOfPaymentTypeEnum.VI;
            cardObj.Number = "4100000000000000";
            cardObj.ExpDate = "1210";
            saleObj.Card = cardObj;
            FraudCheckType cardholderAuthentication = new FraudCheckType();
            cardholderAuthentication.AuthenticationValue = "123456789012345678901234567890123456789012345678901234567890";
            saleObj.CardholderAuthentication = cardholderAuthentication;

            try
            {
                SaleResponse responseObj = litle.Sale(saleObj);
            }
            catch (LitleOnlineException e)
            {
                Assert.True(e.Message.StartsWith("Error validating xml data against the schema"));
            }
        }
        public void test2Sale()
        {
            Sale sale = new Sale();
            sale.OrderId = "2";
            sale.Amount = 20020;
            sale.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;
            sale.BillToAddress = contact;
            CardType card = new CardType();
            card.Type = MethodOfPaymentTypeEnum.MC;
            card.Number = "5112010000000003";
            card.ExpDate = "0212";
            card.CardValidationNum = "261";
            sale.Card = card;
            FraudCheckType authenticationvalue = new FraudCheckType();
            authenticationvalue.AuthenticationValue = "BwABBJQ1AgAAAAAgJDUCAAAAAAA=";
            sale.CardholderAuthentication = authenticationvalue;

            SaleResponse response = litle.Sale(sale);
            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);

            Credit credit = new Credit();
            credit.LitleTxnId = response.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);
        }