From f3f0674cb684df8f59c63f01338ce2963a69f28f Mon Sep 17 00:00:00 2001 From: Nitinsl Date: Thu, 16 Mar 2023 19:03:02 +0530 Subject: [PATCH 1/5] commiting changes and unit tests --- CnpSdkForNet/CnpSdkForNet/CnpVersion.cs | 4 +- CnpSdkForNet/CnpSdkForNet/XmlRequestFields.cs | 151 +++++++++++++++++- .../Unit/TestAuthorization.cs | 119 ++++++++++++++ .../CnpSdkForNetTest/Unit/TestSale.cs | 92 +++++++++++ 4 files changed, 363 insertions(+), 3 deletions(-) diff --git a/CnpSdkForNet/CnpSdkForNet/CnpVersion.cs b/CnpSdkForNet/CnpSdkForNet/CnpVersion.cs index 4bde18d..9c6d6ae 100644 --- a/CnpSdkForNet/CnpSdkForNet/CnpVersion.cs +++ b/CnpSdkForNet/CnpSdkForNet/CnpVersion.cs @@ -8,7 +8,7 @@ namespace Cnp.Sdk */ public class CnpVersion { - public const String CurrentCNPXMLVersion = "12.27"; - public const String CurrentCNPSDKVersion = "12.27.0"; + public const String CurrentCNPXMLVersion = "12.30"; + public const String CurrentCNPSDKVersion = "12.30.0"; } } diff --git a/CnpSdkForNet/CnpSdkForNet/XmlRequestFields.cs b/CnpSdkForNet/CnpSdkForNet/XmlRequestFields.cs index 8aef67a..b9640dc 100644 --- a/CnpSdkForNet/CnpSdkForNet/XmlRequestFields.cs +++ b/CnpSdkForNet/CnpSdkForNet/XmlRequestFields.cs @@ -281,6 +281,7 @@ public long surchargeAmount } public orderSourceType orderSource; public customerInfo customerInfo; + public sellerInfo sellerInfo;//12.29 public contact billToAddress; public contact retailerAddress;///12.24 public additionalCOFData additionalCOFData; @@ -531,6 +532,25 @@ public fraudSwitchIndicatorEnum fraudSwitchIndicator } public passengerTransportData passengerTransportData; //12.25 and 12.26 end + + //12.30 start + private authIndicatorEnum authIndicatorField; + private bool authIndicatorSet; + public authIndicatorEnum authIndicator + { + get + { + return authIndicatorField; + } + set + { + authIndicatorField = value; + authIndicatorSet = true; + } + } + + //12.30 end + public bool? skipRealtimeAU; public string merchantCategoryCode; @@ -547,6 +567,8 @@ public override string Serialize() if (cnpTxnIdSet) { xml += "\r\n" + cnpTxnIdField + ""; + xml += "\r\n" + amount + ""; + xml += "\r\n" + authIndicatorField + ""; } else { @@ -560,6 +582,10 @@ public override string Serialize() { xml += "\r\n" + customerInfo.Serialize() + "\r\n"; } + if (sellerInfo != null) + { + xml += "\r\n" + sellerInfo.Serialize() + "\r\n"; + } if (billToAddress != null) { xml += "\r\n" + billToAddress.Serialize() + "\r\n"; @@ -694,6 +720,15 @@ public override string Serialize() xml += "\r\n" + passengerTransportData.Serialize() + "\r\n"; } //end + + //12.30 start + + if (authIndicatorSet) + { + xml += "\r\n" + authIndicatorField + ""; + } + //end + if (merchantData != null) { xml += "\r\n" + merchantData.Serialize() + "\r\n"; @@ -2607,6 +2642,7 @@ public long surchargeAmount } public orderSourceType orderSource; public customerInfo customerInfo; + public sellerInfo sellerInfo;//12.29 public contact billToAddress; public contact retailerAddress;///12.24 public contact shipToAddress; @@ -2907,6 +2943,10 @@ public override string Serialize() { xml += "\r\n" + customerInfo.Serialize() + "\r\n"; } + if (sellerInfo != null) + { + xml += "\r\n" + sellerInfo.Serialize() + "\r\n"; + } if (billToAddress != null) { xml += "\r\n" + billToAddress.Serialize() + "\r\n"; @@ -3720,6 +3760,7 @@ public enum orderChannelEnum SOCIAL, MARKETPLACE, IN_STORE_KIOSK, + MIT// new 12.28 } //new 12.25, 12.26 and 12.27 start @@ -3791,6 +3832,14 @@ public enum walletSourceType } //12.25, 12.26 and 12.27 end + //new 12.28, 12.29 and 12.30 start + public enum authIndicatorEnum + { + Estimated, + Incremental + } + + #endregion #region Child elements. @@ -4458,7 +4507,7 @@ public partial class cardTokenType public string tokenUrl; public string expDate; public string cardValidationNum; - private string authenticatedShopperID; + private string authenticatedShopperID; private methodOfPaymentTypeEnum typeField; private bool typeSet; public methodOfPaymentTypeEnum type @@ -6211,6 +6260,106 @@ public string Serialize() } } + //12.29 + public partial class sellerInfo + { + public string accountNumber; + private int aggregateOrderCountField; + private bool aggregateOrderCountSet; + public int aggregateOrderCount + { + get { return aggregateOrderCountField; } + set { aggregateOrderCountField = value; aggregateOrderCountSet = true; } + } + + private int aggregateOrderDollarsField; + private bool aggregateOrderDollarsSet; + + public int aggregateOrderDollars + { + get { return aggregateOrderDollarsField; } + set { aggregateOrderDollarsField = value; aggregateOrderDollarsSet = true; } + } + public sellerAddress sellerAddress; + public string createdDate; + public string domain; + public string email; + public string lastUpdateDate; + public string name; + public string onboardingEmail; + public string onboardingIpAddress; + public string parentEntity; + public string phone; + public string sellerId; + public sellerTagsType sellerTags; + public string username; + + public string Serialize() + { + var xml = ""; + if (accountNumber != null) xml += "\r\n" + SecurityElement.Escape(accountNumber) + ""; + if (aggregateOrderCountSet) xml += "\r\n" + aggregateOrderCountField + ""; + if (aggregateOrderDollarsSet) xml += "\r\n" + aggregateOrderDollarsField + ""; + if (sellerAddress != null) + { + xml += "\r\n" + sellerAddress.Serialize() + "\r\n"; + } + return xml; + if (createdDate != null) xml += "\r\n" + SecurityElement.Escape(createdDate) + ""; + if (domain != null) xml += "\r\n" + SecurityElement.Escape(domain) + ""; + if (email != null) xml += "\r\n" + SecurityElement.Escape(email) + ""; + if (lastUpdateDate != null) xml += "\r\n" + SecurityElement.Escape(lastUpdateDate) + ""; + if (name != null) xml += "\r\n" + SecurityElement.Escape(name) + ""; + if (onboardingEmail != null) xml += "\r\n" + SecurityElement.Escape(onboardingEmail) + ""; + if (onboardingIpAddress != null) xml += "\r\n" + SecurityElement.Escape(onboardingIpAddress) + ""; + if (parentEntity != null) xml += "\r\n" + SecurityElement.Escape(parentEntity) + ""; + if (phone != null) xml += "\r\n" + SecurityElement.Escape(phone) + ""; + if (sellerId != null) xml += "\r\n" + SecurityElement.Escape(sellerId) + ""; + if (sellerTags != null) + { + xml += "\r\n" + sellerTags.Serialize() + "\r\n"; + } + if (username != null) xml += "\r\n" + SecurityElement.Escape(username) + ""; + + return xml; + } + + } + + public partial class sellerAddress + { + public string sellerStreetaddress; + public string sellerUnit; + public string sellerPostalcode; + public string sellerCity; + public string sellerProvincecode; + public string sellerCountrycode; + + public string Serialize() + { + var xml = ""; + if (sellerStreetaddress != null) xml += "\r\n" + SecurityElement.Escape(sellerStreetaddress) + ""; + if (sellerUnit != null) xml += "\r\n" + SecurityElement.Escape(sellerUnit) + ""; + if (sellerPostalcode != null) xml += "\r\n" + SecurityElement.Escape(sellerPostalcode) + ""; + if (sellerCity != null) xml += "\r\n" + SecurityElement.Escape(sellerCity) + ""; + if (sellerProvincecode != null) xml += "\r\n" + SecurityElement.Escape(sellerProvincecode) + ""; + if (sellerCountrycode != null) xml += "\r\n" + SecurityElement.Escape(sellerCountrycode) + ""; + return xml; + } + } + + public partial class sellerTagsType + { + public string tag; + + public string Serialize() + { + var xml = ""; + if (tag != null) xml += "\r\n" + SecurityElement.Escape(tag) + ""; + return xml; + } + } + public partial class propertyAddress { public string name; diff --git a/CnpSdkForNet/CnpSdkForNetTest/Unit/TestAuthorization.cs b/CnpSdkForNet/CnpSdkForNetTest/Unit/TestAuthorization.cs index 4e68044..ffa3a51 100644 --- a/CnpSdkForNet/CnpSdkForNetTest/Unit/TestAuthorization.cs +++ b/CnpSdkForNet/CnpSdkForNetTest/Unit/TestAuthorization.cs @@ -2,6 +2,7 @@ using NUnit.Framework; using Moq; using System.Text.RegularExpressions; +using System.Xml.Linq; namespace Cnp.Sdk.Test.Unit @@ -892,5 +893,123 @@ public void AuthWithLodgingInfoPropertyAddressChanges() ///new testcase 12.25 Assert.NotNull(authorizationResponse); Assert.AreEqual(123, authorizationResponse.cnpTxnId); } + + // 12.28, 12.29 and 12.30 start + [Test] + public void AuthWithOrderchannelEnumMIT_SellerInfo_AuthIndicatorEstimatedEnum() + { + var auth = new authorization(); + auth.orderId = "12344"; + auth.amount = 2; + auth.orderSource = orderSourceType.ecommerce; + var sellerInfo = new sellerInfo(); + sellerInfo.accountNumber = "4485581000000005"; + sellerInfo.aggregateOrderCount = 4; + sellerInfo.aggregateOrderDollars = 100000; + var sellerAddress = new sellerAddress(); + sellerAddress.sellerStreetaddress = "15 Main Street"; + sellerAddress.sellerUnit = "100 AB"; + sellerAddress.sellerPostalcode = "12345"; + sellerAddress.sellerCity = "San Jose"; + sellerAddress.sellerProvincecode = "MA"; + sellerAddress.sellerCountrycode = "US"; + sellerInfo.sellerAddress = sellerAddress; + sellerInfo.createdDate = "2015-11-12T20:33:09"; + sellerInfo.domain = "vap"; + sellerInfo.email = "bob@example.com"; + sellerInfo.lastUpdateDate = "2015-11-12T20:33:09"; + sellerInfo.name = "bob"; + sellerInfo.onboardingEmail = "bob@example.com"; + sellerInfo.onboardingIpAddress = "75.100.88.78"; + sellerInfo.parentEntity = "abc"; + sellerInfo.phone = "9785510040"; + sellerInfo.sellerId = "123456789"; + var sellerTagsType = new sellerTagsType(); + sellerTagsType.tag = "3"; + sellerInfo.sellerTags = sellerTagsType; + sellerInfo.username = "bob123"; + auth.sellerInfo = sellerInfo; + auth.reportGroup = "Planets"; + auth.id = "thisisid"; + auth.businessIndicator = businessIndicatorEnum.fundTransfer; + auth.orderChannel = orderChannelEnum.MIT; + auth.crypto = false; + auth.fraudCheckStatus = "Not Approved"; + var passengerTransportData = new passengerTransportData(); + passengerTransportData.passengerName = "Pia Jaiswal"; + passengerTransportData.ticketNumber = "TR0001"; + passengerTransportData.issuingCarrier = "IC"; + passengerTransportData.carrierName = "Indigo"; + passengerTransportData.restrictedTicketIndicator = "TI2022"; + passengerTransportData.numberOfAdults = 1; + passengerTransportData.numberOfChildren = 1; + passengerTransportData.customerCode = "C2011583"; + passengerTransportData.arrivalDate = new System.DateTime(2022, 12, 31); + passengerTransportData.issueDate = new System.DateTime(2022, 12, 25); + passengerTransportData.travelAgencyCode = "TAC12345"; + passengerTransportData.travelAgencyName = "Yatra"; + passengerTransportData.computerizedReservationSystem = computerizedReservationSystemEnum.STRT; + passengerTransportData.creditReasonIndicator = creditReasonIndicatorEnum.A; + passengerTransportData.ticketChangeIndicator = ticketChangeIndicatorEnum.C; + passengerTransportData.ticketIssuerAddress = "Hinjewadi"; + passengerTransportData.exchangeTicketNumber = "ETN12345"; + passengerTransportData.exchangeAmount = 12300; + passengerTransportData.exchangeFeeAmount = 11000; + + var tripLegData = new tripLegData(); + tripLegData.tripLegNumber = 12; + tripLegData.departureCode = "DC"; + tripLegData.carrierCode = "CC"; + tripLegData.serviceClass = serviceClassEnum.First; + tripLegData.stopOverCode = "N"; + tripLegData.destinationCode = "DC111"; + tripLegData.fareBasisCode = "FBC12345"; + tripLegData.departureDate = new System.DateTime(2023, 1, 31); + tripLegData.originCity = "Pune"; + tripLegData.travelNumber = "TN111"; + tripLegData.departureTime = "13:05"; + tripLegData.arrivalTime = "16:10"; + tripLegData.remarks = "NA"; + passengerTransportData.tripLegData = tripLegData; + auth.passengerTransportData = passengerTransportData; + auth.authIndicator = authIndicatorEnum.Estimated; + + var mock = new Mock(); + + mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*4485581000000005.*4.*100000.*", RegexOptions.Singleline))) + .Returns("123"); + + var mockedCommunication = mock.Object; + cnp.SetCommunication(mockedCommunication); + var authorizationResponse = cnp.Authorize(auth); + + Assert.NotNull(authorizationResponse); + Assert.AreEqual(123, authorizationResponse.cnpTxnId); + } + + [Test] + public void AuthWithAuthIndicatorIncrementalEnum() + { + var auth = new authorization(); + auth.id = "thisisid"; + auth.customerId = "Cust044"; + auth.reportGroup = "Planets"; + auth.cnpTxnId = 12345; + auth.amount = 5000; + auth.authIndicator = authIndicatorEnum.Incremental; + var mock = new Mock(); + mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*12345.*5000.*", RegexOptions.Singleline))) + .Returns("123"); + + var mockedCommunication = mock.Object; + cnp.SetCommunication(mockedCommunication); + var authorizationResponse = cnp.Authorize(auth); + + Assert.NotNull(authorizationResponse); + Assert.AreEqual(123, authorizationResponse.cnpTxnId); + + } + // 12.28, 12.29 and 12.30 end + } } diff --git a/CnpSdkForNet/CnpSdkForNetTest/Unit/TestSale.cs b/CnpSdkForNet/CnpSdkForNetTest/Unit/TestSale.cs index a340446..0521a39 100644 --- a/CnpSdkForNet/CnpSdkForNetTest/Unit/TestSale.cs +++ b/CnpSdkForNet/CnpSdkForNetTest/Unit/TestSale.cs @@ -700,5 +700,97 @@ public void TestSaleWithLodgingInfoPropertyAddressChanges() ///new testcase 12.2 Assert.NotNull(response); Assert.AreEqual("sandbox", response.location); } + + [Test] + public void TestSaleWithOrderchannelEnumMIT_SellerInfo() //new testcase for 12.28 and 12.29 + { + sale sale = new sale(); + sale.orderId = "12344"; + sale.amount = 2; + sale.orderSource = orderSourceType.ecommerce; + var sellerInfo = new sellerInfo(); + sellerInfo.accountNumber = "4485581000000005"; + sellerInfo.aggregateOrderCount = 4; + sellerInfo.aggregateOrderDollars = 100000; + var sellerAddress = new sellerAddress(); + sellerAddress.sellerStreetaddress = "15 Main Street"; + sellerAddress.sellerUnit = "100 AB"; + sellerAddress.sellerPostalcode = "12345"; + sellerAddress.sellerCity = "San Jose"; + sellerAddress.sellerProvincecode = "MA"; + sellerAddress.sellerCountrycode = "US"; + sellerInfo.sellerAddress = sellerAddress; + sellerInfo.createdDate = "2015-11-12T20:33:09"; + sellerInfo.domain = "vap"; + sellerInfo.email = "bob@example.com"; + sellerInfo.lastUpdateDate = "2015-11-12T20:33:09"; + sellerInfo.name = "bob"; + sellerInfo.onboardingEmail = "bob@example.com"; + sellerInfo.onboardingIpAddress = "75.100.88.78"; + sellerInfo.parentEntity = "abc"; + sellerInfo.phone = "9785510040"; + sellerInfo.sellerId = "123456789"; + var sellerTagsType = new sellerTagsType(); + sellerTagsType.tag = "3"; + sellerInfo.sellerTags = sellerTagsType; + sellerInfo.username = "bob123"; + sale.sellerInfo = sellerInfo; + sale.reportGroup = "Planets"; + sale.id = "thisisid"; + sale.businessIndicator = businessIndicatorEnum.fundTransfer; + sale.crypto = false; + sale.orderChannel = orderChannelEnum.MIT; + sale.fraudCheckStatus = "Not Approved"; + + var passengerTransportData = new passengerTransportData(); + passengerTransportData.passengerName = "Pia Jaiswal"; + passengerTransportData.ticketNumber = "TR0001"; + passengerTransportData.issuingCarrier = "IC"; + passengerTransportData.carrierName = "Indigo"; + passengerTransportData.restrictedTicketIndicator = "TI2022"; + passengerTransportData.numberOfAdults = 1; + passengerTransportData.numberOfChildren = 1; + passengerTransportData.customerCode = "C2011583"; + passengerTransportData.arrivalDate = new System.DateTime(2022, 12, 31); + passengerTransportData.issueDate = new System.DateTime(2022, 12, 25); + passengerTransportData.travelAgencyCode = "TAC12345"; + passengerTransportData.travelAgencyName = "Yatra"; + passengerTransportData.computerizedReservationSystem = computerizedReservationSystemEnum.STRT; + passengerTransportData.creditReasonIndicator = creditReasonIndicatorEnum.A; + passengerTransportData.ticketChangeIndicator = ticketChangeIndicatorEnum.C; + passengerTransportData.ticketIssuerAddress = "Hinjewadi"; + passengerTransportData.exchangeTicketNumber = "ETN12345"; + passengerTransportData.exchangeAmount = 12300; + passengerTransportData.exchangeFeeAmount = 11000; + + var tripLegData = new tripLegData(); + tripLegData.tripLegNumber = 12; + tripLegData.departureCode = "DC"; + tripLegData.carrierCode = "CC"; + tripLegData.serviceClass = serviceClassEnum.First; + tripLegData.stopOverCode = "N"; + tripLegData.destinationCode = "DC111"; + tripLegData.fareBasisCode = "FBC12345"; + tripLegData.departureDate = new System.DateTime(2023, 1, 31); + tripLegData.originCity = "Pune"; + tripLegData.travelNumber = "TN111"; + tripLegData.departureTime = "13:05"; + tripLegData.arrivalTime = "16:10"; + tripLegData.remarks = "NA"; + passengerTransportData.tripLegData = tripLegData; + sale.passengerTransportData = passengerTransportData; + + var mock = new Mock(); + + mock.Setup(Communications => Communications.HttpPost(It.IsRegex(".*4485581000000005.*4.*100000.*", RegexOptions.Singleline))) + .Returns("123sandbox"); + + var mockedCommunication = mock.Object; + cnp.SetCommunication(mockedCommunication); + var response = cnp.Sale(sale); + + Assert.NotNull(response); + Assert.AreEqual("sandbox", response.location); + } } } From eb77550f28bd37e77873371ac0661d9cad07bbdc Mon Sep 17 00:00:00 2001 From: Nitinsl Date: Mon, 20 Mar 2023 16:38:10 +0530 Subject: [PATCH 2/5] Promoting Functional Tests --- .../CnpSdkForNetTest/Functional/TestAuth.cs | 134 ++++++++++++++++++ .../CnpSdkForNetTest/Functional/TestSale.cs | 83 +++++++++++ 2 files changed, 217 insertions(+) diff --git a/CnpSdkForNet/CnpSdkForNetTest/Functional/TestAuth.cs b/CnpSdkForNet/CnpSdkForNetTest/Functional/TestAuth.cs index 134a1b3..4ee91ba 100644 --- a/CnpSdkForNet/CnpSdkForNetTest/Functional/TestAuth.cs +++ b/CnpSdkForNet/CnpSdkForNetTest/Functional/TestAuth.cs @@ -1144,5 +1144,139 @@ public void SimpleAuthWithAuthMaxNotApplied() //12.27 Assert.AreEqual(false, response.authMax.authMaxApplied); Assert.AreEqual(checkDate, response.postDate); } + + //12.28,12.29 and 12.30 start + [Test] + public void SimpleAuthWithOrdChanelEnumMIT() + { + var authorization = new authorization + { + id = "1", + reportGroup = "Planets", + orderId = "12344", + amount = 106, + orderSource = orderSourceType.ecommerce, + authIndicator = authIndicatorEnum.Estimated, + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "414100000000000000", + expDate = "1210" + }, + customBilling = new customBilling { phone = "1112223333" }, + orderChannel = orderChannelEnum.MIT + }; + var response = _cnp.Authorize(authorization); + + DateTime checkDate = new DateTime(0001, 1, 1, 00, 00, 00); + + Assert.AreEqual("000", response.response); + Assert.AreEqual(checkDate, response.postDate); + } + + [Test] + public void SimpleAuthWithSellerInfo() + { + 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" }, + sellerInfo = new sellerInfo + { + accountNumber = "4485581000000005", + aggregateOrderCount = 4, + aggregateOrderDollars = 100000, + sellerAddress = new sellerAddress + { + sellerStreetaddress = "15 Main Street", + sellerUnit = "100 AB", + sellerPostalcode = "12345", + sellerCity = "San Jose", + sellerProvincecode = "MA", + sellerCountrycode = "US" + }, + createdDate = "2015-11-12T20:33:09", + domain = "vap", + email = "bob@example.com", + lastUpdateDate = "2015-11-12T20:33:09", + name = "bob", + onboardingEmail = "bob@example.com", + onboardingIpAddress = "75.100.88.78", + parentEntity = "abc", + phone = "9785510040", + sellerId = "123456789", + sellerTags = new sellerTagsType + { + tag = "2" + }, + username = "bob123" + } + }; + var response = _cnp.Authorize(authorization); + + DateTime checkDate = new DateTime(0001, 1, 1, 00, 00, 00); + + Assert.AreEqual("000", response.response); + Assert.AreEqual(checkDate, response.postDate); + } + + [Test] + public void SimpleAuthWithAuthIndicatorWithEstimatedEnum() + { + var authorization = new authorization + { + id = "1", + reportGroup = "Planets", + orderId = "12344", + amount = 106, + orderSource = orderSourceType.ecommerce, + authIndicator = authIndicatorEnum.Estimated, + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "414100000000000000", + expDate = "1210" + }, + customBilling = new customBilling { phone = "1112223333" } + }; + var response = _cnp.Authorize(authorization); + + DateTime checkDate = new DateTime(0001, 1, 1, 00, 00, 00); + + Assert.AreEqual("000", response.response); + Assert.AreEqual(checkDate, response.postDate); + } + + [Test] + public void SimpleAuthWithAuthIndicatorWithIncreamentalEnum() + { + var authorization = new authorization + { + id = "1", + customerId = "CustId", + reportGroup = "Planets", + cnpTxnId = 901097991325067135, + amount = 106, + authIndicator = authIndicatorEnum.Incremental, + + }; + var response = _cnp.Authorize(authorization); + + DateTime checkDate = new DateTime(0001, 1, 1, 00, 00, 00); + + Assert.AreEqual("000", response.response); + Assert.AreEqual(checkDate, response.postDate); + } + //12.28,12.29 and 12.30 end } } diff --git a/CnpSdkForNet/CnpSdkForNetTest/Functional/TestSale.cs b/CnpSdkForNet/CnpSdkForNetTest/Functional/TestSale.cs index bb52938..a4ba965 100644 --- a/CnpSdkForNet/CnpSdkForNetTest/Functional/TestSale.cs +++ b/CnpSdkForNet/CnpSdkForNetTest/Functional/TestSale.cs @@ -835,5 +835,88 @@ public void SimpleSaleWithAuthMaxNotApplied() //12.27 Assert.AreEqual(false, responseObj.authMax.authMaxApplied); StringAssert.AreEqualIgnoringCase("Approved", responseObj.message); } + + [Test] + public void SimpleSaleWithOrdChanelEnumMIT() //12.28 + { + var saleObj = new sale + { + id = "1", + reportGroup = "Planets", + orderId = "12344", + amount = 106, + orderSource = orderSourceType.ecommerce, + crypto = false, + orderChannel = orderChannelEnum.MIT, + fraudCheckStatus = "Not Approved", + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "414100000000000000", + expDate = "1210" + }, + overridePolicy = "Override Policy", + fsErrorCode = "FS Error Code", + merchantAccountStatus = "Merchant Account Status", + productEnrolled = productEnrolledEnum.GUARPAY2, + decisionPurpose = decisionPurposeEnum.INFORMATION_ONLY, + fraudSwitchIndicator = fraudSwitchIndicatorEnum.PRE, + customBilling = new customBilling { phone = "1112223333" } + }; + var responseObj = _cnp.Sale(saleObj); + StringAssert.AreEqualIgnoringCase("Approved", responseObj.message); + } + + [Test] + public void SimpleSaleWithSellerInfo() //12.29 + { + var saleObj = new sale + { + id = "1", + amount = 106, + cnpTxnId = 123456, + orderId = "12344", + orderSource = orderSourceType.ecommerce, + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "414100000000000000", + expDate = "1210" + }, + sellerInfo = new sellerInfo + { + accountNumber = "4485581000000005", + aggregateOrderCount = 4, + aggregateOrderDollars = 100000, + sellerAddress = new sellerAddress + { + sellerStreetaddress = "15 Main Street", + sellerUnit = "100 AB", + sellerPostalcode = "12345", + sellerCity = "San Jose", + sellerProvincecode = "MA", + sellerCountrycode = "US" + }, + createdDate = "2015-11-12T20:33:09", + domain = "vap", + email = "bob@example.com", + lastUpdateDate = "2015-11-12T20:33:09", + name = "bob", + onboardingEmail = "bob@example.com", + onboardingIpAddress = "75.100.88.78", + parentEntity = "abc", + phone = "9785510040", + sellerId = "123456789", + sellerTags = new sellerTagsType + { + tag = "2" + }, + username = "bob123" + + } + }; + var responseObj = _cnp.Sale(saleObj); + StringAssert.AreEqualIgnoringCase("Approved", responseObj.message); + } } } From c4d5be77214b3666f42c23524faec7c247717b6a Mon Sep 17 00:00:00 2001 From: e5651806 Date: Mon, 20 Mar 2023 16:43:34 +0530 Subject: [PATCH 3/5] Version change from v12.27 to v12.30 --- CnpSdkForNet/CnpSdkForNet/CnpSdkForNet.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CnpSdkForNet/CnpSdkForNet/CnpSdkForNet.csproj b/CnpSdkForNet/CnpSdkForNet/CnpSdkForNet.csproj index eac420d..68ef125 100644 --- a/CnpSdkForNet/CnpSdkForNet/CnpSdkForNet.csproj +++ b/CnpSdkForNet/CnpSdkForNet/CnpSdkForNet.csproj @@ -3,7 +3,7 @@ netstandard2.0 true dotNetSDKKey.snk - 12.27.0 + 12.30.0 Vantiv.CnpSdkForNet FIS Copyright © FIS 2020 From 74f749874842790489ce633c199b135d391a27d2 Mon Sep 17 00:00:00 2001 From: Nitinsl Date: Mon, 20 Mar 2023 17:50:39 +0530 Subject: [PATCH 4/5] Promoting Batch Test --- .../CnpSdkForNetTest/Functional/TestBatch.cs | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) diff --git a/CnpSdkForNet/CnpSdkForNetTest/Functional/TestBatch.cs b/CnpSdkForNet/CnpSdkForNetTest/Functional/TestBatch.cs index 63f14e6..788b143 100644 --- a/CnpSdkForNet/CnpSdkForNetTest/Functional/TestBatch.cs +++ b/CnpSdkForNet/CnpSdkForNetTest/Functional/TestBatch.cs @@ -1939,6 +1939,99 @@ public void simpleAuthReversalWithAdditionalCOFdata() } } + // 12.28,12.29 and 12.30 start + [Test] + public void SimpleAuthSaleWithOrderchannelEnumMIT_SellerInfo_AuthIndicatorEstimatedEnum() //12.28 , 12.29 and 12.30 + { + var cnpBatchRequest = new batchRequest(); + var authorization = new authorization + { + id = new Random().Next(100).ToString(), + reportGroup = "Planets", + orderId = "12344", + amount = new Random().Next(1000), + orderSource = orderSourceType.ecommerce, + sellerInfo = new sellerInfo + { + accountNumber = "4485581000000005", + aggregateOrderCount = 4, + aggregateOrderDollars = 100000, + sellerAddress = new sellerAddress + { + sellerStreetaddress = "15 Main Street", + sellerUnit = "100 AB", + sellerPostalcode = "12345", + sellerCity = "San Jose", + sellerProvincecode = "MA", + sellerCountrycode = "US" + }, + createdDate = "2015-11-12T20:33:09", + domain = "vap", + email = "bob@example.com", + lastUpdateDate = "2015-11-12T20:33:09", + name = "bob", + onboardingEmail = "bob@example.com", + onboardingIpAddress = "75.100.88.78", + parentEntity = "abc", + phone = "9785510040", + sellerId = "123456789", + sellerTags = new sellerTagsType + { + tag = "2" + }, + username = "bob123" + + }, + crypto = false, + orderChannel = orderChannelEnum.MIT, + fraudCheckStatus = "Not Approved", + card = new cardType + { + type = methodOfPaymentTypeEnum.VI, + number = "4100000000000001", + expDate = "1223" + + }, + + overridePolicy = "Override Policy", + fsErrorCode = "FS Error Code", + merchantAccountStatus = "Merchant Account Status", + productEnrolled = productEnrolledEnum.GUARPAY2, + decisionPurpose = decisionPurposeEnum.INFORMATION_ONLY, + fraudSwitchIndicator = fraudSwitchIndicatorEnum.PRE, + customBilling = new customBilling { phone = "1112223333" }, + authIndicator = authIndicatorEnum.Estimated + }; + + cnpBatchRequest.addAuthorization(authorization); + + _cnp.addBatch(cnpBatchRequest); + + var batchName = _cnp.sendToCnp(); + + _cnp.blockAndWaitForResponse(batchName, estimatedResponseTime(2 * 2, 10 * 2)); + + var cnpResponse = _cnp.receiveFromCnp(batchName); + + Assert.NotNull(cnpResponse); + Assert.AreEqual("0", cnpResponse.response); + Assert.AreEqual("Valid Format", cnpResponse.message); + + var cnpBatchResponse = cnpResponse.nextBatchResponse(); + while (cnpBatchResponse != null) + { + var authResponse = cnpBatchResponse.nextAuthorizationResponse(); + while (authResponse != null) + { + Assert.AreEqual("000", authResponse.response); + + authResponse = cnpBatchResponse.nextAuthorizationResponse(); + } + cnpBatchResponse = cnpResponse.nextBatchResponse(); + } + } + // 12.28,12.29 and 12.30 end + private int estimatedResponseTime(int numAuthsAndSales, int numRest) { return (int)(5 * 60 * 1000 + 2.5 * 1000 + numAuthsAndSales * (1 / 5) * 1000 + numRest * (1 / 50) * 1000) * 5; From b2bd528ac293daee2fdcdd5ccd16c3963f6b413c Mon Sep 17 00:00:00 2001 From: Nitinsl Date: Mon, 20 Mar 2023 19:15:20 +0530 Subject: [PATCH 5/5] Promoting Unit Test Chnages --- CnpSdkForNet/CnpSdkForNetTest/Unit/TestAuthorization.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/CnpSdkForNet/CnpSdkForNetTest/Unit/TestAuthorization.cs b/CnpSdkForNet/CnpSdkForNetTest/Unit/TestAuthorization.cs index ffa3a51..24550d5 100644 --- a/CnpSdkForNet/CnpSdkForNetTest/Unit/TestAuthorization.cs +++ b/CnpSdkForNet/CnpSdkForNetTest/Unit/TestAuthorization.cs @@ -2,7 +2,6 @@ using NUnit.Framework; using Moq; using System.Text.RegularExpressions; -using System.Xml.Linq; namespace Cnp.Sdk.Test.Unit