Skip to content

Commit

Permalink
Merge pull request #149 from Judopay/PrimaryAccountDetailsRegisterChe…
Browse files Browse the repository at this point in the history
…ckCard-JR-5339

JR-5339 : Add PrimaryAccountDetails to RegisterCardModel and CheckCardModel
  • Loading branch information
Stuart-Baillie authored Jul 30, 2021
2 parents 856450f + 8782585 commit ea18863
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 2 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Change Log
All notable changes to this project will be documented in this file.

## 3.1 Changes on 2021-04
## 3.1 Changes on 2021-08
- Amount is now optional on voids, collections and refunds. If not specified, the remaining amount of the original transaction will be used.
- Update Api-Version to 6.3
- Update Api-Version to 6.6
- Allow WebPaymentReference to be set on PaymentModel
- Add AuthCode to initial receipt response
- Add AuthCode, WebPaymentReference and Acquirer to response of Transactions.Get(receiptId)
- New exemption flags ChallengeRequestIndicator and ScaExemption added to the ThreeDSecureTwo Model
- Add PrimaryAccountDetails to RegisterCardModel and CheckCardModel

## 3.0 Changes on 2021-03-11
- Update default base Urls with certificate pinning checks
Expand Down
7 changes: 7 additions & 0 deletions JudoPayDotNet/Models/RegisterCardModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,13 @@ public RegisterCardModel()
[DataMember(EmitDefaultValue = false)]
// ReSharper disable once UnusedMember.Global
public JObject ClientDetails { get; set; }

/// <summary>
/// Details needed for MCC 6012 transactions
/// </summary>
[DataMember(EmitDefaultValue = false)]
// ReSharper disable once UnusedMember.Global
public PrimaryAccountDetailsModel PrimaryAccountDetails { get; set; }
}
// ReSharper restore UnusedMember.Global
}
20 changes: 20 additions & 0 deletions JudoPayDotNetIntegrationTests/CheckCardTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,26 @@ public void ValidateWithoutSuccess(CheckCardModel checkCardModel, JudoModelError
Assert.IsTrue(fieldErrors.Any(x => x.Code == (int)expectedModelErrorCode));
}

[Test]
public async Task PrimaryAccountDetailsCheckCard()
{
var checkCardModel = GetCheckCardModel(Configuration.Cybersource_Judoid);
// Given a RegisterCardModel with PrimaryAccountDetails
checkCardModel.PrimaryAccountDetails = new PrimaryAccountDetailsModel
{
Name = "Doe",
AccountNumber = "1234567",
DateOfBirth = "2000-12-31",
PostCode = "EC2A 4DP"
};

var response = await JudoPayApiCyberSource.CheckCards.Create(checkCardModel);

Assert.IsNotNull(response);
Assert.IsFalse(response.HasError);
Assert.AreEqual("Success", response.Response.Result);
}

internal class RegisterCheckCardTestSource
{
public static IEnumerable ValidateFailureTestCases
Expand Down
20 changes: 20 additions & 0 deletions JudoPayDotNetIntegrationTests/RegisterCardTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,25 @@ public void ValidateWithoutSuccess(RegisterCardModel registerCardModel, JudoMode
Assert.IsTrue(fieldErrors.Count >= 1);
Assert.IsTrue(fieldErrors.Any(x => x.Code == (int)expectedModelErrorCode));
}

[Test]
public async Task PrimaryAccountDetailsRegisterCard()
{
var registerCardModel = GetRegisterCardModel("432438862");
// Given a RegisterCardModel with PrimaryAccountDetails
registerCardModel.PrimaryAccountDetails = new PrimaryAccountDetailsModel
{
Name = "Doe",
AccountNumber = "1234567",
DateOfBirth = "2000-12-31",
PostCode = "EC2A 4DP"
};

var response = await JudoPayApiIridium.RegisterCards.Create(registerCardModel);

Assert.IsNotNull(response);
Assert.IsFalse(response.HasError);
Assert.AreEqual("Success", response.Response.Result);
}
}
}

0 comments on commit ea18863

Please sign in to comment.