51 lines
4.0 KiB
Markdown
51 lines
4.0 KiB
Markdown
## ADDED Requirements
|
|
|
|
### Requirement: Device exchange shipping entry SHALL collect a structured recipient address
|
|
The system SHALL collect recipient name, recipient phone number, a province/city/district selection sourced from `element-china-area-data`, and a separate detailed address when the user fills shipping information for a pending device exchange.
|
|
|
|
#### Scenario: User opens the shipping popup for a pending exchange
|
|
- **WHEN** the device exchange record is in the state that allows filling shipping information
|
|
- **AND** the user opens the shipping popup
|
|
- **THEN** the popup SHALL show editable fields for recipient name, recipient phone number, province/city/district, and detailed address
|
|
|
|
#### Scenario: User attempts to submit without a complete address
|
|
- **WHEN** the user submits the shipping popup without selecting province/city/district or without entering a detailed address
|
|
- **THEN** the system SHALL block submission
|
|
- **AND** the system SHALL tell the user that the shipping address is incomplete
|
|
|
|
### Requirement: Device exchange shipping entry SHALL support pasted shipping-text recognition
|
|
The system SHALL provide a way for the user to paste one shipping-info string and SHALL attempt to recognize recipient name, mainland China phone number, and address content from that string into editable form fields.
|
|
|
|
#### Scenario: Pasted shipping text contains recognizable recipient information
|
|
- **WHEN** the user pastes a shipping-info string containing a recipient name, an 11-digit mainland China phone number, and address content
|
|
- **THEN** the system SHALL prefill the recognized recipient name and phone number
|
|
- **AND** the system SHALL prefill the recognized address content into the structured address form as far as it can infer
|
|
|
|
#### Scenario: Pasted shipping text is only partially recognizable
|
|
- **WHEN** the user pastes a shipping-info string but the system cannot confidently extract every required field
|
|
- **THEN** the system SHALL preserve the fields it can recognize
|
|
- **AND** the user SHALL still be able to manually complete or correct the remaining fields before submission
|
|
|
|
### Requirement: Device exchange shipping submission SHALL preserve the existing API contract
|
|
The system SHALL continue submitting `recipient_name`, `recipient_phone`, and `recipient_address` to `/api/c/v1/exchange/{id}/shipping-info`, and SHALL compose `recipient_address` from the selected province/city/district text together with the detailed address.
|
|
|
|
#### Scenario: User submits valid shipping information
|
|
- **WHEN** the user submits the popup with a valid recipient name, a valid mainland China phone number, a selected province/city/district, and a detailed address
|
|
- **THEN** the system SHALL call `/api/c/v1/exchange/{id}/shipping-info`
|
|
- **AND** the payload SHALL keep `recipient_name` and `recipient_phone`
|
|
- **AND** the payload SHALL send a composed `recipient_address` string containing the selected region text and the detailed address
|
|
|
|
### Requirement: Existing exchange shipping information SHALL remain editable without data loss
|
|
The system SHALL preserve previously saved shipping information when reopening the popup and SHALL support best-effort conversion from a previously saved combined address string into the new structured address fields.
|
|
|
|
#### Scenario: Existing saved address can be split into region and detail
|
|
- **WHEN** the popup opens for an exchange record that already has a saved `recipient_address`
|
|
- **AND** the saved address can be matched to province/city/district data
|
|
- **THEN** the system SHALL prefill the region selection and the detailed address
|
|
|
|
#### Scenario: Existing saved address cannot be fully split
|
|
- **WHEN** the popup opens for an exchange record that already has a saved `recipient_address`
|
|
- **AND** the saved address cannot be confidently split into province/city/district plus detailed address
|
|
- **THEN** the system SHALL preserve the original saved address content for manual correction
|
|
- **AND** the user SHALL still be able to complete a valid structured address before resubmitting
|