From 602c67890b1a1de792f33e0469b7ac925f6d6b34 Mon Sep 17 00:00:00 2001 From: Djoyke Reijans <115019123+DjoykeAbyah@users.noreply.github.com> Date: Tue, 7 Jan 2025 14:53:31 +0000 Subject: [PATCH] added comments for Region.cs --- Adyen.Test/RegionTest.cs | 19 ++++++++++--------- Adyen/Constants/Region.cs | 39 ++++++++++++++++++++++++++++++--------- 2 files changed, 40 insertions(+), 18 deletions(-) diff --git a/Adyen.Test/RegionTest.cs b/Adyen.Test/RegionTest.cs index 89933182..040e975f 100644 --- a/Adyen.Test/RegionTest.cs +++ b/Adyen.Test/RegionTest.cs @@ -14,9 +14,9 @@ public void TestValidRegions() { // Get all valid regions from the Region enum var validRegions = Enum.GetValues(typeof(Region)) - .Cast<Region>() - .Select(r => r.ToString().ToLower()) - .ToList(); + .Cast<Region>() + .Select(r => r.ToString().ToLower()) + .ToList(); // Define the expected list of valid regions var expected = new List<string> @@ -24,8 +24,8 @@ public void TestValidRegions() "eu", "au", "us", - "in", - "apse" + "apse", + "in" }; // Assert that the valid regions match the expected list @@ -37,10 +37,10 @@ public void TestTerminalApiEndpointsMapping() { // Convert TERMINAL_API_ENDPOINTS_MAPPING keys to lowercase strings for comparison var actual = RegionMapping.TERMINAL_API_ENDPOINTS_MAPPING - .ToDictionary( - entry => entry.Key.ToString().ToLower(), - entry => entry.Value - ); + .ToDictionary( + entry => entry.Key.ToString().ToLower(), + entry => entry.Value + ); // Define the expected map of region to endpoint mappings var expected = new Dictionary<string, string> @@ -54,5 +54,6 @@ public void TestTerminalApiEndpointsMapping() // Assert that the TERMINAL_API_ENDPOINTS_MAPPING matches the expected map CollectionAssert.AreEquivalent(expected, actual); } + } } diff --git a/Adyen/Constants/Region.cs b/Adyen/Constants/Region.cs index c3602d02..6b5cf6cc 100644 --- a/Adyen/Constants/Region.cs +++ b/Adyen/Constants/Region.cs @@ -1,27 +1,48 @@ +using System.Collections.Generic; + namespace Adyen.Constants { /// <summary> - /// Enum to set region based urls for terminal api - /// https://docs.adyen.com/point-of-sale/design-your-integration/terminal-api/ + /// Enum to set region-based URLs for the Terminal API. + /// Reference: https://docs.adyen.com/point-of-sale/design-your-integration/terminal-api/ /// </summary> public enum Region { - //Europe + /// <summary> + /// European Union region + /// </summary> EU = 0, - //Australia + /// <summary> + /// Australia region + /// </summary> AU = 1, - //US + /// <summary> + /// United States region + /// </summary> US = 2, - //East Asia - APSE = 3 + /// <summary> + /// Asia-Pacific, South East region + /// </summary> + APSE = 3, + + /// <summary> + /// India region + /// </summary> + IN = 4 } + /// <summary> + /// A static class that provides mapping of regions to their respective Terminal API endpoints. + /// </summary> public static class RegionMapping { - public static readonly Dictionary<Region, string> TERMINAL_API_ENDPOINTS_MAPPING = new() + /// <summary> + /// Maps regions to their respective Terminal API live endpoints. + /// </summary> + public static readonly Dictionary<Region, string> TERMINAL_API_ENDPOINTS_MAPPING = new Dictionary<Region, string>() { { Region.EU, "https://terminal-api-live.adyen.com" }, { Region.AU, "https://terminal-api-live-au.adyen.com" }, @@ -29,4 +50,4 @@ public static class RegionMapping { Region.APSE, "https://terminal-api-live-apse.adyen.com" } }; } -} \ No newline at end of file +}