Skip to content

ATS-COM-CAT-015Issue promotion codes with controlled access: Capability Test Specification

Markdown

ATS-COM-CAT-015

Issue promotion codes with controlled access: Capability Test Specification

Markdown
  • DocumentProposed
  • Product intentProposed

KindAcceptance test setProduct areaCommerceModuleCatalog and Selling ConfigurationRevision2

Read atservices-commerce c8b66a98react-console baf6dae3

Coverage

  • Rule covered
  • Transition covered
  • Validation covered
  • Permission covered
  • Edge gap: FND-COM-CAT-069
  • Failure covered
  • Boundary covered
  • Concurrency gap: FND-COM-CAT-069
  • Invariant covered
  • Interaction covered

Test Scenarios

19 scenarios proving CAP-COM-CAT-015; 14 bound to an existing test.

01 Normalized codes cannot duplicate another promotion’s codeinvariantapinegativetest
Proves
BR-CAP-COM-CAT-015-01 INV-DOM-COM-CAT-005-06
Preconditions
A promotion already owns EARLY25
Steps
Create a spaced case variant and the same code under another promotion
Expected
Both attempts report occupied identity while display spelling remains separately retained
Data
none
Bound to
Source
services-commerce:modules/promotions/tests/e2e/promotion-codes.e2e.spec.js#refuses “EARLY25” beside “early 25”, 409 code_taken
02 Automatic promotions refuse code issuancevalidationapinegativetest
Proves
BR-CAP-COM-CAT-015-02
Preconditions
An automatic promotion exists
Steps
Create a code and request a generated batch
Expected
Both operations fail
Data
none
Bound to
Source
services-commerce:modules/promotions/tests/e2e/promotions.e2e.spec.js#refuses a code, 409 automatic_promotion_has_no_codes
03 Code intervals cannot exceed promotion datesboundaryapinegativetest
Proves
BR-CAP-COM-CAT-015-03 INV-DOM-COM-CAT-005-07
Preconditions
The promotion operates during March
Steps
Start a code in February and end one in April
Expected
Both intervals are refused
Data
none
Bound to
Source
services-commerce:modules/promotions/tests/e2e/promotion-codes.e2e.spec.js#refuses a window ending after the promotion’s, 400 window_exceeds_promotion
04 Code normalization precedes character validationvalidationunitnegativetest
Proves
BR-CAP-COM-CAT-015-04 BR-CAP-COM-CAT-015-05
Preconditions
Creation and entry accept candidate code text
Steps
Try punctuation, sharp-s, emoji, full-width letters and sixty-five characters
Expected
Unsupported characters and excessive length fail; full-width letters normalize and succeed
Data
none
Bound to
Source
services-commerce:modules/promotions/tests/unit/pricing/code-charset.spec.js#refuses a slash, a percent sign, ß, an accent, punctuation, NUL, emoji and full-width punctuation (D-REC-12)
05 Single-use configuration rejects conflicting capacityvalidationapinegativetest
Proves
BR-CAP-COM-CAT-015-06
Preconditions
Code creation selects single use
Steps
Create a default single-use code and one requesting five uses
Expected
The default permits one use and the conflicting request fails
Data
none
Bound to
Source
services-commerce:modules/promotions/tests/e2e/promotion-codes.e2e.spec.js#makes a single-use code one use in all
06 Purchaser restrictions act independently of ownershipruleunitnegativetest
Proves
BR-CAP-COM-CAT-015-07
Preconditions
Codes carry contact, organization and owner fixtures
Steps
Assess subjects inside and outside restriction lists
Expected
Listed subjects qualify, unlisted subjects receive appropriate refusals and ownership adds no restriction
Data
none
Bound to
Source
services-commerce:modules/promotions/tests/unit/pricing/validation.spec.js#admits a purchaser among a code’s contact restrictions
07 Recorded usage protects the code’s lower limitinvariantapinegativetest
Proves
BR-CAP-COM-CAT-015-08 INV-DOM-COM-CAT-005-08
Preconditions
The code has already been used three times
Steps
Reduce its limit to two
Expected
The change fails
Data
Planted redemptions
Bound to
Source
services-commerce:modules/promotions/tests/e2e/promotion-codes.e2e.spec.js#refuses a limit below the uses made, 409 limit_below_uses
08 Revocation ends the code lifecycletransitionapinegativetest
Proves
BR-CAP-COM-CAT-015-09 INV-DOM-COM-CAT-005-09
Preconditions
The code starts active
Steps
Disable, enable and revoke it, then request enablement
Expected
Supported transitions are recorded and revival fails
Data
none
Bound to
Source
services-commerce:modules/promotions/tests/e2e/promotion-codes.e2e.spec.js#disables an active code, enables a disabled one and revokes it
09 Generation validates template capacity and quantityboundaryunitnegativetest
Proves
BR-CAP-COM-CAT-015-10
Preconditions
Issuance requests can vary templates and counts
Steps
Use too few wildcards, invalid spacing, insufficient space and out-of-range counts
Expected
Each invalid request returns a readable refusal
Data
none
Bound to
Source
services-commerce:modules/promotions/tests/unit/issuance/code-template.spec.js#refuses fewer than 6 wildcards in plain words
10 The first code establishes cancellation-release defaultsruleapitest
Proves
BR-CAP-COM-CAT-015-11
Preconditions
Two new promotions have no codes
Steps
Create a personal single-use first code and a shared first code
Expected
The personal case enables and records release; the shared case leaves release disabled
Data
none
Bound to
Source
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
11 Issuance resumes missing work and retains failed progressfailureunittest
Proves
BR-CAP-COM-CAT-015-12 AS-JNY-COM-CAT-004-04 INV-DOM-COM-CAT-005-14
Preconditions
A batch requests twelve hundred codes
Steps
Run, interrupt and resume generation, repeat the request and force persistent conflicts
Expected
Generation completes in chunks, resumes missing codes, reuses the batch and retains partial work on failure
Data
none
Bound to
Source
services-commerce:modules/promotions/tests/unit/issuance/issuance-job.spec.js#makes 1,200 codes in chunks of 500, 500 and 200 and completes
12 Exported cells cannot become spreadsheet formulasboundaryunittest
Proves
BR-CAP-COM-CAT-015-13
Preconditions
Code or note values begin with formula characters
Steps
Render the CSV export
Expected
Formula-like cells gain a protective leading quote
Data
none
Bound to
Source
services-commerce:modules/promotions/tests/unit/issuance/issuance-request-csv.spec.js#prefixes cells starting with = + - @ with a single quote
13 Code reads cannot authorize creationpermissionapinegativetest
Proves
BR-CAP-COM-CAT-015-14
Preconditions
The principal has promotion-read permission
Steps
Inspect codes and attempt to create one
Expected
Reading succeeds and creation fails permission checks
Data
Read-exclusively persona
Bound to
Source
services-commerce:modules/promotions/tests/e2e/promotions-security.e2e.spec.js#reads every read route
14 Code creation and generation remain discoverable in the consolerulebrowsertest
Proves
AS-JNY-COM-CAT-004-05
Preconditions
Mock promotion data supports browser editing
Steps
Add a limited annotated code, generate a batch and inspect All Codes
Expected
Creation opens the code page, the batch appears in issuance history and All Codes locates the code
Data
Console mock
Bound to
Source
react-console:e2e/mock/promotions.mock.spec.ts#a code is added in the code editor with a limit and a note, and lands on its page
15 Code state changes promotion launch readinessinteractionapiproposed
Proves
BR-CAP-COM-CAT-014-10 BR-CAP-COM-CAT-015-09
Preconditions
A coded draft has one active code.
Steps
Disable its code and attempt launch; enable the code and launch; revoke it and assess a new claim.
Expected
Launch without an active code refuses; launch after enablement succeeds and the revoked claim refuses.
Data
Run-owned workspace and records; fixed clock where dates are exercised.
Source
services-commerce:modules/promotions/tests/e2e/promotions.e2e.spec.js#refuses to activate a coded promotion with no active code, 409 no_active_code,services-commerce:modules/promotions/tests/e2e/promotion-codes.e2e.spec.js#keeps a revoked code revoked: no operation moves it again
16 Code restrictions change the checkout resultinteractionapiproposed
Proves
BR-CAP-COM-CAT-015-07 BR-CAP-COM-CAT-016-11 BR-CAP-COM-CAT-016-13
Preconditions
A valid code restricts a purchaser and has a stated eligibility rule.
Steps
Assess a listed subject, an unrelated subject and an anonymous subject.
Expected
Only the permitted qualifying subject receives the benefit; other results retain safe refusal messages.
Data
Run-owned workspace and records; fixed clock where dates are exercised.
Source
services-commerce:modules/promotions/tests/unit/pricing/validation.spec.js#does not restrict by owner,services-commerce:modules/promotions/tests/unit/pricing/validation.spec.js#answers the first refusal in the order of 10.3: an inactive code before an exhausted one,services-commerce:modules/promotions/tests/unit/pricing/validation.spec.js#fails closed on an indeterminate verdict, for must_match and for must_not_match alike
17 Releasing usage restores capacity without erasing termsinteractionapiproposed
Proves
BR-CAP-COM-CAT-015-08 BR-CAP-COM-CAT-015-11 BR-CAP-COM-CAT-017-04 BR-CAP-COM-CAT-017-05
Preconditions
A personal single-use first code has one applied redemption.
Steps
Attempt to lower its limit; release with override and a reason; read counts and frozen allocations.
Expected
The invalid limit change refuses; release restores capacity while retaining the discount evidence.
Data
Run-owned workspace and records; fixed clock where dates are exercised.
Source
services-commerce:modules/promotions/tests/e2e/promotion-codes.e2e.spec.js#refuses a limit below the uses made, 409 limit_below_uses,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,services-commerce:modules/promotions/tests/e2e/promotion-redemptions.e2e.spec.js#refuses a release without a reason, 400,services-commerce:docs/milestones/plans/COMM-M1-plan.md#D13. Restore a personal code when its order is cancelled?
18 Promotion code lifecycle is exercised across every declared movetransitionapinegativeproposed
Proves
BR-CAP-COM-CAT-015-09 BR-CAP-COM-CAT-015-12
Preconditions
Independent run-owned records start in each declared origin state; guarded variants omit one required condition at a time.
Steps
For each transition case, establish the origin, apply its trigger with the guard satisfied, read the resulting state and side effects, then repeat on a separate record with a required guard absent.
Expected
Every allowed case reaches its stated destination and retains its declared side effects; failed guards preserve the originating record except for the separately documented partial offer action.
Data
Run-owned workspace and records; fixed clock where dates are exercised.
Source
rhythm-v2-docs:specs/commerce/catalog/design/state-models/STATE-COM-CAT-008-promotion-code-lifecycle.md#STATE-COM-CAT-008,services-commerce:modules/promotions/services/persistence/promotion-codes.ts:PROMOTION_CODE_TRANSITIONS,services-commerce:modules/promotions/services/persistence/promotion-codes.ts:PROMOTION_CODE_TRANSITIONS,services-commerce:modules/promotions/tests/e2e/promotion-codes.e2e.spec.js#keeps a revoked code revoked: no operation moves it again,services-commerce:modules/promotions/services/persistence/promotion-codes.ts:PROMOTION_CODE_TRANSITIONS
19 Code issuance batch is exercised across every declared movetransitionapinegativeproposed
Proves
BR-CAP-COM-CAT-015-09 BR-CAP-COM-CAT-015-12
Preconditions
Independent run-owned records start in each declared origin state; guarded variants omit one required condition at a time.
Steps
For each transition case, establish the origin, apply its trigger with the guard satisfied, read the resulting state and side effects, then repeat on a separate record with a required guard absent.
Expected
Every allowed case reaches its stated destination and retains its declared side effects; failed guards preserve the originating record except for the separately documented partial offer action.
Data
Run-owned workspace and records; fixed clock where dates are exercised.
Source
rhythm-v2-docs:specs/commerce/catalog/design/state-models/STATE-COM-CAT-009-code-issuance-batch.md#STATE-COM-CAT-009,services-commerce:modules/promotions/services/persistence/promotion-code-issuances.ts,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,services-commerce:modules/promotions/services/issuance/issuance-job.ts,services-commerce:modules/promotions/services/issuance/issuance-workflow.ts,services-commerce:modules/promotions/services/issuance/issuance-workflow.ts:readCodeIssuance

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.