Commit fa59fe79 by 张立顺

fix: remove customer order metadata from submit payload

1 parent 22f5277b
# Remove Customer Submit Fields Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** Remove `customer.updatedDate` and `customer.goodsOrder` from every create-order API request without mutating page state or removing unrelated customer fields.
**Architecture:** Extend the existing customer-property denylist used by the pure `buildSubmitPayload` serialization helper. Verify behavior at that boundary so every submission route receives the same cleanup.
**Tech Stack:** JavaScript ES modules, Node.js built-in test runner, npm work-order test scripts.
## Global Constraints
- Remove only `customer.updatedDate` and `customer.goodsOrder` in addition to the customer properties already cleaned.
- Do not modify the page's `orderObj` or customer archive echo data.
- Preserve unrelated customer fields.
- Apply the cleanup to normal payment, prerecorded, correction, and supplement submissions through their shared payload builder.
---
### Task 1: Clean customer-only submission fields
**Files:**
- Modify: `tabWorkOrder/pages/createOrder/services/submitPayload.helpers.js`
- Test: `tabWorkOrder/pages/createOrder/tests/submitPayload.helpers.test.mjs`
**Interfaces:**
- Consumes: `buildSubmitPayload(orderObj, context)` and `SUBMIT_CUSTOMER_PROPERTIES_TO_DELETE` from `submitPayload.helpers.js`.
- Produces: A cloned request object that omits `customer.updatedDate` and `customer.goodsOrder` while preserving other customer properties.
- [ ] **Step 1: Write the failing regression test**
Extend `baseOrder.customer` and `IT-WO-SUB-005` as follows:
```js
customer: {
buyTime: 'x',
createdDate: 'y',
updatedDate: 'z',
goodsOrder: { orderCode: 'GO1' },
customerName: 'retained customer',
plateNumber: 'P'
}
assert.equal(out.customer.updatedDate, undefined)
assert.equal(out.customer.goodsOrder, undefined)
assert.equal(out.customer.customerName, 'retained customer')
```
- [ ] **Step 2: Run the focused test and verify RED**
Run:
```powershell
node --test --test-name-pattern "strips audit fields on build" tabWorkOrder/pages/createOrder/tests/submitPayload.helpers.test.mjs
```
Expected: `IT-WO-SUB-005` fails because `customer.updatedDate` or `customer.goodsOrder` is still present.
- [ ] **Step 3: Implement the minimal cleanup**
Change the customer denylist to:
```js
export const SUBMIT_CUSTOMER_PROPERTIES_TO_DELETE = [
'buyTime',
'createdDate',
'updatedDate',
'goodsOrder'
]
```
- [ ] **Step 4: Run the focused test and verify GREEN**
Run the command from Step 2. Expected: the focused test passes.
- [ ] **Step 5: Run regression verification**
Run:
```powershell
npm run test:createOrder
npm run test:workOrder
git diff --check
```
Expected: all non-live tests pass, live tests remain explicitly skipped, closure status is `ok`, and the diff check reports no errors.
- [ ] **Step 6: Commit only this task's files**
```powershell
git add -- tabWorkOrder/pages/createOrder/services/submitPayload.helpers.js tabWorkOrder/pages/createOrder/tests/submitPayload.helpers.test.mjs docs/superpowers/plans/2026-08-17-remove-customer-submit-fields.md
git commit -m "fix: remove customer order metadata from submit payload"
```
...@@ -18,7 +18,12 @@ export const SUBMIT_ROOT_PROPERTIES_TO_DELETE = [ ...@@ -18,7 +18,12 @@ export const SUBMIT_ROOT_PROPERTIES_TO_DELETE = [
] ]
/** 提交前从 customer 剥离的字段 */ /** 提交前从 customer 剥离的字段 */
export const SUBMIT_CUSTOMER_PROPERTIES_TO_DELETE = ['buyTime', 'createdDate'] export const SUBMIT_CUSTOMER_PROPERTIES_TO_DELETE = [
'buyTime',
'createdDate',
'updatedDate',
'goodsOrder'
]
/** /**
* 根据业务场景选择提交 API 方法名 * 根据业务场景选择提交 API 方法名
......
...@@ -15,7 +15,14 @@ describe('submitPayload.helpers', () => { ...@@ -15,7 +15,14 @@ describe('submitPayload.helpers', () => {
subOrderList: [{}], subOrderList: [{}],
customerCouponCode: 'C1', customerCouponCode: 'C1',
selectPayType: 1, selectPayType: 1,
customer: { buyTime: 'x', createdDate: 'y', plateNumber: 'P' }, customer: {
buyTime: 'x',
createdDate: 'y',
updatedDate: 'z',
goodsOrder: { orderCode: 'GO1' },
customerName: 'retained customer',
plateNumber: 'P'
},
profitAllocatinList: [], profitAllocatinList: [],
associateOrderCode: 'OLD1' associateOrderCode: 'OLD1'
} }
...@@ -57,6 +64,9 @@ describe('submitPayload.helpers', () => { ...@@ -57,6 +64,9 @@ describe('submitPayload.helpers', () => {
assert.equal(out.profitAllocatinList, undefined) assert.equal(out.profitAllocatinList, undefined)
assert.equal(out.baseSceneName, undefined) assert.equal(out.baseSceneName, undefined)
assert.equal(out.customer.buyTime, undefined) assert.equal(out.customer.buyTime, undefined)
assert.equal(out.customer.updatedDate, undefined)
assert.equal(out.customer.goodsOrder, undefined)
assert.equal(out.customer.customerName, 'retained customer')
}) })
it('IT-WO-SUB-006: save removes subOrderList and coupon', () => { it('IT-WO-SUB-006: save removes subOrderList and coupon', () => {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!