Skip to content

CAP-COM-CAT-001Configure reusable sale-processing policies

Markdown

CAP-COM-CAT-001

Configure reusable sale-processing policies

Markdown
  • DocumentDraft
  • Product intentProposed
  • ImplementationObserved

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
Each sale is processed under one known policy with a business unit and a currency that agree.A policy in use is prevented from being removed or switched off from under the sales that depend on it.A placed sale retains the rules it was placed under even when the policy later changes.
Surfaces
consoleapi
Preconditions
Accounting already provides the selected unit and supported currencies.
Postconditions
The policy is retained at its next version and appears in Used By wherever Commerce points at it.
Intent sources
services-commerce:docs/milestones/COMM-M1-set-up-what-you-sell.md#D9services-commerce:docs/milestones/plans/COMM-M1-plan.md#2. Scope (item 1)services-commerce:docs/milestones/plans/COMM-M1-plan.md#4. Assumptions (A1, A3)services-commerce:docs/milestones/walkthroughs/COMM-M1-handoff.md#What changed after your review (1)

Controls

22 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-DAT-004 TC-LOG-004 TC-LOG-005 TC-PI-001 TC-PI-002 TC-PI-003 TC-PI-005 TC-PRV-001 TC-PRV-002

Permissions

KeyChecked atScope
commerce.ordering-profiles.readapitenant
commerce.ordering-profiles.createapitenant
commerce.ordering-profiles.updateapitenant
commerce.ordering-profiles.deleteapitenant
commerce.ordering-profiles.bulkapitenant

Business Rules

16 rules, 13 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
Saving a checkout policy requires both the business unit receiving the sale and the currency used to price it.
origin: COMM-M1 plan A1 (docs/milestones/plans/COMM-M1-plan.md)
no proof recorded yet
validationapi, database, consoletest
services-commerce:modules/configuration/tests/e2e/ordering-profiles.e2e.spec.js#answers 400 to a profile without a business unit or without a currency: the two money facts a profile always has
02must prove
Proposed
Commerce refuses a policy currency outside the business unit’s supported currencies and preserves the previous record.
no proof recorded yet
validationservice, consoletest
services-commerce:modules/configuration/tests/e2e/ordering-profiles.e2e.spec.js#answers 400 currency_not_supported_by_business_unit to a currency the business unit does not transact in
03must prove
Proposed
The default merchant account must be active and match the policy’s unit and currency; an unknown account is refused, but an Accounting connection failure permits saving with a warning.
✓ An active USD account of an identical unit on a USD policy is accepted.✗ An inactive account, or a EUR account on a USD policy, fails validation identifying the field.
no proof recorded yet
validationservicetest
04must prove
Proposed
Range-based card acceptance requires ordered minimum and maximum amounts, and the range is stored only with that acceptance mode.
no proof recorded yet
validationapi, database, consoletest
services-commerce:modules/configuration/tests/e2e/ordering-profiles.e2e.spec.js#answers 400 to a within_range acceptance without its minimum, naming card_minimum_total_minor, with or without the maximum (0755)
05must prove
Proposed
The pay-now window defaults to thirty minutes and accepts values from one minute through one week.
origin: COMM-M1 plan A3 (docs/milestones/plans/COMM-M1-plan.md)
no proof recorded yet
validationdatabase, consoletest
services-commerce:modules/configuration/tests/integration/db/configuration-records.table.integration.spec.js#refuses a tender window outside one minute to a week, by ordering_profiles_tender_window_minutes_check
06
Proposed
Creating a minimally specified policy enables pay now, card and bank debit, store credit, a thirty-minute window, pro forma invoicing and unrestricted card acceptance, with no collection option or card fee.
policyservice, databasetest
services-commerce:modules/configuration/tests/e2e/ordering-profiles.e2e.spec.js#gives every setting the request left out its default: pay now, the card and ACH system methods, store credit, no collection option, thirty minutes, pro forma, a card always, no fee
07must prove
Proposed
Commerce identifies and refuses blank payment-method, collection-option and installment-plan entries, and refuses duplicate payment methods.
no proof recorded yet
validationapi, service, consoletest
services-commerce:modules/configuration/tests/unit/api/blank-ordering-profile-ids.spec.js#refuses a blank entry beside a good one on a create, naming the entry
08
Proposed
A policy keeps its supplied or name-derived identity permanently and rejects defaults, new and resolve as identities regardless of case.
validationapi, servicetest
services-commerce:modules/configuration/tests/unit/persistence/ordering-profile-rules.spec.js#refuses a reserved id whatever its case and surrounding spaces
09must prove
Proposed
Once policies exist, one active policy remains the workspace default: creation selects the first, and staff can transfer the designation but cannot clear it.
origin: COMM-M1 plan A1 (docs/milestones/plans/COMM-M1-plan.md)
no proof recorded yet
invariantservice, databasetest
services-commerce:modules/configuration/tests/integration/services/persistence/ordering-profiles.integration.spec.js#makes a second profile no default, and one stating is_tenant_default the default in place of the first, in one transaction
10must prove
Proposed
Deactivating or deleting a policy serving as a workspace or application default is refused with the retaining default identified.
no proof recorded yet
lifecycleservice, consoletest
services-commerce:modules/configuration/tests/integration/services/persistence/ordering-profiles.integration.spec.js#refuses making an application default inactive, 409 profile_is_default naming the application, and deactivates it once no default names it (D31)
11must prove
Proposed
Store, checkout and order references prevent policy deletion, with a store reference identified in the applicable refusal.
no proof recorded yet
lifecycleservice, databasetest
services-commerce:modules/configuration/tests/e2e/ordering-profiles.e2e.spec.js#answers 409 naming the store while a store sells under the profile, then 200 once the store is gone
12
Proposed
Used By reports Commerce-held store and application-default references and the workspace-default designation, excluding references held by other applications.
policyservice, consoletest
services-commerce:modules/configuration/tests/integration/services/persistence/ordering-profiles.queries.integration.spec.js#answers the tenant default’s stores by name, its flag and the pointers as one list
13must prove
Proposed
Staff replace a complete policy using its read version; Commerce rejects a stale version without overwriting the saved policy.
no proof recorded yet
invariantapi, servicetest
14must prove
Proposed
The order’s retained policy snapshot contains settlement, card, invoicing and fee-product settings independently of subsequent policy edits.
no proof recorded yet
invariantservicetest
services-commerce:modules/configuration/tests/integration/services/persistence/ordering-profiles.queries.integration.spec.js#snapshotOf freezes the settlement, card, invoicing, fee-product and quote rules an order carries (22 §9), nothing else
15must prove
Proposed
Policy reads require read permission and each creation, replacement or deletion requires its matching administrator permission; readers cannot change saved records.
no proof recorded yet
permissionapi, consoletest
services-commerce:modules/configuration/tests/e2e/configuration-security.e2e.spec.js#is refused the replacements, 403 permission_missing, the records unchanged
16must prove
Proposed
A full lock prevents replacing a checkout policy, and either full or deletion-only locking prevents removing it.
no proof recorded yet
policyserviceobserved

Scenarios

IdGivenWhenThenProvenance
01No policy exists in the workspaceCreate Main using only its business unit and USDThe first version of Main becomes default and receives the remaining default settingstest
services-commerce:modules/configuration/tests/e2e/ordering-profiles.e2e.spec.js#answers 200, the id its name suggests, in the tenant of the path, at version 1, the first profile the tenant default
02Main carries the workspace-default designationRequest removal of MainThe refusal identifies its default roletest
services-commerce:modules/configuration/tests/e2e/ordering-profiles.e2e.spec.js#answers 409 profile_is_default for the tenant default, naming the rule
03Card acceptance uses an amount rangeSubmit that policy without the minimumValidation identifies the absent minimum and prevents savingtest
services-commerce:modules/configuration/tests/e2e/ordering-profiles.e2e.spec.js#answers 400 to a within_range acceptance without its minimum, naming card_minimum_total_minor, with or without the maximum (0755)

Edge Cases

IdGivenWhenThenProvenance
04The Accounting connection is unavailableSave a policy with a default merchant accountSaving continues with a warning that eligibility was not verifiedtest

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.