Ejemplo n.º 1
0
        public void PosWithoutCapabilityAndEntryMode()
        {
            var authorization = new authorization
            {
                reportGroup = "Planets",
                orderId = "12",
                amount = 106,
                orderSource = orderSourceType.ecommerce,
                pos = new pos { cardholderId = posCardholderIdTypeEnum.pin },
                card = new cardType
                {
                    type = methodOfPaymentTypeEnum.VI,
                    number = "4100000000000002",
                    expDate = "1210"
                },
                customBilling = new customBilling { phone = "1112223333" }
            };

            try
            {
                _litle.Authorize(authorization);
                Assert.Fail("Exception is expected!");
            }
            catch (LitleOnlineException e)
            {
                Assert.True(e.Message.StartsWith("Error validating xml data against the schema"));
            }
        }
        public void Test3DsAuthenticatedShouldNotSayItem()
        {
            var auth = new authorization
            {
                orderId = "12344",
                amount = 2,
                orderSource = orderSourceType.item3dsAuthenticated,
                reportGroup = "Planets",
                billToAddress = new contact
                {
                    email = "*****@*****.**",
                    zip = "12345"
                }
            };

            var mock = new Mock<Communications>();

            mock.Setup(communications => communications.HttpPost(It.IsRegex(".*<amount>2</amount>.*<orderSource>3dsAuthenticated</orderSource>.*", RegexOptions.Singleline), It.IsAny<Dictionary<string, string>>()))
                .Returns("<litleOnlineResponse version='8.14' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><authorizationResponse><litleTxnId>123</litleTxnId></authorizationResponse></litleOnlineResponse>");

            var mockedCommunication = mock.Object;
            _litle.setCommunication(mockedCommunication);
            var authorizationResponse = _litle.Authorize(auth);

            Assert.NotNull(authorizationResponse);
            Assert.AreEqual(123, authorizationResponse.litleTxnId);
        }
Ejemplo n.º 3
0
        public void posWithoutCapabilityAndEntryMode()
        {
            var authorization = new authorization();
            authorization.reportGroup = "Planets";
            authorization.orderId = "12344";
            authorization.amount = 106;
            authorization.orderSource = orderSourceType.ecommerce;
            var pos = new pos();
            pos.cardholderId = posCardholderIdTypeEnum.pin;
            authorization.pos = pos;
            var card = new cardType();
            card.type = methodOfPaymentTypeEnum.VI;
            card.number = "4100000000000002";
            card.expDate = "1210";
            authorization.card = card; //This needs to compile

            var cb = new customBilling();
            cb.phone = "1112223333"; //This needs to compile too

            try
            {
                litle.Authorize(authorization);
                //expected exception;
            }
            catch (LitleOnlineException e)
            {
                Assert.True(e.Message.StartsWith("Error validating xml data against the schema"));
            }
        }
        public void TestAuth()
        {
            var authorization = new authorization();
            authorization.reportGroup = "Planets";
            authorization.orderId = "12344";
            authorization.amount = 106;
            authorization.orderSource = orderSourceType.ecommerce;
            var card = new cardType();
            card.type = methodOfPaymentTypeEnum.VI;
            card.number = "4100000000000002";
            card.expDate = "1210";
            authorization.card = card;

            var mock = new Mock<Communications>(_memoryStreams);

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

            var mockedCommunication = mock.Object;
            litle.setCommunication(mockedCommunication);
            var authorize = litle.Authorize(authorization);
            Assert.AreEqual(123, authorize.litleTxnId);
        }
Ejemplo n.º 5
0
        public void AuthWithAmpersand()
        {
            var authorization = new authorization
            {
                orderId = "7",
                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()
        {
            var authorization = new authorization();
            authorization.orderId = "12";
            authorization.amount = 50000;
            authorization.orderSource = orderSourceType.ecommerce;
            var card = new cardType();
            card.type = methodOfPaymentTypeEnum.AX;
            card.number = "375001014000009";
            card.expDate = "0412";
            authorization.card = card;
            authorization.allowPartialAuth = true;

            var response = litle.Authorize(authorization);
            Assert.AreEqual("010", response.response);
            Assert.AreEqual("Partially Approved", response.message);
            Assert.AreEqual("40000", response.approvedAmount);
        }
        public void test15()
        {
            var authorization = new authorization();
            authorization.orderId = "15";
            authorization.amount = 3000;
            authorization.orderSource = orderSourceType.ecommerce;
            var card = new cardType();
            card.type = methodOfPaymentTypeEnum.MC;
            card.number = "5500000254444445";
            card.expDate = "0312";
            authorization.card = card;

            var 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()
        {
            var auth = new authorization();
            auth.orderId = "32";
            auth.amount = 10010;
            auth.orderSource = orderSourceType.ecommerce;
            var 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;
            var card = new cardType();
            card.number = "4457010000000009";
            card.expDate = "0112";
            card.cardValidationNum = "349";
            card.type = methodOfPaymentTypeEnum.VI;
            auth.card = card;

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

            var capture = new capture();
            capture.litleTxnId = authorizeResponse.litleTxnId;
            capture.amount = 5005;
            var captureResponse = litle.Capture(capture);
            Assert.AreEqual("000", captureResponse.response);
            Assert.AreEqual("Approved", captureResponse.message);

            var reversal = new authReversal();
            reversal.litleTxnId = authorizeResponse.litleTxnId;
            var reversalResponse = litle.AuthReversal(reversal);
            Assert.AreEqual("111", reversalResponse.response);
            Assert.AreEqual("Authorization amount has already been depleted", reversalResponse.message);
        }
Ejemplo n.º 9
0
        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);
        }
Ejemplo n.º 10
0
        public void TestPrintxmlShouldDefaultToFalse()
        {
            config.Remove("printxml");

            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;

            authorizationResponse response = litle.Authorize(authorization);

            Assert.AreEqual("000", response.response);
        }
        public void TestOrigTxnIdAndOrigAmount()
        {
            var auth = new authorization
            {
                amount      = 584,
                orderSource = orderSourceType.ecommerce,
                originalNetworkTransactionId = "1234567890123456978901234567890",
                originalTransactionAmount    = 6478,
                reportGroup = "Planets"
            };

            var mock = new Mock <Communications>();

            mock.Setup(communications => communications.HttpPost(It.IsRegex(".*<amount>584</amount>\r\n<orderSource>ecommerce</orderSource>\r\n<originalNetworkTransactionId>1234567890123456978901234567890</originalNetworkTransactionId>\r\n<originalTransactionAmount>6478</originalTransactionAmount>.*", RegexOptions.Singleline), It.IsAny <Dictionary <string, string> >()))
            .Returns("<litleOnlineResponse version='9.12' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><authorizationResponse><litleTxnId>123</litleTxnId>><message>Approved</message></authorizationResponse></litleOnlineResponse>");

            var mockedCommunication = mock.Object;

            _litle.setCommunication(mockedCommunication);
            _litle.Authorize(auth);
        }
Ejemplo n.º 12
0
        public void test13()
        {
            var authorization = new authorization();

            authorization.orderId     = "13";
            authorization.amount      = 15000;
            authorization.orderSource = orderSourceType.ecommerce;
            var card = new cardType();

            card.type                      = methodOfPaymentTypeEnum.DI;
            card.number                    = "6011010140000004";
            card.expDate                   = "0812";
            authorization.card             = card;
            authorization.allowPartialAuth = true;

            var response = litle.Authorize(authorization);

            Assert.AreEqual("010", response.response);
            Assert.AreEqual("Partially Approved", response.message);
            Assert.AreEqual("12000", response.approvedAmount);
        }
Ejemplo n.º 13
0
        public void TestAuthHandleSpecialCharacters()
        {
            var authorization = new authorization
            {
                id          = "1",
                reportGroup = "<'&\">",
                orderId     = "14",
                amount      = 106,
                orderSource = orderSourceType.ecommerce,
                paypal      = new payPal
                {
                    payerId       = "1234",
                    token         = "1234",
                    transactionId = "123456"
                }
            };

            var response = _cnp.Authorize(authorization);

            Assert.AreEqual("Approved", response.message);
        }
Ejemplo n.º 14
0
        public void TestNotHavingTheLogFileSettingShouldDefaultItsValueToNull()
        {
            config.Remove("logFile");

            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;

            authorizationResponse response = litle.Authorize(authorization);

            Assert.AreEqual("000", response.response);
        }
Ejemplo n.º 15
0
        public void TestTrackData()
        {
            var transaction = new authorization
            {
                id            = "10",
                orderId       = "13",
                amount        = 12522,
                orderSource   = orderSourceType.retail,
                billToAddress = new billToAddress {
                    zip = "95032"
                },
                card = new cardType {
                    track = "%B40000001^Doe/JohnP^06041...?;40001=0604101064200?"
                },
                pos = new pos
                {
                    capability   = posCapabilityTypeEnum.magstripe,
                    entryMode    = posEntryModeTypeEnum.completeread,
                    cardholderId = posCardholderIdTypeEnum.signature
                }
            };

            var test = new BaseCnpOnlineTest();

            test.SetExpectedPopulated("id", transaction.id, null, null);
            test.SetExpectedPopulated("cnpTxnId", "12.0", null);
            test.SetExpectedPopulated("orderId", transaction.orderId, null, null);
            test.SetExpectedPopulated("response", "000", null, null);
            test.SetExpectedPopulated("responseTime", null, null);
            test.SetExpectedPopulated("message", "Approved", null, null);
            test.SetExpectedPopulated("authCode", null, null);
            test.SetExpectedUnpopulated("networkTransactionId", null, "8.30");
            test.SetExpectedPopulated("networkTransactionId", "8.30", "9.0");
            test.SetExpectedUnpopulated("networkTransactionId", "9.0", "9.10");
            test.SetExpectedPopulated("networkTransactionId", "9.10", "10.0");
            test.SetExpectedUnpopulated("networkTransactionId", "10.0", "10.5");
            test.SetExpectedPopulated("networkTransactionId", "10.5", null);
            test.SetExpectedPopulated("litleTxnId", "8.21", "12.0");
            test.RunCnpTestThreaded <authorizationResponse>(transaction);
        }
Ejemplo n.º 16
0
        public void test34()
        {
            authorization auth = new authorization();

            auth.orderId     = "34";
            auth.amount      = 30030;
            auth.orderSource = orderSourceType.ecommerce;
            contact billToAddress = new contact();

            billToAddress.name         = "Eileen Jones";
            billToAddress.addressLine1 = "3 Main St.";
            billToAddress.city         = "Bloomfield";
            billToAddress.state        = "CT";
            billToAddress.zip          = "06002";
            billToAddress.country      = countryTypeEnum.US;
            auth.billToAddress         = billToAddress;
            cardType card = new cardType();

            card.number            = "6011010000000003";
            card.expDate           = "0312";
            card.cardValidationNum = "758";
            card.type = methodOfPaymentTypeEnum.DI;
            auth.card = card;

            authorizationResponse authorizeResponse = litle.Authorize(auth);

            Assert.AreEqual("000", authorizeResponse.response);
            Assert.AreEqual("Approved", authorizeResponse.message);
            Assert.AreEqual("33333", authorizeResponse.authCode);
            Assert.AreEqual("10", authorizeResponse.fraudResult.avsResult);
            Assert.AreEqual("M", authorizeResponse.fraudResult.cardValidationResult);

            authReversal reversal = new authReversal();

            reversal.litleTxnId = authorizeResponse.litleTxnId;
            authReversalResponse reversalResponse = litle.AuthReversal(reversal);

            Assert.AreEqual("000", reversalResponse.response);
            Assert.AreEqual("Approved", reversalResponse.message);
        }
Ejemplo n.º 17
0
        public void TestSimpleAuthWithCardWithOrigTxnIdAndAmount()
        {
            var transaction = new authorization
            {
                id          = "2",
                orderId     = "5",
                amount      = 106,
                orderSource = orderSourceType.ecommerce,
                originalNetworkTransactionId = "123456789012345678901234567890",
                originalTransactionAmount    = 2500,
                card = new cardType
                {
                    type    = methodOfPaymentTypeEnum.VI,
                    number  = "410000000000000000",
                    expDate = "1210"
                },
                customBilling = new customBilling {
                    phone = "1112223333"
                }
            };

            var test = new BaseCnpOnlineTest();

            test.SetExpectedPopulated("id", transaction.id, null, null);
            test.SetExpectedPopulated("cnpTxnId", "12.0", null);
            test.SetExpectedPopulated("orderId", transaction.orderId, null, null);
            test.SetExpectedPopulated("response", "000", null, null);
            test.SetExpectedPopulated("responseTime", null, null);
            test.SetExpectedPopulated("message", "Approved", null, null);
            test.SetExpectedPopulated("authCode", null, null);
            test.SetExpectedUnpopulated("networkTransactionId", null, "8.30");
            test.SetExpectedPopulated("networkTransactionId", "8.30", "9.0");
            test.SetExpectedUnpopulated("networkTransactionId", "9.0", "9.10");
            test.SetExpectedPopulated("networkTransactionId", "9.10", "10.0");
            test.SetExpectedUnpopulated("networkTransactionId", "10.0", "10.5");
            test.SetExpectedPopulated("networkTransactionId", "10.5", null);
            test.SetExpectedPopulated("litleTxnId", "8.21", "12.0");
            test.RunCnpTestThreaded <authorizationResponse>(transaction);
        }
        public void TestMethodOfPaymentApplepayAndWallet()
        {
            var auth = new authorization
            {
                orderId     = "12344",
                amount      = 2,
                orderSource = orderSourceType.applepay,
                reportGroup = "Planets",
                applepay    = new applepayType
                {
                    data      = "user",
                    signature = "sign",
                    version   = "1",
                    header    = new applepayHeaderType
                    {
                        applicationData    = "454657413164",
                        ephemeralPublicKey = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
                        publicKeyHash      = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
                        transactionId      = "1234"
                    }
                },
                wallet = new wallet {
                    walletSourceTypeId = "123"
                }
            };

            var mock = new Mock <Communications>();

            mock.Setup(communications => communications.HttpPost(It.IsRegex(".*?<litleOnlineRequest.*?<authorization.*?<orderSource>applepay</orderSource>.*?<applepay>.*?<data>user</data>.*?</applepay>.*?<wallet>.*?<walletSourceTypeId>123</walletSourceTypeId>.*?</wallet>.*?</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>");

            var mockedCommunication = mock.Object;

            _litle.setCommunication(mockedCommunication);
            var authorizationResponse = _litle.Authorize(auth);

            Assert.NotNull(authorizationResponse);
            Assert.AreEqual(123, authorizationResponse.litleTxnId);
        }
Ejemplo n.º 19
0
 private void btnOK_Click(object sender, RoutedEventArgs e)
 {
     if (this.model == null)
     {
         return;
     }
     if (string.IsNullOrEmpty(this.model.barcode))
     {
         MessageBox.Show("请输入BarCode", "提示");
     }
     else
     {
         /*
          * UserSaveResponse userSaveResponse = LocalApi.ExecuteInfo(
          * new UserSaveRequest()
          * {
          *     barcode = this.model.barcode,
          * }
          * );
          */
         BarCodes = this.model.barcode;
         string result = Test_BIS_INS_TransfINSBaseData(BarCodes);
         Console.WriteLine(result);
         JavaScriptSerializer js   = new JavaScriptSerializer();
         authorization        auth = js.Deserialize <authorization>(result);
         //authorization auth = (authorization)JsonConvert.DeserializeObject(result, typeof(authorization));
         string a = auth.Result;
         if (auth.Result == "True")
         {
             MessageBox.Show("前工序存在此BarCode", "提示");
             this.Close();
         }
         else
         {
             MessageBox.Show("不存在", "提示");
             this.Close();
         }
     }
 }
        public void Test24()
        {
            authorization authorization = new authorization();

            authorization.id          = "1";
            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 = cnp.Authorize(authorization);

            Assert.AreEqual("000", response.response);
            Assert.AreEqual("Approved", response.message);
            //TODO: // Need to find why enhanced auth response is not generated for this merchant. Probably config issue
            Assert.AreEqual(affluenceTypeEnum.MASSAFFLUENT, response.enhancedAuthResponse.affluence);
        }
Ejemplo n.º 21
0
        public void TestNotHavingTheLogFileSettingShouldDefaultItsValueToNull()
        {
            _config.Remove("logFile");

            var authorization = new authorization
            {
                reportGroup = "Planets",
                orderId     = "15",
                amount      = 106,
                orderSource = orderSourceType.ecommerce,
                card        = new cardType
                {
                    type    = methodOfPaymentTypeEnum.VI,
                    number  = "414100000000000000",
                    expDate = "1210"
                }
            };

            var response = _litle.Authorize(authorization);

            Assert.AreEqual("000", response.response);
        }
Ejemplo n.º 22
0
        public void Test12()
        {
            authorization authorization = new authorization();

            authorization.id          = "1";
            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 = cnp.Authorize(authorization);

            Assert.AreEqual("010", response.response);
            Assert.AreEqual("Partially Approved", response.message);
            Assert.AreEqual("40000", response.approvedAmount);
        }
Ejemplo n.º 23
0
        public void TestPrintxmlShouldDefaultToFalse()
        {
            _config.Remove("printxml");

            var authorization = new authorization
            {
                reportGroup = "Planets",
                orderId     = "17",
                amount      = 106,
                orderSource = orderSourceType.ecommerce,
                card        = new cardType
                {
                    type    = methodOfPaymentTypeEnum.VI,
                    number  = "414100000000000000",
                    expDate = "1210"
                }
            };

            var response = _litle.Authorize(authorization);

            Assert.AreEqual("000", response.response);
        }
Ejemplo n.º 24
0
        public void SimpleAuthWithMpos()
        {
            authorization authorization = new authorization();

            authorization.reportGroup = "Planets";
            authorization.orderId     = "12344";
            authorization.amount      = 200;
            authorization.orderSource = orderSourceType.ecommerce;
            mposType mpos = new mposType();

            mpos.ksn            = "77853211300008E00016";
            mpos.encryptedTrack = "CASE1E185EADD6AFE78C9A214B21313DCD836FDD555FBE3A6C48D141FE80AB9172B963265AFF72111895FE415DEDA162CE8CB7AC4D91EDB611A2AB756AA9CB1A000000000000000000000000000000005A7AAF5E8885A9DB88ECD2430C497003F2646619A2382FFF205767492306AC804E8E64E8EA6981DD";
            mpos.formatId       = "30";
            mpos.track1Status   = 0;
            mpos.track2Status   = 0;
            authorization.mpos  = mpos; //This needs to compile


            authorizationResponse response = litle.Authorize(authorization);

            Assert.AreEqual("000", response.response);
        }
Ejemplo n.º 25
0
        public void Test23()
        {
            var authorization = new authorization();

            authorization.id          = "1";
            authorization.orderId     = "23";
            authorization.amount      = 5000;
            authorization.orderSource = orderSourceType.ecommerce;
            var card = new cardType();

            card.type          = methodOfPaymentTypeEnum.MC;
            card.number        = "5112010201000109";
            card.expDate       = "0412";
            authorization.card = card;

            var response = this.SendTransaction <authorizationResponse>(authorization);

            Assert.AreEqual("000", response.response);
            Assert.AreEqual("Approved", response.message);
            //TODO: // Need to find why enhanced auth response is not generated for this merchant. Probably config issue
            Assert.AreEqual(affluenceTypeEnum.AFFLUENT, response.enhancedAuthResponse.affluence);
        }
Ejemplo n.º 26
0
        public void TestSurchargeAmount_Optional()
        {
            var auth = new authorization();

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

            var mock = new Mock <Communications>();

            mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<amount>2</amount>\r\n<orderSource>ecommerce</orderSource>.*", RegexOptions.Singleline)))
            .Returns("<cnpOnlineResponse version='8.14' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><authorizationResponse><cnpTxnId>123</cnpTxnId></authorizationResponse></cnpOnlineResponse>");

            var mockedCommunication = mock.Object;

            cnp.SetCommunication(mockedCommunication);
            var authorizationResponse = cnp.Authorize(auth);

            Assert.NotNull(authorizationResponse);
            Assert.AreEqual(123, authorizationResponse.cnpTxnId);
        }
Ejemplo n.º 27
0
        public void TestMethodOfPaymentApplepayAndWallet()
        {
            var auth = new authorization();

            auth.orderId     = "12344";
            auth.amount      = 2;
            auth.orderSource = orderSourceType.applepay;
            auth.reportGroup = "Planets";
            var applepay           = new applepayType();
            var applepayHeaderType = new applepayHeaderType();

            applepayHeaderType.applicationData    = "454657413164";
            applepayHeaderType.ephemeralPublicKey = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
            applepayHeaderType.publicKeyHash      = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
            applepayHeaderType.transactionId      = "1234";
            applepay.header    = applepayHeaderType;
            applepay.data      = "user";
            applepay.signature = "sign";
            applepay.version   = "1";
            auth.applepay      = applepay;

            var wallet = new wallet();

            wallet.walletSourceTypeId = "123";
            auth.wallet = wallet;

            var mock = new Mock <Communications>();

            mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*?<cnpOnlineRequest.*?<authorization.*?<orderSource>applepay</orderSource>.*?<applepay>.*?<data>user</data>.*?</applepay>.*?<wallet>.*?<walletSourceTypeId>123</walletSourceTypeId>.*?</wallet>.*?</authorization>.*?", RegexOptions.Singleline)))
            .Returns("<cnpOnlineResponse version='8.10' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><authorizationResponse><cnpTxnId>123</cnpTxnId></authorizationResponse></cnpOnlineResponse>");

            var mockedCommunication = mock.Object;

            cnp.SetCommunication(mockedCommunication);
            var authorizationResponse = cnp.Authorize(auth);

            Assert.NotNull(authorizationResponse);
            Assert.AreEqual(123, authorizationResponse.cnpTxnId);
        }
Ejemplo n.º 28
0
        public void Test11()
        {
            var authorization = new authorization();

            authorization.id          = "1";
            authorization.orderId     = "11";
            authorization.amount      = 60000;
            authorization.orderSource = orderSourceType.ecommerce;
            var card = new cardType();

            card.type                      = methodOfPaymentTypeEnum.MC;
            card.number                    = "5112010140000004";
            card.expDate                   = "1111";
            authorization.card             = card;
            authorization.allowPartialAuth = true;

            var response = this.SendTransaction <authorizationResponse>(authorization);

            Assert.AreEqual("010", response.response);
            Assert.AreEqual("Partially Approved", response.message);
            Assert.AreEqual(48000, response.approvedAmount);
        }
        public void Test25()
        {
            authorization authorization = new authorization();

            authorization.id          = "1";
            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 = cnp.Authorize(authorization);

            Assert.AreEqual("000", response.response);
            Assert.AreEqual("Approved", response.message);
            //TODO: // Need to find why enhanced auth response is not generated for this merchant. Probably config issue
            Assert.AreEqual("BRA", response.enhancedAuthResponse.issuerCountry);
        }
        public void testLitleOnlineException()
        {
            var authorization = new authorization();

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

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

            var mock = new Mock <Communications>(_memoryStreams);

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

            var mockedCommunication = mock.Object;

            litle.setCommunication(mockedCommunication);
            try
            {
                litle.Authorize(authorization);
            }
            catch (LitleOnlineException e)
            {
                Assert.AreEqual("Error validating xml data against the schema", e.Message);
            }
        }
Ejemplo n.º 31
0
        public void test2AVS()
        {
            authorization authorization = new authorization();

            authorization.id          = "1";
            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);
        }
Ejemplo n.º 32
0
 public void AuthWithAmpersand()
 {
     var authorization = new authorization();
     authorization.orderId = "1";
     authorization.amount = 10010;
     authorization.orderSource = orderSourceType.ecommerce;
     var contact = new contact();
     contact.name = "John & Jane Smith";
     contact.addressLine1 = "1 Main St.";
     contact.city = "Burlington";
     contact.state = "MA";
     contact.zip = "01803-3747";
     contact.country = countryTypeEnum.US;
     authorization.billToAddress = contact;
     var card = new cardType();
     card.type = methodOfPaymentTypeEnum.VI;
     card.number = "4457010000000009";
     card.expDate = "0112";
     card.cardValidationNum = "349";
     authorization.card = card;
     var response = litle.Authorize(authorization);
     Assert.AreEqual("000", response.response);
 }
Ejemplo n.º 33
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);
        }
Ejemplo n.º 34
0
        public void TestAddAuthorization()
        {
            var authorization = new authorization();

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

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

            batchRequest.addAuthorization(authorization);

            Assert.AreEqual(1, batchRequest.getNumAuthorization());
            Assert.AreEqual(authorization.amount, batchRequest.getSumOfAuthorization());

            mockCnpFile.Verify(cnpFile => cnpFile.createRandomFile(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), mockCnpTime.Object));
            mockCnpFile.Verify(cnpFile => cnpFile.AppendLineToFile(mockFilePath, authorization.Serialize()));
        }
Ejemplo n.º 35
0
        public void simpleAuthWithPaypal()
        {
            authorization authorization = new authorization();

            authorization.reportGroup = "Planets";
            authorization.orderId     = "123456";
            authorization.amount      = 106;
            authorization.orderSource = orderSourceType.ecommerce;
            payPal paypal = new payPal();

            paypal.payerId       = "1234";
            paypal.token         = "1234";
            paypal.transactionId = "123456";
            authorization.paypal = paypal; //This needs to compile

            customBilling cb = new customBilling();

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

            authorizationResponse response = litle.Authorize(authorization);

            Assert.AreEqual("Approved", response.message);
        }
Ejemplo n.º 36
0
        public void SimpleAuthWithCard()
        {
            var authorization = new authorization
            {
                id          = "1",
                reportGroup = "Planets",
                orderId     = "12344",
                amount      = 106,
                orderSource = orderSourceType.ecommerce,
                card        = new cardType
                {
                    type    = methodOfPaymentTypeEnum.VI,
                    number  = "414100000000000000",
                    expDate = "1210"
                },
                customBilling = new customBilling {
                    phone = "1112223333"
                }
            };
            var response = _cnp.Authorize(authorization);

            Assert.AreEqual("000", response.response);
        }
Ejemplo n.º 37
0
        public void test14()
        {
            var authorization = new authorization();

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

            card.type          = methodOfPaymentTypeEnum.VI;
            card.number        = "4457010200000247";
            card.expDate       = "0812";
            authorization.card = card;

            var 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);
        }
Ejemplo n.º 38
0
        public void test16()
        {
            var authorization = new authorization();

            authorization.orderId     = "16";
            authorization.amount      = 3000;
            authorization.orderSource = orderSourceType.ecommerce;
            var card = new cardType();

            card.type          = methodOfPaymentTypeEnum.MC;
            card.number        = "5592106621450897";
            card.expDate       = "0312";
            authorization.card = card;

            var response = litle.Authorize(authorization);

            Assert.AreEqual("000", response.response);
            Assert.AreEqual("Approved", response.message);
            Assert.AreEqual(fundingSourceTypeEnum.PREPAID, response.enhancedAuthResponse.fundingSource.type);
            Assert.AreEqual("0", response.enhancedAuthResponse.fundingSource.availableBalance);
            Assert.AreEqual("YES", response.enhancedAuthResponse.fundingSource.reloadable);
            Assert.AreEqual("PAYROLL", response.enhancedAuthResponse.fundingSource.prepaidCardType);
        }
Ejemplo n.º 39
0
        public void testAuthHandleSpecialCharacters()
        {
            authorization authorization = new authorization();

            authorization.reportGroup = "<'&\">";
            authorization.orderId     = "123456";
            authorization.amount      = 106;
            authorization.orderSource = orderSourceType.ecommerce;
            payPal paypal = new payPal();

            paypal.payerId       = "1234";
            paypal.token         = "1234";
            paypal.transactionId = "123456";
            authorization.paypal = paypal; //This needs to compile

            customBilling cb = new customBilling();

            cb.phone = "<'&\">"; //This needs to compile too

            authorizationResponse response = litle.Authorize(authorization);

            Assert.AreEqual("Approved", response.message);
        }
        public void test31()
        {
            var authorization = new authorization();
            authorization.orderId = "31";
            authorization.amount = 25000;
            authorization.orderSource = orderSourceType.ecommerce;
            var card = new cardType();
            card.type = methodOfPaymentTypeEnum.VI;
            card.number = "4024720001231239";
            card.expDate = "1212";
            authorization.card = card;
            authorization.allowPartialAuth = true;
            var healthcareiias = new healthcareIIAS();
            var healthcareamounts = new healthcareAmounts();
            healthcareamounts.totalHealthcareAmount = 18699;
            healthcareamounts.RxAmount = 1000;
            healthcareamounts.visionAmount = 15099;
            healthcareiias.healthcareAmounts = healthcareamounts;
            healthcareiias.IIASFlag = IIASFlagType.Y;
            authorization.healthcareIIAS = healthcareiias;

            var response = litle.Authorize(authorization);
            Assert.AreEqual("010", response.response);
            Assert.AreEqual("Partially Approved", response.message);
            Assert.AreEqual("18699", response.approvedAmount);
        }
        public void test28()
        {
            var authorization = new authorization();
            authorization.orderId = "28";
            authorization.amount = 15000;
            authorization.orderSource = orderSourceType.ecommerce;
            var card = new cardType();
            card.type = methodOfPaymentTypeEnum.MC;
            card.number = "5194560012341234";
            card.expDate = "1212";
            authorization.card = card;
            authorization.allowPartialAuth = true;
            var healthcareiias = new healthcareIIAS();
            var healthcareamounts = new healthcareAmounts();
            healthcareamounts.totalHealthcareAmount = 15000;
            healthcareamounts.RxAmount = 3698;
            healthcareiias.healthcareAmounts = healthcareamounts;
            healthcareiias.IIASFlag = IIASFlagType.Y;
            authorization.healthcareIIAS = healthcareiias;

            var response = litle.Authorize(authorization);
            Assert.AreEqual("000", response.response);
            Assert.AreEqual("Approved", response.message);
        }
Ejemplo n.º 42
0
        public void test9AVS()
        {
            var authorization = new authorization();
            authorization.orderId = "9";
            authorization.amount = 0;
            authorization.orderSource = orderSourceType.ecommerce;
            var 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;
            var card = new cardType();
            card.type = methodOfPaymentTypeEnum.AX;
            card.number = "375001010000003";
            card.expDate = "0912";
            card.cardValidationNum = "0421";
            authorization.card = card;

            var response = litle.Authorize(authorization);
            Assert.AreEqual("303", response.response);
            Assert.AreEqual("Pick Up Card", response.message);
            Assert.AreEqual("34", response.fraudResult.avsResult);
        }
        public void test33()
        {
            var auth = new authorization();
            auth.orderId = "33";
            auth.amount = 20020;
            auth.orderSource = orderSourceType.ecommerce;
            var billToAddress = new contact();
            billToAddress.name = "Mike J. Hammer";
            billToAddress.addressLine1 = "2 Main St.";
            billToAddress.addressLine2 = "Apt. 222";
            billToAddress.city = "Riverside";
            billToAddress.state = "RI";
            billToAddress.zip = "02915";
            billToAddress.country = countryTypeEnum.US;
            auth.billToAddress = billToAddress;
            var card = new cardType();
            card.number = "5112010000000003";
            card.expDate = "0212";
            card.cardValidationNum = "261";
            card.type = methodOfPaymentTypeEnum.MC;
            auth.card = card;
            var fraud = new fraudCheckType();
            fraud.authenticationValue = "BwABBJQ1AgAAAAAgJDUCAAAAAAA=";
            auth.cardholderAuthentication = fraud;

            var authorizeResponse = litle.Authorize(auth);
            Assert.AreEqual("000", authorizeResponse.response);
            Assert.AreEqual("Approved", authorizeResponse.message);
            Assert.AreEqual("22222", authorizeResponse.authCode);
            Assert.AreEqual("10", authorizeResponse.fraudResult.avsResult);
            Assert.AreEqual("M", authorizeResponse.fraudResult.cardValidationResult);

            var reversal = new authReversal();
            reversal.litleTxnId = authorizeResponse.litleTxnId;
            var reversalResponse = litle.AuthReversal(reversal);
            Assert.AreEqual("000", reversalResponse.response);
            Assert.AreEqual("Approved", reversalResponse.message);
        }
Ejemplo n.º 44
0
        public void test3AVS()
        {
            var authorization = new authorization();
            authorization.orderId = "3";
            authorization.amount = 0;
            authorization.orderSource = orderSourceType.ecommerce;
            var 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;
            var card = new cardType();
            card.type = methodOfPaymentTypeEnum.DI;
            card.number = "6011010000000003";
            card.expDate = "0312";
            card.cardValidationNum = "758";
            authorization.card = card;

            var 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);
        }
Ejemplo n.º 45
0
        public void test4AVS()
        {
            var authorization = new authorization();
            authorization.orderId = "4";
            authorization.amount = 0;
            authorization.orderSource = orderSourceType.ecommerce;
            var 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;
            var card = new cardType();
            card.type = methodOfPaymentTypeEnum.AX;
            card.number = "375001000000005";
            card.expDate = "0412";
            card.cardValidationNum = "758";
            authorization.card = card;

            var 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 test35()
        {
            var auth = new authorization();
            auth.orderId = "35";
            auth.amount = 40040;
            auth.orderSource = orderSourceType.ecommerce;
            var billToAddress = new contact();
            billToAddress.name = "Bob Black";
            billToAddress.addressLine1 = "4 Main St.";
            billToAddress.city = "Laurel";
            billToAddress.state = "MD";
            billToAddress.zip = "20708";
            billToAddress.country = countryTypeEnum.US;
            auth.billToAddress = billToAddress;
            var card = new cardType();
            card.number = "375001000000005";
            card.expDate = "0412";
            card.type = methodOfPaymentTypeEnum.AX;
            auth.card = card;

            var authorizeResponse = litle.Authorize(auth);
            Assert.AreEqual("000", authorizeResponse.response);
            Assert.AreEqual("Approved", authorizeResponse.message);
            Assert.AreEqual("44444", authorizeResponse.authCode);
            Assert.AreEqual("12", authorizeResponse.fraudResult.avsResult);

            var capture = new capture();
            capture.litleTxnId = authorizeResponse.litleTxnId;
            capture.amount = 20020;
            var captureResponse = litle.Capture(capture);
            Assert.AreEqual("000", captureResponse.response);
            Assert.AreEqual("Approved", captureResponse.message);

            var reversal = new authReversal();
            reversal.litleTxnId = authorizeResponse.litleTxnId;
            reversal.amount = 20020;
            var reversalResponse = litle.AuthReversal(reversal);
            Assert.AreEqual("000", reversalResponse.response);
            Assert.AreEqual("Approved", reversalResponse.message);
        }
Ejemplo n.º 47
0
        public void test5Auth()
        {
            var authorization = new authorization();
            authorization.orderId = "5";
            authorization.amount = 50050;
            authorization.orderSource = orderSourceType.ecommerce;
            var card = new cardType();
            card.type = methodOfPaymentTypeEnum.VI;
            card.number = "4457010200000007";
            card.expDate = "0512";
            card.cardValidationNum = "463";
            authorization.card = card;
            var authenticationvalue = new fraudCheckType();
            authenticationvalue.authenticationValue = "BwABBJQ1AgAAAAAgJDUCAAAAAAA=";
            authorization.cardholderAuthentication = authenticationvalue;

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

            var capture = new capture();
            capture.litleTxnId = response.litleTxnId;
            var captureresponse = litle.Capture(capture);
            Assert.AreEqual("000", captureresponse.response);
            Assert.AreEqual("Approved", captureresponse.message);

            var credit = new credit();
            credit.litleTxnId = captureresponse.litleTxnId;
            var creditResponse = litle.Credit(credit);
            Assert.AreEqual("000", creditResponse.response);
            Assert.AreEqual("Approved", creditResponse.message);

            var newvoid = new voidTxn();
            newvoid.litleTxnId = creditResponse.litleTxnId;
            var voidResponse = litle.DoVoid(newvoid);
            Assert.AreEqual("000", voidResponse.response);
            Assert.AreEqual("Approved", voidResponse.message);
        }
        public void test30()
        {
            var authorization = new authorization();
            authorization.orderId = "30";
            authorization.amount = 20000;
            authorization.orderSource = orderSourceType.ecommerce;
            var card = new cardType();
            card.type = methodOfPaymentTypeEnum.VI;
            card.number = "4024720001231239";
            card.expDate = "1212";
            authorization.card = card;
            authorization.allowPartialAuth = true;
            var healthcareiias = new healthcareIIAS();
            var 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;

            var response = litle.Authorize(authorization);
            Assert.AreEqual("341", response.response);
            Assert.AreEqual("Invalid healthcare amounts", response.message);
        }
Ejemplo n.º 49
0
        public void test6Auth()
        {
            var authorization = new authorization();
            authorization.orderId = "6";
            authorization.amount = 60060;
            authorization.orderSource = orderSourceType.ecommerce;
            var 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;
            var card = new cardType();
            card.type = methodOfPaymentTypeEnum.VI;
            card.number = "4457010100000008";
            card.expDate = "0612";
            card.cardValidationNum = "992";
            authorization.card = card;

            var 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 test36()
        {
            var auth = new authorization();
            auth.orderId = "36";
            auth.amount = 20500;
            auth.orderSource = orderSourceType.ecommerce;
            var card = new cardType();
            card.number = "375000026600004";
            card.expDate = "0512";
            card.type = methodOfPaymentTypeEnum.AX;
            auth.card = card;

            var authorizeResponse = litle.Authorize(auth);
            Assert.AreEqual("000", authorizeResponse.response);
            Assert.AreEqual("Approved", authorizeResponse.message);

            var reversal = new authReversal();
            reversal.litleTxnId = authorizeResponse.litleTxnId;
            reversal.amount = 10000;
            var reversalResponse = litle.AuthReversal(reversal);
            Assert.AreEqual("336", reversalResponse.response);
            Assert.AreEqual("Reversal Amount does not match Authorization amount", reversalResponse.message);
        }
Ejemplo n.º 51
0
        public void test2AVS()
        {
            var authorization = new authorization();
            authorization.orderId = "2";
            authorization.amount = 0;
            authorization.orderSource = orderSourceType.ecommerce;
            var 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;
            var card = new cardType();
            card.type = methodOfPaymentTypeEnum.MC;
            card.number = "5112010000000003";
            card.expDate = "0212";
            card.cardValidationNum = "261";
            authorization.card = card;
            var authenticationvalue = new fraudCheckType();
            authenticationvalue.authenticationValue = "BwABBJQ1AgAAAAAgJDUCAAAAAAA=";
            authorization.cardholderAuthentication = authenticationvalue;

            var 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);
        }
Ejemplo n.º 52
0
        public void test8AVS()
        {
            var authorization = new authorization();
            authorization.orderId = "8";
            authorization.amount = 0;
            authorization.orderSource = orderSourceType.ecommerce;
            var 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;
            var card = new cardType();
            card.type = methodOfPaymentTypeEnum.DI;
            card.number = "6011010100000002";
            card.expDate = "0812";
            card.cardValidationNum = "184";
            authorization.card = card;

            var 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);
        }
Ejemplo n.º 53
0
            : this(new TwitterExecute(authorization))
#endif
        {
Ejemplo n.º 54
0
        public void Test1AVS()
        {
            var authorization = new authorization();
            authorization.orderId = "1";
            authorization.amount = 0;
            authorization.orderSource = orderSourceType.ecommerce;
            var 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;
            var card = new cardType();
            card.type = methodOfPaymentTypeEnum.VI;
            card.number = "4457010000000009";
            card.expDate = "0112";
            card.cardValidationNum = "349";
            authorization.card = card;

            var 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 InvalidCredientialsBatch()
        {
            var litleBatchRequest = new batchRequest(memoryStreams);

            var authorization = new authorization();
            authorization.reportGroup = "Planets";
            authorization.orderId = "12344";
            authorization.amount = 106;
            authorization.orderSource = orderSourceType.ecommerce;
            var card = new cardType();
            card.type = methodOfPaymentTypeEnum.VI;
            card.number = "4100000000000001";
            card.expDate = "1210";
            authorization.card = card;

            litleBatchRequest.addAuthorization(authorization);

            var authorization2 = new authorization();
            authorization2.reportGroup = "Planets";
            authorization2.orderId = "12345";
            authorization2.amount = 106;
            authorization2.orderSource = orderSourceType.ecommerce;
            var card2 = new cardType();
            card2.type = methodOfPaymentTypeEnum.VI;
            card2.number = "4242424242424242";
            card2.expDate = "1210";
            authorization2.card = card2;

            litleBatchRequest.addAuthorization(authorization2);

            var reversal = new authReversal();
            reversal.litleTxnId = 12345678000L;
            reversal.amount = 106;
            reversal.payPalNotes = "Notes";

            litleBatchRequest.addAuthReversal(reversal);

            var reversal2 = new authReversal();
            reversal2.litleTxnId = 12345678900L;
            reversal2.amount = 106;
            reversal2.payPalNotes = "Notes";

            litleBatchRequest.addAuthReversal(reversal2);

            var capture = new capture();
            capture.litleTxnId = 123456000;
            capture.amount = 106;
            capture.payPalNotes = "Notes";

            litleBatchRequest.addCapture(capture);

            var capture2 = new capture();
            capture2.litleTxnId = 123456700;
            capture2.amount = 106;
            capture2.payPalNotes = "Notes";

            litleBatchRequest.addCapture(capture2);

            var capturegivenauth = new captureGivenAuth();
            capturegivenauth.amount = 106;
            capturegivenauth.orderId = "12344";
            var authInfo = new authInformation();
            var 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);

            var capturegivenauth2 = new captureGivenAuth();
            capturegivenauth2.amount = 106;
            capturegivenauth2.orderId = "12344";
            var 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);

            var creditObj = new credit();
            creditObj.amount = 106;
            creditObj.orderId = "2111";
            creditObj.orderSource = orderSourceType.ecommerce;
            creditObj.card = card;

            litleBatchRequest.addCredit(creditObj);

            var creditObj2 = new credit();
            creditObj2.amount = 106;
            creditObj2.orderId = "2111";
            creditObj2.orderSource = orderSourceType.ecommerce;
            creditObj2.card = card2;

            litleBatchRequest.addCredit(creditObj2);

            var echeckcredit = new echeckCredit();
            echeckcredit.amount = 12L;
            echeckcredit.orderId = "12345";
            echeckcredit.orderSource = orderSourceType.ecommerce;
            var echeck = new echeckType();
            echeck.accType = echeckAccountTypeEnum.Checking;
            echeck.accNum = "1099999903";
            echeck.routingNum = "011201995";
            echeck.checkNum = "123455";
            echeckcredit.echeck = echeck;
            var billToAddress = new contact();
            billToAddress.name = "Bob";
            billToAddress.city = "Lowell";
            billToAddress.state = "MA";
            billToAddress.email = "litle.com";
            echeckcredit.billToAddress = billToAddress;

            litleBatchRequest.addEcheckCredit(echeckcredit);

            var echeckcredit2 = new echeckCredit();
            echeckcredit2.amount = 12L;
            echeckcredit2.orderId = "12346";
            echeckcredit2.orderSource = orderSourceType.ecommerce;
            var echeck2 = new echeckType();
            echeck2.accType = echeckAccountTypeEnum.Checking;
            echeck2.accNum = "1099999903";
            echeck2.routingNum = "011201995";
            echeck2.checkNum = "123456";
            echeckcredit2.echeck = echeck2;
            var billToAddress2 = new contact();
            billToAddress2.name = "Mike";
            billToAddress2.city = "Lowell";
            billToAddress2.state = "MA";
            billToAddress2.email = "litle.com";
            echeckcredit2.billToAddress = billToAddress2;

            litleBatchRequest.addEcheckCredit(echeckcredit2);

            var echeckredeposit = new echeckRedeposit();
            echeckredeposit.litleTxnId = 123456;
            echeckredeposit.echeck = echeck;

            litleBatchRequest.addEcheckRedeposit(echeckredeposit);

            var echeckredeposit2 = new echeckRedeposit();
            echeckredeposit2.litleTxnId = 123457;
            echeckredeposit2.echeck = echeck2;

            litleBatchRequest.addEcheckRedeposit(echeckredeposit2);

            var echeckSaleObj = new echeckSale();
            echeckSaleObj.amount = 123456;
            echeckSaleObj.orderId = "12345";
            echeckSaleObj.orderSource = orderSourceType.ecommerce;
            echeckSaleObj.echeck = echeck;
            echeckSaleObj.billToAddress = billToAddress;

            litleBatchRequest.addEcheckSale(echeckSaleObj);

            var echeckSaleObj2 = new echeckSale();
            echeckSaleObj2.amount = 123456;
            echeckSaleObj2.orderId = "12346";
            echeckSaleObj2.orderSource = orderSourceType.ecommerce;
            echeckSaleObj2.echeck = echeck2;
            echeckSaleObj2.billToAddress = billToAddress2;

            litleBatchRequest.addEcheckSale(echeckSaleObj2);

            var echeckVerificationObject = new echeckVerification();
            echeckVerificationObject.amount = 123456;
            echeckVerificationObject.orderId = "12345";
            echeckVerificationObject.orderSource = orderSourceType.ecommerce;
            echeckVerificationObject.echeck = echeck;
            echeckVerificationObject.billToAddress = billToAddress;

            litleBatchRequest.addEcheckVerification(echeckVerificationObject);

            var echeckVerificationObject2 = new echeckVerification();
            echeckVerificationObject2.amount = 123456;
            echeckVerificationObject2.orderId = "12346";
            echeckVerificationObject2.orderSource = orderSourceType.ecommerce;
            echeckVerificationObject2.echeck = echeck2;
            echeckVerificationObject2.billToAddress = billToAddress2;

            litleBatchRequest.addEcheckVerification(echeckVerificationObject2);

            var forcecapture = new forceCapture();
            forcecapture.amount = 106;
            forcecapture.orderId = "12344";
            forcecapture.orderSource = orderSourceType.ecommerce;
            forcecapture.card = card;

            litleBatchRequest.addForceCapture(forcecapture);

            var forcecapture2 = new forceCapture();
            forcecapture2.amount = 106;
            forcecapture2.orderId = "12345";
            forcecapture2.orderSource = orderSourceType.ecommerce;
            forcecapture2.card = card2;

            litleBatchRequest.addForceCapture(forcecapture2);

            var saleObj = new sale();
            saleObj.amount = 106;
            saleObj.litleTxnId = 123456;
            saleObj.orderId = "12344";
            saleObj.orderSource = orderSourceType.ecommerce;
            saleObj.card = card;

            litleBatchRequest.addSale(saleObj);

            var saleObj2 = new sale();
            saleObj2.amount = 106;
            saleObj2.litleTxnId = 123456;
            saleObj2.orderId = "12345";
            saleObj2.orderSource = orderSourceType.ecommerce;
            saleObj2.card = card2;

            litleBatchRequest.addSale(saleObj2);

            var registerTokenRequest = new registerTokenRequestType();
            registerTokenRequest.orderId = "12344";
            registerTokenRequest.accountNumber = "1233456789103801";
            registerTokenRequest.reportGroup = "Planets";

            litleBatchRequest.addRegisterTokenRequest(registerTokenRequest);

            var registerTokenRequest2 = new registerTokenRequestType();
            registerTokenRequest2.orderId = "12345";
            registerTokenRequest2.accountNumber = "1233456789103801";
            registerTokenRequest2.reportGroup = "Planets";

            litleBatchRequest.addRegisterTokenRequest(registerTokenRequest2);

            litle.addBatch(litleBatchRequest);

            try
            {
                var litleResponse = litle.sendToLitleWithStream();
            }
            catch (LitleOnlineException e)
            {
                Assert.AreEqual("Error establishing a network connection", e.Message);
            }
        }
Ejemplo n.º 56
0
        public void test7AVS()
        {
            var authorization = new authorization();
            authorization.orderId = "7";
            authorization.amount = 0;
            authorization.orderSource = orderSourceType.ecommerce;
            var 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;
            var card = new cardType();
            card.type = methodOfPaymentTypeEnum.MC;
            card.number = "5112010100000002";
            card.expDate = "0712";
            card.cardValidationNum = "251";
            authorization.card = card;

            var 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 nullBatchData()
        {
            var litleBatchRequest = new batchRequest(memoryStreams);

            var authorization = new authorization();
            authorization.reportGroup = "Planets";
            authorization.orderId = "12344";
            authorization.amount = 106;
            authorization.orderSource = orderSourceType.ecommerce;
            var card = new cardType();
            card.type = methodOfPaymentTypeEnum.VI;
            card.number = "414100000000000000";
            card.expDate = "1210";
            authorization.card = card; //This needs to compile

            litleBatchRequest.addAuthorization(authorization);
            try
            {
                litleBatchRequest.addAuthorization(null);
            }
            catch (NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            var reversal = new authReversal();
            reversal.litleTxnId = 12345678000L;
            reversal.amount = 106;
            reversal.payPalNotes = "Notes";

            litleBatchRequest.addAuthReversal(reversal);
            try
            {
                litleBatchRequest.addAuthReversal(null);
            }
            catch (NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            var capture = new capture();
            capture.litleTxnId = 123456000;
            capture.amount = 106;
            capture.payPalNotes = "Notes";

            litleBatchRequest.addCapture(capture);
            try
            {
                litleBatchRequest.addCapture(null);
            }
            catch (NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            var capturegivenauth = new captureGivenAuth();
            capturegivenauth.amount = 106;
            capturegivenauth.orderId = "12344";
            var authInfo = new authInformation();
            var 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 (NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            var creditObj = new credit();
            creditObj.amount = 106;
            creditObj.orderId = "2111";
            creditObj.orderSource = orderSourceType.ecommerce;
            creditObj.card = card;

            litleBatchRequest.addCredit(creditObj);
            try
            {
                litleBatchRequest.addCredit(null);
            }
            catch (NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            var echeckcredit = new echeckCredit();
            echeckcredit.amount = 12L;
            echeckcredit.orderId = "12345";
            echeckcredit.orderSource = orderSourceType.ecommerce;
            var echeck = new echeckType();
            echeck.accType = echeckAccountTypeEnum.Checking;
            echeck.accNum = "12345657890";
            echeck.routingNum = "011201995";
            echeck.checkNum = "123455";
            echeckcredit.echeck = echeck;
            var 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 (NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            var echeckredeposit = new echeckRedeposit();
            echeckredeposit.litleTxnId = 123456;
            echeckredeposit.echeck = echeck;

            litleBatchRequest.addEcheckRedeposit(echeckredeposit);
            try
            {
                litleBatchRequest.addEcheckRedeposit(null);
            }
            catch (NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            var 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 (NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            var 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 (NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            var forcecapture = new forceCapture();
            forcecapture.amount = 106;
            forcecapture.orderId = "12344";
            forcecapture.orderSource = orderSourceType.ecommerce;
            forcecapture.card = card;

            litleBatchRequest.addForceCapture(forcecapture);
            try
            {
                litleBatchRequest.addForceCapture(null);
            }
            catch (NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            var 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 (NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            var registerTokenRequest = new registerTokenRequestType();
            registerTokenRequest.orderId = "12344";
            registerTokenRequest.accountNumber = "1233456789103801";
            registerTokenRequest.reportGroup = "Planets";

            litleBatchRequest.addRegisterTokenRequest(registerTokenRequest);
            try
            {
                litleBatchRequest.addRegisterTokenRequest(null);
            }
            catch (NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }

            try
            {
                litle.addBatch(litleBatchRequest);
            }
            catch (NullReferenceException e)
            {
                Assert.AreEqual("Object reference not set to an instance of an object.", e.Message);
            }
        }
        public void SimpleBatch()
        {
            var litleBatchRequest = new batchRequest(memoryStreams);

            var authorization = new authorization();
            authorization.reportGroup = "Planets";
            authorization.orderId = "12344";
            authorization.amount = 106;
            authorization.orderSource = orderSourceType.ecommerce;
            var card = new cardType();
            card.type = methodOfPaymentTypeEnum.VI;
            card.number = "4100000000000001";
            card.expDate = "1210";
            authorization.card = card;

            litleBatchRequest.addAuthorization(authorization);

            var authorization2 = new authorization();
            authorization2.reportGroup = "Planets";
            authorization2.orderId = "12345";
            authorization2.amount = 106;
            authorization2.orderSource = orderSourceType.ecommerce;
            var card2 = new cardType();
            card2.type = methodOfPaymentTypeEnum.VI;
            card2.number = "4242424242424242";
            card2.expDate = "1210";
            authorization2.card = card2;

            litleBatchRequest.addAuthorization(authorization2);

            var reversal = new authReversal();
            reversal.litleTxnId = 12345678000L;
            reversal.amount = 106;
            reversal.payPalNotes = "Notes";

            litleBatchRequest.addAuthReversal(reversal);

            var reversal2 = new authReversal();
            reversal2.litleTxnId = 12345678900L;
            reversal2.amount = 106;
            reversal2.payPalNotes = "Notes";

            litleBatchRequest.addAuthReversal(reversal2);

            var capture = new capture();
            capture.litleTxnId = 123456000;
            capture.amount = 106;
            capture.payPalNotes = "Notes";

            litleBatchRequest.addCapture(capture);

            var capture2 = new capture();
            capture2.litleTxnId = 123456700;
            capture2.amount = 106;
            capture2.payPalNotes = "Notes";

            litleBatchRequest.addCapture(capture2);

            var capturegivenauth = new captureGivenAuth();
            capturegivenauth.amount = 106;
            capturegivenauth.orderId = "12344";
            var authInfo = new authInformation();
            var 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);

            var capturegivenauth2 = new captureGivenAuth();
            capturegivenauth2.amount = 106;
            capturegivenauth2.orderId = "12344";
            var 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);

            var creditObj = new credit();
            creditObj.amount = 106;
            creditObj.orderId = "2111";
            creditObj.orderSource = orderSourceType.ecommerce;
            creditObj.card = card;

            litleBatchRequest.addCredit(creditObj);

            var creditObj2 = new credit();
            creditObj2.amount = 106;
            creditObj2.orderId = "2111";
            creditObj2.orderSource = orderSourceType.ecommerce;
            creditObj2.card = card2;

            litleBatchRequest.addCredit(creditObj2);

            var echeckcredit = new echeckCredit();
            echeckcredit.amount = 12L;
            echeckcredit.orderId = "12345";
            echeckcredit.orderSource = orderSourceType.ecommerce;
            var echeck = new echeckType();
            echeck.accType = echeckAccountTypeEnum.Checking;
            echeck.accNum = "1099999903";
            echeck.routingNum = "011201995";
            echeck.checkNum = "123455";
            echeckcredit.echeck = echeck;
            var billToAddress = new contact();
            billToAddress.name = "Bob";
            billToAddress.city = "Lowell";
            billToAddress.state = "MA";
            billToAddress.email = "litle.com";
            echeckcredit.billToAddress = billToAddress;

            litleBatchRequest.addEcheckCredit(echeckcredit);

            var echeckcredit2 = new echeckCredit();
            echeckcredit2.amount = 12L;
            echeckcredit2.orderId = "12346";
            echeckcredit2.orderSource = orderSourceType.ecommerce;
            var echeck2 = new echeckType();
            echeck2.accType = echeckAccountTypeEnum.Checking;
            echeck2.accNum = "1099999903";
            echeck2.routingNum = "011201995";
            echeck2.checkNum = "123456";
            echeckcredit2.echeck = echeck2;
            var billToAddress2 = new contact();
            billToAddress2.name = "Mike";
            billToAddress2.city = "Lowell";
            billToAddress2.state = "MA";
            billToAddress2.email = "litle.com";
            echeckcredit2.billToAddress = billToAddress2;

            litleBatchRequest.addEcheckCredit(echeckcredit2);

            var echeckredeposit = new echeckRedeposit();
            echeckredeposit.litleTxnId = 123456;
            echeckredeposit.echeck = echeck;

            litleBatchRequest.addEcheckRedeposit(echeckredeposit);

            var echeckredeposit2 = new echeckRedeposit();
            echeckredeposit2.litleTxnId = 123457;
            echeckredeposit2.echeck = echeck2;

            litleBatchRequest.addEcheckRedeposit(echeckredeposit2);

            var echeckSaleObj = new echeckSale();
            echeckSaleObj.amount = 123456;
            echeckSaleObj.orderId = "12345";
            echeckSaleObj.orderSource = orderSourceType.ecommerce;
            echeckSaleObj.echeck = echeck;
            echeckSaleObj.billToAddress = billToAddress;

            litleBatchRequest.addEcheckSale(echeckSaleObj);

            var echeckSaleObj2 = new echeckSale();
            echeckSaleObj2.amount = 123456;
            echeckSaleObj2.orderId = "12346";
            echeckSaleObj2.orderSource = orderSourceType.ecommerce;
            echeckSaleObj2.echeck = echeck2;
            echeckSaleObj2.billToAddress = billToAddress2;

            litleBatchRequest.addEcheckSale(echeckSaleObj2);

            var echeckPreNoteSaleObj1 = new echeckPreNoteSale();
            echeckPreNoteSaleObj1.orderId = "12345";
            echeckPreNoteSaleObj1.orderSource = orderSourceType.ecommerce;
            echeckPreNoteSaleObj1.echeck = echeck;
            echeckPreNoteSaleObj1.billToAddress = billToAddress;

            litleBatchRequest.addEcheckPreNoteSale(echeckPreNoteSaleObj1);

            var echeckPreNoteSaleObj2 = new echeckPreNoteSale();
            echeckPreNoteSaleObj2.orderId = "12345";
            echeckPreNoteSaleObj2.orderSource = orderSourceType.ecommerce;
            echeckPreNoteSaleObj2.echeck = echeck2;
            echeckPreNoteSaleObj2.billToAddress = billToAddress2;

            litleBatchRequest.addEcheckPreNoteSale(echeckPreNoteSaleObj2);

            var echeckPreNoteCreditObj1 = new echeckPreNoteCredit();
            echeckPreNoteCreditObj1.orderId = "12345";
            echeckPreNoteCreditObj1.orderSource = orderSourceType.ecommerce;
            echeckPreNoteCreditObj1.echeck = echeck;
            echeckPreNoteCreditObj1.billToAddress = billToAddress;

            litleBatchRequest.addEcheckPreNoteCredit(echeckPreNoteCreditObj1);

            var echeckPreNoteCreditObj2 = new echeckPreNoteCredit();
            echeckPreNoteCreditObj2.orderId = "12345";
            echeckPreNoteCreditObj2.orderSource = orderSourceType.ecommerce;
            echeckPreNoteCreditObj2.echeck = echeck2;
            echeckPreNoteCreditObj2.billToAddress = billToAddress2;

            litleBatchRequest.addEcheckPreNoteCredit(echeckPreNoteCreditObj2);

            var echeckVerificationObject = new echeckVerification();
            echeckVerificationObject.amount = 123456;
            echeckVerificationObject.orderId = "12345";
            echeckVerificationObject.orderSource = orderSourceType.ecommerce;
            echeckVerificationObject.echeck = echeck;
            echeckVerificationObject.billToAddress = billToAddress;

            litleBatchRequest.addEcheckVerification(echeckVerificationObject);

            var echeckVerificationObject2 = new echeckVerification();
            echeckVerificationObject2.amount = 123456;
            echeckVerificationObject2.orderId = "12346";
            echeckVerificationObject2.orderSource = orderSourceType.ecommerce;
            echeckVerificationObject2.echeck = echeck2;
            echeckVerificationObject2.billToAddress = billToAddress2;

            litleBatchRequest.addEcheckVerification(echeckVerificationObject2);

            var forcecapture = new forceCapture();
            forcecapture.amount = 106;
            forcecapture.orderId = "12344";
            forcecapture.orderSource = orderSourceType.ecommerce;
            forcecapture.card = card;

            litleBatchRequest.addForceCapture(forcecapture);

            var forcecapture2 = new forceCapture();
            forcecapture2.amount = 106;
            forcecapture2.orderId = "12345";
            forcecapture2.orderSource = orderSourceType.ecommerce;
            forcecapture2.card = card2;

            litleBatchRequest.addForceCapture(forcecapture2);

            var saleObj = new sale();
            saleObj.amount = 106;
            saleObj.litleTxnId = 123456;
            saleObj.orderId = "12344";
            saleObj.orderSource = orderSourceType.ecommerce;
            saleObj.card = card;

            litleBatchRequest.addSale(saleObj);

            var saleObj2 = new sale();
            saleObj2.amount = 106;
            saleObj2.litleTxnId = 123456;
            saleObj2.orderId = "12345";
            saleObj2.orderSource = orderSourceType.ecommerce;
            saleObj2.card = card2;

            litleBatchRequest.addSale(saleObj2);

            var registerTokenRequest = new registerTokenRequestType();
            registerTokenRequest.orderId = "12344";
            registerTokenRequest.accountNumber = "1233456789103801";
            registerTokenRequest.reportGroup = "Planets";

            litleBatchRequest.addRegisterTokenRequest(registerTokenRequest);

            var registerTokenRequest2 = new registerTokenRequestType();
            registerTokenRequest2.orderId = "12345";
            registerTokenRequest2.accountNumber = "1233456789103801";
            registerTokenRequest2.reportGroup = "Planets";

            litleBatchRequest.addRegisterTokenRequest(registerTokenRequest2);

            var updateCardValidationNumOnToken = new updateCardValidationNumOnToken();
            updateCardValidationNumOnToken.orderId = "12344";
            updateCardValidationNumOnToken.cardValidationNum = "123";
            updateCardValidationNumOnToken.litleToken = "4100000000000001";

            litleBatchRequest.addUpdateCardValidationNumOnToken(updateCardValidationNumOnToken);

            var updateCardValidationNumOnToken2 = new updateCardValidationNumOnToken();
            updateCardValidationNumOnToken2.orderId = "12345";
            updateCardValidationNumOnToken2.cardValidationNum = "123";
            updateCardValidationNumOnToken2.litleToken = "4242424242424242";

            litleBatchRequest.addUpdateCardValidationNumOnToken(updateCardValidationNumOnToken2);
            litle.addBatch(litleBatchRequest);

            var litleResponse = litle.sendToLitleWithStream();

            Assert.NotNull(litleResponse);
            Assert.AreEqual("0", litleResponse.response);
            Assert.AreEqual("Valid Format", litleResponse.message);

            var litleBatchResponse = litleResponse.nextBatchResponse();
            while (litleBatchResponse != null)
            {
                var authorizationResponse = litleBatchResponse.nextAuthorizationResponse();
                while (authorizationResponse != null)
                {
                    Assert.AreEqual("000", authorizationResponse.response);

                    authorizationResponse = litleBatchResponse.nextAuthorizationResponse();
                }

                var authReversalResponse = litleBatchResponse.nextAuthReversalResponse();
                while (authReversalResponse != null)
                {
                    Assert.AreEqual("360", authReversalResponse.response);

                    authReversalResponse = litleBatchResponse.nextAuthReversalResponse();
                }

                var captureResponse = litleBatchResponse.nextCaptureResponse();
                while (captureResponse != null)
                {
                    Assert.AreEqual("360", captureResponse.response);

                    captureResponse = litleBatchResponse.nextCaptureResponse();
                }

                var captureGivenAuthResponse = litleBatchResponse.nextCaptureGivenAuthResponse();
                while (captureGivenAuthResponse != null)
                {
                    Assert.AreEqual("000", captureGivenAuthResponse.response);

                    captureGivenAuthResponse = litleBatchResponse.nextCaptureGivenAuthResponse();
                }

                var creditResponse = litleBatchResponse.nextCreditResponse();
                while (creditResponse != null)
                {
                    Assert.AreEqual("000", creditResponse.response);

                    creditResponse = litleBatchResponse.nextCreditResponse();
                }

                var echeckCreditResponse = litleBatchResponse.nextEcheckCreditResponse();
                while (echeckCreditResponse != null)
                {
                    Assert.AreEqual("000", echeckCreditResponse.response);

                    echeckCreditResponse = litleBatchResponse.nextEcheckCreditResponse();
                }

                var echeckRedepositResponse = litleBatchResponse.nextEcheckRedepositResponse();
                while (echeckRedepositResponse != null)
                {
                    Assert.AreEqual("360", echeckRedepositResponse.response);

                    echeckRedepositResponse = litleBatchResponse.nextEcheckRedepositResponse();
                }

                var echeckSalesResponse = litleBatchResponse.nextEcheckSalesResponse();
                while (echeckSalesResponse != null)
                {
                    Assert.AreEqual("000", echeckSalesResponse.response);

                    echeckSalesResponse = litleBatchResponse.nextEcheckSalesResponse();
                }

                var echeckPreNoteSaleResponse = litleBatchResponse.nextEcheckPreNoteSaleResponse();
                while (echeckPreNoteSaleResponse != null)
                {
                    Assert.AreEqual("000", echeckPreNoteSaleResponse.response);

                    echeckPreNoteSaleResponse = litleBatchResponse.nextEcheckPreNoteSaleResponse();
                }

                var echeckPreNoteCreditResponse = litleBatchResponse.nextEcheckPreNoteCreditResponse();
                while (echeckPreNoteCreditResponse != null)
                {
                    Assert.AreEqual("000", echeckPreNoteCreditResponse.response);

                    echeckPreNoteCreditResponse = litleBatchResponse.nextEcheckPreNoteCreditResponse();
                }

                var echeckVerificationResponse = litleBatchResponse.nextEcheckVerificationResponse();
                while (echeckVerificationResponse != null)
                {
                    Assert.AreEqual("957", echeckVerificationResponse.response);

                    echeckVerificationResponse = litleBatchResponse.nextEcheckVerificationResponse();
                }

                var forceCaptureResponse = litleBatchResponse.nextForceCaptureResponse();
                while (forceCaptureResponse != null)
                {
                    Assert.AreEqual("000", forceCaptureResponse.response);

                    forceCaptureResponse = litleBatchResponse.nextForceCaptureResponse();
                }

                var registerTokenResponse = litleBatchResponse.nextRegisterTokenResponse();
                while (registerTokenResponse != null)
                {
                    Assert.AreEqual("820", registerTokenResponse.response);

                    registerTokenResponse = litleBatchResponse.nextRegisterTokenResponse();
                }

                var saleResponse = litleBatchResponse.nextSaleResponse();
                while (saleResponse != null)
                {
                    Assert.AreEqual("000", saleResponse.response);

                    saleResponse = litleBatchResponse.nextSaleResponse();
                }

                var updateCardValidationNumOnTokenResponse =
                    litleBatchResponse.nextUpdateCardValidationNumOnTokenResponse();
                while (updateCardValidationNumOnTokenResponse != null)
                {
                    Assert.AreEqual("823", updateCardValidationNumOnTokenResponse.response);

                    updateCardValidationNumOnTokenResponse =
                        litleBatchResponse.nextUpdateCardValidationNumOnTokenResponse();
                }

                litleBatchResponse = litleResponse.nextBatchResponse();
            }
        }
Ejemplo n.º 59
0
        public void test5AVS()
        {
            var authorization = new authorization();
            authorization.orderId = "5";
            authorization.amount = 0;
            authorization.orderSource = orderSourceType.ecommerce;
            var card = new cardType();
            card.type = methodOfPaymentTypeEnum.VI;
            card.number = "4457010200000007";
            card.expDate = "0512";
            card.cardValidationNum = "463";
            authorization.card = card;
            var authenticationvalue = new fraudCheckType();
            authenticationvalue.authenticationValue = "BwABBJQ1AgAAAAAgJDUCAAAAAAA=";
            authorization.cardholderAuthentication = authenticationvalue;

            var 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 test34()
        {
            var auth = new authorization();
            auth.orderId = "34";
            auth.amount = 30030;
            auth.orderSource = orderSourceType.ecommerce;
            var billToAddress = new contact();
            billToAddress.name = "Eileen Jones";
            billToAddress.addressLine1 = "3 Main St.";
            billToAddress.city = "Bloomfield";
            billToAddress.state = "CT";
            billToAddress.zip = "06002";
            billToAddress.country = countryTypeEnum.US;
            auth.billToAddress = billToAddress;
            var card = new cardType();
            card.number = "6011010000000003";
            card.expDate = "0312";
            card.cardValidationNum = "758";
            card.type = methodOfPaymentTypeEnum.DI;
            auth.card = card;

            var authorizeResponse = litle.Authorize(auth);
            Assert.AreEqual("000", authorizeResponse.response);
            Assert.AreEqual("Approved", authorizeResponse.message);
            Assert.AreEqual("33333", authorizeResponse.authCode);
            Assert.AreEqual("10", authorizeResponse.fraudResult.avsResult);
            Assert.AreEqual("M", authorizeResponse.fraudResult.cardValidationResult);

            var reversal = new authReversal();
            reversal.litleTxnId = authorizeResponse.litleTxnId;
            var reversalResponse = litle.AuthReversal(reversal);
            Assert.AreEqual("000", reversalResponse.response);
            Assert.AreEqual("Approved", reversalResponse.message);
        }