diff --git a/Adyen.Test/Adyen.Test.csproj b/Adyen.Test/Adyen.Test.csproj
index 993375854..0fb11ebf0 100644
--- a/Adyen.Test/Adyen.Test.csproj
+++ b/Adyen.Test/Adyen.Test.csproj
@@ -5,11 +5,11 @@
false
- 3.0.1
+ 3.0.2
- 3.0.1
+ 3.0.2
- 3.0.1
+ 3.0.2
diff --git a/Adyen.Test/CheckoutTest.cs b/Adyen.Test/CheckoutTest.cs
index 8bd3ab957..658881797 100644
--- a/Adyen.Test/CheckoutTest.cs
+++ b/Adyen.Test/CheckoutTest.cs
@@ -11,8 +11,24 @@ namespace Adyen.Test
[TestClass]
public class CheckoutTest : BaseTest
{
+ ///
+ /// Tests successful checkout client Test URL generation.
+ ///
+ [TestMethod]
+ public void CheckoutEndpointTestEnvironmentSuccessTest()
+ {
+ var config = new Config();
+ var client = new Client(config);
+ client.SetEnviroment(Model.Enum.Environment.Test, "companyUrl");
+ Assert.AreEqual(config.CheckoutEndpoint, @"https://checkout-test.adyen.com");
+ Assert.AreEqual(config.Endpoint, @"https://pal-test.adyen.com");
+ }
+
+ ///
+ /// Tests successful checkout client Live URL generation.
+ ///
[TestMethod]
- public void CheckoutEndpointTest()
+ public void CheckoutEndpointLiveEnvironmentSuccessTest()
{
var config = new Config();
var client = new Client(config);
@@ -21,6 +37,18 @@ public void CheckoutEndpointTest()
Assert.AreEqual(config.Endpoint, @"https://companyUrl-pal-live.adyenpayments.com");
}
+ ///
+ /// Tests unsuccessful checkout client Live URL generation.
+ ///
+ [TestMethod]
+ [ExpectedException(typeof(InvalidOperationException), "Missing liveEndpointUrlPrefix for endpoint generation")]
+ public void CheckoutEndpointLiveErrorTest()
+ {
+ var config = new Config();
+ var client = new Client(config);
+ client.SetEnviroment(Model.Enum.Environment.Live);
+ }
+
///
/// Test success flow for
/// POST /payments
diff --git a/Adyen.Test/CloudApiPosRequestTest.cs b/Adyen.Test/CloudApiPosRequestTest.cs
index f9616ea0a..8ce5f3b5b 100644
--- a/Adyen.Test/CloudApiPosRequestTest.cs
+++ b/Adyen.Test/CloudApiPosRequestTest.cs
@@ -51,20 +51,23 @@ public void TestCloudApiAsyncRequest()
public void TestCloudApiTransactionStatusResponseSuccess()
{
var paymentRequest = MockPosApiRequest.CreatePosPaymentRequest();
- var client = CreateMockTestClientPosCloudApiRequest("Mocks/terminalapi/pospayment-transaction-status-response.json");
+ var client =
+ CreateMockTestClientPosCloudApiRequest("Mocks/terminalapi/pospayment-transaction-status-response.json");
var payment = new PosPaymentCloudApi(client);
var saleToPoiResponse = payment.TerminalApiCloudSync(paymentRequest);
try
{
- var transactionStatusResponse = (TransactionStatusResponse)saleToPoiResponse.MessagePayload;
- var messagePayloadResponse = transactionStatusResponse.RepeatedMessageResponse.RepeatedResponseMessageBody.MessagePayload;
+ var transactionStatusResponse = (TransactionStatusResponse) saleToPoiResponse.MessagePayload;
+ var messagePayloadResponse = transactionStatusResponse.RepeatedMessageResponse
+ .RepeatedResponseMessageBody.MessagePayload;
Assert.IsNotNull(saleToPoiResponse);
Assert.AreEqual(saleToPoiResponse.MessageHeader.ServiceID, "35543420");
Assert.AreEqual(saleToPoiResponse.MessageHeader.SaleID, "TOSIM_1_1_6");
Assert.AreEqual(saleToPoiResponse.MessageHeader.POIID, "P400Plus-12345678");
Assert.AreEqual(transactionStatusResponse.Response.Result, ResultType.Success);
- Assert.AreEqual(messagePayloadResponse.PaymentResult.PaymentInstrumentData.CardData.EntryMode[0], EntryModeType.ICC);
+ Assert.AreEqual(messagePayloadResponse.PaymentResult.PaymentInstrumentData.CardData.EntryMode[0],
+ EntryModeType.ICC);
Assert.AreEqual(messagePayloadResponse.POIData.POIReconciliationID, "1000");
}
catch (Exception)
@@ -98,15 +101,17 @@ public void TestCloudApiSyncErrorResponse()
{
//Create a mock pos payment request
var paymentRequest = MockPosApiRequest.CreatePosPaymentRequest();
- var client = CreateMockTestClientPosCloudApiRequest("Mocks/terminalapi/pospayment-notification-error-response.json");
+ var client =
+ CreateMockTestClientPosCloudApiRequest(
+ "Mocks/terminalapi/pospayment-notification-error-response.json");
var payment = new PosPaymentCloudApi(client);
var saleToPoiResponse = payment.TerminalApiCloudSync(paymentRequest);
- var messagePayload = (EventNotification)saleToPoiResponse.MessagePayload;
+ var messagePayload = (EventNotification) saleToPoiResponse.MessagePayload;
Assert.AreEqual(saleToPoiResponse.MessageHeader.MessageClass, MessageClassType.Event);
Assert.AreEqual(saleToPoiResponse.MessageHeader.MessageCategory, MessageCategoryType.Event);
Assert.AreEqual(saleToPoiResponse.MessageHeader.SaleID, "POSSystemID12345");
Assert.AreEqual(saleToPoiResponse.MessageHeader.POIID, "P400Plus-12345678");
- Assert.AreEqual(messagePayload.EventToNotify,EventToNotifyType.Reject);
+ Assert.AreEqual(messagePayload.EventToNotify, EventToNotifyType.Reject);
}
catch (Exception)
{
@@ -114,6 +119,28 @@ public void TestCloudApiSyncErrorResponse()
}
}
-
+
+ [TestMethod]
+ public void TestCloudApiDisplaySuccessResponse()
+ {
+ try
+ {
+ //Create a mock pos payment request
+ var paymentRequest = MockPosApiRequest.CreatePosPaymentRequest();
+ var client =
+ CreateMockTestClientPosCloudApiRequest(
+ "Mocks/terminalapi/display-response-success.json");
+ var payment = new PosPaymentCloudApi(client);
+ var saleToPoiResponse = payment.TerminalApiCloudSync(paymentRequest);
+ Assert.IsNotNull(saleToPoiResponse);
+ var response = (DisplayResponse)saleToPoiResponse.MessagePayload;
+ Assert.AreEqual(response.OutputResult[0].InfoQualify, InfoQualifyType.Display);
+ Assert.AreEqual(response.OutputResult[0].Device, DeviceType.CustomerDisplay);
+ }
+ catch (Exception)
+ {
+ Assert.Fail();
+ }
+ }
}
}
diff --git a/Adyen.Test/Mocks/terminalapi/display-response-success.json b/Adyen.Test/Mocks/terminalapi/display-response-success.json
new file mode 100644
index 000000000..f8574fa7e
--- /dev/null
+++ b/Adyen.Test/Mocks/terminalapi/display-response-success.json
@@ -0,0 +1,22 @@
+{
+ "SaleToPOIResponse": {
+ "DisplayResponse": {
+ "OutputResult": [{
+ "Device": "CustomerDisplay",
+ "InfoQualify": "Display",
+ "Response": {
+ "Result": "Success"
+ }
+ }]
+ },
+ "MessageHeader": {
+ "ProtocolVersion": "3.0",
+ "SaleID": "POSSystemID12345Appie",
+ "MessageClass": "Device",
+ "MessageCategory": "Display",
+ "ServiceID": "20135010",
+ "POIID": "MX925-284691408",
+ "MessageType": "Response"
+ }
+ }
+}
\ No newline at end of file
diff --git a/Adyen.Test/Mocks/threedsecure2/authorise3ds2-response-challengeshopper.json b/Adyen.Test/Mocks/threedsecure2/authorise3ds2-response-challengeshopper.json
index 24862728a..ac0f558cc 100644
--- a/Adyen.Test/Mocks/threedsecure2/authorise3ds2-response-challengeshopper.json
+++ b/Adyen.Test/Mocks/threedsecure2/authorise3ds2-response-challengeshopper.json
@@ -5,7 +5,7 @@
"threeds2.threeDS2ResponseData.acsURL": "https://pal-test.adyen.com/threeds2simulator/acs/challenge.shtml",
"threeds2.threeDS2ResponseData.threeDSServerTransID": "74044f6c-7d79-4dd1-9859-3b2879a32fb1",
"threeds2.threeDS2ResponseData.authenticationType": "01",
- "threeds2.threeDS2ResponseData.messageVersion": "3.0.1",
+ "threeds2.threeDS2ResponseData.messageVersion": "3.0.2",
"threeds2.threeDS2Token": "[token]",
"threeds2.threeDS2ResponseData.acsTransID": "ba961c4b-33f2-4830-3141-744b8586aeb0",
"threeds2.threeDS2ResponseData.acsReferenceNumber": "ADYEN-ACS-SIMULATOR"
diff --git a/Adyen.Test/PaymentTest.cs b/Adyen.Test/PaymentTest.cs
index 6ae4e69aa..f31a7e4b2 100644
--- a/Adyen.Test/PaymentTest.cs
+++ b/Adyen.Test/PaymentTest.cs
@@ -77,7 +77,7 @@ public void TestAuthorise3DS2ChallengeShopperMocked()
Assert.AreEqual("https://pal-test.adyen.com/threeds2simulator/acs/challenge.shtml", GetAdditionalData(paymentResult.AdditionalData, "threeds2.threeDS2ResponseData.acsURL"));
Assert.AreEqual("74044f6c-7d79-4dd1-9859-3b2879a32fb1", GetAdditionalData(paymentResult.AdditionalData, "threeds2.threeDS2ResponseData.threeDSServerTransID"));
Assert.AreEqual("01", GetAdditionalData(paymentResult.AdditionalData, "threeds2.threeDS2ResponseData.authenticationType"));
- Assert.AreEqual("3.0.1", GetAdditionalData(paymentResult.AdditionalData, "threeds2.threeDS2ResponseData.messageVersion"));
+ Assert.AreEqual("3.0.2", GetAdditionalData(paymentResult.AdditionalData, "threeds2.threeDS2ResponseData.messageVersion"));
Assert.AreEqual("[token]", GetAdditionalData(paymentResult.AdditionalData, "threeds2.threeDS2Token"));
Assert.AreEqual("ba961c4b-33f2-4830-3141-744b8586aeb0", GetAdditionalData(paymentResult.AdditionalData, "threeds2.threeDS2ResponseData.acsTransID"));
Assert.AreEqual("ADYEN-ACS-SIMULATOR", GetAdditionalData(paymentResult.AdditionalData, "threeds2.threeDS2ResponseData.acsReferenceNumber"));
diff --git a/Adyen/Adyen.csproj b/Adyen/Adyen.csproj
index 9c72405bf..21612078c 100644
--- a/Adyen/Adyen.csproj
+++ b/Adyen/Adyen.csproj
@@ -4,15 +4,15 @@
netstandard2.0
false
Adyen
- 3.0.1
- 3.0.1
- 3.0.1
+ 3.0.2
+ 3.0.2
+ 3.0.2
true
The Adyen API Library for .net core enables you to work with Adyen APIs, Hosted Payment Pages and terminal api with any .net application.
https://github.com/Adyen/adyen-dotnet-api-library
https://github.com/Adyen/adyen-dotnet-api-library
git
- 3.0.1
+ 3.0.2
https://github.com/Adyen/adyen-dotnet-api-library/blob/master/LICENSE
Adyen
Adyen
diff --git a/Adyen/Client.cs b/Adyen/Client.cs
index ff740cb4a..adc9e0c5c 100644
--- a/Adyen/Client.cs
+++ b/Adyen/Client.cs
@@ -1,8 +1,9 @@
-using Adyen.Constants;
+using System;
+using Adyen.Constants;
using Adyen.HttpClient.Interfaces;
using Adyen.HttpClient;
-using Adyen.Model.Enum;
-using System.Net.Security;
+using Adyen.Exceptions;
+using Environment = Adyen.Model.Enum.Environment;
namespace Adyen
{
@@ -70,15 +71,15 @@ public void SetEnviroment(Environment environment, string liveEndpointUrlPrefix)
Config.CheckoutEndpoint = ClientConfig.CheckoutEndpointTest;
break;
case Environment.Live:
- Config.Endpoint = ClientConfig.EndpointLive;
- Config.HppEndpoint = ClientConfig.HppLive;
- Config.CloudApiEndPoint = ClientConfig.CloudApiEndPointLive;
- //set live endpoint for checkout api
- if (!string.IsNullOrEmpty(liveEndpointUrlPrefix))
+ if (string.IsNullOrEmpty(liveEndpointUrlPrefix))
{
- Config.Endpoint = ClientConfig.EndpointProtocol + liveEndpointUrlPrefix + ClientConfig.EndpointLiveSuffix;
- Config.CheckoutEndpoint = ClientConfig.EndpointProtocol + liveEndpointUrlPrefix + ClientConfig.CheckoutEndpointLiveSuffix;
+ throw new InvalidOperationException(ExceptionMessages.MissingLiveEndpointUrlPrefix);
}
+
+ Config.Endpoint = ClientConfig.EndpointProtocol + liveEndpointUrlPrefix + ClientConfig.EndpointLiveSuffix;
+ Config.HppEndpoint = ClientConfig.HppLive;
+ Config.CloudApiEndPoint = ClientConfig.CloudApiEndPointLive;
+ Config.CheckoutEndpoint = ClientConfig.EndpointProtocol + liveEndpointUrlPrefix + ClientConfig.CheckoutEndpointLiveSuffix;
break;
}
}
diff --git a/Adyen/Constants/ClientConfig.cs b/Adyen/Constants/ClientConfig.cs
index 25efd88b6..2d90d6049 100644
--- a/Adyen/Constants/ClientConfig.cs
+++ b/Adyen/Constants/ClientConfig.cs
@@ -20,6 +20,6 @@ public class ClientConfig
public static string NexoProtocolVersion = "3.0";
public static string LibName = "adyen-dotnet-api-library";
- public static string LibVersion = "3.0.1";
+ public static string LibVersion = "3.0.2";
}
}
diff --git a/Adyen/Exceptions/ExceptionMessages.cs b/Adyen/Exceptions/ExceptionMessages.cs
index dc366d9e0..4ce0e1176 100644
--- a/Adyen/Exceptions/ExceptionMessages.cs
+++ b/Adyen/Exceptions/ExceptionMessages.cs
@@ -11,5 +11,6 @@ internal class ExceptionMessages
internal const string InvalidMessageType = "Invalid Message Type for the message: {0}";
internal const string TerminalErrorResponse = "Terminal Error Response: {0}";
internal const string ExceptionDuringDeserialization = "Exception during deserialization of object: {0}, Exception Message: {1}";
+ internal const string MissingLiveEndpointUrlPrefix = "Missing liveEndpointUrlPrefix for endpoint generation";
}
}
diff --git a/Adyen/Model/Nexo/DisplayResponse.cs b/Adyen/Model/Nexo/DisplayResponse.cs
index fb9ba07a5..5a3ddf7f3 100644
--- a/Adyen/Model/Nexo/DisplayResponse.cs
+++ b/Adyen/Model/Nexo/DisplayResponse.cs
@@ -1,13 +1,14 @@
-namespace Adyen.Model.Nexo
+using Adyen.CloudApiSerialization;
+
+namespace Adyen.Model.Nexo
{
///
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
- public partial class DisplayResponse
+ public partial class DisplayResponse : IMessagePayload
{
-
///
[System.Xml.Serialization.XmlElementAttribute("OutputResult", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public OutputResult[] OutputResult;
diff --git a/README.md b/README.md
index 7d13d621d..862ef3225 100644
--- a/README.md
+++ b/README.md
@@ -25,7 +25,7 @@ The Library supports all APIs under the following services:
* Simply download and restore nuget packages
https://www.nuget.org/packages/Adyen/
* or install it from package manager
- PM> Install-Package Adyen -Version 3.0.1
+ PM> Install-Package Adyen -Version 3.0.2
## Documentation
* https://docs.adyen.com/developers/development-resources/libraries