From 0a4d28ce8a59d6a2e678f434c8a0384d4c61f882 Mon Sep 17 00:00:00 2001 From: Stuart Baillie Date: Tue, 27 Jul 2021 11:40:37 +0100 Subject: [PATCH] JR-5220 : Add PrimaryAccountDetails to RegisterCardModel and CheckCardModel --- CHANGELOG.md | 5 +++-- JudoPayDotNet/Models/RegisterCardModel.cs | 7 +++++++ .../CheckCardTests.cs | 20 +++++++++++++++++++ .../RegisterCardTests.cs | 20 +++++++++++++++++++ 4 files changed, 50 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a6d4150..709c6ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/JudoPayDotNet/Models/RegisterCardModel.cs b/JudoPayDotNet/Models/RegisterCardModel.cs index dc868ae..4671e5e 100644 --- a/JudoPayDotNet/Models/RegisterCardModel.cs +++ b/JudoPayDotNet/Models/RegisterCardModel.cs @@ -114,6 +114,13 @@ public RegisterCardModel() [DataMember(EmitDefaultValue = false)] // ReSharper disable once UnusedMember.Global public JObject ClientDetails { get; set; } + + /// + /// Details needed for MCC 6012 transactions + /// + [DataMember(EmitDefaultValue = false)] + // ReSharper disable once UnusedMember.Global + public PrimaryAccountDetailsModel PrimaryAccountDetails { get; set; } } // ReSharper restore UnusedMember.Global } diff --git a/JudoPayDotNetIntegrationTests/CheckCardTests.cs b/JudoPayDotNetIntegrationTests/CheckCardTests.cs index b5f962e..8b5adaa 100644 --- a/JudoPayDotNetIntegrationTests/CheckCardTests.cs +++ b/JudoPayDotNetIntegrationTests/CheckCardTests.cs @@ -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 diff --git a/JudoPayDotNetIntegrationTests/RegisterCardTests.cs b/JudoPayDotNetIntegrationTests/RegisterCardTests.cs index 35c7b7d..f615e46 100644 --- a/JudoPayDotNetIntegrationTests/RegisterCardTests.cs +++ b/JudoPayDotNetIntegrationTests/RegisterCardTests.cs @@ -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); + } } }