訂單
這一頁從系統實際的 tool 產生。授權項目是權杖要勾的項目;「核可」是 Agent 呼叫之後要不要等人在網站上核可。
order_cancel
取消訂單,和它還沒取消的請款單。
給 Agent 的原文
Cancel an order and all its bills that are not cancelled yet.
參數
| 名稱 | 型別 | 必填 | 說明 |
|---|---|---|---|
order | string | 必填 | Order number (OD-000001) or id |
reason | string | 必填 | |
idempotency_key | string | 必填 | Required for every call that writes (not for dry_run). The same key within 24 hours returns the first result instead of doing it again. |
授權項目:orders:cancel
order_create
成立訂單;issue_bill(預設 true)同時開一張全額的請款單,false 只成立訂單(之後用 bill_create 請款)。可以先試算看金額和到期日,不會建立任何東西。
給 Agent 的原文
Create an order; issue_bill (default true, needs bills:create) also issues a bill for the full amount, false creates the order only (bill it later with bill_create). Use dry_run to see the amounts and due date first without creating anything.
參數
| 名稱 | 型別 | 必填 | 說明 |
|---|---|---|---|
items | Item[] | 必填 | |
items[].name | string | 必填 | |
items[].unit_price | string | 必填 | Amount as a string, e.g. "12000" or "12.50" |
items[].quantity | integer | default: 1 | |
items[].discount | Discount(可以是 null) | ||
items[].description | string | ||
items[].ref | string | Item code in an external system | |
currency | string(可以是 null) | Empty uses the default currency of the workspace | |
locale | string(可以是 null) | ||
tax_included | boolean | default: true | |
tax_type | TAXABLE | ZERO_RATED | EXEMPT | default: "TAXABLE" | |
buyer | Buyer(可以是 null) | ||
buyer.legal_name | string | Empty uses the customer name | |
buyer.tax_id | string | ||
buyer.address | string | ||
buyer.primary_email | string | ||
buyer.cc_emails | string[] | default: [] | |
notes | string(可以是 null) | Empty uses the default notes of the locale | |
customer | Customer(可以是 null) | Required unless customer_id is given, also for dry_run (missing returns VALUE_REQUIRED, field customer.name) | |
customer.name | string | 必填 | |
customer.ref | string | Customer code in an external system; only stored and used for filtering | |
customer_id | string(可以是 null) | Customer number or id (needs customers:read): customer and buyer fields you leave out are filled from the customer | |
issue_bill | boolean | Also issue a bill for the full amount (needs bills:create); false creates the order only default: true | |
due_date | date(可以是 null) | Due date of the bill; empty uses the default payment term; not allowed with issue_bill: false | |
agent_note | string | ||
metadata | MetadataEntry[](可以是 null) | ||
metadata[].key | string | 必填 | |
metadata[].value | string | 必填 | |
online_payment | boolean(可以是 null) | Omitted: true when the workspace has an active payment gateway | |
bank_transfer | BankTransfer(可以是 null) | Omitted uses the bank transfer in settings; null means no bank transfer | |
bank_transfer.bank_code | string | 必填 | |
bank_transfer.account_number | string | 必填 | |
bank_transfer.account_name | string | 必填 | |
bank_transfer.bank_name | string | ||
bank_transfer.branch | string | ||
dry_run | boolean | default: false | |
idempotency_key | string | Required for every call that writes (not for dry_run). The same key within 24 hours returns the first result instead of doing it again. |
授權項目:orders:create;issue_bill 是 true(沒帶也是)時,另外要 bills:create;帶 customer_id 從客戶帶入資料時,另外要 customers:read。
order_get
用編號(OD-000001)或 id 查一張訂單,附 version 和 allowed_actions。
給 Agent 的原文
Get one order by number (OD-000001) or id, with its version and allowed_actions.
參數
| 名稱 | 型別 | 必填 | 說明 |
|---|---|---|---|
order | string | 必填 | Order number (OD-000001) or id |
授權項目:orders:read
order_search
查訂單,新的在前;回摘要,要一張訂單和它的請款單用 order_get。
給 Agent 的原文
Search orders, newest first. Returns summaries; use order_get for one order and its bills.
參數
| 名稱 | 型別 | 必填 | 說明 |
|---|---|---|---|
limit | integer | 1 to 100 default: 20 | |
cursor | string(可以是 null) | next_cursor from the previous page | |
keyword | string | Part of the order/bill number or customer name; an email or phone needs pii:read | |
item_name | string | ||
customer_ref | string(可以是 null) | ||
status | CONFIRMED | CANCELLED(可以是 null) | ||
created_from | date(可以是 null) | ||
created_to | date(可以是 null) | ||
billing_status | UNBILLED | PARTIALLY_BILLED | BILLED[](可以是 null) | Any of these billing statuses (cancelled orders match none) |
授權項目:orders:read;keyword 像 Email 或電話時,另外要 pii:read。
order_send
寄訂單確認信給訂單上的買方:品項、金額、付款方式和每張請款單的連結。寄出前要先試算,把結果給使用者看、問過使用者,再帶試算給的確認碼寄。
給 Agent 的原文
Email an order confirmation to the buyer on the order (primary email and CC): items, totals, payment methods and bank transfer details, and a link to each bill of the order that is not cancelled. No attachment. Cancelled orders cannot be sent. Before sending, call with dry_run: true, show the user the order, bills and recipients, and ask whether to send; then call again with the confirmation_code from the dry run.
參數
| 名稱 | 型別 | 必填 | 說明 |
|---|---|---|---|
order | string | 必填 | Order number (OD-000001) or id |
message | string | A note added to the email, up to 1,000 characters | |
dry_run | boolean | default: false | |
confirmation_code | string(可以是 null) | Required unless dry_run is true: the confirmation_code returned by a dry run with the same parameters. | |
idempotency_key | string | Required for every call that writes (not for dry_run). The same key within 24 hours returns the first result instead of doing it again. |
授權項目:orders:send
order_update
改訂單的客戶、買方、備註和付款方式(有請款單付清或開了發票就不能改),要帶 order_get 拿到的 version。
給 Agent 的原文
Change the customer, buyer, notes and payment options of an order (not when a bill is paid or an e-invoice is issued). Send the version from order_get.
參數
| 名稱 | 型別 | 必填 | 說明 |
|---|---|---|---|
order | string | 必填 | Order number (OD-000001) or id |
version | integer | 必填 | |
customer | Customer | 必填 | |
customer.name | string | 必填 | |
customer.ref | string | Customer code in an external system; only stored and used for filtering | |
buyer | Buyer | 必填 | |
buyer.legal_name | string | Empty uses the customer name | |
buyer.tax_id | string | ||
buyer.address | string | ||
buyer.primary_email | string | ||
buyer.cc_emails | string[] | default: [] | |
notes | string | 必填 | |
online_payment | boolean | 必填 | |
bank_transfer | BankTransfer(可以是 null) | 必填 | |
bank_transfer.bank_code | string | 必填 | |
bank_transfer.account_number | string | 必填 | |
bank_transfer.account_name | string | 必填 | |
bank_transfer.bank_name | string | ||
bank_transfer.branch | string | ||
idempotency_key | string | 必填 | Required for every call that writes (not for dry_run). The same key within 24 hours returns the first result instead of doing it again. |
授權項目:orders:update、pii:read
order_update_agent_data
換掉訂單上給 agent 用的備註和 metadata;網站、PDF、分享頁都不顯示,不用帶 version。
給 Agent 的原文
Replace the agent note and metadata of an order. Not shown on the website, PDF or share page; no version needed.
參數
| 名稱 | 型別 | 必填 | 說明 |
|---|---|---|---|
agent_note | string | 必填 | |
metadata | MetadataEntry[] | 必填 | |
metadata[].key | string | 必填 | |
metadata[].value | string | 必填 | |
order | string | 必填 | Order number (OD-000001) or id |
idempotency_key | string | 必填 | Required for every call that writes (not for dry_run). The same key within 24 hours returns the first result instead of doing it again. |
授權項目:orders:update