From 5b5f70b63e41aeeed9ff85fb56eba457096fecc3 Mon Sep 17 00:00:00 2001 From: Djoyke Reijans <115019123+DjoykeAbyah@users.noreply.github.com> Date: Tue, 3 Sep 2024 10:56:13 +0000 Subject: [PATCH 1/6] adjusted parameters in HMACValidator.cs and UtilTest.cs --- Adyen.IntegrationTest/Adyen.IntegrationTest.csproj | 2 +- Adyen.Test/Adyen.Test.csproj | 2 +- Adyen.Test/UtilTest.cs | 8 ++++---- Adyen/Adyen.csproj | 2 +- Adyen/Util/HMACValidator.cs | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Adyen.IntegrationTest/Adyen.IntegrationTest.csproj b/Adyen.IntegrationTest/Adyen.IntegrationTest.csproj index 47320b58c..b77b59730 100644 --- a/Adyen.IntegrationTest/Adyen.IntegrationTest.csproj +++ b/Adyen.IntegrationTest/Adyen.IntegrationTest.csproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 false diff --git a/Adyen.Test/Adyen.Test.csproj b/Adyen.Test/Adyen.Test.csproj index d079238c7..4ff216a59 100644 --- a/Adyen.Test/Adyen.Test.csproj +++ b/Adyen.Test/Adyen.Test.csproj @@ -2,7 +2,7 @@ true - net6.0;netstandard2.0 + net8.0;netstandard2.0 false diff --git a/Adyen.Test/UtilTest.cs b/Adyen.Test/UtilTest.cs index b2450c6c7..cca30d9dc 100644 --- a/Adyen.Test/UtilTest.cs +++ b/Adyen.Test/UtilTest.cs @@ -20,16 +20,16 @@ public void TestHmac() var ecnrypted = hmacValidator.CalculateHmac(data, key); Assert.IsTrue(string.Equals(ecnrypted, "34oR8T1whkQWTv9P+SzKyp8zhusf9n0dpqrm9nsqSJs=")); } - + [TestMethod] public void TestBalancePlatformHmac() { var notification = "{\"data\":{\"balancePlatform\":\"Integration_tools_test\",\"accountId\":\"BA32272223222H5HVKTBK4MLB\",\"sweep\":{\"id\":\"SWPC42272223222H5HVKV6H8C64DP5\",\"schedule\":{\"type\":\"balance\"},\"status\":\"active\",\"targetAmount\":{\"currency\":\"EUR\",\"value\":0},\"triggerAmount\":{\"currency\":\"EUR\",\"value\":0},\"type\":\"pull\",\"counterparty\":{\"balanceAccountId\":\"BA3227C223222H5HVKT3H9WLC\"},\"currency\":\"EUR\"}},\"environment\":\"test\",\"type\":\"balancePlatform.balanceAccountSweep.updated\"}"; - var signKey = "D7DD5BA6146493707BF0BE7496F6404EC7A63616B7158EC927B9F54BB436765F"; - var hmacKey = "9Qz9S/0xpar1klkniKdshxpAhRKbiSAewPpWoxKefQA="; + var hmacKey = "D7DD5BA6146493707BF0BE7496F6404EC7A63616B7158EC927B9F54BB436765F"; + var signKey = "9Qz9S/0xpar1klkniKdshxpAhRKbiSAewPpWoxKefQA="; var hmacValidator = new HmacValidator(); - bool response = hmacValidator.IsValidWebhook(hmacKey, signKey, notification); + bool response = hmacValidator.IsValidWebhook(signKey, hmacKey, notification); Assert.IsTrue(response); } diff --git a/Adyen/Adyen.csproj b/Adyen/Adyen.csproj index 206b9e610..5aaf0a526 100644 --- a/Adyen/Adyen.csproj +++ b/Adyen/Adyen.csproj @@ -1,7 +1,7 @@  - net6.0;netstandard2.0 + net8.0;netstandard2.0 false Adyen diff --git a/Adyen/Util/HMACValidator.cs b/Adyen/Util/HMACValidator.cs index 7bf302d35..af75c6182 100644 --- a/Adyen/Util/HMACValidator.cs +++ b/Adyen/Util/HMACValidator.cs @@ -101,10 +101,10 @@ public bool IsValidHmac(NotificationRequestItem notificationRequestItem, string /// The HMAC signature, retrieved from the request header. /// The webhook payload. /// A return value indicates the HMAC validation succeeded. - public bool IsValidWebhook(string hmacKey, string hmacSignature, string payload) + public bool IsValidWebhook(string hmacSignature, string hmacKey, string payload) { - var calculatedSign = CalculateHmac(payload, hmacSignature); - return TimeSafeEquals(Encoding.UTF8.GetBytes(hmacKey), Encoding.UTF8.GetBytes(calculatedSign)); + var calculatedSign = CalculateHmac(payload, hmacKey); + return TimeSafeEquals(Encoding.UTF8.GetBytes(hmacSignature), Encoding.UTF8.GetBytes(calculatedSign)); } /// This method compares two bytestrings in constant time based on length of shortest bytestring to prevent timing attacks. From 308d0e2d3c282f1d8e135dab1635d922124d94ff Mon Sep 17 00:00:00 2001 From: Djoyke Reijans <115019123+DjoykeAbyah@users.noreply.github.com> Date: Tue, 3 Sep 2024 10:57:23 +0000 Subject: [PATCH 2/6] adjusted parameters in HMACValidator.cs and UtilTest.cs --- Adyen.IntegrationTest/Adyen.IntegrationTest.csproj | 2 +- Adyen.Test/Adyen.Test.csproj | 2 +- Adyen/Adyen.csproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Adyen.IntegrationTest/Adyen.IntegrationTest.csproj b/Adyen.IntegrationTest/Adyen.IntegrationTest.csproj index b77b59730..47320b58c 100644 --- a/Adyen.IntegrationTest/Adyen.IntegrationTest.csproj +++ b/Adyen.IntegrationTest/Adyen.IntegrationTest.csproj @@ -1,7 +1,7 @@ - net8.0 + net6.0 false diff --git a/Adyen.Test/Adyen.Test.csproj b/Adyen.Test/Adyen.Test.csproj index 4ff216a59..d079238c7 100644 --- a/Adyen.Test/Adyen.Test.csproj +++ b/Adyen.Test/Adyen.Test.csproj @@ -2,7 +2,7 @@ true - net8.0;netstandard2.0 + net6.0;netstandard2.0 false diff --git a/Adyen/Adyen.csproj b/Adyen/Adyen.csproj index 5aaf0a526..206b9e610 100644 --- a/Adyen/Adyen.csproj +++ b/Adyen/Adyen.csproj @@ -1,7 +1,7 @@  - net8.0;netstandard2.0 + net6.0;netstandard2.0 false Adyen From 92bc77ee65ea1cfdb944a4e87a349c73a320b28c Mon Sep 17 00:00:00 2001 From: Djoyke Reijans <115019123+DjoykeAbyah@users.noreply.github.com> Date: Tue, 3 Sep 2024 11:36:58 +0000 Subject: [PATCH 3/6] renamed singKey to signature in TestBalancePlatformHmac --- Adyen.Test/UtilTest.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Adyen.Test/UtilTest.cs b/Adyen.Test/UtilTest.cs index cca30d9dc..189908cb3 100644 --- a/Adyen.Test/UtilTest.cs +++ b/Adyen.Test/UtilTest.cs @@ -17,8 +17,8 @@ public void TestHmac() var data = "countryCode:currencyCode:merchantAccount:merchantReference:paymentAmount:sessionValidity:skinCode:NL:EUR:MagentoMerchantTest2:TEST-PAYMENT-2017-02-01-14\\:02\\:05:199:2017-02-02T14\\:02\\:05+01\\:00:PKz2KML1"; var key = "DFB1EB5485895CFA84146406857104ABB4CBCABDC8AAF103A624C8F6A3EAAB00"; var hmacValidator = new HmacValidator(); - var ecnrypted = hmacValidator.CalculateHmac(data, key); - Assert.IsTrue(string.Equals(ecnrypted, "34oR8T1whkQWTv9P+SzKyp8zhusf9n0dpqrm9nsqSJs=")); + var encrypted = hmacValidator.CalculateHmac(data, key); + Assert.IsTrue(string.Equals(encrypted, "34oR8T1whkQWTv9P+SzKyp8zhusf9n0dpqrm9nsqSJs=")); } [TestMethod] @@ -27,9 +27,9 @@ public void TestBalancePlatformHmac() var notification = "{\"data\":{\"balancePlatform\":\"Integration_tools_test\",\"accountId\":\"BA32272223222H5HVKTBK4MLB\",\"sweep\":{\"id\":\"SWPC42272223222H5HVKV6H8C64DP5\",\"schedule\":{\"type\":\"balance\"},\"status\":\"active\",\"targetAmount\":{\"currency\":\"EUR\",\"value\":0},\"triggerAmount\":{\"currency\":\"EUR\",\"value\":0},\"type\":\"pull\",\"counterparty\":{\"balanceAccountId\":\"BA3227C223222H5HVKT3H9WLC\"},\"currency\":\"EUR\"}},\"environment\":\"test\",\"type\":\"balancePlatform.balanceAccountSweep.updated\"}"; var hmacKey = "D7DD5BA6146493707BF0BE7496F6404EC7A63616B7158EC927B9F54BB436765F"; - var signKey = "9Qz9S/0xpar1klkniKdshxpAhRKbiSAewPpWoxKefQA="; + var signature = "9Qz9S/0xpar1klkniKdshxpAhRKbiSAewPpWoxKefQA="; var hmacValidator = new HmacValidator(); - bool response = hmacValidator.IsValidWebhook(signKey, hmacKey, notification); + bool response = hmacValidator.IsValidWebhook(signature, hmacKey, notification); Assert.IsTrue(response); } From f1da77d8d5736b8b65f6796d4425ece65eb339c7 Mon Sep 17 00:00:00 2001 From: Djoyke Reijans <115019123+DjoykeAbyah@users.noreply.github.com> Date: Mon, 9 Sep 2024 09:38:55 +0000 Subject: [PATCH 4/6] deprecated IsValidWebhook, introduces isValidPlatformWebhook --- Adyen.Test/UtilTest.cs | 15 ++++++++++++++- Adyen/Util/HMACValidator.cs | 15 ++++++++++++--- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/Adyen.Test/UtilTest.cs b/Adyen.Test/UtilTest.cs index 189908cb3..a49145ec1 100644 --- a/Adyen.Test/UtilTest.cs +++ b/Adyen.Test/UtilTest.cs @@ -21,15 +21,28 @@ public void TestHmac() Assert.IsTrue(string.Equals(encrypted, "34oR8T1whkQWTv9P+SzKyp8zhusf9n0dpqrm9nsqSJs=")); } + //[Deprecated] [TestMethod] public void TestBalancePlatformHmac() + { + var notification = + "{\"data\":{\"balancePlatform\":\"Integration_tools_test\",\"accountId\":\"BA32272223222H5HVKTBK4MLB\",\"sweep\":{\"id\":\"SWPC42272223222H5HVKV6H8C64DP5\",\"schedule\":{\"type\":\"balance\"},\"status\":\"active\",\"targetAmount\":{\"currency\":\"EUR\",\"value\":0},\"triggerAmount\":{\"currency\":\"EUR\",\"value\":0},\"type\":\"pull\",\"counterparty\":{\"balanceAccountId\":\"BA3227C223222H5HVKT3H9WLC\"},\"currency\":\"EUR\"}},\"environment\":\"test\",\"type\":\"balancePlatform.balanceAccountSweep.updated\"}"; + var signKey = "D7DD5BA6146493707BF0BE7496F6404EC7A63616B7158EC927B9F54BB436765F"; + var hmacKey = "9Qz9S/0xpar1klkniKdshxpAhRKbiSAewPpWoxKefQA="; + var hmacValidator = new HmacValidator(); + bool response = hmacValidator.IsValidWebhook(signKey, hmacKey, notification); + Assert.IsTrue(response); + } + + [TestMethod] + public void IsValidPlatformWebhookTest() { var notification = "{\"data\":{\"balancePlatform\":\"Integration_tools_test\",\"accountId\":\"BA32272223222H5HVKTBK4MLB\",\"sweep\":{\"id\":\"SWPC42272223222H5HVKV6H8C64DP5\",\"schedule\":{\"type\":\"balance\"},\"status\":\"active\",\"targetAmount\":{\"currency\":\"EUR\",\"value\":0},\"triggerAmount\":{\"currency\":\"EUR\",\"value\":0},\"type\":\"pull\",\"counterparty\":{\"balanceAccountId\":\"BA3227C223222H5HVKT3H9WLC\"},\"currency\":\"EUR\"}},\"environment\":\"test\",\"type\":\"balancePlatform.balanceAccountSweep.updated\"}"; var hmacKey = "D7DD5BA6146493707BF0BE7496F6404EC7A63616B7158EC927B9F54BB436765F"; var signature = "9Qz9S/0xpar1klkniKdshxpAhRKbiSAewPpWoxKefQA="; var hmacValidator = new HmacValidator(); - bool response = hmacValidator.IsValidWebhook(signature, hmacKey, notification); + bool response = hmacValidator.IsValidPlatformWebhook(signature, hmacKey, notification); Assert.IsTrue(response); } diff --git a/Adyen/Util/HMACValidator.cs b/Adyen/Util/HMACValidator.cs index af75c6182..ba6fab943 100644 --- a/Adyen/Util/HMACValidator.cs +++ b/Adyen/Util/HMACValidator.cs @@ -95,13 +95,22 @@ public bool IsValidHmac(NotificationRequestItem notificationRequestItem, string } /// - /// Validates a balance platform and management webhook payload with the given and . + /// [Deprecated] + /// Please use IsValidPlatformebhook() + /// + public bool IsValidWebhook(string hmacKey, string hmacSignature, string payload) + { + return IsValidPlatformWebhook(hmacSignature, hmacKey, payload); + } + + /// + /// Validates a balance platform and management webhook payload with the given and . /// - /// The HMAC key, retrieved from the Adyen Customer Area. /// The HMAC signature, retrieved from the request header. + /// The HMAC key, retrieved from the Adyen Customer Area. /// The webhook payload. /// A return value indicates the HMAC validation succeeded. - public bool IsValidWebhook(string hmacSignature, string hmacKey, string payload) + public bool IsValidPlatformWebhook(string hmacSignature, string hmacKey, string payload) { var calculatedSign = CalculateHmac(payload, hmacKey); return TimeSafeEquals(Encoding.UTF8.GetBytes(hmacSignature), Encoding.UTF8.GetBytes(calculatedSign)); From b2acb1c618e6e93f2e3828f3280cdd867d2e5f61 Mon Sep 17 00:00:00 2001 From: Djoyke Reijans <115019123+DjoykeAbyah@users.noreply.github.com> Date: Mon, 9 Sep 2024 10:23:09 +0000 Subject: [PATCH 5/6] fix IsValidWebhook --- Adyen.Test/UtilTest.cs | 39 +++++++++++++------------------------ Adyen/Util/HMACValidator.cs | 16 ++++----------- 2 files changed, 17 insertions(+), 38 deletions(-) diff --git a/Adyen.Test/UtilTest.cs b/Adyen.Test/UtilTest.cs index a49145ec1..2e810dae0 100644 --- a/Adyen.Test/UtilTest.cs +++ b/Adyen.Test/UtilTest.cs @@ -15,35 +15,22 @@ public class UtilTest : BaseTest public void TestHmac() { var data = "countryCode:currencyCode:merchantAccount:merchantReference:paymentAmount:sessionValidity:skinCode:NL:EUR:MagentoMerchantTest2:TEST-PAYMENT-2017-02-01-14\\:02\\:05:199:2017-02-02T14\\:02\\:05+01\\:00:PKz2KML1"; - var key = "DFB1EB5485895CFA84146406857104ABB4CBCABDC8AAF103A624C8F6A3EAAB00"; + var hmacKey = "DFB1EB5485895CFA84146406857104ABB4CBCABDC8AAF103A624C8F6A3EAAB00"; var hmacValidator = new HmacValidator(); - var encrypted = hmacValidator.CalculateHmac(data, key); + var encrypted = hmacValidator.CalculateHmac(data, hmacKey); Assert.IsTrue(string.Equals(encrypted, "34oR8T1whkQWTv9P+SzKyp8zhusf9n0dpqrm9nsqSJs=")); } - //[Deprecated] [TestMethod] public void TestBalancePlatformHmac() - { - var notification = - "{\"data\":{\"balancePlatform\":\"Integration_tools_test\",\"accountId\":\"BA32272223222H5HVKTBK4MLB\",\"sweep\":{\"id\":\"SWPC42272223222H5HVKV6H8C64DP5\",\"schedule\":{\"type\":\"balance\"},\"status\":\"active\",\"targetAmount\":{\"currency\":\"EUR\",\"value\":0},\"triggerAmount\":{\"currency\":\"EUR\",\"value\":0},\"type\":\"pull\",\"counterparty\":{\"balanceAccountId\":\"BA3227C223222H5HVKT3H9WLC\"},\"currency\":\"EUR\"}},\"environment\":\"test\",\"type\":\"balancePlatform.balanceAccountSweep.updated\"}"; - var signKey = "D7DD5BA6146493707BF0BE7496F6404EC7A63616B7158EC927B9F54BB436765F"; - var hmacKey = "9Qz9S/0xpar1klkniKdshxpAhRKbiSAewPpWoxKefQA="; - var hmacValidator = new HmacValidator(); - bool response = hmacValidator.IsValidWebhook(signKey, hmacKey, notification); - Assert.IsTrue(response); - } - - [TestMethod] - public void IsValidPlatformWebhookTest() { var notification = "{\"data\":{\"balancePlatform\":\"Integration_tools_test\",\"accountId\":\"BA32272223222H5HVKTBK4MLB\",\"sweep\":{\"id\":\"SWPC42272223222H5HVKV6H8C64DP5\",\"schedule\":{\"type\":\"balance\"},\"status\":\"active\",\"targetAmount\":{\"currency\":\"EUR\",\"value\":0},\"triggerAmount\":{\"currency\":\"EUR\",\"value\":0},\"type\":\"pull\",\"counterparty\":{\"balanceAccountId\":\"BA3227C223222H5HVKT3H9WLC\"},\"currency\":\"EUR\"}},\"environment\":\"test\",\"type\":\"balancePlatform.balanceAccountSweep.updated\"}"; var hmacKey = "D7DD5BA6146493707BF0BE7496F6404EC7A63616B7158EC927B9F54BB436765F"; - var signature = "9Qz9S/0xpar1klkniKdshxpAhRKbiSAewPpWoxKefQA="; + var hmacSignature = "9Qz9S/0xpar1klkniKdshxpAhRKbiSAewPpWoxKefQA="; var hmacValidator = new HmacValidator(); - bool response = hmacValidator.IsValidPlatformWebhook(signature, hmacKey, notification); - Assert.IsTrue(response); + bool response = hmacValidator.IsValidWebhook(hmacSignature, hmacKey, notification); + Assert.IsTrue(response); } [TestMethod] @@ -57,7 +44,7 @@ public void TestSerializationShopperInteractionDefaultIsZero() [TestMethod] public void TestNotificationRequestItemHmac() { - var key = "DFB1EB5485895CFA84146406857104ABB4CBCABDC8AAF103A624C8F6A3EAAB00"; + var hmacKey = "DFB1EB5485895CFA84146406857104ABB4CBCABDC8AAF103A624C8F6A3EAAB00"; var expectedSign = "ipnxGCaUZ4l8TUW75a71/ghd2Fe5ffvX0pV4TLTntIc="; var additionalData = new Dictionary { @@ -77,23 +64,23 @@ public void TestNotificationRequestItemHmac() var hmacValidator = new HmacValidator(); var data = hmacValidator.GetDataToSign(notificationRequestItem); Assert.AreEqual("pspReference:originalReference:merchantAccount:reference:1000:EUR:EVENT:true", data); - var encrypted = hmacValidator.CalculateHmac(notificationRequestItem, key); + var encrypted = hmacValidator.CalculateHmac(notificationRequestItem, hmacKey); Assert.AreEqual(expectedSign, encrypted); - Assert.IsTrue(hmacValidator.IsValidHmac(notificationRequestItem, key)); + Assert.IsTrue(hmacValidator.IsValidHmac(notificationRequestItem, hmacKey)); notificationRequestItem.AdditionalData["hmacSignature"] = "notValidSign"; - Assert.IsFalse(hmacValidator.IsValidHmac(notificationRequestItem, key)); + Assert.IsFalse(hmacValidator.IsValidHmac(notificationRequestItem, hmacKey)); } [TestMethod] public void TestHmacCalculationNotificationRequestWithSpecialChars() { - string key = "66B61474A0AA3736BA8789EDC6D6CD9EBA0C4F414A554E32A407F849C045C69D"; + string hmacKey = "66B61474A0AA3736BA8789EDC6D6CD9EBA0C4F414A554E32A407F849C045C69D"; var mockPath = GetMockFilePath("mocks/notification-response-refund-fail.json"); var response = MockFileToString(mockPath); var hmacValidator = new HmacValidator(); var notificationRequest = JsonOperation.Deserialize(response); var notificationItem = notificationRequest.NotificationItemContainers[0].NotificationItem; - var isValidHmac = hmacValidator.IsValidHmac(notificationItem, key); + var isValidHmac = hmacValidator.IsValidHmac(notificationItem, hmacKey); Assert.IsTrue(isValidHmac); } @@ -120,10 +107,10 @@ public void TestNullHmacValidator() Success = true, AdditionalData = null }; - var isValidHmacAdditionalDataNull = hmacValidator.IsValidHmac(notificationRequestItem, "key"); + var isValidHmacAdditionalDataNull = hmacValidator.IsValidHmac(notificationRequestItem, "hmacKey"); Assert.IsFalse(isValidHmacAdditionalDataNull); notificationRequestItem.AdditionalData = new Dictionary(); - var isValidHmacAdditionalDataEmpty = hmacValidator.IsValidHmac(notificationRequestItem, "key"); + var isValidHmacAdditionalDataEmpty = hmacValidator.IsValidHmac(notificationRequestItem, "hmacKey"); Assert.IsFalse(isValidHmacAdditionalDataEmpty); } diff --git a/Adyen/Util/HMACValidator.cs b/Adyen/Util/HMACValidator.cs index ba6fab943..bec1b0f38 100644 --- a/Adyen/Util/HMACValidator.cs +++ b/Adyen/Util/HMACValidator.cs @@ -11,10 +11,10 @@ public class HmacValidator private const string HmacSignature = "hmacSignature"; // Computes the Base64 encoded signature using the HMAC algorithm with the HMACSHA256 hashing function. - public string CalculateHmac(string signingstring, string hmacKey) + public string CalculateHmac(string payload, string hmacKey) { byte[] key = PackH(hmacKey); - byte[] data = Encoding.UTF8.GetBytes(signingstring); + byte[] data = Encoding.UTF8.GetBytes(payload); try { @@ -94,14 +94,6 @@ public bool IsValidHmac(NotificationRequestItem notificationRequestItem, string return string.Equals(expectedSign, merchantSign); } - /// - /// [Deprecated] - /// Please use IsValidPlatformebhook() - /// - public bool IsValidWebhook(string hmacKey, string hmacSignature, string payload) - { - return IsValidPlatformWebhook(hmacSignature, hmacKey, payload); - } /// /// Validates a balance platform and management webhook payload with the given and . @@ -110,12 +102,12 @@ public bool IsValidWebhook(string hmacKey, string hmacSignature, string payload) /// The HMAC key, retrieved from the Adyen Customer Area. /// The webhook payload. /// A return value indicates the HMAC validation succeeded. - public bool IsValidPlatformWebhook(string hmacSignature, string hmacKey, string payload) + public bool IsValidWebhook(string hmacSignature, string hmacKey, string payload) { var calculatedSign = CalculateHmac(payload, hmacKey); return TimeSafeEquals(Encoding.UTF8.GetBytes(hmacSignature), Encoding.UTF8.GetBytes(calculatedSign)); } - + /// This method compares two bytestrings in constant time based on length of shortest bytestring to prevent timing attacks. private static bool TimeSafeEquals(byte[] a, byte[] b) { From 52c7570a061fdb80ae9174d674600ef7b15ea73b Mon Sep 17 00:00:00 2001 From: Djoyke Reijans <115019123+DjoykeAbyah@users.noreply.github.com> Date: Mon, 9 Sep 2024 10:26:14 +0000 Subject: [PATCH 6/6] fix IsValidWebhook --- Adyen.Test/UtilTest.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Adyen.Test/UtilTest.cs b/Adyen.Test/UtilTest.cs index 2e810dae0..8bea2e2cb 100644 --- a/Adyen.Test/UtilTest.cs +++ b/Adyen.Test/UtilTest.cs @@ -17,8 +17,8 @@ public void TestHmac() var data = "countryCode:currencyCode:merchantAccount:merchantReference:paymentAmount:sessionValidity:skinCode:NL:EUR:MagentoMerchantTest2:TEST-PAYMENT-2017-02-01-14\\:02\\:05:199:2017-02-02T14\\:02\\:05+01\\:00:PKz2KML1"; var hmacKey = "DFB1EB5485895CFA84146406857104ABB4CBCABDC8AAF103A624C8F6A3EAAB00"; var hmacValidator = new HmacValidator(); - var encrypted = hmacValidator.CalculateHmac(data, hmacKey); - Assert.IsTrue(string.Equals(encrypted, "34oR8T1whkQWTv9P+SzKyp8zhusf9n0dpqrm9nsqSJs=")); + var hmacSignature = hmacValidator.CalculateHmac(data, hmacKey); + Assert.IsTrue(string.Equals(hmacSignature, "34oR8T1whkQWTv9P+SzKyp8zhusf9n0dpqrm9nsqSJs=")); } [TestMethod]