예제 #1
0
        public void testSale()
        {
            sale sale = new sale();

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

            card.type    = methodOfPaymentTypeEnum.VI;
            card.number  = "4100000000000002";
            card.expDate = "1210";
            sale.card    = card;

            var mock = new Mock <Communications>();

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

            Communications mockedCommunication = mock.Object;

            litle.setCommunication(mockedCommunication);
            saleResponse saleresponse = litle.Sale(sale);

            Assert.AreEqual(123, saleresponse.litleTxnId);
        }
예제 #2
0
        public void test1Sale()
        {
            sale sale = new sale();

            sale.id          = "1";
            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.id         = response.id;
            credit.litleTxnId = response.litleTxnId;
            creditResponse creditResponse = litle.Credit(credit);

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


            voidTxn newvoid = new voidTxn();

            newvoid.id         = creditResponse.id;
            newvoid.litleTxnId = creditResponse.litleTxnId;
            litleOnlineResponseTransactionResponseVoidResponse voidResponse = litle.DoVoid(newvoid);

            Assert.AreEqual("000", voidResponse.response);
            Assert.AreEqual("Approved", voidResponse.message);
        }
예제 #3
0
        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);
        }
예제 #4
0
        public void TestFraudFilterOverride()
        {
            sale sale = new sale();

            sale.orderId             = "12344";
            sale.amount              = 2;
            sale.orderSource         = orderSourceType.ecommerce;
            sale.reportGroup         = "Planets";
            sale.fraudFilterOverride = false;

            var mock = new Mock <Communications>();

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

            Communications mockedCommunication = mock.Object;

            litle.setCommunication(mockedCommunication);
            litle.Sale(sale);
        }
예제 #5
0
        public void SimpleSaleWithCard()
        {
            var saleObj = new sale
            {
                id          = "1",
                amount      = 106,
                litleTxnId  = 123456,
                orderId     = "12344",
                orderSource = orderSourceType.ecommerce,
                card        = new cardType
                {
                    type    = methodOfPaymentTypeEnum.VI,
                    number  = "4100000000000000",
                    expDate = "1210"
                }
            };

            var responseObj = _litle.Sale(saleObj);

            StringAssert.AreEqualIgnoringCase("Approved", responseObj.message);
        }