Skip to content

Commit

Permalink
Merge pull request #66 from Nitinsl/Feature-F225322-V12.31
Browse files Browse the repository at this point in the history
Feature f225322 v12.31
  • Loading branch information
isunnapud authored Jul 11, 2023
2 parents 6e76c6f + c4fbdee commit 472a8ee
Show file tree
Hide file tree
Showing 12 changed files with 611 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.30.0</PackageVersion>
<PackageVersion>12.31.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.30";
public const String CurrentCNPSDKVersion = "12.30.0";
public const String CurrentCNPXMLVersion = "12.31";
public const String CurrentCNPSDKVersion = "12.31.0";
}
}
61 changes: 60 additions & 1 deletion CnpSdkForNet/CnpSdkForNet/XmlRequestFields.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1166,6 +1166,15 @@ public bool payPalOrderComplete
public lodgingInfo lodgingInfo;
public string pin;
public passengerTransportData passengerTransportData;//12.26
//12.31 start
private foreignRetailerIndicatorEnum foreignRetailerIndicatorField;
private bool foreignRetailerIndicatorSet;
public foreignRetailerIndicatorEnum foreignRetailerIndicator
{
get { return foreignRetailerIndicatorField; }
set { foreignRetailerIndicatorField = value; foreignRetailerIndicatorSet = true; }
}
//12.31 end

public override string Serialize()
{
Expand Down Expand Up @@ -1199,6 +1208,10 @@ public override string Serialize()
{
xml += "\r\n<passengerTransportData>" + passengerTransportData.Serialize() + "\r\n</passengerTransportData>";
}
if (foreignRetailerIndicatorSet)//12.31
{
xml += "\r\n<foreignRetailerIndicator>" + foreignRetailerIndicatorField + "</foreignRetailerIndicator>";
}
xml += "\r\n</capture>";

return xml;
Expand Down Expand Up @@ -1328,6 +1341,15 @@ public bool crypto
///end
public string merchantCategoryCode;
public passengerTransportData passengerTransportData; //12.26
//12.31 start
private foreignRetailerIndicatorEnum foreignRetailerIndicatorField;
private bool foreignRetailerIndicatorSet;
public foreignRetailerIndicatorEnum foreignRetailerIndicator
{
get { return foreignRetailerIndicatorField; }
set { foreignRetailerIndicatorField = value; foreignRetailerIndicatorSet = true; }
}
//12.31 end
public override string Serialize()
{
var xml = "\r\n<captureGivenAuth";
Expand Down Expand Up @@ -1444,6 +1466,10 @@ public override string Serialize()
{
xml += "\r\n<passengerTransportData>" + passengerTransportData.Serialize() + "\r\n</passengerTransportData>";
}
if (foreignRetailerIndicatorSet)//12.31
{
xml += "\r\n<foreignRetailerIndicator>" + foreignRetailerIndicatorField + "</foreignRetailerIndicator>";
}
xml += "\r\n</captureGivenAuth>";
return xml;
}
Expand Down Expand Up @@ -2129,6 +2155,16 @@ public processingType processingType

public string merchantCategoryCode;
public passengerTransportData passengerTransportData;//12.26

//12.31 start
private foreignRetailerIndicatorEnum foreignRetailerIndicatorField;
private bool foreignRetailerIndicatorSet;
public foreignRetailerIndicatorEnum foreignRetailerIndicator
{
get { return foreignRetailerIndicatorField; }
set { foreignRetailerIndicatorField = value; foreignRetailerIndicatorSet = true; }
}
//12.31 end
public override string Serialize()
{
var xml = "\r\n<forceCapture";
Expand Down Expand Up @@ -2221,6 +2257,10 @@ public override string Serialize()
{
xml += "\r\n<passengerTransportData>" + passengerTransportData.Serialize() + "</passengerTransportData>";
}
if (foreignRetailerIndicatorSet)//12.31
{
xml += "\r\n<foreignRetailerIndicator>" + foreignRetailerIndicatorField + "</foreignRetailerIndicator>";
}


xml += "\r\n</forceCapture>";
Expand Down Expand Up @@ -2910,6 +2950,15 @@ public long originalTransactionAmount
public pinlessDebitRequestType pinlessDebitRequest;
public bool? skipRealtimeAU;
public string merchantCategoryCode;
//12.31 start
private foreignRetailerIndicatorEnum foreignRetailerIndicatorField;
private bool foreignRetailerIndicatorSet;
public foreignRetailerIndicatorEnum foreignRetailerIndicator
{
get { return foreignRetailerIndicatorField; }
set { foreignRetailerIndicatorField = value; foreignRetailerIndicatorSet = true; }
}
//12.31 end

//private routingPreferenceEnum routingPreferenceField;
//private bool routingPreferenceSet;
Expand Down Expand Up @@ -3145,6 +3194,10 @@ public override string Serialize()
{
xml += "\r\n<passengerTransportData>" + passengerTransportData.Serialize() + "\r\n</passengerTransportData>";
}
if (foreignRetailerIndicatorSet)//12.31
{
xml += "\r\n<foreignRetailerIndicator>" + foreignRetailerIndicatorField + "</foreignRetailerIndicator>";
}
//end
//if (routingPreferenceSet)
//{
Expand Down Expand Up @@ -3838,8 +3891,14 @@ public enum authIndicatorEnum
Estimated,
Incremental
}
// 12.28, 12.29 and 12.30 end


//new 12.31 start
public enum foreignRetailerIndicatorEnum
{
F
}
// 12.31 end
#endregion

#region Child elements.
Expand Down
201 changes: 201 additions & 0 deletions CnpSdkForNet/CnpSdkForNetTest/Functional/TestBatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2031,7 +2031,208 @@ public void SimpleAuthSaleWithOrderchannelEnumMIT_SellerInfo_AuthIndicatorEstima
}
}
// 12.28,12.29 and 12.30 end
[Test]
public void SimpleCaptureForceCaptureSaleCaptureGivenAuthWithForeignRetailerIndicator()//12.31
{
var cnpBatchRequest = new batchRequest();
var card = new cardType();
card.type = methodOfPaymentTypeEnum.VI;
card.number = "4100000000000001";
card.expDate = "1210";

var authorization = new authorization
{
id = new Random().Next(100).ToString(),
reportGroup = "Planets",
orderId = "12344",
amount = 106,
orderSource = orderSourceType.ecommerce,
crypto = false,
orderChannel = orderChannelEnum.PHONE,
fraudCheckStatus = "Not Approved",
card = card,
retailerAddress = new contact
{
name = "Mikasa Ackerman",
addressLine1 = "1st Main Street",
city = "Burlington",
state = "MA",
country = countryTypeEnum.USA,
email = "[email protected]",
zip = "01867-4456",
sellerId = "s1234",
url = "www.google.com"
},
additionalCOFData = new additionalCOFData()
{
totalPaymentCount = "35",
paymentType = paymentTypeEnum.Fixed_Amount,
uniqueId = "12345wereew233",
frequencyOfMIT = frequencyOfMITEnum.BiWeekly,
validationReference = "re3298rhriw4wrw",
sequenceIndicator = 2
},
customBilling = new customBilling { phone = "1112223333" }
};

var capture = new capture();
capture.id = new Random().Next(100).ToString();
capture.cnpTxnId = 123456000;
capture.orderId = "12344";
capture.amount = 106;
capture.payPalNotes = "Notes";
capture.foreignRetailerIndicator = foreignRetailerIndicatorEnum.F;

var forcecapture = new forceCapture();
forcecapture.id = new Random().Next(1000).ToString();
forcecapture.amount = 106;
forcecapture.orderId = "12344";
forcecapture.orderSource = orderSourceType.ecommerce;
forcecapture.card = card;
forcecapture.foreignRetailerIndicator = foreignRetailerIndicatorEnum.F;

var capturegivenauth = new captureGivenAuth
{
id = new Random().Next(10000000).ToString(),
amount = new Random().Next(100000),
orderId = "12344",
crypto = false,
authInformation = new authInformation
{
authDate = new DateTime(2002, 10, 9),
authCode = "543216",
authAmount = 12345,
},
orderSource = orderSourceType.ecommerce,
card = card,
retailerAddress = new contact
{
name = "Mikasa Ackerman",
addressLine1 = "1st Main Street",
city = "Burlington",
state = "MA",
country = countryTypeEnum.USA,
email = "[email protected]",
zip = "01867-4456",
sellerId = "s1234",
url = "www.google.com"
},
additionalCOFData = new additionalCOFData()
{
totalPaymentCount = "35",
paymentType = paymentTypeEnum.Fixed_Amount,
uniqueId = "12345wereew233",
frequencyOfMIT = frequencyOfMITEnum.BiWeekly,
validationReference = "re3298rhriw4wrw",
sequenceIndicator = 2
},
processingType = processingType.accountFunding,
originalNetworkTransactionId = "abc123",
originalTransactionAmount = 123456789,
foreignRetailerIndicator = foreignRetailerIndicatorEnum.F

};
var saleObj = new sale
{
id = new Random().Next(10000000).ToString(),
amount = 1234567,
reportGroup = "Planets",
orderId = "1234984",
orderSource = orderSourceType.ecommerce,
crypto = false,
orderChannel = orderChannelEnum.PHONE,
fraudCheckStatus = "Not Approved",
card = card,
retailerAddress = new contact
{
name = "Mikasa Ackerman",
addressLine1 = "1st Main Street",
city = "Burlington",
state = "MA",
country = countryTypeEnum.USA,
email = "[email protected]",
zip = "01867-4456",
sellerId = "s1234",
url = "www.google.com"
},
additionalCOFData = new additionalCOFData()
{
totalPaymentCount = "35",
paymentType = paymentTypeEnum.Fixed_Amount,
uniqueId = "12345wereew233",
frequencyOfMIT = frequencyOfMITEnum.BiWeekly,
validationReference = "re3298rhriw4wrw",
sequenceIndicator = 2
},
customBilling = new customBilling { phone = "1112223333" },
foreignRetailerIndicator = foreignRetailerIndicatorEnum.F
};

cnpBatchRequest.addAuthorization(authorization);
cnpBatchRequest.addCapture(capture);
cnpBatchRequest.addForceCapture(forcecapture);
cnpBatchRequest.addCaptureGivenAuth(capturegivenauth);
cnpBatchRequest.addSale(saleObj);

_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();
}

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

captureResponse = cnpBatchResponse.nextCaptureResponse();
}

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

forceCaptureResponse = cnpBatchResponse.nextForceCaptureResponse();
}

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

captureGivenAuthResponse = cnpBatchResponse.nextCaptureGivenAuthResponse();
}

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

saleResponse = cnpBatchResponse.nextSaleResponse();
}
cnpBatchResponse = cnpResponse.nextBatchResponse();
}

}
//12.31 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;
Expand Down
32 changes: 32 additions & 0 deletions CnpSdkForNet/CnpSdkForNetTest/Functional/TestCapture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -256,5 +256,37 @@ public void SimpleCaptureWithPassengerTransportData()///12.26
var response = _cnp.Capture(capture);
Assert.AreEqual("Approved", response.message);
}

[Test]
public void SimpleCaptureWithForeignRetailerIndicator()///12.31
{
var capture = new capture
{
id = "1",
cnpTxnId = 123456000,
orderId = "defaultOrderId",
amount = 106,
lodgingInfo = new lodgingInfo
{
bookingID = "BID1234555",
passengerName = "Rohan Sharma",
propertyAddress = new propertyAddress
{
name = "Xpress",
city = "Pune",
region = "WES",
country = countryTypeEnum.IN
},
travelPackageIndicator = travelPackageIndicatorEnum.AirlineReservation,
smokingPreference = "N",
numberOfRooms = 1,
tollFreePhoneNumber = "1234567890"
},
foreignRetailerIndicator= foreignRetailerIndicatorEnum.F

};
var response = _cnp.Capture(capture);
Assert.AreEqual("Approved", response.message);
}
}
}
Loading

0 comments on commit 472a8ee

Please sign in to comment.