Пример #1
0
        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);
        }
Пример #2
0
        public void test55()
        {
            authorization auth = new authorization();

            auth.id          = "1";
            auth.orderId     = "55";
            auth.amount      = 15000;
            auth.orderSource = orderSourceType.ecommerce;
            cardType card = new cardType();

            card.number            = "5435101234510196";
            card.expDate           = "1112";
            card.cardValidationNum = "987";
            card.type = methodOfPaymentTypeEnum.MC;
            auth.card = card;

            authorizationResponse response = litle.Authorize(auth);

            Assert.AreEqual("000", response.response);
            Assert.AreEqual("Approved", response.message);
            Assert.AreEqual("801", response.tokenResponse.tokenResponseCode);
            Assert.AreEqual("Account number was successfully registered", response.tokenResponse.tokenMessage);
            Assert.AreEqual(methodOfPaymentTypeEnum.MC, response.tokenResponse.type);
            Assert.AreEqual("543510", response.tokenResponse.bin);
        }
        public void test32()
        {
            authorization auth = new authorization();

            auth.id          = "1";
            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.id         = authorizeResponse.id;
            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.id         = authorizeResponse.id;
            reversal.litleTxnId = 320000000000000000;
            authReversalResponse reversalResponse = litle.AuthReversal(reversal);

            Assert.AreEqual("000", reversalResponse.response);
            Assert.AreEqual("Approved", reversalResponse.message);
        }
Пример #4
0
        public void SimpleAuthWithUnicode()
        {
            var authorization = new authorization
            {
                reportGroup = "русский中文",
                orderId     = "12344",
                amount      = 106,
                orderSource = orderSourceType.ecommerce,
                card        = new cardType
                {
                    type    = methodOfPaymentTypeEnum.VI,
                    number  = "4100000000000000",
                    expDate = "1210"
                },
                billToAddress = new contact
                {
                    addressLine1 = "Planetsрусский中文",
                    zip          = "01803-3747",
                    firstName    = "vvantiv"
                }
            };

            var response = _litle.Authorize(authorization);

            Assert.AreEqual("русский中文", response.reportGroup);
        }
Пример #5
0
        public void SimpleAuthWithCard()
        {
            authorization authorization = new authorization();

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

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

            customBilling cb = new customBilling();

            cb.phone = "1112223333"; //This needs to compile too

            authorizationResponse response = litle.Authorize(authorization);

            Assert.AreEqual("000", response.response);
        }
Пример #6
0
        public void Test1Auth()
        {
            authorization authorization = new authorization();

            authorization.id          = "1";
            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.id         = response.id;
            capture.litleTxnId = response.litleTxnId;
            captureResponse captureResponse = litle.Capture(capture);

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

            credit credit = new credit();

            credit.id         = captureResponse.id;
            credit.litleTxnId = captureResponse.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);
        }
Пример #7
0
        public void test14()
        {
            authorization authorization = new authorization();

            authorization.id          = "1";
            authorization.orderId     = "14";
            authorization.amount      = 3000;
            authorization.orderSource = orderSourceType.ecommerce;
            cardType card = new cardType();

            card.type          = methodOfPaymentTypeEnum.VI;
            card.number        = "4457010200000247";
            card.expDate       = "0812";
            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("NO", response.enhancedAuthResponse.fundingSource.reloadable);
            Assert.AreEqual("GIFT", response.enhancedAuthResponse.fundingSource.prepaidCardType);
        }
Пример #8
0
        public void SimpleAuthWithCard()
        {
            var authorization = new authorization
            {
                reportGroup = "Planets",
                orderId     = "1",
                amount      = 106,
                orderSource = orderSourceType.ecommerce,
                card        = new cardType
                {
                    type    = methodOfPaymentTypeEnum.VI,
                    number  = "414100000000000000",
                    expDate = "1210"
                },
                customBilling = new customBilling {
                    phone = "1112223333"
                }
            };

            var response = _litle.Authorize(authorization);

            Assert.AreEqual("000", response.response);
        }
        public void TestFraudFilterOverride()
        {
            authorization auth = new authorization();

            auth.orderId             = "12344";
            auth.amount              = 2;
            auth.orderSource         = orderSourceType.ecommerce;
            auth.reportGroup         = "Planets";
            auth.fraudFilterOverride = true;

            var mock = new Mock <Communications>();

            mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<fraudFilterOverride>true</fraudFilterOverride>.*", 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 authorizationResponse = litle.Authorize(auth);

            Assert.NotNull(authorizationResponse);
            Assert.AreEqual(123, authorizationResponse.litleTxnId);
        }