All problems

Checkout Re-Enables Gift Wrap After It Was Turned Off

Level 1 · node · Correctness · Explicit boolean false defaulting error

Scenario

A checkout service stores the request giftWrap choice as an order option and should use the store default only when the value is omitted. At a store whose default is true, a customer who explicitly sends giftWrap:false still gets an order with giftWrap:true and an unwanted wrapping charge. The checkout service, store settings repository, and order repository are separated.

Requirements

- Preserve an explicitly supplied giftWrap value whether true or false - Use the store default only when giftWrap is omitted - Preserve explicit false even when the store default is true - Preserve explicit true when the store default is false - Store the final choice in the order repository and return the same value

Acceptance criteria

  • Explicit giftWrap true is stored
  • Explicit giftWrap false is stored
  • An omitted giftWrap uses a true store default
  • An omitted giftWrap uses a false store default
  • The returned giftWrap value matches the stored order