From 6175523db43867d9558e4c901ac24d1d761b7cc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Fri, 17 May 2024 00:05:23 +0200 Subject: [PATCH 001/119] Fix "MD001: heading-increment" and "MD009: no-trailing-spaces". --- docs/features/exactly-payment.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/features/exactly-payment.md b/docs/features/exactly-payment.md index d22315506..89decfd0b 100644 --- a/docs/features/exactly-payment.md +++ b/docs/features/exactly-payment.md @@ -11,7 +11,7 @@ To start using, follow these steps: - A live project for your final site. 3. Go to . 4. Take note of your _Project ID_ and your _Project API key_ (both are GUID style hexadecimal strings). -5. On your Orchard Core tenant go to Admin dashboard > Configuration > Features. +5. On your Orchard Core tenant go to Admin dashboard > Configuration > Features. 6. Make sure the _Orchard Core Commerce - Payment - Exactly_ feature is enabled. 7. Go to Admin dashboard > Configuration > Commerce > Exactly API. 8. Fill out the _Project ID_ and _API key_ fields. @@ -21,7 +21,7 @@ Once you have set up the site configuration, an additional _Pay with exactly_ bu > ℹ At the time of writing callback URLs targeting _localhost_ are not supported. If you want to test your site locally, we suggest adding a whitelisted domain to your [hosts file](https://en.wikipedia.org/wiki/Hosts_(file)). The address doesn't have to be accessible from their server so this approach is safer than exposing your machine via port forwarding or tunneling.. -### Cards +## Cards There are available test cards for the sandbox environment that can be found in [Exactly's documentation](https://exactly.com/docs/api#tag/Transactions/operation/createTransaction). Some of these test card numbers are commonly used by other payment providers as well. @@ -34,7 +34,7 @@ There are available test cards for the sandbox environment that can be found in > ⚠ The sandbox environment only supports EUR and USD currencies. If payment is attempted with anything else, it will display a _403.21: Unsupported currency_ error. -### Technical overview +## Technical overview As mentioned above, this module uses redirects to communicate with the payment processor. This means the OrchardCore.Commerce site never sees the buyer's payment information, which avoids potential liability and improves buyer confidence. Here is a broad overview of what happens when you click on the _Pay with exactly_ button: From e01996934ce583e94fff95086cc0cb59aa39eb81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Thu, 23 May 2024 00:24:44 +0200 Subject: [PATCH 002/119] Update package versions and use single variable for OC versions. --- Directory.Packages.props | 51 +++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index f062a2853..160180647 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -2,38 +2,41 @@ true false + 1.8.3 + 1.8.0 + - - + + - - - - + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - + - + From 7eebeb63552a8fca288eb6a00eff8cb9ba7eabd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Thu, 23 May 2024 00:45:58 +0200 Subject: [PATCH 003/119] Fix using. --- .../Tests/BasicTests/BasicOrchardFeaturesTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/OrchardCore.Commerce.Tests.UI/Tests/BasicTests/BasicOrchardFeaturesTests.cs b/test/OrchardCore.Commerce.Tests.UI/Tests/BasicTests/BasicOrchardFeaturesTests.cs index db1bb3fd3..fbe5bf8f8 100644 --- a/test/OrchardCore.Commerce.Tests.UI/Tests/BasicTests/BasicOrchardFeaturesTests.cs +++ b/test/OrchardCore.Commerce.Tests.UI/Tests/BasicTests/BasicOrchardFeaturesTests.cs @@ -1,5 +1,5 @@ using Lombiq.Tests.UI.Attributes; -using Lombiq.Tests.UI.Extensions; +using Lombiq.Tests.UI.BasicOrchardFeaturesTesting; using Lombiq.Tests.UI.Services; using OrchardCore.Commerce.Tests.UI.Helpers; using Xunit; From 32b6d2e184ed2815f2b4d5063bef81ec378e2e0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Thu, 23 May 2024 00:50:42 +0200 Subject: [PATCH 004/119] Fix xUnit1045 warning. --- .../CurrencyTests.cs | 37 +++++++++++++------ 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/test/OrchardCore.Commerce.Tests/CurrencyTests.cs b/test/OrchardCore.Commerce.Tests/CurrencyTests.cs index 016737f91..f878a4587 100644 --- a/test/OrchardCore.Commerce.Tests/CurrencyTests.cs +++ b/test/OrchardCore.Commerce.Tests/CurrencyTests.cs @@ -1,5 +1,6 @@ using OrchardCore.Commerce.MoneyDataType; using OrchardCore.Commerce.MoneyDataType.Abstractions; +using System.Collections.Generic; using System.Globalization; using Xunit; using static OrchardCore.Commerce.MoneyDataType.Currency; @@ -8,28 +9,42 @@ namespace OrchardCore.Commerce.Tests; public class CurrencyTests { + private static readonly IEnumerable _currencyProviders = new[] { new CurrencyProvider() }; + public static CurrencyTheoryData TestData => new() { - { UsDollar, 1234.56m, "$1,234.56" }, - { Euro, 1234.56m, "€1234.56" }, - { JapaneseYen, 1234.56m, "¥1,235" }, - { BritishPound, 1234.56m, "£1,234.56" }, - { AustralianDollar, 1234.56m, "$1,234.56" }, - { CanadianDollar, 1234.56m, "$1,234.56" }, - { SwissFranc, 1234.56m, "CHF 1’234.56" }, // #spell-check-ignore-line - { ChineseYuan, 1234.56m, "¥1,234.56" }, - { new Currency("My FOO", "My FOO", "f", "FOO"), 1234.56m, string.Create(CultureInfo.InvariantCulture, $"(FOO) {1234.56m:N}") }, + { UsDollar.CurrencyIsoCode, 1234.56m, "$1,234.56" }, + { Euro.CurrencyIsoCode, 1234.56m, "€1234.56" }, + { JapaneseYen.CurrencyIsoCode, 1234.56m, "¥1,235" }, + { BritishPound.CurrencyIsoCode, 1234.56m, "£1,234.56" }, + { AustralianDollar.CurrencyIsoCode, 1234.56m, "$1,234.56" }, + { CanadianDollar.CurrencyIsoCode, 1234.56m, "$1,234.56" }, + { SwissFranc.CurrencyIsoCode, 1234.56m, "CHF 1’234.56" }, // #spell-check-ignore-line + { ChineseYuan.CurrencyIsoCode, 1234.56m, "¥1,234.56" }, }; [Theory] [MemberData(nameof(TestData))] - public void CurrenciesProperlyFormatAmounts(ICurrency currency, decimal amount, string expectedFormat) + public void KnownCurrenciesProperlyFormatAmounts(string currencyCode, decimal amount, string expectedFormat) + { + var currency = FromIsoCurrencyCode(currencyCode, _currencyProviders); + Validate(currency, amount, expectedFormat); + } + + [Fact] + public void CustomCurrencyProperlyFormatsAmount() + { + var currency = new Currency("My FOO", "My FOO", "f", "FOO"); + Validate(currency, 1234.56m, string.Create(CultureInfo.InvariantCulture, $"(FOO) {1234.56m:N}")); + } + + private static void Validate(ICurrency currency, decimal amount, string expectedFormat) { var result = currency.ToString(amount).Replace(" ", string.Empty).Replace('¥', '¥'); Assert.Equal(expectedFormat.Replace(" ", string.Empty).Replace('¥', '¥'), result); } - public class CurrencyTheoryData : TheoryData + public class CurrencyTheoryData : TheoryData { } } From 153a95c44734035cce6dacce06b47e23444a873b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Thu, 23 May 2024 11:29:59 +0200 Subject: [PATCH 005/119] Remove obsolete custom htmlvalidate config file. --- .../OrchardCore.Commerce.Tests.UI.csproj | 7 ------- test/OrchardCore.Commerce.Tests.UI/UITestBase.cs | 5 ----- .../orchardcore.htmlvalidate.json | 9 --------- 3 files changed, 21 deletions(-) delete mode 100644 test/OrchardCore.Commerce.Tests.UI/orchardcore.htmlvalidate.json diff --git a/test/OrchardCore.Commerce.Tests.UI/OrchardCore.Commerce.Tests.UI.csproj b/test/OrchardCore.Commerce.Tests.UI/OrchardCore.Commerce.Tests.UI.csproj index be393bd5a..f5f9efe57 100644 --- a/test/OrchardCore.Commerce.Tests.UI/OrchardCore.Commerce.Tests.UI.csproj +++ b/test/OrchardCore.Commerce.Tests.UI/OrchardCore.Commerce.Tests.UI.csproj @@ -22,11 +22,4 @@ - - - PreserveNewest - true - - - diff --git a/test/OrchardCore.Commerce.Tests.UI/UITestBase.cs b/test/OrchardCore.Commerce.Tests.UI/UITestBase.cs index 53868e680..d811e99f1 100644 --- a/test/OrchardCore.Commerce.Tests.UI/UITestBase.cs +++ b/test/OrchardCore.Commerce.Tests.UI/UITestBase.cs @@ -64,11 +64,6 @@ protected override Task ExecuteTestAsync( OrchardCoreUITestExecutorConfiguration.AssertBrowserLogIsEmpty(messageWithoutJqueryError); }; - configuration.HtmlValidationConfiguration.HtmlValidationOptions = - configuration.HtmlValidationConfiguration.HtmlValidationOptions - .CloneWith(validationOptions => validationOptions.ConfigPath = - Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "orchardcore.htmlvalidate.json")); // #spell-check-ignore-line - if (changeConfigurationAsync != null) await changeConfigurationAsync(configuration); }); } diff --git a/test/OrchardCore.Commerce.Tests.UI/orchardcore.htmlvalidate.json b/test/OrchardCore.Commerce.Tests.UI/orchardcore.htmlvalidate.json deleted file mode 100644 index e11bb8c64..000000000 --- a/test/OrchardCore.Commerce.Tests.UI/orchardcore.htmlvalidate.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": [ - "./.htmlvalidate.json" - ], - "rules": { - "form-dup-name": "off" - }, - "root": true -} From b1681dbe403cc57bd0b33c286904c00ef5d2782a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Thu, 23 May 2024 13:15:52 +0200 Subject: [PATCH 006/119] Add orchardcore-preview to the nuget config. --- Nuget.config | 1 + 1 file changed, 1 insertion(+) diff --git a/Nuget.config b/Nuget.config index ddd7f13a1..4241120c9 100644 --- a/Nuget.config +++ b/Nuget.config @@ -5,6 +5,7 @@ + From 367ba07ee78dc0628f12aa6822f0abbf445cce68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Thu, 23 May 2024 13:18:41 +0200 Subject: [PATCH 007/119] Update references. --- Directory.Packages.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 160180647..2babc5e1b 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -2,8 +2,8 @@ true false - 1.8.3 - 1.8.0 + 2.0.0-preview-18217 + 2.0.0-preview-18217 From 86122d17109d5459f5407f327aeece445ae68481 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1ra=20El-Saig?= Date: Thu, 23 May 2024 13:24:30 +0200 Subject: [PATCH 008/119] Remove Newtonsoft from cshtml files. --- .../Views/AddressFieldEditor-WesternCommonNameParts.cshtml | 5 ++--- .../Views/AddressFieldEditor.cshtml | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Modules/OrchardCore.Commerce.ContentFields/Views/AddressFieldEditor-WesternCommonNameParts.cshtml b/src/Modules/OrchardCore.Commerce.ContentFields/Views/AddressFieldEditor-WesternCommonNameParts.cshtml index b1d5dfea9..d9f21f76f 100644 --- a/src/Modules/OrchardCore.Commerce.ContentFields/Views/AddressFieldEditor-WesternCommonNameParts.cshtml +++ b/src/Modules/OrchardCore.Commerce.ContentFields/Views/AddressFieldEditor-WesternCommonNameParts.cshtml @@ -1,6 +1,5 @@ @model AddressFieldEditorViewModel -@using Newtonsoft.Json @using OrchardCore.Commerce.Abstractions.Fields @using OrchardCore.Commerce.Abstractions.Models @using OrchardCore.Commerce.AddressDataType @@ -24,7 +23,7 @@ var regions = Model.Regions.Select(region => { - region.Selected = region.Value == address?.Region; + region.Selected = region.Value == address.Region; return region; }); @@ -112,7 +111,7 @@