Skip to content

[Shopify] Make codeunit 30272 "Shpfy Update Price Source" public#8587

Open
onbuyuka wants to merge 1 commit into
mainfrom
bugs/638340-shpfy-update-price-source-public
Open

[Shopify] Make codeunit 30272 "Shpfy Update Price Source" public#8587
onbuyuka wants to merge 1 commit into
mainfrom
bugs/638340-shpfy-update-price-source-public

Conversation

@onbuyuka

@onbuyuka onbuyuka commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

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

[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

Partners need to BindSubscription on this codeunit to replicate the default price calculation logic when subscribing to OnBeforeCalculateUnitPrice with Handled := true. The codeunit only reads Shop configuration (Currency Code, Allow Line Disc., Prices Including VAT, VAT Bus. Posting Gr.) and has EventSubscriberInstance = Manual, so exposing it does not auto-activate any subscriptions or expose sensitive data.

Fixes AB#638340

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@onbuyuka onbuyuka requested a review from a team as a code owner June 11, 2026 15:07
@github-actions github-actions Bot added the AL: Apps (W1) Add-on apps for W1 label Jun 11, 2026
@github-actions github-actions Bot added this to the Version 29.0 milestone Jun 11, 2026
@onbuyuka onbuyuka enabled auto-merge (squash) June 11, 2026 17:10
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Stale Status Check Deleted

The Pull Request Build workflow run for this PR was older than 72 hours and has been deleted.

📋 Why was it deleted?

Status checks that are too old may no longer reflect the current state of the target branch. To ensure this PR is validated against the latest code and passes up-to-date checks, a fresh build is required.


🔄 How to trigger a new status check:

  1. 📤 Push a new commit to the PR branch, or
  2. 🔁 Close and reopen the PR

This will automatically trigger a new Pull Request Build workflow run.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant