Skip to content

Commit

Permalink
Feature f225322 v12.33 (#69)
Browse files Browse the repository at this point in the history
* promoting code changes

* Committing test changes for v12.33

* committing test change

* commiting test changes and changelog

---------

Co-authored-by: Nitinsl <[email protected]>
  • Loading branch information
Sushamaghadage123 and Nitinsl committed Jan 9, 2024
1 parent 1a34671 commit 2b20690
Show file tree
Hide file tree
Showing 21 changed files with 1,161 additions and 29 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@

= Worldpay CNP CHANGELOG

==Version: 12.33.0 (Jan 09, 2024)
Note: It contains changes from cnpAPI v12.32 and v12.33. In case you need any feature supported by cnpAPI v12.32 and v12.33.please use SDK version 12.33.0.

* Change: [cnpAPI v12.33] Added new simple types numberOfPeriods of type digit,string10Type
* Change: [cnpAPI v12.33] Added new simple element shipmentId
* Change: [cnpAPI v12.33] new complex element subscription is added with few simple elements subscriptionId ,nextDeliveryDate ,periodUnit ,numberOfPeriods ,regularItemPrice ,currentPeriod
* Change: [cnpAPI v12.33] Added new Enum periodUnit of type enum with values WEEK,MONTH,QUARTER,YEAR
* Change: [cnpAPI v12.32] simple type of customerIpAddress is changed from ipAddress to newly added simpletype stringipAddress

==Version 12.31.0 (July 11, 2023)
Note : It contains changes from cnpAPI v12.31. In case you need any feature supported by cnpAPI v12.31, please use SDK version 12.31.0
* Change: [cnpAPI v12.31] Added new Enum foreignRetailerIndicatorEnum with value F
Expand Down
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.31.0</PackageVersion>
<PackageVersion>12.33.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.31";
public const String CurrentCNPSDKVersion = "12.31.0";
public const String CurrentCNPXMLVersion = "12.33";
public const String CurrentCNPSDKVersion = "12.33.0";
}
}
122 changes: 100 additions & 22 deletions CnpSdkForNet/CnpSdkForNet/XmlRequestFields.cs
Original file line number Diff line number Diff line change
Expand Up @@ -871,13 +871,7 @@ public int surchargeAmount
set { surchargeAmountField = value; surchargeAmountIsSet = true; }
}

private bool enhancedDataIsSet;
private enhancedData enhancedDataField;
public enhancedData enhancedData
{
get { return enhancedDataField; }
set { enhancedDataField = value; enhancedDataIsSet = true; }
}
public enhancedData enhancedData;

private bool processingInstructionsIsSet;
private processingInstructions processingInstructionsField;
Expand Down Expand Up @@ -937,11 +931,11 @@ public override string Serialize()
xml += this.customBillingField.Serialize();
}

if (this.enhancedDataIsSet)
if (enhancedData != null)
{
xml += this.enhancedDataField.Serialize();
xml += "\r\n<enhancedData>" + enhancedData.Serialize() + "\r\n</enhancedData>";
}

if (this.lodgingInfoIsSet)
{
xml += this.lodgingInfoField.Serialize();
Expand Down Expand Up @@ -992,14 +986,8 @@ public int surchargeAmount
set { surchargeAmountField = value; surchargeAmountIsSet = true; }
}

private bool enhancedDataIsSet;
private enhancedData enhancedDataField;
public enhancedData enhancedData
{
get { return enhancedDataField; }
set { enhancedDataField = value; enhancedDataIsSet = true; }
}

public enhancedData enhancedData;

private bool processingInstructionsIsSet;
private processingInstructions processingInstructionsField;
public processingInstructions processingInstructions
Expand Down Expand Up @@ -1058,9 +1046,9 @@ public override string Serialize()
xml += this.customBillingField.Serialize();
}

if (this.enhancedDataIsSet)
if (enhancedData != null)
{
xml += this.enhancedDataField.Serialize();
xml += "\r\n<enhancedData>" + enhancedData.Serialize() + "\r\n</enhancedData>";
}

if (this.lodgingInfoIsSet)
Expand Down Expand Up @@ -4301,12 +4289,16 @@ public long itemDiscountAmount
public string productName;
///end
public List<detailTax> detailTaxes;
// 12.33
public string shipmentId;
public List<subscriptions> subscription;

public lineItemData()
{
detailTaxes = new List<detailTax>();
subscription = new List<subscriptions>();
}

public string Serialize()
{
var xml = "";
Expand All @@ -4326,11 +4318,16 @@ public string Serialize()
if (itemSubCategory != null) xml += "\r\n<itemSubCategory>" + SecurityElement.Escape(itemSubCategory) + "</itemSubCategory>";
if (productId != null) xml += "\r\n<productId>" + SecurityElement.Escape(productId) + "</productId>";
if (productName != null) xml += "\r\n<productName>" + SecurityElement.Escape(productName) + "</productName>";
///end
///end
foreach (var detailTax in detailTaxes)
{
if (detailTax != null) xml += "\r\n<detailTax>" + detailTax.Serialize() + "</detailTax>";
}
if (shipmentId != null) xml += "\r\n<shipmentId>" + SecurityElement.Escape(shipmentId) + "</shipmentId>";
foreach (var subscription in subscription)
{
if (subscription != null) xml += "\r\n<subscription>" + subscription.Serialize() + "</subscription>";
}
return xml;
}

Expand Down Expand Up @@ -6419,6 +6416,87 @@ public string Serialize()
}
}

//12.33 start
public partial class subscriptions
{
public string subscriptionId;
public DateTime nextDeliveryDate;

private periodUnit periodUnitField;
private bool periodUnitSet;
public periodUnit periodUnit
{
get { return periodUnitField; }
set { periodUnitField = value; periodUnitSet = true; }
}

private int numberOfPeriodsField;
private bool numberOfPeriodsSet;
public int numberOfPeriods
{
get
{
return numberOfPeriodsField;
}
set
{
numberOfPeriodsField = value;
numberOfPeriodsSet = true;
}
}

private int regularItemPriceField;
private bool regularItemPriceSet;
public int regularItemPrice
{
get { return regularItemPriceField; }
set { regularItemPriceField = value; regularItemPriceSet = true; }
}

private int currentPeriodField;
private bool currentPeriodSet;
public int currentPeriod
{
get
{
return currentPeriodField;
}
set
{
currentPeriodField = value;
currentPeriodSet = true;
}
}

public string Serialize()
{
var xml = "";
if (subscriptionId != null) xml += "\r\n<subscriptionId>" + SecurityElement.Escape(subscriptionId) + "</subscriptionId>";
if (nextDeliveryDate != null)
{
xml += "\r\n<nextDeliveryDate>" + XmlUtil.toXsdDate(nextDeliveryDate) + "</nextDeliveryDate>";
}
if (periodUnitSet)
{
xml += "\r\n<periodUnit>" + periodUnitField + "</periodUnit>";
}
if (numberOfPeriodsSet) xml += "\r\n<numberOfPeriods>" + numberOfPeriodsField + "</numberOfPeriods>";
if (regularItemPriceSet) xml += "\r\n<regularItemPrice>" + regularItemPriceField + "</regularItemPrice>";
if (currentPeriodSet) xml += "\r\n<currentPeriod>" + currentPeriodField + "</currentPeriod>";
return xml;
}
}

public enum periodUnit
{
/// <remarks/>
WEEK,
MONTH,
QUARTER,
YEAR
}
//12.33 end

public partial class propertyAddress
{
public string name;
Expand Down
58 changes: 58 additions & 0 deletions CnpSdkForNet/CnpSdkForNetTest/Functional/TestAuth.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1278,5 +1278,63 @@ public void SimpleAuthWithAuthIndicatorWithIncreamentalEnum()
Assert.AreEqual(checkDate, response.postDate);
}
//12.28,12.29 and 12.30 end

[Test]
public void SimpleAuthWithShipmentIdAndSubscription()
{
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" },
enhancedData = new enhancedData
{
customerReference = "000000008110801",
salesTax = 23,
deliveryType = enhancedDataDeliveryType.DIG,
taxExempt = false,
detailTaxes = new List<detailTax>(),
lineItems = new List<lineItemData>(),

}
};

var mysubscription = new subscriptions();
mysubscription.subscriptionId = "123";
mysubscription.currentPeriod = 114;
mysubscription.periodUnit = periodUnit.YEAR;
mysubscription.numberOfPeriods = 123;
mysubscription.regularItemPrice = 69;
mysubscription.nextDeliveryDate = new DateTime(2017, 1, 1);

var mylineItemData = new lineItemData();
mylineItemData.itemSequenceNumber = 1;
mylineItemData.itemDescription = "Electronics";
mylineItemData.productCode = "El03";
mylineItemData.itemCategory = "E Appiances";
mylineItemData.itemSubCategory = "appliaces";
mylineItemData.productId = "1023";
mylineItemData.productName = "dyer";
mylineItemData.shipmentId = "2124";
mylineItemData.subscription.Add(mysubscription);
authorization.enhancedData.lineItems.Add(mylineItemData);

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);
}
}
}
Loading

0 comments on commit 2b20690

Please sign in to comment.