Skip to content

Commit

Permalink
Merge pull request #148 from Judopay/ThreeDSecureEci-JR-5242
Browse files Browse the repository at this point in the history
ThreeDSecureEci-JR-5242
  • Loading branch information
chrisurun authored Jul 21, 2021
2 parents 4c6718f + a0c9841 commit 47e5b2b
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 7 deletions.
2 changes: 1 addition & 1 deletion JudoPayDotNet/Http/VersioningHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ internal class VersioningHandler : DelegatingHandler
{
public const string API_VERSION_HEADER = "api-version";

internal const string DEFAULT_API_VERSION = "6.3";
internal const string DEFAULT_API_VERSION = "6.6";

private readonly string _apiVersionValue;

Expand Down
6 changes: 6 additions & 0 deletions JudoPayDotNet/Models/ThreeDSecureReceiptModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ public class ThreeDSecureReceiptModel
/// </summary>
[DataMember]
public string Result { get; set; }

/// <summary>
/// Electronic Commerce Indicator
/// </summary>
[DataMember]
public string Eci { get; set; }
}
// ReSharper restore UnusedMember.Global
// ReSharper restore UnusedAutoPropertyAccessor.Global
Expand Down
6 changes: 5 additions & 1 deletion JudoPayDotNetIntegrationTests/TransactionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,13 @@ public void GetTransactionFromWebPayment()

// And an associated payment (passing webPaymentReference)
var paymentWithCard = GetCardPaymentModel();
paymentWithCard.YourPaymentReference = webPaymentRequest.YourPaymentReference;
paymentWithCard.WebPaymentReference = webPaymentReference;

// Set other fields to be identical for the authentication to be successful
paymentWithCard.Amount = webPaymentRequest.Amount;
paymentWithCard.YourConsumerReference = webPaymentRequest.YourConsumerReference;
paymentWithCard.YourPaymentReference = webPaymentRequest.YourPaymentReference;

var response = JudoPayApiIridium.Payments.Create(paymentWithCard).Result;

Assert.IsNotNull(response);
Expand Down
5 changes: 5 additions & 0 deletions JudoPayDotNetIntegrationTests/WebPaymentsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,11 @@ public async Task CreatePaymentSessionThenPayWithReference()
var paymentWithCard = GetCardPaymentModel();
paymentWithCard.WebPaymentReference = result.Response.Reference;

// Set other fields to be identical for the authentication to be successful
paymentWithCard.Amount = request.Amount;
paymentWithCard.YourConsumerReference = request.YourConsumerReference;
paymentWithCard.YourPaymentReference = request.YourPaymentReference;

var response = await JudoPayApiIridium.Payments.Create(paymentWithCard);

Assert.IsNotNull(response);
Expand Down
10 changes: 5 additions & 5 deletions JudoPayDotNetTests/Clients/ThreeDsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ public static IEnumerable CompleteSuccessTestCases
threeDSecure :
{
attempted : true,
result : 'done'
result : 'done',
eci : '05'
}
}").SetName("CompleteThreeDsAuthorizationsWithSuccess");
}
Expand Down Expand Up @@ -186,8 +187,7 @@ public static IEnumerable ValidateCompleteFailureTestCases
}

[Test, TestCaseSource(typeof(ThreeDCaseSources), "CompleteSuccessTestCases")]
public void CompleteThreeDsWithSuccess(long receiptId, ThreeDResultModel threeDResult,
string responseData)
public void CompleteThreeDsWithSuccess(long receiptId, ThreeDResultModel threeDResult, string responseData)
{
var httpClient = Substitute.For<IHttpClient>();
var response = new HttpResponseMessage(HttpStatusCode.OK) {Content = new StringContent(responseData)};
Expand All @@ -203,14 +203,14 @@ public void CompleteThreeDsWithSuccess(long receiptId, ThreeDResultModel threeDR

var judo = new JudoPayApi(DotNetLoggerFactory.Create, client);

var paymentReceiptResult =
judo.ThreeDs.Complete3DSecure(receiptId, threeDResult).Result;
var paymentReceiptResult = judo.ThreeDs.Complete3DSecure(receiptId, threeDResult).Result;

Assert.NotNull(paymentReceiptResult);
Assert.IsFalse(paymentReceiptResult.HasError);
Assert.NotNull(paymentReceiptResult.Response);
Assert.That(paymentReceiptResult.Response.ReceiptId, Is.EqualTo(134567));
Assert.That(paymentReceiptResult.Response.ThreeDSecure.Result, Is.EqualTo("done"));
Assert.That(paymentReceiptResult.Response.ThreeDSecure.Eci, Is.EqualTo("05"));
}

[Test, TestCaseSource(typeof(ThreeDCaseSources), "CompleteFailureTestCases")]
Expand Down

0 comments on commit 47e5b2b

Please sign in to comment.