-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'alanz-cd-update-sdk-3ds'
- Loading branch information
Showing
26 changed files
with
390 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using eWAY.Rapid.Models; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace eWAY.Rapid.Tests.IntegrationTests | ||
{ | ||
//Block the integration test beacuse rapid Sandbox is not support MPI now. | ||
[TestClass] | ||
public class Direct3DSEnrollTests : SdkTestBase | ||
{ | ||
private IRapidClient _client; | ||
private Direct3DSEnrollRequest _request; | ||
|
||
[TestInitialize] | ||
public void Initial() | ||
{ | ||
_client = CreateRapidApiClient(); | ||
_request = TestUtil.CreateEnrollRequest(); | ||
} | ||
|
||
[TestMethod] | ||
public void Enroll_Returns_ValidResponse() | ||
{ | ||
var response = _client.Direct3DSEnroll(_request); | ||
|
||
Assert.IsFalse(string.IsNullOrEmpty(response.Default3dsUrl)); | ||
Assert.AreNotEqual(0, response.TraceId); | ||
Assert.IsFalse(string.IsNullOrEmpty(response.AccessCode)); | ||
Assert.IsNull(response.Errors); | ||
} | ||
|
||
[TestMethod] | ||
public void Enroll_Returns_ErrorResponse() | ||
{ | ||
var request = TestUtil.CreateEnrollRequest(); | ||
//Send no postal code will cause error V6068 | ||
request.Customer.Address.PostalCode = ""; | ||
|
||
var response = _client.Direct3DSEnroll(request); | ||
|
||
Assert.IsTrue(string.IsNullOrEmpty(response.Default3dsUrl)); | ||
Assert.AreEqual(0, response.TraceId); | ||
Assert.IsTrue(string.IsNullOrEmpty(response.AccessCode)); | ||
Assert.IsNotNull(response.Errors); | ||
Assert.AreEqual("V6068", response.Errors[0]); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
using eWAY.Rapid.Models; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace eWAY.Rapid.Tests.IntegrationTests | ||
{ | ||
//Block the integration test beacuse rapid Sandbox is not support MPI now. | ||
[TestClass] | ||
public class Direct3DSVerifyTests : SdkTestBase | ||
{ | ||
private IRapidClient _client; | ||
|
||
[TestInitialize] | ||
public void Initialize() | ||
{ | ||
_client = CreateRapidApiClient(); | ||
} | ||
|
||
[TestMethod] | ||
public void Verify_Returns_Valid_Response() | ||
{ | ||
var request = Generate3DSVerifyRequest(); | ||
var response = _client.Direct3DSVerify(request); | ||
|
||
Assert.AreNotEqual(0, response.TraceId); | ||
Assert.IsNotNull(response.AccessCode); | ||
Assert.IsNotNull(response.ThreeDSecureAuth); | ||
//Before verify, need to go to Direct3DSUrl to initialize the request, if not, will return D4417 | ||
Assert.IsNotNull(response.Errors); | ||
Assert.AreEqual("D4417", response.Errors[0]); | ||
} | ||
|
||
[TestMethod] | ||
public void Verify_Returns_Errors_Invalid_Response() | ||
{ | ||
var request = Generate3DSVerifyRequest(); | ||
request.TraceId = 0; | ||
var response = _client.Direct3DSVerify(request); | ||
|
||
Assert.AreEqual("0", response.TraceId); | ||
Assert.IsNull(response.AccessCode); | ||
Assert.IsNull(response.ThreeDSecureAuth); | ||
Assert.IsNotNull(response.Errors); | ||
Assert.AreEqual("D4417", response.Errors[0]); | ||
} | ||
|
||
private Direct3DSVerifyRequest Generate3DSVerifyRequest() | ||
{ | ||
var enrollResponse = _client.Direct3DSEnroll(TestUtil.CreateEnrollRequest()); | ||
return new Direct3DSVerifyRequest() | ||
{ | ||
TraceId = enrollResponse.TraceId, | ||
AccessCode = enrollResponse.AccessCode | ||
}; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
namespace eWAY.Rapid.Internals.Models | ||
{ | ||
internal class Direct3DSecureAuth | ||
{ | ||
/// <summary>Cardholder Authentication Value</summary> | ||
public string Cryptogram { get; set; } | ||
/// <summary>Electronic Commerce Indicator</summary> | ||
public string ECI { get; set; } | ||
/// <summary>Transaction identifier resulting from authentication processing for 3DS V1</summary> | ||
public string XID { get; set; } | ||
/// <summary>The result of the 3D Secure authentication </summary> | ||
public string AuthStatus { get; set; } | ||
/// <summary>Version of 3D Secure.</summary> | ||
public string Version { get; set; } | ||
/// <summary>Transaction Id for 3DS 2.0</summary> | ||
public string dsTransactionId { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
eWAY.Rapid/Internals/Request/Direct3DSecureEnrollRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using eWAY.Rapid.Internals.Models; | ||
using System.Collections.Generic; | ||
|
||
namespace eWAY.Rapid.Internals.Request | ||
{ | ||
internal | ||
class Direct3DSecureEnrollRequest : BaseRequest | ||
{ | ||
public DirectTokenCustomer Customer { get; set; } | ||
public ShippingAddress ShippingAddress { get; set; } | ||
public List<LineItem> Items { get; set; } | ||
public Payment Payment { get; set; } | ||
public string RedirectUrl { get; set; } | ||
public string SecuredCardData { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace eWAY.Rapid.Internals.Request | ||
{ | ||
internal class Direct3DSecureVerifyRequest : BaseRequest | ||
{ | ||
public long TraceId { get; set; } | ||
public string AccessCode { get; set; } | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
eWAY.Rapid/Internals/Response/Direct3DSecureEnrollResponse.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace eWAY.Rapid.Internals.Response | ||
{ | ||
internal class Direct3DSecureEnrollResponse : BaseResponse | ||
{ | ||
public string Default3dsUrl { get; set; } | ||
public long TraceId { get; set; } | ||
public string AccessCode { get; set; } | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
eWAY.Rapid/Internals/Response/Direct3DSecureVerifyResponse.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using eWAY.Rapid.Internals.Models; | ||
|
||
namespace eWAY.Rapid.Internals.Response | ||
{ | ||
internal class Direct3DSecureVerifyResponse : BaseResponse | ||
{ | ||
public string TraceId { get; set; } | ||
public string AccessCode { get; set; } | ||
public Direct3DSecureAuth ThreeDSecureAuth { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.