public void TestRecyclingDataOnVoidResponseIsOptional()
        {
            VoidTxn voidTxn = new VoidTxn();
            voidTxn.LitleTxnId = 123;

            var mock = new Mock<Communications>();

            mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*", RegexOptions.Singleline), It.IsAny<Dictionary<String, String>>()))
                .Returns("<litleOnlineResponse version='8.16' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><voidResponse><litleTxnId>123</litleTxnId><response>000</response><responseTime>2013-01-31T15:48:09</responseTime><postDate>2013-01-31</postDate><message>Approved</message></voidResponse></litleOnlineResponse>");

            Communications mockedCommunication = mock.Object;
            litle.SetCommunication(mockedCommunication);
            LitleOnlineResponseTransactionResponseVoidResponse response = litle.DoVoid(voidTxn);
            Assert.AreEqual(123, response.LitleTxnId);
            Assert.IsNull(response.Recycling);
        }
        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 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 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 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);
        }
        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 LitleOnlineResponseTransactionResponseVoidResponse DoVoid(VoidTxn v)
        {
            LitleOnlineRequest request = CreateLitleOnlineRequest();
            FillInReportGroup(v);
            request.VoidTxn = v;

            LitleOnlineResponse response = SendToLitle(request);
            return response.VoidResponse;
        }