From 11c470189425846a4ee739b3a16bc2b6dce46620 Mon Sep 17 00:00:00 2001 From: Onat Buyukakkus <55088871+onbuyuka@users.noreply.github.com> Date: Thu, 21 May 2026 16:26:17 +0200 Subject: [PATCH 1/4] [Shopify] Re-enable pricing tests to verify CI failure Fixes AB#621557 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../Test/DisabledTests/ShpfyCatalogPricesTest.json | 14 -------------- .../DisabledTests/ShpfyProductPriceCalcTest.json | 8 -------- 2 files changed, 22 deletions(-) delete mode 100644 src/Apps/W1/Shopify/Test/DisabledTests/ShpfyCatalogPricesTest.json delete mode 100644 src/Apps/W1/Shopify/Test/DisabledTests/ShpfyProductPriceCalcTest.json diff --git a/src/Apps/W1/Shopify/Test/DisabledTests/ShpfyCatalogPricesTest.json b/src/Apps/W1/Shopify/Test/DisabledTests/ShpfyCatalogPricesTest.json deleted file mode 100644 index 1d7984bb34..0000000000 --- a/src/Apps/W1/Shopify/Test/DisabledTests/ShpfyCatalogPricesTest.json +++ /dev/null @@ -1,14 +0,0 @@ -[ - { - "bug": "621557", - "codeunitId": 139646, - "CodeunitName": "Shpfy Catalog Prices Test", - "Method": "UnitTestCalcCatalogPrice" - }, - { - "bug": "621557", - "codeunitId": 139646, - "CodeunitName": "Shpfy Catalog Prices Test", - "Method": "UnitTestCalcMarketCatalogPrice" - } -] \ No newline at end of file diff --git a/src/Apps/W1/Shopify/Test/DisabledTests/ShpfyProductPriceCalcTest.json b/src/Apps/W1/Shopify/Test/DisabledTests/ShpfyProductPriceCalcTest.json deleted file mode 100644 index 0a728636e5..0000000000 --- a/src/Apps/W1/Shopify/Test/DisabledTests/ShpfyProductPriceCalcTest.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "bug": "621557", - "codeunitId": 139605, - "CodeunitName": "Shpfy Product Price Calc. Test", - "Method": "UnitTestCalcPriceTest" - } -] From dfd81cb82c427cc9be244eaf4b1170382ef8a5f4 Mon Sep 17 00:00:00 2001 From: Onat Buyukakkus <55088871+onbuyuka@users.noreply.github.com> Date: Thu, 21 May 2026 21:56:22 +0200 Subject: [PATCH 2/4] Add probes to UnitTestCalcPriceTest to diagnose CI failure PROBE_1: IsExtendedPriceCalculationEnabled() should be false after Disable PROBE_2: IsExtendedPriceCalculationEnabled() should still be false later PROBE_3: Discount should be applied (Price != InitPrice) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../Test/Products/ShpfyProductPriceCalcTest.Codeunit.al | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Apps/W1/Shopify/Test/Products/ShpfyProductPriceCalcTest.Codeunit.al b/src/Apps/W1/Shopify/Test/Products/ShpfyProductPriceCalcTest.Codeunit.al index 5b88fe6b76..4d30619c0a 100644 --- a/src/Apps/W1/Shopify/Test/Products/ShpfyProductPriceCalcTest.Codeunit.al +++ b/src/Apps/W1/Shopify/Test/Products/ShpfyProductPriceCalcTest.Codeunit.al @@ -36,6 +36,7 @@ codeunit 139605 "Shpfy Product Price Calc. Test" InitializeTest: Codeunit "Shpfy Initialize Test"; ProductInitTest: Codeunit "Shpfy Product Init Test"; ProductPriceCalculation: Codeunit "Shpfy Product Price Calc."; + PriceCalcMgt: Codeunit "Price Calculation Mgt."; InitUnitCost: Decimal; InitPrice: Decimal; InitDiscountPerc: Decimal; @@ -45,6 +46,8 @@ codeunit 139605 "Shpfy Product Price Calc. Test" begin // [INIT] Initialization startup data. LibraryPriceCalculation.DisableExtendedPriceCalculation(); + // PROBE 1: confirm what IsExtendedPriceCalculationEnabled returns in this env + LibraryAssert.AreEqual(false, PriceCalcMgt.IsExtendedPriceCalculationEnabled(), 'PROBE_1_IsExtendedShouldBeFalseAfterDisable'); Shop := InitializeTest.CreateShop(); Shop."Allow Line Disc." := false; Shop.Modify(); @@ -80,6 +83,10 @@ codeunit 139605 "Shpfy Product Price Calc. Test" ProductPriceCalculation.CalcPrice(Item, '', '', UnitCost, Price, ComparePrice); // [THEN] InitUnitCost = UnitCost LibraryAssert.AreEqual(InitUnitCost, UnitCost, 'Unit Cost'); + // PROBE 2: confirm what IsExtended returns AFTER setting up discount group + LibraryAssert.AreEqual(false, PriceCalcMgt.IsExtendedPriceCalculationEnabled(), 'PROBE_2_IsExtendedShouldStillBeFalse'); + // PROBE 3: dump Price/ComparePrice values into the failure message so we can see them + LibraryAssert.AreNotEqual(InitPrice, Price, StrSubstNo('PROBE_3_DiscountApplied? Price=%1 InitPrice=%2 ComparePrice=%3 InitDiscountPerc=%4', Price, InitPrice, ComparePrice, InitDiscountPerc)); // [THEN] InitPrice = ComparePrice. ComparePrice is the price without the discount. LibraryAssert.AreEqual(InitPrice, ComparePrice, 'Compare Price'); // [THEN] InitPrice - InitDiscountPerc = Price From 878c85d70abf268b372b24760be26cc6342ff582 Mon Sep 17 00:00:00 2001 From: Onat Buyukakkus <55088871+onbuyuka@users.noreply.github.com> Date: Fri, 22 May 2026 09:41:18 +0200 Subject: [PATCH 3/4] Fix AA0217 by extracting StrSubstNo format string to Label Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../Test/Products/ShpfyProductPriceCalcTest.Codeunit.al | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Apps/W1/Shopify/Test/Products/ShpfyProductPriceCalcTest.Codeunit.al b/src/Apps/W1/Shopify/Test/Products/ShpfyProductPriceCalcTest.Codeunit.al index 4d30619c0a..f587ac2674 100644 --- a/src/Apps/W1/Shopify/Test/Products/ShpfyProductPriceCalcTest.Codeunit.al +++ b/src/Apps/W1/Shopify/Test/Products/ShpfyProductPriceCalcTest.Codeunit.al @@ -37,6 +37,7 @@ codeunit 139605 "Shpfy Product Price Calc. Test" ProductInitTest: Codeunit "Shpfy Product Init Test"; ProductPriceCalculation: Codeunit "Shpfy Product Price Calc."; PriceCalcMgt: Codeunit "Price Calculation Mgt."; + Probe3Lbl: Label 'PROBE_3_DiscountApplied? Price=%1 InitPrice=%2 ComparePrice=%3 InitDiscountPerc=%4', Locked = true; InitUnitCost: Decimal; InitPrice: Decimal; InitDiscountPerc: Decimal; @@ -86,7 +87,7 @@ codeunit 139605 "Shpfy Product Price Calc. Test" // PROBE 2: confirm what IsExtended returns AFTER setting up discount group LibraryAssert.AreEqual(false, PriceCalcMgt.IsExtendedPriceCalculationEnabled(), 'PROBE_2_IsExtendedShouldStillBeFalse'); // PROBE 3: dump Price/ComparePrice values into the failure message so we can see them - LibraryAssert.AreNotEqual(InitPrice, Price, StrSubstNo('PROBE_3_DiscountApplied? Price=%1 InitPrice=%2 ComparePrice=%3 InitDiscountPerc=%4', Price, InitPrice, ComparePrice, InitDiscountPerc)); + LibraryAssert.AreNotEqual(InitPrice, Price, StrSubstNo(Probe3Lbl, Price, InitPrice, ComparePrice, InitDiscountPerc)); // [THEN] InitPrice = ComparePrice. ComparePrice is the price without the discount. LibraryAssert.AreEqual(InitPrice, ComparePrice, 'Compare Price'); // [THEN] InitPrice - InitDiscountPerc = Price From 3f13c1ed53d5a2fe3df199287fdb83b267cb4cbf Mon Sep 17 00:00:00 2001 From: Onat Buyukakkus <55088871+onbuyuka@users.noreply.github.com> Date: Fri, 22 May 2026 13:28:37 +0200 Subject: [PATCH 4/4] Use EnableExtendedPriceCalculation + SetupDefaultHandler V15 to force legacy pricing DisableExtendedPriceCalculation() only unbinds the override subscriber; it is a no-op on tenants where the SalesPrices feature key is already enabled (which is the default on bcinsider/Sandbox/29.0+). When that happens the dispatcher falls through to the Price Calculation Setup table and picks V16, which does not read Sales Price / Sales Line Discount. Following the pattern used in TestPriceCalculationV16, explicitly enable extended pricing then call SetupDefaultHandler with the V15 handler so the legacy data path is exercised regardless of tenant state. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../Test/Catalogs/ShpfyCatalogPricesTest.Codeunit.al | 8 ++++++-- .../Products/ShpfyProductPriceCalcTest.Codeunit.al | 12 +++--------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/Apps/W1/Shopify/Test/Catalogs/ShpfyCatalogPricesTest.Codeunit.al b/src/Apps/W1/Shopify/Test/Catalogs/ShpfyCatalogPricesTest.Codeunit.al index e78f9db18e..d19f3433c8 100644 --- a/src/Apps/W1/Shopify/Test/Catalogs/ShpfyCatalogPricesTest.Codeunit.al +++ b/src/Apps/W1/Shopify/Test/Catalogs/ShpfyCatalogPricesTest.Codeunit.al @@ -46,7 +46,9 @@ codeunit 139646 "Shpfy Catalog Prices Test" ComparePrice: Decimal; begin // Creating test data. - LibraryPriceCalculation.DisableExtendedPriceCalculation(); + // Extended pricing is on by default in the tenant; explicitly select the V15 handler so the legacy Sales Price / Sales Line Discount data path is exercised. + LibraryPriceCalculation.EnableExtendedPriceCalculation(); + LibraryPriceCalculation.SetupDefaultHandler("Price Calculation Handler"::"Business Central (Version 15.0)"); Shop := InitializeTest.CreateShop(); Shop."Allow Line Disc." := false; Shop.Modify(); @@ -112,7 +114,9 @@ codeunit 139646 "Shpfy Catalog Prices Test" ComparePrice: Decimal; begin // Creating test data. - LibraryPriceCalculation.DisableExtendedPriceCalculation(); + // Extended pricing is on by default in the tenant; explicitly select the V15 handler so the legacy Sales Price / Sales Line Discount data path is exercised. + LibraryPriceCalculation.EnableExtendedPriceCalculation(); + LibraryPriceCalculation.SetupDefaultHandler("Price Calculation Handler"::"Business Central (Version 15.0)"); Shop := InitializeTest.CreateShop(); Shop."Allow Line Disc." := false; Shop.Modify(); diff --git a/src/Apps/W1/Shopify/Test/Products/ShpfyProductPriceCalcTest.Codeunit.al b/src/Apps/W1/Shopify/Test/Products/ShpfyProductPriceCalcTest.Codeunit.al index f587ac2674..d22e239f5a 100644 --- a/src/Apps/W1/Shopify/Test/Products/ShpfyProductPriceCalcTest.Codeunit.al +++ b/src/Apps/W1/Shopify/Test/Products/ShpfyProductPriceCalcTest.Codeunit.al @@ -36,8 +36,6 @@ codeunit 139605 "Shpfy Product Price Calc. Test" InitializeTest: Codeunit "Shpfy Initialize Test"; ProductInitTest: Codeunit "Shpfy Product Init Test"; ProductPriceCalculation: Codeunit "Shpfy Product Price Calc."; - PriceCalcMgt: Codeunit "Price Calculation Mgt."; - Probe3Lbl: Label 'PROBE_3_DiscountApplied? Price=%1 InitPrice=%2 ComparePrice=%3 InitDiscountPerc=%4', Locked = true; InitUnitCost: Decimal; InitPrice: Decimal; InitDiscountPerc: Decimal; @@ -46,9 +44,9 @@ codeunit 139605 "Shpfy Product Price Calc. Test" ComparePrice: Decimal; begin // [INIT] Initialization startup data. - LibraryPriceCalculation.DisableExtendedPriceCalculation(); - // PROBE 1: confirm what IsExtendedPriceCalculationEnabled returns in this env - LibraryAssert.AreEqual(false, PriceCalcMgt.IsExtendedPriceCalculationEnabled(), 'PROBE_1_IsExtendedShouldBeFalseAfterDisable'); + // Extended pricing is on by default in the tenant; explicitly select the V15 handler so the legacy Sales Price / Sales Line Discount data path is exercised. + LibraryPriceCalculation.EnableExtendedPriceCalculation(); + LibraryPriceCalculation.SetupDefaultHandler("Price Calculation Handler"::"Business Central (Version 15.0)"); Shop := InitializeTest.CreateShop(); Shop."Allow Line Disc." := false; Shop.Modify(); @@ -84,10 +82,6 @@ codeunit 139605 "Shpfy Product Price Calc. Test" ProductPriceCalculation.CalcPrice(Item, '', '', UnitCost, Price, ComparePrice); // [THEN] InitUnitCost = UnitCost LibraryAssert.AreEqual(InitUnitCost, UnitCost, 'Unit Cost'); - // PROBE 2: confirm what IsExtended returns AFTER setting up discount group - LibraryAssert.AreEqual(false, PriceCalcMgt.IsExtendedPriceCalculationEnabled(), 'PROBE_2_IsExtendedShouldStillBeFalse'); - // PROBE 3: dump Price/ComparePrice values into the failure message so we can see them - LibraryAssert.AreNotEqual(InitPrice, Price, StrSubstNo(Probe3Lbl, Price, InitPrice, ComparePrice, InitDiscountPerc)); // [THEN] InitPrice = ComparePrice. ComparePrice is the price without the discount. LibraryAssert.AreEqual(InitPrice, ComparePrice, 'Compare Price'); // [THEN] InitPrice - InitDiscountPerc = Price