Orders: products run on a business. Add one to an existing business to go deeper, e.g. liens, litigations, bankruptcies, website and industry classification, KYC on the owners, documents or adverse media. Most products need a business_verification_verify (or identity) order first.

Products: business_verification_verify, business_verification_qualify, identity, tin, website, liens, ucc_liens, tax_liens, litigations, bankruptcies, adverse_media, enhanced_screenings, documents, kyc, kyc_doc_v, people_litigations, people_bankruptcies, people_ucc_liens, people_tax_liens, people_criminal_history, business_enrichment, email_risk, risk, international_business_verification.

Order statuses: created, pending, audited, completed, approved, rejected.

Functions

create-order

fn (business-id: Str, product: Str): Map
fn (business-id: Str, product: Str, opts: Map): Map
fn (business-id: Str, product: Str, opts: Map, options: Map): Map

POST /businesses/{id}/orders - Order a product on a business. opts: subproducts (e.g. ["industry_classification"] with website, or ["certificate_of_good_standing"] with documents), options (e.g. {person_match: true} with tin).

Example

::middesk::orders/create-order("biz_...", "liens")
::middesk::orders/create-order("biz_...", "website", {subproducts: ["industry_classification"]})

get-order

fn (order-id: Str): Map
fn (order-id: Str, options: Map): Map

GET /orders/{id} - Retrieve an order by id.

Example

order ::middesk::orders/get-order("ord_g7h8i9")
::middesk::orders/is-done(order)

is-done

fn (order: Any): Bool

True when an order has finished: status completed, audited, approved or rejected.

Example

::middesk::orders/is-done({status: "completed"})  // true
::middesk::orders/is-done({status: "pending"})  // false

list-orders

fn (business-id: Str): Map
fn (business-id: Str, params: Map): Map
fn (business-id: Str, params: Map, options: Map): Map

GET /businesses/{id}/orders - A business's orders. params: page, per_page, packages (Vec of products, comma joined).

Example

orders ::middesk::orders/list-orders("biz_a1b2c3", {packages: ["liens", "website"]})
map(orders.data, %.status)

order-body

fn (product: Str, opts: Map): Map

The body for create-order: {product, subproducts?, options?} with unset parts dropped. Exposed for testing.

Example

::middesk::orders/order-body("website", {subproducts: ["industry_classification"]})
// {product: "website", subproducts: ["industry_classification"]}

::middesk::orders/order-body("liens", {})  // {product: "liens"}

update-order

fn (order-id: Str, params: Map): Map
fn (order-id: Str, params: Map, options: Map): Map

PUT /orders/{id} - Set an order's assignee_id or status.

Example

::middesk::orders/update-order("ord_g7h8i9", {status: "approved"})