Skip to content

Commit

Permalink
Merge pull request #63 from Nitinsl/Feature-F205651-V12.30
Browse files Browse the repository at this point in the history
Feature f205651 v12.30
  • Loading branch information
isunnapud authored Mar 21, 2023
2 parents 1e1f491 + b2bd528 commit 00fc5cf
Show file tree
Hide file tree
Showing 8 changed files with 673 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CnpSdkForNet/CnpSdkForNet/CnpSdkForNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>dotNetSDKKey.snk</AssemblyOriginatorKeyFile>
<PackageVersion>12.27.0</PackageVersion>
<PackageVersion>12.30.0</PackageVersion>
<Title>Vantiv.CnpSdkForNet</Title>
<Authors>FIS</Authors>
<Copyright>Copyright © FIS 2020</Copyright>
Expand Down
4 changes: 2 additions & 2 deletions CnpSdkForNet/CnpSdkForNet/CnpVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
}
151 changes: 150 additions & 1 deletion CnpSdkForNet/CnpSdkForNet/XmlRequestFields.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -547,6 +567,8 @@ public override string Serialize()
if (cnpTxnIdSet)
{
xml += "\r\n<cnpTxnId>" + cnpTxnIdField + "</cnpTxnId>";
xml += "\r\n<amount>" + amount + "</amount>";
xml += "\r\n<authIndicator>" + authIndicatorField + "</authIndicator>";
}
else
{
Expand All @@ -560,6 +582,10 @@ public override string Serialize()
{
xml += "\r\n<customerInfo>" + customerInfo.Serialize() + "\r\n</customerInfo>";
}
if (sellerInfo != null)
{
xml += "\r\n<sellerInfo>" + sellerInfo.Serialize() + "\r\n</sellerInfo>";
}
if (billToAddress != null)
{
xml += "\r\n<billToAddress>" + billToAddress.Serialize() + "\r\n</billToAddress>";
Expand Down Expand Up @@ -694,6 +720,15 @@ public override string Serialize()
xml += "\r\n<passengerTransportData>" + passengerTransportData.Serialize() + "\r\n</passengerTransportData>";
}
//end

//12.30 start

if (authIndicatorSet)
{
xml += "\r\n<authIndicator>" + authIndicatorField + "</authIndicator>";
}
//end

if (merchantData != null)
{
xml += "\r\n<merchantData>" + merchantData.Serialize() + "\r\n</merchantData>";
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -2907,6 +2943,10 @@ public override string Serialize()
{
xml += "\r\n<customerInfo>" + customerInfo.Serialize() + "\r\n</customerInfo>";
}
if (sellerInfo != null)
{
xml += "\r\n<sellerInfo>" + sellerInfo.Serialize() + "\r\n</sellerInfo>";
}
if (billToAddress != null)
{
xml += "\r\n<billToAddress>" + billToAddress.Serialize() + "\r\n</billToAddress>";
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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<accountNumber>" + SecurityElement.Escape(accountNumber) + "</accountNumber>";
if (aggregateOrderCountSet) xml += "\r\n<aggregateOrderCount>" + aggregateOrderCountField + "</aggregateOrderCount>";
if (aggregateOrderDollarsSet) xml += "\r\n<aggregateOrderDollars>" + aggregateOrderDollarsField + "</aggregateOrderDollars>";
if (sellerAddress != null)
{
xml += "\r\n<sellerAddress>" + sellerAddress.Serialize() + "\r\n</sellerAddress>";
}
return xml;
if (createdDate != null) xml += "\r\n<createdDate>" + SecurityElement.Escape(createdDate) + "</createdDate>";
if (domain != null) xml += "\r\n<domain>" + SecurityElement.Escape(domain) + "</domain>";
if (email != null) xml += "\r\n<email>" + SecurityElement.Escape(email) + "</email>";
if (lastUpdateDate != null) xml += "\r\n<lastUpdateDate>" + SecurityElement.Escape(lastUpdateDate) + "</lastUpdateDate>";
if (name != null) xml += "\r\n<name>" + SecurityElement.Escape(name) + "</name>";
if (onboardingEmail != null) xml += "\r\n<onboardingEmail>" + SecurityElement.Escape(onboardingEmail) + "</onboardingEmail>";
if (onboardingIpAddress != null) xml += "\r\n<onboardingIpAddress>" + SecurityElement.Escape(onboardingIpAddress) + "</onboardingIpAddress>";
if (parentEntity != null) xml += "\r\n<parentEntity>" + SecurityElement.Escape(parentEntity) + "</parentEntity>";
if (phone != null) xml += "\r\n<phone>" + SecurityElement.Escape(phone) + "</phone>";
if (sellerId != null) xml += "\r\n<sellerId>" + SecurityElement.Escape(sellerId) + "</sellerId>";
if (sellerTags != null)
{
xml += "\r\n<sellerTags>" + sellerTags.Serialize() + "\r\n</sellerTags>";
}
if (username != null) xml += "\r\n<username>" + SecurityElement.Escape(username) + "</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<sellerStreetaddress>" + SecurityElement.Escape(sellerStreetaddress) + "</sellerStreetaddress>";
if (sellerUnit != null) xml += "\r\n<sellerUnit>" + SecurityElement.Escape(sellerUnit) + "</sellerUnit>";
if (sellerPostalcode != null) xml += "\r\n<sellerPostalcode>" + SecurityElement.Escape(sellerPostalcode) + "</sellerPostalcode>";
if (sellerCity != null) xml += "\r\n<sellerCity>" + SecurityElement.Escape(sellerCity) + "</sellerCity>";
if (sellerProvincecode != null) xml += "\r\n<sellerProvincecode>" + SecurityElement.Escape(sellerProvincecode) + "</sellerProvincecode>";
if (sellerCountrycode != null) xml += "\r\n<sellerCountrycode>" + SecurityElement.Escape(sellerCountrycode) + "</sellerCountrycode>";
return xml;
}
}

public partial class sellerTagsType
{
public string tag;

public string Serialize()
{
var xml = "";
if (tag != null) xml += "\r\n<tag>" + SecurityElement.Escape(tag) + "</tag>";
return xml;
}
}

public partial class propertyAddress
{
public string name;
Expand Down
134 changes: 134 additions & 0 deletions CnpSdkForNet/CnpSdkForNetTest/Functional/TestAuth.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "[email protected]",
lastUpdateDate = "2015-11-12T20:33:09",
name = "bob",
onboardingEmail = "[email protected]",
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
}
}
Loading

0 comments on commit 00fc5cf

Please sign in to comment.