Skip to content

CEXT-6421: extract totals-collector into a standalone app#129

Open
obarcelonap wants to merge 15 commits into
mainfrom
fees
Open

CEXT-6421: extract totals-collector into a standalone app#129
obarcelonap wants to merge 15 commits into
mainfrom
fees

Conversation

@obarcelonap

Copy link
Copy Markdown
Member

Description

Extracts the 9 out-of-process discount webhook example actions (total-collector-discounts)
from the checkout starter kit monolith into apps/totals-collector, a standalone Adobe
Commerce App Management app built on @adobe/aio-commerce-sdk, following the same
domain-split pattern applied to apps/shipping-method.

Highlights of this extraction:

  • Response construction rebuilt on @adobe/aio-commerce-sdk's webhook operation builders
    (ok, exceptionOperation, replaceOperation) instead of hand-rolled JSON-patch objects.
  • Commerce's single get_total_modifications.execute webhook slot is declared declaratively
    in app.commerce.config.ts (PaaS and SaaS variants), auto-subscribed at install time — no
    manual webhooks.xml or admin setup. The 9 actions are alternative example implementations
    of that one contract; the config ships with tiered-quantity-discount as a swappable
    default placeholder.
  • Webhook calls run with require-adobe-auth: true; Commerce's signature verification is
    handled by the App Management platform rather than a hand-rolled digital-signature check,
    matching the pattern validated in apps/shipping-method. Actions read the already-parsed
    shippingAssignment/quote/total webhook fields directly off params.
  • Every action is instrumented with OpenTelemetry via @adobe/aio-lib-telemetry.
  • No hand-rolled Commerce HTTP client, OAuth, or signature-verification code — this domain
    never calls Commerce at all.

Related Issue

CEXT-6421

Motivation and Context

Part of the broader effort to split the checkout starter kit monolith into independently
deployable App Management apps per domain, so each domain (shipping, payment, tax, fees) can
be installed, associated, and versioned on its own.

How Has This Been Tested?

  • npm test (vitest) covering all 9 discount actions, the shared discount-helper library, the
    relocated tracking action, and the declarative webhook config.
  • npx biome check . clean.
  • npm install triggers aio-commerce-lib-app hooks postinstall, which regenerates
    src/commerce-extensibility-1/.generated/ from app.commerce.config.ts and install.yaml.

Screenshots (if appropriate):

N/A

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Splits the 9 total-collector-discounts webhook actions out of the monolith into
apps/totals-collector, an independent App Management app built on the same
aio-commerce-lib-app/aio-commerce-sdk scaffolding and require-adobe-auth +
declarative webhook subscription pattern established in apps/shipping-method.
Response construction moves to the SDK's webhook operation builders, and every
action gains OpenTelemetry instrumentation via aio-lib-telemetry.
@obarcelonap obarcelonap requested a review from a team as a code owner July 9, 2026 15:43
Testing the declarative config object itself isn't valuable — it's a plain
data structure, not behavior.
These were internal working plan/spec docs used to drive the
totals-collector migration, not meant to land in the codebase.

@jcuerdo jcuerdo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, same question than in #130

@obarcelonap

Copy link
Copy Markdown
Member Author

LGTM, same question than in #130

separate PR to drop the current code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants