feat(skills): scs-order-flow — order flow via relais#6
Conversation
Port the verified SCS production order flow onto the relais `scs` (legacy)
site. Every HTTP step (login -> goods query -> add cart -> match receiver ->
fix quantity -> select -> submit order) maps to a `relais exec scs.*` call;
acs_token is injected from the vault, never passed in --data.
- scripts/order_flow_test.ps1 reference PowerShell flow (field-set source)
- scripts/order_flow_relais.py executable relais-native port (--submit to order)
- skills/scs-order-flow/SKILL.md loadable skill: parse/receiver/cart rules,
8-step mapping, and two findings verified live against api.tffair.cn:
* goods.website_goods_to needs no `edi_api` prefix (spec path is equivalent)
* customer_id / receive_address_id must be strings (else err_code 201)
Verified end-to-end against production: order_id 192076 placed via relais.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Drive the full order flow through ScsLegacyAdapter against a mock server: goods query -> add cart -> match receiver -> query cart -> select -> submit order. Pins offline the two facts verified live: goods.website_goods_to needs no `edi_api` prefix, and customer_id/receive_address_id are sent as strings; plus acs_token body injection and per-step routing. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a16752a856
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| | login_name | `QLLKHZHH` | | ||
| | password | `QLLKHZHH` | |
There was a problem hiding this comment.
Remove production credentials from the skill
This skill documents a reusable production login/password while the surrounding instructions point at https://api.tffair.cn and describe how to submit real orders. Anyone with access to the repo can use these values to get an acs_token and mutate the account or place orders, so the credentials should be removed and supplied only through the vault or user-provided secrets.
Useful? React with 👍 / 👎.
| acs_token = $Token | ||
| customer_id = $CustomerId | ||
| is_recycle_bottle = 0 | ||
| receive_address_id = $receiveId |
There was a problem hiding this comment.
Stringify receive_address_id in the PowerShell flow
When receive_id is parsed from the address response as a number, this sends receive_address_id as a JSON number even though the new skill notes that getShoppingCarts rejects numeric receive_address_id with err_code 201, and the Python port explicitly casts it to str. Cast $receiveId to a string here so the flow does not fail immediately after adding the cart item.
Useful? React with 👍 / 👎.
…odex review)
order_flow_relais.py:
- abort on malformed relais output instead of silently using {} for `data`
- match the just-created cart item by EXACT cart id only (drop fuzzy
same-goods fallback that could submit the wrong existing item); normalize
ids to strings for all comparisons
- validate total_amt is present before the irreversible order call
- correct --submit help: a no-order run still mutates cart state
scs_legacy_order_flow_test.rs:
- stateful cart reads: first read unselected (select_status 2), second read
selected (1), so the "exactly one selected" check tracks a real transition
- assert select is called exactly once with the precise select payload
- assert order body carries shopping_cart_ids + string customer id/total_amt
SKILL.md: quote string-typed placeholders (receive_address_id, total_amt).
README: call the test the happy-path (submit) flow, not the full flow.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…l doc The skill embedded the default account's login + plaintext password. Replace them with operator/env placeholders ($SCS_LOGIN / $SCS_PASSWORD) and a note to source credentials at run time. The PowerShell reference already takes creds as parameters, not hard-coded. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
What
Ports the verified SCS production order flow onto the relais
scs(legacy) site, as a loadable skill plus two reference scripts.Every HTTP step maps to a
relais exec scs.*call;acs_tokenis injected from the vault (never in--data):login.do→goods.website_goods_to→shoppingcarts.create→customers.customers_receive_list→getShoppingCarts→shoppingcarts.update→shoppingcarts.select→orders.order_for_allFiles
scripts/order_flow_test.ps1— original PowerShell flow (field-set source of truth)scripts/order_flow_relais.py— executable relais-native port (--submitplaces a real order; omit for a dry cart run)skills/scs-order-flow/SKILL.md— loadable skill: parse rules, receiver rule, cart rule, the 8-step mapping, and safety boundariesVerified live against production (
api.tffair.cn)End-to-end through the master relais build — order_id 192076 placed (拉弗格10年 ×2, receiver 测试/receive_id 93, total_amt 598). Two findings baked into the skill:
goods.website_goods_toneeds noedi_apiprefix — the swagger spec path/1/goods/website_goods_tois equivalent.customer_id/receive_address_idmust be strings — numbers are rejected aserr_code 201 请求json格式错误.🤖 Generated with Claude Code