Order methods: cancel, confirm, deliver, dispute
The Order Verbs cancel, confirm, deliver, dispute as typed SDK methods, with inputs, result, refusals and an example.
Reference for Order, one group of Order methods.
Order.cancel
Cancel ends an Order before fulfillment and returns any payment in full. Verb page.
interface OrderVerbs {
cancel(input: OrderCancelInput, options?: SB.CallOptions): SB.Call<Order>
}Emits Order.canceled.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
order | Order | required | The unfulfilled Order. |
Returns
| Output | Type | Required | Description |
|---|---|---|---|
order | Order | required | The canceled Order. |
Refuses when
| Check | Error | Fix | Then call |
|---|---|---|---|
| The key is valid, but its scopes do not allow this operation. | forbidden | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |
| The record changed since it was read, so the write would overwrite a newer version. | conflict | Read the record again, then retry the write against its current state. | None. |
| The record is not in a state that allows this Verb, so the call is refused. | refused | Read the record, run the Verb that moves it to an allowed state, then retry. | None. |
Example
import { $ } from 'startup-builder'
const order = await $.Order.cancel({ order: 'order_dswDnxf2vt' })Order.confirm
Confirm records the Customer’s sign-off on delivered work, which closes the Order and earns the Startup its fee. Verb page.
interface OrderVerbs {
confirm(input: OrderConfirmInput, options?: SB.CallOptions): SB.Call<Order>
}Emits Order.confirmed.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
order | Order | required | The delivered Order. |
lines | json | The lines confirmed; every delivered line when absent. Each confirmed line bills on its own. |
Returns
| Output | Type | Required | Description |
|---|---|---|---|
order | Order | required | The closed Order. |
Refuses when
| Check | Error | Fix | Then call |
|---|---|---|---|
| The key is valid, but its scopes do not allow this operation. | forbidden | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |
| The record is not in a state that allows this Verb, so the call is refused. | refused | Read the record, run the Verb that moves it to an allowed state, then retry. | None. |
Example
import { $ } from 'startup-builder'
const order = await $.Order.confirm({ order: 'order_dswDnxf2vt' })Order.deliver
Deliver hands the finished work of a Service Order to its Customer and opens the acceptance window. Verb page.
interface OrderVerbs {
deliver(input: OrderDeliverInput, options?: SB.CallOptions): SB.Call<Order>
}Emits Order.delivered.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
order | Order | required | The Order whose work is done. |
work | json | required | The deliverable and its evidence. |
lines | json | The lines delivered; every open line when absent. Each delivered line opens its own acceptance window. |
Returns
| Output | Type | Required | Description |
|---|---|---|---|
order | Order | required | The delivered Order. |
Refuses when
| Check | Error | Fix | Then call |
|---|---|---|---|
| The key is valid, but its scopes do not allow this operation. | forbidden | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |
| The record is not in a state that allows this Verb, so the call is refused. | refused | Read the record, run the Verb that moves it to an allowed state, then retry. | None. |
Example
import { $ } from 'startup-builder'
const order = await $.Order.deliver({ order: 'order_dswDnxf2vt', work: {} })Order.dispute
Dispute contests a delivered Order under its Outcome Contract and starts the remedy the contract names. Verb page.
interface OrderVerbs {
dispute(input: OrderDisputeInput, options?: SB.CallOptions): SB.Call<Order>
}Emits Order.disputed.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
order | Order | required | The delivered Order. |
reason | text | required | What falls short of the promise. |
lines | json | The lines disputed; every delivered line when absent. Undisputed lines stay open to confirm. |
Returns
| Output | Type | Required | Description |
|---|---|---|---|
order | Order | required | The disputed Order. |
Refuses when
| Check | Error | Fix | Then call |
|---|---|---|---|
| The input does not match the schema of the operation. | invalid-input | Read the schema of the operation, then send every required field with the right type. | None. |
| The key is valid, but its scopes do not allow this operation. | forbidden | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |
| The record is not in a state that allows this Verb, so the call is refused. | refused | Read the record, run the Verb that moves it to an allowed state, then retry. | None. |
Example
import { $ } from 'startup-builder'
const order = await $.Order.dispute({ order: 'order_dswDnxf2vt', reason: 'Example reason' })