Skip to content

ATS-COM-ORD-004Use promotion codes before the sale: Capability Test Specification

Markdown

ATS-COM-ORD-004

Use promotion codes before the sale: Capability Test Specification

Markdown
  • DocumentProposed

KindAcceptance test setProduct areaCommerceModuleCustomer purchases, purchased benefits and vendor stockRevision2

Read atservices-commerce c8b66a98macroservice-libraries 54536a44react-console baf6dae3

Coverage

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

Test Scenarios

13 scenarios proving CAP-COM-ORD-004; 11 bound to an existing test.

01 Equivalent entered codes identify one offervalidationapitest
Proves
BR-CAP-COM-ORD-004-01
Preconditions
The fixture defines the displayed early-bird code.
Steps
[ { "do": "Enter case and spacing variants including full-width text.", "provenance": "test", "source": "services-commerce:modules/checkout/tests/e2e/promotions.e2e.spec.js#applies the one code to each, full-width letters and an ideographic space included (D-REC-12), shown by its display code, the entered code kept as typed (trimmed at the boundary)" } ]
Expected
Each resolves to the same code while retaining the trimmed entered form.
Data
Use the controlled records and transports established by the cited tests.
Bound to
services-commerce:modules/checkout/tests/e2e/promotions.e2e.spec.js#applies the one code to each, full-width letters and an ideographic space included (D-REC-12), shown by its display code, the entered code kept as typed (trimmed at the boundary)
Source
services-commerce:modules/checkout/tests/e2e/promotions.e2e.spec.js#applies the one code to each, full-width letters and an ideographic space included (D-REC-12), shown by its display code, the entered code kept as typed (trimmed at the boundary)
02 Unsupported code text is rejected at the boundaryboundaryapinegativetest
Proves
BR-CAP-COM-ORD-004-02
Preconditions
An editable cart is available.
Steps
[ { "do": "Submit slash, percent, backslash, unusual letter, emoji, NUL and blank cases from the bindings.", "provenance": "test", "source": "services-commerce:modules/checkout/tests/e2e/checkout-promotion-code-refusals.e2e.spec.js#refuses a code with a slash and a percent sign, 400, with the sentence (D-REC-6)" } ]
Expected
The response explains validation failure and retains no invalid code.
Data
Use the controlled records and transports established by the cited tests.
Bound to
services-commerce:modules/checkout/tests/e2e/checkout-promotion-code-refusals.e2e.spec.js#refuses a code with a slash and a percent sign, 400, with the sentence (D-REC-6)
services-commerce:modules/checkout/tests/e2e/checkout-promotion-code-refusals.e2e.spec.js#refuses a code holding a NUL character, 400, where the database would refuse the text as a 500
Source
services-commerce:modules/checkout/tests/e2e/checkout-promotion-code-refusals.e2e.spec.js#refuses a code with a slash and a percent sign, 400, with the sentence (D-REC-6)
03 Repeated promotion entry leaves the first use intactedgeapinegativetest
Proves
BR-CAP-COM-ORD-004-03
Preconditions
An early-bird code is already entered.
Steps
[ { "do": "Enter it again and enter another code for the same promotion.", "provenance": "test", "source": "services-commerce:modules/checkout/tests/e2e/promotions.e2e.spec.js#refuses the same code entered again, 409 already_applied with the customer’s message" } ]
Expected
The response identifies already_applied and history records the rejected entry.
Data
Use the controlled records and transports established by the cited tests.
Bound to
services-commerce:modules/checkout/tests/e2e/promotions.e2e.spec.js#refuses the same code entered again, 409 already_applied with the customer’s message
services-commerce:modules/checkout/tests/e2e/promotions.e2e.spec.js#records the refusal on the trail as checkout.promotion_code_rejected, already_applied
services-commerce:modules/checkout/tests/e2e/promotions.e2e.spec.js#rejects a second code of the same promotion already_applied, the first still applied
Source
services-commerce:modules/checkout/tests/e2e/promotions.e2e.spec.js#refuses the same code entered again, 409 already_applied with the customer’s message
04 A non-qualifying code is recorded without a savingvalidationapinegativetest
Proves
BR-CAP-COM-ORD-004-04
Preconditions
A merchandise offer is entered on a membership-only purchase.
Steps
[ { "do": "Preview and place that cart.", "provenance": "test", "source": "services-commerce:modules/checkout/tests/e2e/promotions.e2e.spec.js#rejects the code nothing_qualifies, with the customer’s message, and takes nothing off" } ]
Expected
The order remains at full price with a rejected-code reason and no redemption.
Data
Use the controlled records and transports established by the cited tests.
Bound to
services-commerce:modules/checkout/tests/e2e/promotions.e2e.spec.js#rejects the code nothing_qualifies, with the customer’s message, and takes nothing off
services-commerce:modules/checkout/tests/e2e/promotions.e2e.spec.js#places the order at the full price, the code not applied
services-commerce:modules/checkout/tests/e2e/promotions.e2e.spec.js#keeps the code on the order’s pricing snapshot as not applied, with its reason
services-commerce:modules/checkout/tests/e2e/promotions.e2e.spec.js#writes no redemption and leaves the uses unchanged
Source
services-commerce:modules/checkout/tests/e2e/promotions.e2e.spec.js#rejects the code nothing_qualifies, with the customer’s message, and takes nothing off
05 A zero-value second discount consumes no useedgeapitest
Proves
BR-CAP-COM-ORD-004-05
Preconditions
An item first receives a full-value promotion and then another percentage code.
Steps
[ { "do": "Preview and place with both entries.", "provenance": "test", "source": "services-commerce:modules/checkout/tests/e2e/promotions.e2e.spec.js#previews TENTH as giving nothing, FREEALL taking the whole $100.00" } ]
Expected
The first offer supplies the saving; the second remains unapplied and has no use count.
Data
Use the controlled records and transports established by the cited tests.
Bound to
services-commerce:modules/checkout/tests/e2e/promotions.e2e.spec.js#previews TENTH as giving nothing, FREEALL taking the whole $100.00
services-commerce:modules/checkout/tests/e2e/promotions.e2e.spec.js#keeps TENTH on the order as not applied, with its reason
Source
services-commerce:modules/checkout/tests/e2e/promotions.e2e.spec.js#previews TENTH as giving nothing, FREEALL taking the whole $100.00
06 Only placement records the redemptiontransitionapitest
Proves
BR-CAP-COM-ORD-004-06
Preconditions
A qualifying registration carries an applied early-bird code.
Steps
[ { "do": "Preview repeatedly and then place.", "provenance": "test", "source": "services-commerce:modules/checkout/tests/e2e/promotions.e2e.spec.js#records the redemption applied with one allocation of 2500" } ]
Expected
Previews do not consume a use; placement records one redemption and one code and promotion use.
Data
Use the controlled records and transports established by the cited tests.
Bound to
services-commerce:modules/checkout/tests/e2e/promotions.e2e.spec.js#records the redemption applied with one allocation of 2500
services-commerce:modules/checkout/tests/e2e/promotions.e2e.spec.js#takes one use of the code and of the promotion
Source
services-commerce:modules/checkout/tests/e2e/promotions.e2e.spec.js#records the redemption applied with one allocation of 2500
07 Restricted offers fail closed when eligibility is unresolvedfailureapitest
Proves
BR-CAP-COM-ORD-004-07
Preconditions
Fixtures cover matching-only, non-matching-only and indeterminate rules.
Steps
[ { "do": "Preview and place as qualifying and non-qualifying purchasers.", "provenance": "test", "source": "services-commerce:modules/checkout/tests/e2e/promotion-eligibility.e2e.spec.js#applies to the member: the preview carries it and no rejection" } ]
Expected
The appropriate restricted offers apply, while refusal or indeterminate results prevent their redemption and placement rechecks them.
Data
Use the controlled records and transports established by the cited tests.
Bound to
services-commerce:modules/checkout/tests/e2e/promotion-eligibility.e2e.spec.js#applies to the member: the preview carries it and no rejection
services-commerce:modules/checkout/tests/e2e/promotion-eligibility.e2e.spec.js#rejects it in the preview as purchaser_not_eligible, with the customer’s sentence
services-commerce:modules/checkout/tests/e2e/promotion-eligibility.e2e.spec.js#admits the buyer who does not match the rule: applied in the preview, placed with the discount
services-commerce:modules/checkout/tests/e2e/promotion-eligibility.e2e.spec.js#rolls everything back: no order, no use, the checkout open
services-commerce:modules/checkout/tests/e2e/promotion-eligibility.e2e.spec.js#refuses it even for must_not_match: an indeterminate decision is not "does not match"
Source
services-commerce:modules/checkout/tests/e2e/promotion-eligibility.e2e.spec.js#applies to the member: the preview carries it and no rejection
08 Portal snapshots omit staff-only explanationspermissionapitest
Proves
BR-CAP-COM-ORD-004-08
Preconditions
The offer belongs to a different business unit.
Steps
[ { "do": "Enter it in staff and portal contexts and inspect the returned snapshot.", "provenance": "test", "source": "services-commerce:modules/checkout/tests/e2e/promotions.e2e.spec.js#tells the console clerk the staff message, which says business unit" } ]
Expected
Staff receive the operational explanation; the portal result retains only customer wording.
Data
Use the controlled records and transports established by the cited tests.
Bound to
services-commerce:modules/checkout/tests/e2e/promotions.e2e.spec.js#tells the console clerk the staff message, which says business unit
services-commerce:modules/checkout/tests/e2e/promotions.e2e.spec.js#tells the portal member the customer message alone, which does not say business unit
services-commerce:modules/checkout/tests/e2e/promotions.e2e.spec.js#keeps the staff message out of the price snapshot the portal member reads
Source
services-commerce:modules/checkout/tests/e2e/promotions.e2e.spec.js#tells the console clerk the staff message, which says business unit
09 Removing a code restores the full previewtransitionapitest
Proves
BR-CAP-COM-ORD-004-09
Preconditions
A cart has an applied discount code.
Steps
[ { "do": "Remove it, read the preview and history, then remove it again.", "provenance": "test", "source": "services-commerce:modules/checkout/tests/e2e/checkout-promotion-code-refusals.e2e.spec.js#answers 404 to the removal of a code the checkout does not carry, naming the code" } ]
Expected
The full price returns, removal appears once in history and the repeated removal returns 404.
Data
Use an isolated workspace with the records and responses named in the preconditions.
Bound to
services-commerce:modules/checkout/tests/e2e/promotions.e2e.spec.js#re-runs the preview without the code: nothing applied, the full price
services-commerce:modules/checkout/tests/e2e/promotions.e2e.spec.js#records checkout.promotion_code_removed naming the code as it was entered
services-commerce:modules/checkout/tests/e2e/promotions.e2e.spec.js#refuses removing a code the checkout does not carry, 404
Source
services-commerce:modules/checkout/tests/e2e/checkout-promotion-code-refusals.e2e.spec.js#answers 404 to the removal of a code the checkout does not carry, naming the code
10 A better exclusive code replaces the automatic savingruleapitest
Proves
BR-CAP-COM-ORD-004-10
Preconditions
The fixture automatic offer prices a shirt at 22.50 dollars.
Steps
[ { "do": "Apply the inferior code and then the better exclusive code in separate carts; place both.", "provenance": "test", "source": "services-commerce:modules/checkout/tests/e2e/automatic-promotions.e2e.spec.js#lets VIP20 replace the automatic promotion when it leaves less to pay: $20.00" } ]
Expected
The inferior code leaves 22.50 dollars due; the better code leaves 20 dollars due and consumes only its own offer use.
Data
Use an isolated workspace with the records and responses named in the preconditions.
Bound to
services-commerce:modules/checkout/tests/e2e/automatic-promotions.e2e.spec.js#keeps the automatic promotion when VIP5 would leave more to pay: $22.50, VIP5 explained
services-commerce:modules/checkout/tests/e2e/automatic-promotions.e2e.spec.js#lets VIP20 replace the automatic promotion when it leaves less to pay: $20.00
services-commerce:modules/checkout/tests/e2e/automatic-promotions.e2e.spec.js#redeems VIP20 and not the automatic promotion it replaced
Source
services-commerce:modules/checkout/tests/e2e/automatic-promotions.e2e.spec.js#lets VIP20 replace the automatic promotion when it leaves less to pay: $20.00
11 A stranger cannot change the cart discountpermissionapitest
Proves
BR-CAP-COM-ORD-004-11
Preconditions
A member has a cart and another member is signed in.
Steps
[ { "do": "Submit a code against the first member’s cart.", "provenance": "test", "source": "services-commerce:modules/checkout/tests/e2e/promotions.e2e.spec.js#refuses another member entering a code on a checkout that is not theirs, 403" } ]
Expected
The request returns 403.
Data
Use an isolated workspace with the records and responses named in the preconditions.
Bound to
services-commerce:modules/checkout/tests/e2e/promotions.e2e.spec.js#refuses another member entering a code on a checkout that is not theirs, 403
Source
services-commerce:modules/checkout/tests/e2e/promotions.e2e.spec.js#refuses another member entering a code on a checkout that is not theirs, 403
12 A changed promotion verdict rolls back purchase commitmentinteractionapiproposed
Proves
BR-CAP-COM-ORD-004-06 BR-CAP-COM-ORD-005-08
Preconditions
A reviewed code is eligible but its subject becomes ineligible before placement.
Steps
[ { "do": "Place the cart and inspect order and redemption records.", "provenance": "proposed", "source": [ "services-commerce:modules/checkout/tests/e2e/promotions.e2e.spec.js#takes one use of the code and of the promotion", "services-commerce:modules/checkout/tests/e2e/promotion-eligibility.e2e.spec.js#refuses the placement 409 promotion_refused, purchaser_not_eligible" ] } ]
Expected
The request refuses the promotion and retains neither an order nor a redemption.
Data
Use an isolated workspace with the records and responses named in the preconditions.
Source
services-commerce:modules/checkout/tests/e2e/promotions.e2e.spec.js#takes one use of the code and of the promotion,services-commerce:modules/checkout/tests/e2e/promotion-eligibility.e2e.spec.js#refuses the placement 409 promotion_refused, purchaser_not_eligible
13 A later code extends the sale’s retained discount historyinteractionapiproposed
Proves
BR-CAP-COM-ORD-004-06 BR-CAP-COM-ORD-015-07
Preconditions
An accepted sale carries an earlier offer and qualifies for a distinct combinable offer.
Steps
[ { "do": "Apply the later offer with authorized staff and inspect both allocations and credit.", "provenance": "proposed", "source": [ "services-commerce:modules/checkout/tests/e2e/promotions.e2e.spec.js#takes one use of the code and of the promotion", "services-commerce:modules/orders/tests/e2e/apply-promotion-amendment.e2e.spec.js#answers 200 with the apply_promotion amendment completed, its plan on the document, its net owed to the buyer" ] } ]
Expected
The earlier allocation remains and the later saving has its own amendment and financial adjustment.
Data
Use an isolated workspace with the records and responses named in the preconditions.
Source
services-commerce:modules/checkout/tests/e2e/promotions.e2e.spec.js#takes one use of the code and of the promotion,services-commerce:modules/orders/tests/e2e/apply-promotion-amendment.e2e.spec.js#answers 200 with the apply_promotion amendment completed, its plan on the document, its net owed to the buyer

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.