public void Test1AVS() { authorization authorization = new authorization(); authorization.id = "1"; authorization.orderId = "1"; authorization.amount = 0; authorization.orderSource = orderSourceType.ecommerce; contact contact = new contact(); contact.name = "John Smith"; contact.addressLine1 = "1 Main St."; contact.city = "Burlington"; contact.state = "MA"; contact.zip = "01803-3747"; contact.country = countryTypeEnum.US; authorization.billToAddress = contact; cardType card = new cardType(); card.type = methodOfPaymentTypeEnum.VI; card.number = "4457010000000009"; card.expDate = "0112"; card.cardValidationNum = "349"; authorization.card = card; authorizationResponse response = cnp.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 test28() { authorization authorization = new authorization(); authorization.id = "1"; authorization.orderId = "28"; authorization.amount = 15000; authorization.orderSource = orderSourceType.ecommerce; cardType card = new cardType(); card.type = methodOfPaymentTypeEnum.MC; card.number = "5194560012341234"; card.expDate = "1212"; authorization.card = card; authorization.allowPartialAuth = true; healthcareIIAS healthcareiias = new healthcareIIAS(); healthcareAmounts healthcareamounts = new healthcareAmounts(); healthcareamounts.totalHealthcareAmount = 15000; healthcareamounts.RxAmount = 3698; healthcareiias.healthcareAmounts = healthcareamounts; healthcareiias.IIASFlag = IIASFlagType.Y; authorization.healthcareIIAS = healthcareiias; authorizationResponse response = litle.Authorize(authorization); Assert.AreEqual("000", response.response); Assert.AreEqual("Approved", response.message); }
public void Test4AVS() { authorization authorization = new authorization(); authorization.id = "1"; authorization.orderId = "4"; authorization.amount = 0; authorization.orderSource = orderSourceType.ecommerce; contact contact = new contact(); contact.name = "Bob Black"; contact.addressLine1 = "4 Main St."; contact.city = "Laurel"; contact.state = "MD"; contact.zip = "20708"; contact.country = countryTypeEnum.US; authorization.billToAddress = contact; cardType card = new cardType(); card.type = methodOfPaymentTypeEnum.AX; card.number = "375001000000005"; card.expDate = "0412"; authorization.card = card; authorizationResponse response = cnp.Authorize(authorization); Assert.AreEqual("000", response.response); Assert.AreEqual("Approved", response.message); Assert.AreEqual("44444", response.authCode.Trim()); Assert.AreEqual("13", response.fraudResult.avsResult); }
public void Test6Auth() { authorization authorization = new authorization(); authorization.id = "1"; authorization.orderId = "6"; authorization.amount = 60060; authorization.orderSource = orderSourceType.ecommerce; contact contact = new contact(); contact.name = "Joe Green"; contact.addressLine1 = "6 Main St."; contact.city = "Derry"; contact.state = "NH"; contact.zip = "03038"; contact.country = countryTypeEnum.US; authorization.billToAddress = contact; cardType card = new cardType(); card.type = methodOfPaymentTypeEnum.VI; card.number = "4457010100000008"; card.expDate = "0612"; card.cardValidationNum = "992"; authorization.card = card; authorizationResponse response = cnp.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 Test57() { authorization auth = new authorization(); auth.id = "1"; auth.orderId = "57"; auth.amount = 15000; auth.orderSource = orderSourceType.ecommerce; cardType card = new cardType(); card.number = "5435101234510196"; card.expDate = "1112"; card.cardValidationNum = "987"; card.type = methodOfPaymentTypeEnum.MC; auth.card = card; authorizationResponse response = cnp.Authorize(auth); Assert.AreEqual("000", response.response); Assert.AreEqual("Approved", response.message); Assert.AreEqual("802", response.tokenResponse.tokenResponseCode); Assert.AreEqual("Account number was previously registered", response.tokenResponse.tokenMessage); Assert.AreEqual(methodOfPaymentTypeEnum.MC, response.tokenResponse.type); Assert.AreEqual("543510", response.tokenResponse.bin); }
public void Test1Auth() { authorization authorization = new authorization(); authorization.id = "1"; authorization.orderId = "1"; authorization.amount = 10100; authorization.orderSource = orderSourceType.ecommerce; contact contact = new contact(); contact.name = "John & Mary Smith"; contact.addressLine1 = "1 Main St."; contact.city = "Burlington"; contact.state = "MA"; contact.zip = "01803-3747"; contact.country = countryTypeEnum.US; authorization.billToAddress = contact; cardType card = new cardType(); card.type = methodOfPaymentTypeEnum.VI; card.number = "4457010000000009"; card.expDate = "0121"; card.cardValidationNum = "349"; authorization.card = card; authorizationResponse response = cnp.Authorize(authorization); Assert.AreEqual("000", response.response); Assert.AreEqual("Approved", response.message); Assert.AreEqual("11111 ", response.authCode); Assert.AreEqual("01", response.fraudResult.avsResult); Assert.AreEqual("M", response.fraudResult.cardValidationResult); capture capture = new capture(); capture.id = response.id; capture.cnpTxnId = response.cnpTxnId; captureResponse captureResponse = cnp.Capture(capture); Assert.AreEqual("000", captureResponse.response); Assert.AreEqual("Approved", captureResponse.message); credit credit = new credit(); credit.id = captureResponse.id; credit.cnpTxnId = captureResponse.cnpTxnId; creditResponse creditResponse = cnp.Credit(credit); Assert.AreEqual("000", creditResponse.response); Assert.AreEqual("Approved", creditResponse.message); voidTxn newvoid = new voidTxn(); newvoid.id = creditResponse.id; newvoid.cnpTxnId = creditResponse.cnpTxnId; voidResponse voidResponse = cnp.DoVoid(newvoid); Assert.AreEqual("000", voidResponse.response); Assert.AreEqual("Approved", voidResponse.message); }
public void TestAuth() { authorization authorization = new authorization(); authorization.reportGroup = "Planets"; authorization.orderId = "12344"; authorization.amount = 106; authorization.orderSource = orderSourceType.ecommerce; cardType card = new cardType(); card.type = methodOfPaymentTypeEnum.VI; card.number = "4100000000000002"; card.expDate = "1210"; authorization.card = card; var mock = new Mock <Communications>(); mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<litleOnlineRequest.*<authorization.*<card>.*<number>4100000000000002</number>.*</card>.*</authorization>.*", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >())) .Returns("<litleOnlineResponse version='8.10' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><authorizationResponse><litleTxnId>123</litleTxnId></authorizationResponse></litleOnlineResponse>"); Communications mockedCommunication = mock.Object; litle.setCommunication(mockedCommunication); authorizationResponse authorize = litle.Authorize(authorization); Assert.AreEqual(123, authorize.litleTxnId); }
public void AuthWithAmpersand() { authorization authorization = new authorization(); authorization.orderId = "1"; authorization.amount = 10010; authorization.orderSource = orderSourceType.ecommerce; contact 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; cardType card = new cardType(); card.type = methodOfPaymentTypeEnum.VI; card.number = "4457010000000009"; card.expDate = "0112"; card.cardValidationNum = "349"; authorization.card = card; authorizationResponse response = litle.Authorize(authorization); Assert.AreEqual("000", response.response); }
public void TestOriginalTransactionWithPin() { authorization auth = new authorization(); auth.originalNetworkTransactionId = "123456789"; auth.originalTransactionAmount = 12; cardType card = new cardType(); card.type = methodOfPaymentTypeEnum.MC; card.number = "414100000000000000"; card.expDate = "1210"; card.pin = "1234"; auth.card = card; var mock = new Mock <Communications>(); mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<card>\r\n<type>MC</type>\r\n<number>414100000000000000</number>\r\n<expDate>1210</expDate>\r\n<pin>1234</pin>\r\n</card>.*", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >())) .Returns("<litleOnlineResponse version='8.10' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><authorizationResponse><litleTxnId>123</litleTxnId></authorizationResponse></litleOnlineResponse>"); Communications mockedCommunication = mock.Object; litle.setCommunication(mockedCommunication); authorizationResponse authorizationResponse = litle.Authorize(auth); Assert.AreEqual(123, authorizationResponse.litleTxnId); }
public void Test3dsAttemptedShouldNotSayItem() { authorization auth = new authorization(); auth.orderId = "12344"; auth.amount = 2; auth.orderSource = orderSourceType.item3dsAttempted; auth.reportGroup = "Planets"; contact billToAddress = new contact(); billToAddress.email = "*****@*****.**"; billToAddress.zip = "12345"; auth.billToAddress = billToAddress; var mock = new Mock <Communications>(); mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<amount>2</amount>.*<orderSource>3dsAttempted</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>"); Communications mockedCommunication = mock.Object; litle.setCommunication(mockedCommunication); authorizationResponse authorizationResponse = litle.Authorize(auth); Assert.NotNull(authorizationResponse); Assert.AreEqual(123, authorizationResponse.litleTxnId); }
public void TestRecycleEngineActive() { String xmlResponse = @"<litleOnlineResponse version='8.23' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'> <authorizationResponse> <litleTxnId>123</litleTxnId> <fraudResult> <advancedFraudResults> <deviceReviewStatus>ReviewStatus</deviceReviewStatus> <deviceReputationScore>800</deviceReputationScore> <triggeredRule>rule triggered</triggeredRule> </advancedFraudResults> </fraudResult> <recycling> <recycleEngineActive>1</recycleEngineActive> </recycling> </authorizationResponse> </litleOnlineResponse>"; litleOnlineResponse litleOnlineResponse = LitleOnline.DeserializeObject(xmlResponse); authorizationResponse authorizationResponse = (authorizationResponse)litleOnlineResponse.authorizationResponse; Assert.AreEqual(123, authorizationResponse.litleTxnId); Assert.NotNull(authorizationResponse.fraudResult); Assert.NotNull(authorizationResponse.fraudResult.advancedFraudResults); Assert.NotNull(authorizationResponse.fraudResult.advancedFraudResults.deviceReviewStatus); Assert.AreEqual("ReviewStatus", authorizationResponse.fraudResult.advancedFraudResults.deviceReviewStatus); Assert.NotNull(authorizationResponse.fraudResult.advancedFraudResults.deviceReputationScore); Assert.AreEqual(800, authorizationResponse.fraudResult.advancedFraudResults.deviceReputationScore); Assert.AreEqual("rule triggered", authorizationResponse.fraudResult.advancedFraudResults.triggeredRule); Assert.AreEqual(true, authorizationResponse.recycling.recycleEngineActive); }
public void TestAuthWithPosCatLevelEnum() { authorization auth = new authorization(); auth.pos = new pos(); auth.orderId = "ABC123"; auth.amount = 98700; auth.pos.catLevel = posCatLevelEnum.selfservice; String expectedResult = @" <authorization id="""" reportGroup=""""> <orderId>ABC123</orderId> <amount>98700</amount> <pos> <catLevel>self service</catLevel> </pos> </authorization>"; Assert.AreEqual(Regex.Replace(expectedResult, @"\s+", String.Empty), Regex.Replace(auth.Serialize(), @"\s+", String.Empty)); var mock = new Mock <Communications>(); mock.Setup(Communications => Communications.HttpPost(It.IsAny <String>(), It.IsAny <Dictionary <String, String> >())) .Returns("<litleOnlineResponse version='8.23' response='0' message='Valid Format' xmlns='http://www.litle.com/schema'><authorizationResponse><litleTxnId>123</litleTxnId></authorizationResponse></litleOnlineResponse>"); Communications mockedCommunication = mock.Object; litle.setCommunication(mockedCommunication); authorizationResponse authorizationResponse = litle.Authorize(auth); Assert.NotNull(authorizationResponse); Assert.AreEqual(123, authorizationResponse.litleTxnId); }
public void TestDebtRepayment() { authorization auth = new authorization(); auth.card = new cardType(); auth.card.type = methodOfPaymentTypeEnum.VI; auth.card.number = "4100000000000001"; auth.card.expDate = "1213"; auth.orderId = "12344"; auth.amount = 2; auth.orderSource = orderSourceType.ecommerce; auth.fraudFilterOverride = true; auth.debtRepayment = true; var mock = new Mock <Communications>(); mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*<fraudFilterOverride>true</fraudFilterOverride>\r\n<debtRepayment>true</debtRepayment>\r\n</authorization>.*", 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>"); Communications mockedCommunication = mock.Object; litle.setCommunication(mockedCommunication); authorizationResponse authorizationResponse = litle.Authorize(auth); Assert.NotNull(authorizationResponse); Assert.AreEqual(123, authorizationResponse.litleTxnId); }
public void test31() { authorization authorization = new authorization(); authorization.orderId = "31"; authorization.amount = 25000; authorization.orderSource = orderSourceType.ecommerce; cardType card = new cardType(); card.type = methodOfPaymentTypeEnum.VI; card.number = "4024720001231239"; card.expDate = "1212"; authorization.card = card; authorization.allowPartialAuth = true; healthcareIIAS healthcareiias = new healthcareIIAS(); healthcareAmounts healthcareamounts = new healthcareAmounts(); healthcareamounts.totalHealthcareAmount = 18699; healthcareamounts.RxAmount = 1000; healthcareamounts.visionAmount = 15099; healthcareiias.healthcareAmounts = healthcareamounts; healthcareiias.IIASFlag = IIASFlagType.Y; authorization.healthcareIIAS = healthcareiias; authorizationResponse response = litle.Authorize(authorization); Assert.AreEqual("010", response.response); Assert.AreEqual("Partially Approved", response.message); Assert.AreEqual("18699", response.approvedAmount); }
public void Test3Auth() { authorization authorization = new authorization(); authorization.id = "1"; authorization.orderId = "3"; authorization.amount = 30030; authorization.orderSource = orderSourceType.ecommerce; contact contact = new contact(); contact.name = "Eileen Jones"; contact.addressLine1 = "3 Main St."; contact.city = "Bloomfield"; contact.state = "CT"; contact.zip = "06002"; contact.country = countryTypeEnum.US; authorization.billToAddress = contact; cardType card = new cardType(); card.type = methodOfPaymentTypeEnum.DI; card.number = "6011010000000003"; card.expDate = "0312"; card.cardValidationNum = "758"; authorization.card = card; authorizationResponse response = cnp.Authorize(authorization); Assert.AreEqual("000", response.response); Assert.AreEqual("Approved", response.message); Assert.AreEqual("33333", response.authCode.Trim()); Assert.AreEqual("10", response.fraudResult.avsResult); Assert.AreEqual("M", response.fraudResult.cardValidationResult); capture capture = new capture(); capture.id = response.id; capture.cnpTxnId = response.cnpTxnId; captureResponse captureResponse = cnp.Capture(capture); Assert.AreEqual("000", captureResponse.response); Assert.AreEqual("Approved", captureResponse.message); credit credit = new credit(); credit.id = captureResponse.id; credit.cnpTxnId = captureResponse.cnpTxnId; creditResponse creditResponse = cnp.Credit(credit); Assert.AreEqual("000", creditResponse.response); Assert.AreEqual("Approved", creditResponse.message); voidTxn newvoid = new voidTxn(); newvoid.id = creditResponse.id; newvoid.cnpTxnId = creditResponse.cnpTxnId; cnpOnlineResponseTransactionResponseVoidResponse voidResponse = cnp.DoVoid(newvoid); Assert.AreEqual("000", voidResponse.response); Assert.AreEqual("Approved", voidResponse.message); }
public void TestWithAdvancedFraudCheck() { 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; advancedFraudChecksType advancedFraudChecks = new advancedFraudChecksType(); advancedFraudChecks.threatMetrixSessionId = "800"; advancedFraudChecks.customAttribute1 = "testAttribute1"; advancedFraudChecks.customAttribute2 = "testAttribute2"; advancedFraudChecks.customAttribute3 = "testAttribute3"; advancedFraudChecks.customAttribute4 = "testAttribute4"; advancedFraudChecks.customAttribute5 = "testAttribute5"; authorization.advancedFraudChecks = advancedFraudChecks; authorizationResponse response = litle.Authorize(authorization); Assert.AreEqual("000", response.response); }
private long doCycle() { requestCount++; authorization authorization = new authorization(); authorization.reportGroup = "123456"; authorization.orderId = ("" + threadId + "-" + DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond); authorization.amount = (106L); authorization.orderSource = (orderSourceType.ecommerce); authorization.id = "id" + threadId; cardType card = new cardType(); card.type = methodOfPaymentTypeEnum.VI; card.number = "4100000000000000"; card.expDate = "1210"; authorization.card = card; long startTime = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond; authorizationResponse response = cnp.Authorize(authorization); long responseTime = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond - startTime; Assert.AreEqual("123456", response.reportGroup); if (response.response == "000") { successCount++; } else { failedCount++; } return(responseTime); }
public void Test36() { authorization auth = new authorization(); auth.id = "1"; auth.orderId = "36"; auth.amount = 20500; auth.orderSource = orderSourceType.ecommerce; cardType card = new cardType(); card.number = "375000026600004"; card.expDate = "0512"; card.type = methodOfPaymentTypeEnum.AX; auth.card = card; authorizationResponse authorizeResponse = cnp.Authorize(auth); Assert.AreEqual("000", authorizeResponse.response); Assert.AreEqual("Approved", authorizeResponse.message); authReversal reversal = new authReversal(); reversal.id = authorizeResponse.id; reversal.cnpTxnId = 360000000000000000; reversal.amount = 10000; authReversalResponse reversalResponse = cnp.AuthReversal(reversal); Assert.AreEqual("000", reversalResponse.response); Assert.AreEqual("Approved", reversalResponse.message); }
public void Test14() { authorization authorization = new authorization(); authorization.id = "1"; authorization.orderId = "14"; authorization.amount = 10100; authorization.orderSource = orderSourceType.ecommerce; cardType card = new cardType(); card.type = methodOfPaymentTypeEnum.VI; card.number = "4457010200000247"; card.expDate = "0821"; 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(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); }
public void Test9AVS() { authorization authorization = new authorization(); authorization.id = "1"; authorization.orderId = "9"; authorization.amount = 0; authorization.orderSource = orderSourceType.ecommerce; contact contact = new contact(); contact.name = "James Miller"; contact.addressLine1 = "9 Main St."; contact.city = "Boston"; contact.state = "MA"; contact.zip = "02134"; contact.country = countryTypeEnum.US; authorization.billToAddress = contact; cardType card = new cardType(); card.type = methodOfPaymentTypeEnum.AX; card.number = "375001010000003"; card.expDate = "0912"; card.cardValidationNum = "0421"; authorization.card = card; authorizationResponse response = cnp.Authorize(authorization); Assert.AreEqual("303", response.response); Assert.AreEqual("Pick Up Card", response.message); Assert.AreEqual("34", response.fraudResult.avsResult); }
public void Test16() { authorization authorization = new authorization(); authorization.id = "1"; authorization.orderId = "16"; authorization.amount = 3000; authorization.orderSource = orderSourceType.ecommerce; cardType card = new cardType(); card.type = methodOfPaymentTypeEnum.MC; card.number = "5592106621450897"; card.expDate = "0312"; 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(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); }
public void Test3AVS() { authorization authorization = new authorization(); authorization.id = "1"; authorization.orderId = "3"; authorization.amount = 0; authorization.orderSource = orderSourceType.ecommerce; contact contact = new contact(); contact.name = "Eileen Jones"; contact.addressLine1 = "3 Main St."; contact.city = "Bloomfield"; contact.state = "CT"; contact.zip = "06002"; contact.country = countryTypeEnum.US; authorization.billToAddress = contact; cardType card = new cardType(); card.type = methodOfPaymentTypeEnum.DI; card.number = "6011010000000003"; card.expDate = "0312"; card.cardValidationNum = "758"; authorization.card = card; authorizationResponse response = cnp.Authorize(authorization); Assert.AreEqual("000", response.response); Assert.AreEqual("Approved", response.message); Assert.AreEqual("33333", response.authCode.Trim()); Assert.AreEqual("10", response.fraudResult.avsResult); Assert.AreEqual("M", response.fraudResult.cardValidationResult); }
public void TestAccountUpdaterResponse() { String xml = @" <authorizationResponse xmlns=""http://www.vantivcnp.com/schema""> <accountUpdater> <extendedCardResponse> <message>TheMessage</message> <code>TheCode</code> </extendedCardResponse> <newCardInfo> <type>VI</type> <number>4100000000000000</number> <expDate>1000</expDate> </newCardInfo> <originalCardInfo> <type>MC</type> <number>5300000000000000</number> <expDate>1100</expDate> </originalCardInfo> </accountUpdater> </authorizationResponse>"; XmlSerializer serializer = new XmlSerializer(typeof(authorizationResponse)); StringReader reader = new StringReader(xml); authorizationResponse authorizationResponse = (authorizationResponse)serializer.Deserialize(reader); Assert.AreEqual("TheMessage", authorizationResponse.accountUpdater.extendedCardResponse.message); Assert.AreEqual("TheCode", authorizationResponse.accountUpdater.extendedCardResponse.code); Assert.AreEqual(methodOfPaymentTypeEnum.VI, authorizationResponse.accountUpdater.newCardInfo.type); Assert.AreEqual("4100000000000000", authorizationResponse.accountUpdater.newCardInfo.number); Assert.AreEqual("1000", authorizationResponse.accountUpdater.newCardInfo.expDate); Assert.AreEqual(methodOfPaymentTypeEnum.MC, authorizationResponse.accountUpdater.originalCardInfo.type); Assert.AreEqual("5300000000000000", authorizationResponse.accountUpdater.originalCardInfo.number); Assert.AreEqual("1100", authorizationResponse.accountUpdater.originalCardInfo.expDate); }
public void Test5AVS() { authorization authorization = new authorization(); authorization.id = "1"; authorization.orderId = "5"; authorization.amount = 0; authorization.orderSource = orderSourceType.ecommerce; cardType card = new cardType(); card.type = methodOfPaymentTypeEnum.VI; card.number = "4457010200000007"; card.expDate = "0512"; card.cardValidationNum = "463"; authorization.card = card; fraudCheckType authenticationvalue = new fraudCheckType(); authenticationvalue.authenticationValue = "BwABBJQ1AgAAAAAgJDUCAAAAAAA="; authorization.cardholderAuthentication = authenticationvalue; authorizationResponse response = cnp.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("M", response.fraudResult.cardValidationResult); }
public void TestDefaultReportGroup() { authorization authorization = new authorization(); authorization.orderId = "12344"; authorization.amount = 106; authorization.orderSource = orderSourceType.ecommerce; cardType card = new cardType(); card.type = methodOfPaymentTypeEnum.VI; card.number = "4100000000000002"; card.expDate = "1210"; authorization.card = card; var mock = new Mock <Communications>(); mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*?<cnpOnlineRequest.*?<authorization.*? reportGroup=\"Default Report Group\">.*?<card>.*?<number>4100000000000002</number>.*?</card>.*?</authorization>.*?", RegexOptions.Singleline), It.IsAny <Dictionary <String, String> >())) .Returns("<cnpOnlineResponse version='8.10' response='0' message='Valid Format' xmlns='http://www.vantivcnp.com/schema'><authorizationResponse reportGroup='Default Report Group'></authorizationResponse></cnpOnlineResponse>"); Communications mockedCommunication = mock.Object; cnp.SetCommunication(mockedCommunication); authorizationResponse authorize = cnp.Authorize(authorization); Assert.AreEqual("Default Report Group", authorize.reportGroup); }
public void Test7AVS() { authorization authorization = new authorization(); authorization.id = "1"; authorization.orderId = "7"; authorization.amount = 0; authorization.orderSource = orderSourceType.ecommerce; contact contact = new contact(); contact.name = "Jane Murray"; contact.addressLine1 = "7 Main St."; contact.city = "Amesbury"; contact.state = "MA"; contact.zip = "01913"; contact.country = countryTypeEnum.US; authorization.billToAddress = contact; cardType card = new cardType(); card.type = methodOfPaymentTypeEnum.MC; card.number = "5112010100000002"; card.expDate = "0712"; card.cardValidationNum = "251"; authorization.card = card; authorizationResponse response = cnp.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 simpleAuthWithApplepayAndSecondaryAmountAndWallet() { authorization authorization = new authorization(); authorization.reportGroup = "Planets"; authorization.orderId = "123456"; authorization.amount = 110; authorization.secondaryAmount = 50; authorization.orderSource = orderSourceType.applepay; applepayType applepay = new applepayType(); applepayHeaderType 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"; authorization.applepay = applepay; wallet wallet = new wallet(); wallet.walletSourceTypeId = "123"; wallet.walletSourceType = walletWalletSourceType.MasterPass; authorization.wallet = wallet; authorizationResponse response = litle.Authorize(authorization); Assert.AreEqual("Insufficient Funds", response.message); Assert.AreEqual("110", response.applepayResponse.transactionAmount); }
public void Test8AVS() { authorization authorization = new authorization(); authorization.id = "1"; authorization.orderId = "8"; authorization.amount = 0; authorization.orderSource = orderSourceType.ecommerce; contact contact = new contact(); contact.name = "Mark Johnson"; contact.addressLine1 = "8 Main St."; contact.city = "Manchester"; contact.state = "NH"; contact.zip = "03101"; contact.country = countryTypeEnum.US; authorization.billToAddress = contact; cardType card = new cardType(); card.type = methodOfPaymentTypeEnum.DI; card.number = "6011010100000002"; card.expDate = "0812"; card.cardValidationNum = "184"; authorization.card = card; authorizationResponse response = cnp.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); }
public void trackData() { authorization authorization = new authorization(); authorization.id = "AX54321678"; authorization.reportGroup = "RG27"; authorization.orderId = "12z58743y1"; authorization.amount = 12522L; authorization.orderSource = orderSourceType.retail; contact billToAddress = new contact(); billToAddress.zip = "95032"; authorization.billToAddress = billToAddress; cardType card = new cardType(); card.track = "%B40000001^Doe/JohnP^06041...?;40001=0604101064200?"; authorization.card = card; pos pos = new pos(); pos.capability = posCapabilityTypeEnum.magstripe; pos.entryMode = posEntryModeTypeEnum.completeread; pos.cardholderId = posCardholderIdTypeEnum.signature; authorization.pos = pos; authorizationResponse response = litle.Authorize(authorization); Assert.AreEqual("Approved", response.message); }
public void test29() { authorization authorization = new authorization(); authorization.id = "1"; authorization.orderId = "29"; authorization.amount = 18699; authorization.orderSource = orderSourceType.ecommerce; cardType card = new cardType(); card.type = methodOfPaymentTypeEnum.VI; card.number = "4024720001231239"; card.expDate = "1212"; authorization.card = card; authorization.allowPartialAuth = true; healthcareIIAS healthcareiias = new healthcareIIAS(); healthcareAmounts healthcareamounts = new healthcareAmounts(); healthcareamounts.totalHealthcareAmount = 31000; healthcareamounts.RxAmount = 1000; healthcareamounts.visionAmount = 19901; healthcareamounts.clinicOtherAmount = 9050; healthcareamounts.dentalAmount = 1049; healthcareiias.healthcareAmounts = healthcareamounts; healthcareiias.IIASFlag = IIASFlagType.Y; authorization.healthcareIIAS = healthcareiias; authorizationResponse response = litle.Authorize(authorization); Assert.AreEqual("341", response.response); }
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 mockLitleResponse = new Mock<litleResponse>(); var mockLitleBatchResponse = new Mock<batchResponse>(); var mockLitleXmlSerializer = new Mock<litleXmlSerializer>(); var mockAuthorizationResponse1 = new authorizationResponse(); mockAuthorizationResponse1.litleTxnId = 123; var mockAuthorizationResponse2 = new authorizationResponse(); mockAuthorizationResponse2.litleTxnId = 124; mockLitleBatchResponse.SetupSequence(litleBatchResponse => litleBatchResponse.nextAuthorizationResponse()) .Returns(mockAuthorizationResponse1) .Returns(mockAuthorizationResponse2) .Returns(null); var mockedLitleResponse = mockLitleResponse.Object; mockedLitleResponse.message = "Error validating xml data against the schema"; mockedLitleResponse.response = "1"; var mockedCommunications = mockCommunications.Object; mockLitleXmlSerializer.Setup( litleXmlSerializer => litleXmlSerializer.DeserializeObjectFromString(It.IsAny<string>())) .Returns(mockedLitleResponse); var mockedLitleXmlSerializer = mockLitleXmlSerializer.Object; var mockedLitleFile = mockLitleFile.Object; try { litle.setCommunication(mockedCommunications); litle.setLitleXmlSerializer(mockedLitleXmlSerializer); litle.setLitleFile(mockedLitleFile); litle.setLitleTime(mockLitleTime.Object); var litleBatchRequest = new batchRequest(_mockCache.Object); litleBatchRequest.setLitleFile(mockedLitleFile); litleBatchRequest.setLitleTime(mockLitleTime.Object); litleBatchRequest.addAuthorization(authorization); litleBatchRequest.addAuthorization(authorization); litle.addBatch(litleBatchRequest); var batchFileName = litle.sendToLitle(); var litleResponse = litle.receiveFromLitle(batchFileName); } catch (LitleOnlineException e) { Assert.AreEqual("Error validating xml data against the schema", e.Message); } }