Skip to content

[releases/28.x] [Shopify] Make codeunit 30272 "Shpfy Update Price Source" public#9664

Open
onbuyuka wants to merge 1 commit into
releases/28.xfrom
bugs/643242-backport
Open

[releases/28.x] [Shopify] Make codeunit 30272 "Shpfy Update Price Source" public#9664
onbuyuka wants to merge 1 commit into
releases/28.xfrom
bugs/643242-backport

Conversation

@onbuyuka

@onbuyuka onbuyuka commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Backport of bug #638340 to releases/28.x.

Fixes AB#643242

Original PR: #8587

## Problem

Partners cannot customize the Shopify connector's price calculation
logic because codeunit 30272 `"Shpfy Update Price Source"` has `Access =
Internal`.

The pricing flow in codeunit 30182 `"Shpfy Product Price Calc."`
publishes `OnBeforeCalculateUnitPrice` with an `IsHandled` pattern,
which partners can subscribe to. Setting `Handled := true` lets them
fully replace the price calculation. However, replicating the default
logic requires `BindSubscription` on codeunit 30272 to ensure the
pricing engine gets the correct currency, VAT, and discount settings
from the Shopify Shop configuration. Because 30272 is `Internal`,
partners cannot reference it as a type for `Bind`/`UnbindSubscription`.

## Fix

Change `Access = Internal` to `Access = Public` on codeunit 30272
`"Shpfy Update Price Source"`. One-line change.

## Why this is safe

- The codeunit only reads non-sensitive Shop configuration: `Currency
Code`, `Allow Line Disc.`, `Prices Including VAT`, `VAT Bus. Posting Gr.
(Price)`.
- It has `EventSubscriberInstance = Manual`, so making it public does
not auto-activate any subscriptions — partners must explicitly
`BindSubscription`.
- The `internal` getters on codeunit 30182 (`GetCurrencyCode`,
`GetAllowLineDisc`, `GetPricesIncludingVAT`, `GetVATBusPostingGroup`)
remain internal — partners can only use this codeunit indirectly via the
existing bind/unbind pattern.
- Only 3 references exist outside its own file: the permission set, a
local variable declaration in 30182, and bind/unbind calls in 30182.

## Partner scenario

```al
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Shpfy Product Events", 'OnBeforeCalculateUnitPrice', '', true, false)]
local procedure MyPriceCalc(...; var Handled: Boolean)
var
    ShpfyUpdatePriceSource: Codeunit "Shpfy Update Price Source";
begin
    BindSubscription(ShpfyUpdatePriceSource);
    // Replicate CalcPrice logic with their customization
    UnbindSubscription(ShpfyUpdatePriceSource);
    Handled := true;
end;
```

Fixes
[AB#638340](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/638340)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@onbuyuka
onbuyuka requested a review from a team July 22, 2026 11:41
@onbuyuka
onbuyuka requested a review from a team as a code owner July 22, 2026 11:41
@github-actions github-actions Bot added AL: Apps (W1) Add-on apps for W1 Integration GitHub request for Integration area labels Jul 22, 2026
@github-actions github-actions Bot added this to the Version 28.4 milestone Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AL: Apps (W1) Add-on apps for W1 Integration GitHub request for Integration area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant