Skip to content

chore: adopt ecommerce 0.3.0 and automation 0.6.1, use the plugin's order token and rejection causes - #17

Merged
bvdaakster merged 3 commits into
mainfrom
chore/adopt-ecommerce-0.3.0
Nov 28, 2026
Merged

bvdaakster merged 3 commits into
mainfrom
chore/adopt-ecommerce-0.3.0

Conversation

@bvdaakster

@bvdaakster bvdaakster commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Upgrades @xtr-dev/payload-ecommerce to 0.3.0 and @xtr-dev/payload-automation to 0.6.1.

Order link token

  • The site's own token (an HMAC of the order number) is removed. Order links carry the plugin's per-order accessToken, and getOrderForVisitor checks it with orders.getOrderByToken({ orderNumber, token }). A signed-in member still opens their own order without a token, and an admin any order.
  • orderPath(order) builds the link from an order read by server code (Local API). It is used for the payment's redirectUrl and for the links in the confirmation and shipped emails, which both re-read the order before sending.
  • The plugin hides the field from REST, GraphQL and the admin panel for everyone; nothing here changes that.
  • A workflow run stores a snapshot of the order that triggered it, token included, and admins can read runs. src/plugins/automation.ts now removes accessToken before a run is stored.
  • Orders created before the upgrade have no token, so their old links stop working (the demo reseeds). Their member and admins can still open them.

Rejected orders

placeOrder no longer matches the error message with a regular expression. It reads the cause with getOrderRejection(error) and orderRefusal words it: which product is short and how many are left, or why the code no longer applies.

Other 0.3.0 changes

  • createOrderFromCart requires everything in orderData: the site already passed it that way.
  • A coupon with status expired is reported with reason expired; the site words refusals from the reason, and a test case covers it.
  • usageCount is still set through the Local API in tests, which the plugin allows.
  • Cart subtotals are rounded with Math.round on integer cents, so no amounts change.

Automation 0.6.1

The seeded workflows have distinct step slugs: the site boots and all integration tests pass on 0.6.1.

Demo settings

  • .env.example sets SQLITE_SYNCHRONOUS=NORMAL (how the demo runs) and, with the README, says what that trades away. The code's default stays FULL. The repository holds no deployment config, so the live deployment's environment has to get the variable by hand.
  • Playwright no longer retries in CI (retries: 0): a test that fails once is reported as failed.

Tests

  • Integration: 123 pass (was 121). New: the wording of each rejection cause; a checkout that loses stock or a coupon's last use between the cart check and the order; wrong, missing, malformed and other orders' tokens are refused; the token is not readable, filterable or writable through the API as an admin or the member; the token is not in workflow runs or jobs.
  • e2e: the email link and the guest's redirect are checked against the new token format. Not run locally; CI runs them.

🤖 Generated with Claude Code

https://claude.ai/code/session_0122PV8TJ7ELGdAX7H2hdrRU

…rder token and rejection causes

- Order links use the plugin's per-order accessToken, checked with
  orders.getOrderByToken; the site's own HMAC token is removed.
- placeOrder reads the cause of a rejected order with getOrderRejection and
  words stock and coupon rejections itself instead of matching the message.
- Workflow runs no longer store the access token of the order that
  triggered them.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0122PV8TJ7ELGdAX7H2hdrRU
@claude

claude Bot commented Nov 28, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

…e2e tests in CI

.env.example sets NORMAL and explains what it trades away; the code's default
stays FULL. Playwright no longer retries in CI, so a test that fails once is
reported as failed.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0122PV8TJ7ELGdAX7H2hdrRU
@claude

claude Bot commented Nov 28, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@bvdaakster
bvdaakster merged commit b81cf68 into main Nov 28, 2026
3 checks passed
@bvdaakster
bvdaakster deleted the chore/adopt-ecommerce-0.3.0 branch November 28, 2026 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant