Skip to content

CAP-COM-CAT-002Select the policy governing a sale

Markdown

CAP-COM-CAT-002

Select the policy governing a sale

Markdown
  • DocumentDraft
  • Product intentProposed
  • ImplementationPartially observed

KindCapabilityProduct areaCommerceModuleCatalog and Selling ConfigurationRevision1

Read atservices-commerce c8b66a98react-console baf6dae3

The Formal Contract

The narrative above explains; the sections below are authoritative — the rules, scenarios and tests this document binds.

Outcomes
Customer customer staff and applications can rely on a predictable answer to which policy governs a sale.A placed sale does not mixes business units or currencies.
Surfaces
consoleapi
Intent sources
services-commerce:docs/milestones/COMM-M1-set-up-what-you-sell.md#D9services-commerce:docs/milestones/plans/COMM-M1-plan.md#D9. Adopt the expanded ordering-profile selection order?services-commerce:docs/milestones/plans/COMM-M1-plan.md#4. Assumptions (A1, A2)

Controls

19 controls apply, from the corpus control catalogue.

TC-AZ-001 TC-AZ-002 TC-AZ-003 TC-AZ-004 TC-AZ-005 TC-AZ-006 TC-TEN-001 TC-TEN-002 TC-TEN-003 TC-CRY-001 TC-DAT-001 TC-DAT-002 TC-DAT-003 TC-LOG-004 TC-LOG-005 TC-PI-001 TC-PI-003 TC-PRV-001 TC-PRV-002

Permissions

KeyChecked atScope
commerce.ordering-profiles.readapitenant
commerce.ordering-profiles.updateapitenant

Business Rules

8 rules, 6 to be proved before approval. A rule's product intent is derived from its origin: 0 confirmed by a product decision, the rest inheriting this capability's proposed.

IdRuleKindEnforced atProvenance
01must prove
Proposed
Policy selection takes the first available choice in this order: an explicit policy, the store’s policy, the first item’s selling-context policy, the application default and the workspace default.
origin: COMM-M1 D9 (docs/milestones/COMM-M1-set-up-what-you-sell.md)
policyservicedocumented
02must prove
Proposed
Adding an item that resolves to a different policy is refused with both policies identified, preserving one policy per order.
origin: COMM-M1 D9 (docs/milestones/COMM-M1-set-up-what-you-sell.md)
invariantservicedocumented
services-commerce:docs/milestones/plans/COMM-M1-plan.md#D9. Adopt the expanded ordering-profile selection order?
03must prove
Proposed
The resolution read selects an explicit policy before an application default before the workspace default and identifies the winning source.
origin: COMM-M1 plan A1 (docs/milestones/plans/COMM-M1-plan.md)
policyservicetest
services-commerce:modules/configuration/tests/e2e/ordering-profiles.e2e.spec.js#resolves a context: the profile it names (explicit), else its application’s default, else the tenant default
04must prove
Proposed
Resolution rejects an unknown policy reference and returns no policy when the workspace has none configured.
validationservicetest
services-commerce:modules/configuration/tests/e2e/ordering-profiles.e2e.spec.js#answers 400 to a context naming a profile the tenant does not have, and nothing for a tenant with no profile at all
05
Proposed
Saving the combined workspace and application defaults document replaces the application map, removing omitted entries.
policyservice, consoletest
services-commerce:modules/configuration/tests/e2e/ordering-profiles.e2e.spec.js#removes an application default left out of the document, the tenant default kept when null
06must prove
Proposed
Defaults replacement succeeds only when every referenced policy belongs to the workspace and is active; otherwise the saved document remains intact.
validationservice, consoletest
services-commerce:modules/configuration/tests/e2e/ordering-profiles.e2e.spec.js#refuses a document naming an inactive or an unknown profile, 400, the document unchanged
07
Proposed
The workspace default supplies the policy for an application with no application-specific default.
origin: COMM-M1 plan A1 (docs/milestones/plans/COMM-M1-plan.md)
policyservicedocumented
08must prove
Proposed
Read permission allows defaults inspection and resolution, while defaults replacement requires policy update permission.
permissionapitest
services-commerce:modules/configuration/tests/e2e/configuration-security.e2e.spec.js#lists and reads the ordering profiles, the defaults document and the resolution

Scenarios

IdGivenWhenThenProvenance
01Events has an application policy distinct from the workspace fallbackResolve the events application contextResolution returns its application default with that source identifiedtest
02The cart already uses Main USDAdd an item assigned to Conference EUR by its selling contextThe conflicting item is refused with both policies identifieddocumented
services-commerce:docs/milestones/plans/COMM-M1-plan.md#D9. Adopt the expanded ordering-profile selection order?

The Markdown files under specs/ in rhythmsoftware/rhythm-v2-docs are the canonical source of truth. This reader is a generated, read-only projection of them.