import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient"; import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient"; import * as core from "../../../../core"; import type * as Square from "../../../index"; import { CustomAttributeDefinitionsClient } from "../resources/customAttributeDefinitions/client/Client"; import { CustomAttributesClient } from "../resources/customAttributes/client/Client"; export declare namespace OrdersClient { type Options = BaseClientOptions; interface RequestOptions extends BaseRequestOptions { } } export declare class OrdersClient { protected readonly _options: NormalizedClientOptionsWithAuth; protected _customAttributeDefinitions: CustomAttributeDefinitionsClient | undefined; protected _customAttributes: CustomAttributesClient | undefined; constructor(options?: OrdersClient.Options); get customAttributeDefinitions(): CustomAttributeDefinitionsClient; get customAttributes(): CustomAttributesClient; /** * Creates a new [order](entity:Order) that can include information about products for * purchase and settings to apply to the purchase. * * To pay for a created order, see * [Pay for Orders](https://developer.squareup.com/docs/orders-api/pay-for-orders). * * You can modify open orders using the [UpdateOrder](api-endpoint:Orders-UpdateOrder) endpoint. * * @param {Square.CreateOrderRequest} request * @param {OrdersClient.RequestOptions} requestOptions - Request-specific configuration. * * @example * await client.orders.create({ * order: { * locationId: "057P5VYJ4A5X1", * referenceId: "my-order-001", * lineItems: [{ * name: "New York Strip Steak", * quantity: "1", * basePriceMoney: { * amount: BigInt("1599"), * currency: "USD" * } * }, { * quantity: "2", * catalogObjectId: "BEMYCSMIJL46OCDV4KYIKXIB", * modifiers: [{ * catalogObjectId: "CHQX7Y4KY6N5KINJKZCFURPZ" * }], * appliedDiscounts: [{ * discountUid: "one-dollar-off" * }] * }], * taxes: [{ * uid: "state-sales-tax", * name: "State Sales Tax", * percentage: "9", * scope: "ORDER" * }], * discounts: [{ * uid: "labor-day-sale", * name: "Labor Day Sale", * percentage: "5", * scope: "ORDER" * }, { * uid: "membership-discount", * catalogObjectId: "DB7L55ZH2BGWI4H23ULIWOQ7", * scope: "ORDER" * }, { * uid: "one-dollar-off", * name: "Sale - $1.00 off", * amountMoney: { * amount: BigInt("100"), * currency: "USD" * }, * scope: "LINE_ITEM" * }] * }, * idempotencyKey: "8193148c-9586-11e6-99f9-28cfe92138cf" * }) */ create(request: Square.CreateOrderRequest, requestOptions?: OrdersClient.RequestOptions): core.HttpResponsePromise; private __create; /** * Retrieves a set of [orders](entity:Order) by their IDs. * * If a given order ID does not exist, the ID is ignored instead of generating an error. * * @param {Square.BatchGetOrdersRequest} request * @param {OrdersClient.RequestOptions} requestOptions - Request-specific configuration. * * @example * await client.orders.batchGet({ * locationId: "057P5VYJ4A5X1", * orderIds: ["CAISEM82RcpmcFBM0TfOyiHV3es", "CAISENgvlJ6jLWAzERDzjyHVybY"] * }) */ batchGet(request: Square.BatchGetOrdersRequest, requestOptions?: OrdersClient.RequestOptions): core.HttpResponsePromise; private __batchGet; /** * Enables applications to preview order pricing without creating an order. * * @param {Square.CalculateOrderRequest} request * @param {OrdersClient.RequestOptions} requestOptions - Request-specific configuration. * * @example * await client.orders.calculate({ * order: { * locationId: "D7AVYMEAPJ3A3", * lineItems: [{ * name: "Item 1", * quantity: "1", * basePriceMoney: { * amount: BigInt("500"), * currency: "USD" * } * }, { * name: "Item 2", * quantity: "2", * basePriceMoney: { * amount: BigInt("300"), * currency: "USD" * } * }], * discounts: [{ * name: "50% Off", * percentage: "50", * scope: "ORDER" * }] * } * }) */ calculate(request: Square.CalculateOrderRequest, requestOptions?: OrdersClient.RequestOptions): core.HttpResponsePromise; private __calculate; /** * Creates a new order, in the `DRAFT` state, by duplicating an existing order. The newly created order has * only the core fields (such as line items, taxes, and discounts) copied from the original order. * * @param {Square.CloneOrderRequest} request * @param {OrdersClient.RequestOptions} requestOptions - Request-specific configuration. * * @example * await client.orders.clone({ * orderId: "ZAISEM52YcpmcWAzERDOyiWS123", * version: 3, * idempotencyKey: "UNIQUE_STRING" * }) */ clone(request: Square.CloneOrderRequest, requestOptions?: OrdersClient.RequestOptions): core.HttpResponsePromise; private __clone; /** * Search all orders for one or more locations. Orders include all sales, * returns, and exchanges regardless of how or when they entered the Square * ecosystem (such as Point of Sale, Invoices, and Connect APIs). * * `SearchOrders` requests need to specify which locations to search and define a * [SearchOrdersQuery](entity:SearchOrdersQuery) object that controls * how to sort or filter the results. Your `SearchOrdersQuery` can: * * Set filter criteria. * Set the sort order. * Determine whether to return results as complete `Order` objects or as * [OrderEntry](entity:OrderEntry) objects. * * Note that details for orders processed with Square Point of Sale while in * offline mode might not be transmitted to Square for up to 72 hours. Offline * orders have a `created_at` value that reflects the time the order was * transmitted to Square and created server-side, not the time the order was * created on the Point of Sale device. * * @param {Square.SearchOrdersRequest} request * @param {OrdersClient.RequestOptions} requestOptions - Request-specific configuration. * * @example * await client.orders.search({ * locationIds: ["057P5VYJ4A5X1", "18YC4JDH91E1H"], * query: { * filter: { * stateFilter: { * states: ["COMPLETED"] * }, * dateTimeFilter: { * closedAt: { * startAt: "2018-03-03T20:00:00+00:00", * endAt: "2019-03-04T21:54:45+00:00" * } * } * }, * sort: { * sortField: "CLOSED_AT", * sortOrder: "DESC" * } * }, * limit: 3, * returnEntries: true * }) */ search(request?: Square.SearchOrdersRequest, requestOptions?: OrdersClient.RequestOptions): core.HttpResponsePromise; private __search; /** * Retrieves an [Order](entity:Order) by ID. * * @param {Square.GetOrdersRequest} request * @param {OrdersClient.RequestOptions} requestOptions - Request-specific configuration. * * @example * await client.orders.get({ * orderId: "order_id" * }) */ get(request: Square.GetOrdersRequest, requestOptions?: OrdersClient.RequestOptions): core.HttpResponsePromise; private __get; /** * Updates an open [order](entity:Order) by adding, replacing, or deleting * fields. Orders with a `COMPLETED` or `CANCELED` state cannot be updated. * * An `UpdateOrder` request requires the following: * * - The `order_id` in the endpoint path, identifying the order to update. * - The latest `version` of the order to update. * - The [sparse order](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders#sparse-order-objects) * containing only the fields to update and the version to which the update is * being applied. * - If deleting fields, the [dot notation paths](https://developer.squareup.com/docs/orders-api/manage-orders/update-orders#identifying-fields-to-delete) * identifying the fields to clear. * * To pay for an order, see * [Pay for Orders](https://developer.squareup.com/docs/orders-api/pay-for-orders). * * @param {Square.UpdateOrderRequest} request * @param {OrdersClient.RequestOptions} requestOptions - Request-specific configuration. * * @example * await client.orders.update({ * orderId: "order_id", * order: { * locationId: "location_id", * lineItems: [{ * uid: "cookie_uid", * name: "COOKIE", * quantity: "2", * basePriceMoney: { * amount: BigInt("200"), * currency: "USD" * } * }], * version: 1 * }, * fieldsToClear: ["discounts"], * idempotencyKey: "UNIQUE_STRING" * }) */ update(request: Square.UpdateOrderRequest, requestOptions?: OrdersClient.RequestOptions): core.HttpResponsePromise; private __update; /** * Pay for an [order](entity:Order) using one or more approved [payments](entity:Payment) * or settle an order with a total of `0`. * * The total of the `payment_ids` listed in the request must be equal to the order * total. Orders with a total amount of `0` can be marked as paid by specifying an empty * array of `payment_ids` in the request. * * To be used with `PayOrder`, a payment must: * * - Reference the order by specifying the `order_id` when [creating the payment](api-endpoint:Payments-CreatePayment). * Any approved payments that reference the same `order_id` not specified in the * `payment_ids` is canceled. * - Be approved with [delayed capture](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/delayed-capture). * Using a delayed capture payment with `PayOrder` completes the approved payment. * * @param {Square.PayOrderRequest} request * @param {OrdersClient.RequestOptions} requestOptions - Request-specific configuration. * * @example * await client.orders.pay({ * orderId: "order_id", * idempotencyKey: "c043a359-7ad9-4136-82a9-c3f1d66dcbff", * paymentIds: ["EnZdNAlWCmfh6Mt5FMNST1o7taB", "0LRiVlbXVwe8ozu4KbZxd12mvaB"] * }) */ pay(request: Square.PayOrderRequest, requestOptions?: OrdersClient.RequestOptions): core.HttpResponsePromise; private __pay; }