@agenzo/merchant-cli 0.7.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -104,10 +104,14 @@ agenzo-merchant-cli ride-elife cancel --api-key "$API_KEY" --yes \
104
104
  ### Hotel booking end-to-end example
105
105
 
106
106
  The core Agent loop is `search → quote → create-order → pay-order → get`. Amounts are decimal currency
107
- units (e.g. `320.00` = 320.00 yuan). `pay-order` takes only `--order-id`; the billing path is chosen
108
- server-side by the developer's `billing_mode`:
109
- - **monthly_settlement**: deducted from the monthly-settlement account.
110
- - **pay_per_call**: the user pays via shared EVO parameters using the `order_id` as the EVO merchantTransID; the platform verifies that payment for the same `order_id` before confirming.
107
+ units (e.g. `320.00` = 320.00 yuan). **`create-order` settles payment AND locks the room** — the funds
108
+ path is chosen server-side by the developer's `billing_mode`:
109
+
110
+ - **monthly_settlement**: the total is deducted from the developer's monthly-settlement account balance.
111
+ - **pay_per_call**: the total is authorized + captured on the developer's bound card via the platform's own EVO integration (server-side; no EVO parameters pass through this CLI).
112
+
113
+ `pay-order` takes only `--order-id` and triggers supplier confirmation / ticket issuance — funds were
114
+ already settled in `create-order`, so both billing modes use the same `pay-order` call.
111
115
 
112
116
  ```bash
113
117
  # 1. Search hotels by coordinates + stay dates (or use --destination-id from find-destination).
@@ -123,7 +127,7 @@ agenzo-merchant-cli hotel-redaug quote --api-key "$API_KEY" \
123
127
  --check-in 2026-02-10 --check-out 2026-02-12 \
124
128
  --adults 2 --room-num 1 --nationality CN
125
129
 
126
- # 3. Create Order (write op: locks rate, no charge; returns order_id + payable amount).
130
+ # 3. Create Order (write op: settles payment + locks the room; returns order_id + fc_order_code).
127
131
  agenzo-merchant-cli hotel-redaug create-order --api-key "$API_KEY" --yes \
128
132
  --product-token "$PRODUCT_TOKEN" \
129
133
  --total-amount 640.00 --currency CNY \
@@ -138,8 +142,8 @@ agenzo-merchant-cli hotel-redaug pay-order --api-key "$API_KEY" --yes \
138
142
  --order-id "$ORDER_ID" \
139
143
  --idempotency-key "hotel-pay-$(date +%s)"
140
144
 
141
- # 4b. Pay Order — pay_per_call path (user already paid via EVO using order_id
142
- # as the EVO merchantTransID). Same command, no other flag.
145
+ # 4b. Pay Order — pay_per_call path (funds already captured on the bound card in
146
+ # create-order; pay-order just triggers supplier confirmation). Same command.
143
147
  agenzo-merchant-cli hotel-redaug pay-order --api-key "$API_KEY" --yes \
144
148
  --order-id "$ORDER_ID" \
145
149
  --idempotency-key "hotel-pay-$(date +%s)"
@@ -182,6 +186,72 @@ agenzo-merchant-cli hotel-redaug get-checkout --api-key "$API_KEY" \
182
186
  --task-order-code "$TASK_ORDER_CODE" --watch --watch-interval 10 --watch-timeout 600
183
187
  ```
184
188
 
189
+ ### Flight booking end-to-end example (flight-flink)
190
+
191
+ The flow is `find-airport → search → verify → create-order → pay-order → get-order (poll until TICKETED)`.
192
+ Amounts are decimal currency units (e.g. `1200.00` = 1200.00 yuan). `create-order` locks the fare without
193
+ charging; `pay-order` settles + triggers ticketing (asynchronous — poll `get-order` until status=TICKETED).
194
+
195
+ ```bash
196
+ # 1. Resolve a city/airport keyword to IATA codes.
197
+ agenzo-merchant-cli flight-flink find-airport --api-key "$API_KEY" --keyword "beijing"
198
+
199
+ # 2. Search one-way flights (trip-type 1=OW, 2=RT, 3=multi-city).
200
+ # journeys always carries ALL legs; for multi-city, relay --journey-id from each result.
201
+ agenzo-merchant-cli flight-flink search --api-key "$API_KEY" \
202
+ --trip-type 1 \
203
+ --journeys '[{"date":"2026-08-01","origin":"PEK","originType":"2","destination":"SHA","destinationType":"2"}]'
204
+
205
+ # 3. Verify price (returns authoritative product_token; if price_changed, re-confirm with user).
206
+ agenzo-merchant-cli flight-flink verify --api-key "$API_KEY" \
207
+ --product-token "$PRODUCT_TOKEN"
208
+
209
+ # 4. Create Order (write op: locks fare, NO charge; status → AWAITING_PAYMENT).
210
+ agenzo-merchant-cli flight-flink create-order --api-key "$API_KEY" --yes \
211
+ --product-token "$VERIFIED_TOKEN" \
212
+ --total-amount 1200.00 --currency CNY \
213
+ --contact-name "ZHANG SAN" --contact-region 86 \
214
+ --contact-phone "13800138000" --contact-email "a@example.com" \
215
+ --passengers '[{"firstName":"SAN","lastName":"ZHANG","gender":"1","birthday":"1990-01-01","id_type":"1","id_number":"E12345678","nationality":"CN","type":"adult","expiration":"2032-01-01"}]' \
216
+ --idempotency-key "flight-create-$(date +%s)"
217
+
218
+ # 5. Pay Order (settles + triggers ticketing; status → PAID).
219
+ agenzo-merchant-cli flight-flink pay-order --api-key "$API_KEY" --yes \
220
+ --order-no "$ORDER_NO" \
221
+ --idempotency-key "flight-pay-$(date +%s)"
222
+
223
+ # 6. Poll status until TICKETED (ticket_infos populated). Single-pax ~100s, multi-pax ~150s+.
224
+ agenzo-merchant-cli flight-flink get-order --api-key "$API_KEY" --order-no "$ORDER_NO" \
225
+ --watch --watch-interval 10 --watch-timeout 300
226
+
227
+ # 7. List flight orders (local read, pagination + optional status filter).
228
+ agenzo-merchant-cli flight-flink list-orders --api-key "$API_KEY" --page 1 --page-size 20
229
+
230
+ # 8. Cancel an un-ticketed order (ticketed orders → use refund-apply instead).
231
+ agenzo-merchant-cli flight-flink cancel-order --api-key "$API_KEY" --yes \
232
+ --order-no "$ORDER_NO" \
233
+ --idempotency-key "flight-cancel-$(date +%s)"
234
+
235
+ # 9. Change (rebooking): search → apply → detail; confirm via pay-order or cancel via change-cancel.
236
+ agenzo-merchant-cli flight-flink change-search --api-key "$API_KEY" \
237
+ --order-no "$ORDER_NO" --date 2026-08-05 --passenger P1 --segment-id S1
238
+ agenzo-merchant-cli flight-flink change-apply --api-key "$API_KEY" --yes \
239
+ --order-no "$ORDER_NO" --passenger P1 --segment-id S1 \
240
+ --product-token "$CHANGE_TOKEN" \
241
+ --contact-name "ZHANG SAN" --contact-region 86 --contact-phone 138 --contact-email a@b.com \
242
+ --idempotency-key "flight-change-$(date +%s)"
243
+
244
+ # 10. Refund: apply → detail → confirm (--confirm 1 to proceed, 2 to cancel).
245
+ agenzo-merchant-cli flight-flink refund-apply --api-key "$API_KEY" --yes \
246
+ --order-no "$ORDER_NO" --passenger P1 --segment-id S1 \
247
+ --reason-type 1 \
248
+ --contact-name "ZHANG SAN" --contact-region 86 --contact-phone 138 --contact-email a@b.com \
249
+ --idempotency-key "flight-refund-$(date +%s)"
250
+ agenzo-merchant-cli flight-flink refund-confirm --api-key "$API_KEY" --yes \
251
+ --refund-order-no "$REFUND_ORDER_NO" --confirm 1 \
252
+ --idempotency-key "flight-refund-confirm-$(date +%s)"
253
+ ```
254
+
185
255
  ## Global flags
186
256
 
187
257
  | Flag | Default | Description |
@@ -257,13 +327,15 @@ merchant-cli **has no host / config commands** and does not govern environments.
257
327
 
258
328
  ## Machine-readable verb schema
259
329
 
260
- Every `ride-elife` and `hotel-redaug` verb supports `--help --format json`, emitting that verb's machine-readable schema (`cli` / `noun` / `verb` / `description` / `flags` / `response` / `example`, some with `error_recovery` / `polling`):
330
+ Every `ride-elife`, `hotel-redaug`, and `flight-flink` verb supports `--help --format json`, emitting that verb's machine-readable schema (`cli` / `noun` / `verb` / `description` / `flags` / `response` / `example`, some with `error_recovery` / `polling`):
261
331
 
262
332
  ```bash
263
333
  agenzo-merchant-cli ride-elife quote --help --format json
264
334
  agenzo-merchant-cli ride-elife book --help --format json
265
335
  agenzo-merchant-cli hotel-redaug quote --help --format json
266
336
  agenzo-merchant-cli hotel-redaug create-order --help --format json # write verb: error_recovery
337
+ agenzo-merchant-cli flight-flink search --help --format json
338
+ agenzo-merchant-cli flight-flink create-order --help --format json
267
339
  agenzo-merchant-cli hotel-redaug pay-order --help --format json # write verb: error_recovery
268
340
  agenzo-merchant-cli hotel-redaug get --help --format json # long-running: polling block
269
341
  ```