Skip to content

CAP-COM-CAT-015Issue promotion codes with controlled access

Markdown

CAP-COM-CAT-015

Issue promotion codes with controlled access

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
Claim restrictions identify the intended permitted purchasers.Batch issuance supplies unique claims with protected spreadsheet export.
Surfaces
consoleapijob
Intent sources
services-commerce:docs/milestones/COMM-M1b-promotions-and-codes.md#Decisions (D-R2)services-commerce:docs/milestones/COMM-M1b-promotions-and-codes.md#Scopeservices-commerce:docs/milestones/COMM-M1-set-up-what-you-sell.md#D13services-commerce:docs/milestones/plans/COMM-M1-plan.md#4. Assumptions (A22, A23)

Controls

27 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-CRY-004 TC-DAT-001 TC-DAT-002 TC-DAT-003 TC-DAT-004 TC-DAT-005 TC-LOG-001 TC-LOG-002 TC-LOG-003 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.promotions.readapitenant
commerce.promotions.manageapitenant

Business Rules

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

IdRuleKindEnforced atProvenance
01must prove
Proposed
Code identity is workspace-wide across promotions after case and space normalization, while the originally entered spelling remains available for display.
origin: COMM-M1 plan A22 (DEF-COM-0817, Q03) (docs/milestones/plans/COMM-M1-plan.md)
validationservice, databasetest
services-commerce:modules/promotions/tests/e2e/promotion-codes.e2e.spec.js#refuses “EARLY25” beside “early 25”, 409 code_taken
02must prove
Proposed
Only code-claimed promotions accept individual or generated codes.
origin: COMM-M1b D-R2 (docs/milestones/COMM-M1b-promotions-and-codes.md)
validationservicetest
services-commerce:modules/promotions/tests/e2e/promotions.e2e.spec.js#refuses a code, 409 automatic_promotion_has_no_codes
03must prove
Confirmed
A code’s effective interval must fit within its promotion’s interval.
origin: COMM-M1 D12 Q6 (docs/milestones/decisions/COMM-M1-D12-evaluation-algorithm.md)
validationservicetest
services-commerce:modules/promotions/tests/e2e/promotion-codes.e2e.spec.js#refuses a window ending after the promotion’s, 400 window_exceeds_promotion
04must prove
Proposed
After width and space normalization, codes accept one to sixty-four ASCII letters, digits, hyphens or underscores and reject other characters during creation and entry.
validationapi, servicetest
services-commerce:modules/promotions/tests/e2e/promotion-codes.e2e.spec.js#refuses a code with a slash or a percent sign, 400, naming code and saying the sentence (D-REC-6)
05must prove
Proposed
Checkout entry uses the same normalization as stored-code lookup, including full-width forms and spaces.
calculationservicetest
services-commerce:modules/promotions/tests/unit/pricing/code-normalization.spec.js#resolves the full-width EARLY25 to EARLY25 (NFKC)
06must prove
Proposed
Single-use codes impose one total use and one use per customer and reject conflicting limits.
origin: COMM-M1b D-R2 (docs/milestones/COMM-M1b-promotions-and-codes.md)
validationservicetest
services-commerce:modules/promotions/tests/e2e/promotion-codes.e2e.spec.js#refuses a single-use code with another limit, 400
07must prove
Proposed
Codes may restrict contacts and organizations or apply their own eligibility rule; their listed owner organizes the code without restricting redemption.
origin: COMM-M1b D-R2 (docs/milestones/COMM-M1b-promotions-and-codes.md)
policyservicetest
08must prove
Proposed
Staff cannot reduce code limits below recorded usage.
validationservicetest
services-commerce:modules/promotions/tests/e2e/promotion-codes.e2e.spec.js#refuses a limit below the uses made, 409 limit_below_uses
09must prove
Proposed
Codes can move between active and disabled and from either to permanently revoked, with transitions retained in promotion history.
lifecycleservicetest
services-commerce:modules/promotions/tests/e2e/promotion-codes.e2e.spec.js#keeps a revoked code revoked: no operation moves it again
10must prove
Proposed
Generation templates use digit, letter and mixed wildcards excluding ambiguous characters, require six wildcards, permit one to five thousand codes and require a possibility space ten thousand times the requested count.
origin: COMM-M1b scope item 1 (docs/milestones/COMM-M1b-promotions-and-codes.md)
validationservicetest
services-commerce:modules/promotions/tests/unit/issuance/code-template.spec.js#refuses the same template for 27 codes, saying what it can make and what was asked
11must prove
Proposed
Unless staff override it, a promotion enables cancellation release when its first code is personal and single-use.
origin: COMM-M1 D13 (docs/milestones/COMM-M1-set-up-what-you-sell.md)
policyservicetest
services-commerce:modules/promotions/tests/integration/services/persistence/promotion-codes.integration.spec.js#turns release on cancellation on when the first code is personal and single-use, and says so in the history
12must prove
Proposed
Code issuance starts asynchronously, reuses the batch for a repeated request, resumes missing codes after interruption and retains completed codes with a readable failure message.
lifecycleservicetest
services-commerce:modules/promotions/tests/unit/issuance/issuance-job.spec.js#continues from the codes that exist after a crash, making only the missing ones
13must prove
Proposed
CSV exports prefix cells beginning with formula characters so opening the file cannot interpret those cells as formulas.
policyservicetest
services-commerce:modules/promotions/tests/unit/issuance/issuance-request-csv.spec.js#prefixes cells starting with = + - @ with a single quote
14must prove
Confirmed
Code management and issuance require management permission, while code, redemption and batch inspection require read permission.
origin: COMM-M1 plan A15 (promotions D-06) (docs/milestones/plans/COMM-M1-plan.md)
permissionapi, consoletest

Scenarios

IdGivenWhenThenProvenance
01A promotion already owns EARLY25Create its spaced case variant on another promotionWorkspace-wide normalized identity prevents the duplicatetest
services-commerce:modules/promotions/tests/e2e/promotion-codes.e2e.spec.js#refuses a code another promotion of the tenant has, 409 code_taken
02A generated code batch has completedExport its codesThe response is a downloadable CSV with a header and the batch’s code rowstest

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.