Skip to content

Instantly share code, notes, and snippets.

@panoply
Last active January 29, 2024 10:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save panoply/810d1c3a2df5fae099df37f528b82703 to your computer and use it in GitHub Desktop.
Save panoply/810d1c3a2df5fae099df37f528b82703 to your computer and use it in GitHub Desktop.
Centra REST Defintions
/* -------------------------------------------- */
/* UTILITIES */
/* -------------------------------------------- */
type Primitive = (
| null
| undefined
| string
| number
| boolean
| symbol
| bigint;
)
type LiteralUnion<
LiteralType,
BaseType extends Primitive
> = LiteralType | (BaseType & Record<never, never>);
/**
* 2 Letter Country Codes
*/
export type CountryCodes = LiteralUnion<(
/** Andorra */
'AD' |
/** United Arab Emirates */
'AE' |
/** Afghanistan */
'AF' |
/** Antigua And Barbuda */
'AG' |
/** Anguilla */
'AI' |
/** Albania */
'AL' |
/** Armenia */
'AM' |
/** Angola */
'AO' |
/** Argentina */
'AR' |
/** American Samoa */
'AS' |
/** Austria */
'AT' |
/** Australia */
'AU' |
/** Aruba */
'AW' |
/** Aland Islands */
'AX' |
/** Azerbaijan */
'AZ' |
/** Bosnia And Herzegovina */
'BA' |
/** Barbados */
'BB' |
/** Bangladesh */
'BD' |
/** Belgium */
'BE' |
/** Burkina Faso */
'BF' |
/** Bulgaria */
'BG' |
/** Bahrain */
'BH' |
/** Burundi */
'BI' |
/** Benin */
'BJ' |
/** Saint Barthelemy */
'BL' |
/** Bermuda */
'BM' |
/** Brunei Darussalam */
'BN' |
/** Bolivia | Plurinational State */
'BO' |
/** Bonaire Sint Eustatius And Saba */
'BQ' |
/** Brazil */
'BR' |
/** Bahamas */
'BS' |
/** Bhutan */
'BT' |
/** Bouvet Island */
'BV' |
/** Botswana */
'BW' |
/** Belarus */
'BY' |
/** Belize */
'BZ' |
/** Canada */
'CA' |
/** Cocos Keeling Islands */
'CC' |
/** Congo The Democratic Republic */
'CD' |
/** Central African Republic */
'CF' |
/** The Congo */
'CG' |
/** Switzerland */
'CH' |
/** Cote Divoire */
'CI' |
/** Cook Islands */
'CK' |
/** Chile */
'CL' |
/** Cameroon */
'CM' |
/** China */
'CN' |
/** Colombia */
'CO' |
/** Costa Rica */
'CR' |
/** Cuba */
'CU' |
/** Cabo Verde */
'CV' |
/** Curacao */
'CW' |
/** Christmas Island */
'CX' |
/** Cyprus */
'CY' |
/** Czech Republic */
'CZ' |
/** Germany */
'DE' |
/** Djibouti */
'DJ' |
/** Denmark */
'DK' |
/** Dominica */
'DM' |
/** Dominican Republic */
'DO' |
/** Algeria **/
'DZ' |
/** Ecuador */
'EC' |
/** Estonia */
'EE' |
/** Egypt */
'EG' |
/** Western Sahara */
'EH' |
/** Eritrea */
'ER' |
/** Spain */
'ES' |
/** Ethiopia */
'ET' |
/** Finland */
'FI' |
/** Fiji */
'FJ' |
/** Falkland Islands Malvinas */
'FK' |
/** Micronesia Federated States */
'FM' |
/** Faroe Islands */
'FO' |
/** France */
'FR' |
/** Gabon */
'GA' |
/** United Kingdom Of Great Britain and Northern Ireland */
'GB' |
/** Grenada */
'GD' |
/** Georgia */
'GE' |
/** French Guiana */
'GF' |
/** Guernsey */
'GG' |
/** Ghana */
'GH' |
/** Gibraltar */
'GI' |
/** Greenland */
'GL' |
/** Gambia */
'GM' |
/** Guinea */
'GN' |
/** Guadeloupe */
'GP' |
/** Equatorial Guinea */
'GQ' |
/** Greece */
'GR' |
/** South Georgia and The South Sandwich Islands */
'GS' |
/** Guatemala */
'GT' |
/** Guam */
'GU' |
/** Guinea Bissau */
'GW' |
/** Guyana */
'GY' |
/** Hong Kong */
'HK' |
/** Heard Island And Mcdonald Islands */
'HM' |
/** Honduras */
'HN' |
/** Croatia */
'HR' |
/** Haiti */
'HT' |
/** Hungary */
'HU' |
/** Indonesia */
'ID' |
/** Ireland */
'IE' |
/** Israel */
'IL' |
/** Isle Of Man */
'IM' |
/** India (Indian Rupee) */
'IN' |
/** British Indian Ocean Territory */
'IO' |
/** Iraq */
'IQ' |
/** Iran Islamic Republic */
'IR' |
/** Iceland */
'IS' |
/** Italy */
'IT' |
/** Jersey */
'JE' |
/** Jamaica */
'JM' |
/** Jordan */
'JO' |
/** Japan */
'JP' |
/** Kenya */
'KE' |
/** Kazakhstan */
'KG' |
/** Cambodia */
'KH' |
/** Kiribati */
'KI' |
/** Comoros */
'KM' |
/** Saint Kitts And Nevis */
'KN' |
/** North Korea */
'KP' |
/** Korea The Republic Of */
'KR' |
/** Kuwait */
'KW' |
/** Cayman Islands */
'KY' |
/** Kazakhstan */
'KZ' |
/** Lao Peoples Democratic Republic */
'LA' |
/** Lebanon */
'LB' |
/** Saint Lucia */
'LC' |
/** Liechtenstein */
'LI' |
/** Sri Lanka */
'LK' |
/** Liberia */
'LR' |
/** Lesotho */
'LS' |
/** Lithuania */
'LT' |
/** Luxembourg */
'LU' |
/** Latvia */
'LV' |
/** Libya */
'LY' |
/** Morocco */
'MA' |
/** Monaco */
'MC' |
/** Moldova Republic */
'MD' |
/** Montenegro */
'ME' |
/** Saint Martin French Part */
'MF' |
/** Madagascar */
'MG' |
/** Marshall Islands */
'MH' |
/** Republic Of North Macedonia */
'MK' |
/** Mali */
'ML' |
/** Myanmar */
'MM' |
/** Mongolia */
'MN' |
/** Macao (Pataca) */
'MO' |
/** Northern Mariana Islands */
'MP' |
/** Martinique */
'MQ' |
/** Mauritania */
'MR' |
/** Montserrat */
'MS' |
/** Malta */
'MT' |
/** Mauritius */
'MU' |
/** Maldives */
'MV' |
/** Malawi */
'MW' |
/** Mexico */
'MX' |
/** Malaysia */
'MY' |
/** Mozambique */
'MZ' |
/** Namibia */
'NA' |
/** New Caledonia */
'NC' |
/** Niger */
'NE' |
/** Norfolk Island */
'NF' |
/** Nigeria */
'NG' |
/** Nicaragua */
'NI' |
/** Netherlands */
'NL' |
/** Norway */
'NO' |
/** Nepal */
'NP' |
/** Nauru */
'NR' |
/** Niue */
'NU' |
/** New Zealand */
'NZ' |
/** Oman */
'OM' |
/** Panama */
'PA' |
/** Peru */
'PE' |
/** French Polynesia */
'PF' |
/** Papua New Guinea */
'PG' |
/** Philippines */
'PH' |
/** Pakistan */
'PK' |
/** Poland */
'PL' |
/** Saint Pierre and Miquelon */
'PM' |
/** Pitcairn */
'PN' |
/** Puerto Rico */
'PR' |
/** Palestine */
'PS' |
/** Portugal */
'PT' |
/** Palau */
'PW' |
/** Paraguay */
'PY' |
/** Qatar */
'QA' |
/** Reunion */
'RE' |
/** Romania */
'RO' |
/** Serbia */
'RS' |
/** Russian Federation */
'RU' |
/** Rwanda */
'RW' |
/** Saudi Arabia */
'SA' |
/** Solomon Islands */
'SB' |
/** Seychelles */
'SC' |
/** Sudan */
'SD' |
/** Sweden */
'SE' |
/** Singapore (Singapore Dollar) */
'SG' |
/** Saint Helena Ascension And Tristan Da Cunha */
'SH' |
/** Slovenia */
'SI' |
/** Svalbard and Jan Mayen */
'SJ' |
/** Slovakia */
'SK' |
/** Sierra Leone */
'SL' |
/** San Marino */
'SM' |
/** Senegal */
'SN' |
/** Somalia */
'SO' |
/** Suriname */
'SR' |
/** South Sudan */
'SS' |
/** Sao Tome And Principe */
'ST' |
/** El Salvador */
'SV' |
/** Sint Maarten */
'SX' |
/** Syrian Arab Republic */
'SY' |
/** Swaziland */
'SZ' |
/** Turks And Caicos Islands */
'TC' |
/** Chad */
'TD' |
/** French Southern Territories */
'TF' |
/** Togo */
'TG' |
/** Thailand */
'TH' |
/** Tajikistan */
'TJ' |
/** Tokelau */
'TK' |
/** Timor Leste */
'TL' |
/** Turkmenistan */
'TM' |
/** Tunisia */
'TN' |
/** Tonga */
'TO' |
/** Turkey */
'TR' |
/** Trinidad And Tobago */
'TT' |
/** Tuvalu */
'TV' |
/** Taiwan */
'TW' |
/** Tanzania United Republic */
'TZ' |
/** Ukraine */
'UA' |
/** Uganda */
'UG' |
/** United States Minor Outlying Islands */
'UM' |
/** United States Of America */
'US' |
/** Uruguay */
'UY' |
/** Uzbekistan */
'UZ' |
/** Holy See */
'VA' |
/** Saint Vincent And The Grenadines */
'VC' |
/** Virgin Islands | British */
'VG' |
/** Virgin Islands | U.S */
'VI' |
/** Viet Nam */
'VN' |
/** Vanuatu */
'VU' |
/** Wallis And Futuna */
'WF' |
/** Republic of Kosovo */
'XK' |
/** Samoa */
'WS' |
/** Yemen */
'YE' |
/** Mayotte */
'YT' |
/** South Africa */
'ZA' |
/** Zambia */
'ZM' |
/** Zimbabwe */
'ZW'
), string>;
/* -------------------------------------------- */
/* BRANDS */
/* -------------------------------------------- */
/**
* **Brand**
*
* The data model for brand/s returned by both the **Checkout API** and **Shop API** endpoints.
*
* ---
*
* Centa Documentation:
*
* - [Shop API](https://docs.centra.com/api-references/shop-api/api-reference/get_brands)
*
* Centra Swagger UI:
*
* - [Checkout API](https://bit.ly/centra-checkout-api--brands)
* - [Shop API](https://bit.ly/centra-shop-api--brands)
*/
export declare interface IBrand {
/**
* The name of the brand.
*/
name: string;
/**
* The ID of the brand.
*/
brand: string;
/**
* The URI of the brand.
*/
uri: string;
/**
* Meta data about the brand.
*/
metaKeywords: string;
/**
* Meta data about the brand.
*/
metaDescription: string;
/**
* Meta data about the brand.
*/
metaTitle: string;
}
/**
* **Brands** (Checkout API)
*
* The **Response** returned by the **Checkout API** endpoints following a POST Request.
*
* @see {@link IBrand}
*/
export declare interface IBrands {
/**
* The session token that of the API.
*/
token: string;
/**
* An array list of Brands
*
* @see {IBrand}
*/
brands: IBrand[];
}
/* -------------------------------------------- */
/* CATEGORY */
/* -------------------------------------------- */
/**
* **Category**
*
* The data model for categories returned by both the **Checkout API** and **Shop API** endpoints.
*
* ---
*
* Centra Documentation:
*
* - [Shop API](https://docs.centra.com/api-references/shop-api/api-reference/get-categories)
*
* Centra Swagger UI:
*
* - [Checkout API](https://bit.ly/centra-checkout-api--categories)
* - [Shop API](https://bit.ly/centra-shop-api--categories)
*/
export declare interface ICategory {
/**
* The name of the category.
*/
name: string;
/**
* The ID of the category.
*/
category: string;
/**
* The URI for this category.
*/
uri: string;
/**
* The complete URI for this category including parent categories.
*/
completeUri: string;
/**
* Meta data about the category.
*/
metaKeywords: string;
/**
* Meta data about the category.
*/
metaDescription: string;
/**
* Meta data about the category.
*/
metaTitle: string;
/**
* Information about localized versions of the category information.
* The key values in the list are the localization URIs, such as en, fr, sv etc.
*
* `"localized": {"sv": {"name": "Byxor"}}` the Swedish category name is “Byxor”.
*/
localized: {
[languageCode: string]: {
/**
* The name of the category in the localized language.
*/
name: string
/**
* An optional string that might have a localized translation
* in the language object.
*/
metaKeywords: string
/**
* An optional string that might have a localized translation
* in the language object.
*/
metaDescription: string
/**
* An optional string that might have a localized translation
* in the language object.
*/
metaTitle: string
}
}
/**
* A list of nested category objects.
* The keys in the object is the `categoryId` of the nested category.
*
* _The objects in the list has the same parameters as the parent category._
*/
categories: object;
/**
* A list of productId for products in this category.
*/
products: string[];
/**
* Sort Order
*
* > **NOTE**
* >
* > No specification for this key exisits in Centra documentation
*/
sortOrder?: number
/**
* Sort String
*
* > **NOTE**
* >
* > No specification for this key exisits in Centra documentation
*/
sortString?: string;
/**
* A list of productId of products
*
* > **NOTE**
* >
* > No specification for this key exisits in Centra documentation
*/
primaryProducts?: string[];
}
/**
* **Categories** (Checkout API)
*
* The **Response** returned by the **Checkout API** endpoints following a POST Request.
*
* @see {@link IPricelist}
*/
export declare interface ICategories {
/**
* The session token that of the API.
*/
token: string;
/**
* An array list of Categories
*
* @see {ICategory}
*/
categories: ICategory[];
}
/* -------------------------------------------- */
/* COLLECTIONS */
/* -------------------------------------------- */
/**
* **Collection**
*
* The data model for collections returned by both the **Checkout API** and **Shop API** endpoints.
*
* ---
*
* Centra Documentation:
*
* - [Shop API](https://docs.centra.com/api-references/shop-api/api-reference/get-collections)
*
* Centra Swagger UI:
*
* - [Checkout API](https://bit.ly/centra-checkout-api--collections)
* - [Shop API](https://bit.ly/centra-shop-api--collections)
*
*/
export declare interface ICollection {
/**
* The name of the collection.
*/
name: string;
/**
* The ID of the collection.
*/
collection: string;
/**
* The URI for this collection.
*/
uri: string;
}
/**
* **Collections** (Checkout API)
*
* The **Response** returned by the **Checkout API** endpoints following a POST Request.
*
* @see {@link ICollection}
*/
export declare interface ICollections {
/**
* The session token that of the API.
*/
token: string;
/**
* An array list of Collections
*
* @see {ICollection}
*/
collections: ICollection[];
}
/* -------------------------------------------- */
/* MARKETS */
/* -------------------------------------------- */
/**
* **Market**
*
* The data model for markets returned by both the **Checkout API** and **Shop API** endpoints.
*
* ---
*
* Centra Swagger UI:
*
* - [Checkout API](https://bit.ly/centra-checkout-api--markets)
* - [Shop API](https://bit.ly/centra-shop-api--markets)
*/
export declare interface IMarket {
/**
* The market ID
*/
market: string;
/**
* Name of th market
*/
name: string;
/**
* Two letter ISO code of countries
*/
countries: string[];
/**
* Product internal IDs
*/
products: string[];
}
/**
* **Markets** (Checkout API)
*
* The **Response** returned by the **Checkout API** endpoints following a POST Request.
*
* @see {@link IMarket}
*/
export declare interface IMarkets {
/**
* The session token that of the API.
*/
token: string;
/**
* An array list of Markets
*
* @see {IMarket}
*/
markets: IMarket[];
}
/* -------------------------------------------- */
/* PRICELISTS */
/* -------------------------------------------- */
/**
* **Pricelist**
*
* The data model for pricelists returned by both the **Checkout API** and **Shop API** endpoints.
*
* ---
*
* Centra Swagger UI:
*
* - [Checkout API](https://bit.ly/centra-checkout-api--pricelists)
* - [Shop API](https://bit.ly/centra-shop-api--pricelists)
*/
export declare interface IPricelist {
/**
* The Pricelist id.
*/
id: string
/**
* The name of pricelist
*/
name: string
/**
* If the pricelist is the default fallback one for the store
*/
default: string
/**
* The currency modal
*/
currency: {
/**
* Currency code (ISO 4217)
*
* @example
* 'EUR'
* 'SEK'
*/
currency: string;
/**
* Name of currency
*/
name: string;
/**
* Prefix used for rendering a price
*
* @default ''
* @example
* '$ '
* '€ '
*/
prefix: string;
/**
* Suffix used for rendering a price
*
* @example
* ' USD'
* ' SEK'
* ' kr.'
*/
suffix: string;
/**
* String to separate integers from decimals
*
* @default '.'
* @example
* '200.00'
* '100.25'
*/
decimalPoint: string;
/**
* Amount of decimals to be rendered
*
* @example
* // assuming value is 2
* '100.00'
*
* // assuming value is 1
* '100.0'
*/
decimalDigits: string;
/**
* Shortname for the currency
*/
uri: string;
}
}
/**
* **Pricelists** (Checkout API)
*
* The **Response** returned by the **Checkout API** endpoints following a POST Request.
*
* @see {@link IPricelist}
*/
export declare interface IPricelists {
/**
* The session token that of the API.
*/
token: string;
/**
* An array list of warehouses
*
* @see {IPricelist}
*/
pricelists: IPricelist[];
}
/* -------------------------------------------- */
/* WAREHOUSES */
/* -------------------------------------------- */
/**
* **Warehouse**
*
* The data model for warehouses returned by both the **Checkout API** and **Shop API** endpoints.
*
* ---
*
* Centra Swagger UI:
*
* - [Checkout API](https://bit.ly/centra-checkout-api--warehouses)
* - [Shop API](https://bit.ly/centra-shop-api--warehouses)
*/
export declare interface IWarehouse {
/**
* Warehouse name
*/
name: number;
/**
* Warehouse ID
*/
warehouse: number;
}
/**
* **Warehouses** (Checkout API)
*
* The **Response** returned by the **Checkout API** endpoints following a POST Request.
*
* @see {@link IWarehouse}
*/
export declare interface IWarehouses {
/**
* The session token that of the API.
*/
token: string;
/**
* An array list of warehouses
*
* @see {IWarehouse}
*/
warehouses: IWarehouse[];
}
/* -------------------------------------------- */
/* PRODUCT */
/* -------------------------------------------- */
/**
* **Product Item Warehouse**
*
* Represents a warehouse on `warehouses[]` contained within `product.items[]` model.
*
* @see {@link IProductItem}
*/
export declare interface IProductItemWarehouse {
/**
* Warehouse ID
*/
warehouse: number;
/**
* Stock quantity
*/
stock: number;
}
/**
* **Product Item**
*
* Represents an item on `items[]` contained within `product` model.
*
* @see {@link IProduct}
*/
export declare interface IProductItem {
/**
* Size ID
*/
sizeId: string;
/**
* Item ID
*/
item: string;
/**
* EAN for this item
*/
ean: string;
/**
* Position on Y-axis of itemTable
*/
itemTableY: number;
/**
* Position on X-axis of itemTable
*/
itemTableX: number;
/**
* Size description, eg: XS, Onesize etc
*/
name: string;
/**
* Product item SKU. This value is uses a combination of `sku`, `variantSku` and `sizeSku`.
*/
sku: string;
/**
*
* If no visibility limit set, the amount of stock left, eg:
*
* - `1`
*
* If visibility limit set, the maximum visible limit, like:
*
* - `15+`
*
* Different settings depending on visibility limit of the Centra
* store settings. Possible values:
*
* - `'preorder'`
* - `'infinite'`
* - `'yes'`
* - `'no'`
* - `'few'`
*/
stock: number | string | 'preorder' | 'infinite' | 'yes' | 'no' | 'few';
/**
* Stock quantities per published warehouse in
* the Checkout plugin. Requires shared secret.
*/
warehouses: IProductItemWarehouse[]
}
/**
* **Product**
*
* The data model for each product returned by the **Checkout API** endpoint.
*
* ---
*
* Centra Documentation:
*
* - [Checkout API](https://bit.ly/centra-docs-checkout-api--products)
*
* Centra Swagger UI:
*
* - [Checkout API](https://bit.ly/centra-checkout-api--products)
*/
export declare interface IProduct {
/**
* Product Display Item ID
*/
product: string;
/**
* Product Display Name
*/
name: string;
/**
* Product URI. Unique URI for the product
*/
uri: string;
/**
* The specific variant SKU.
* Either only Product or a combination of Product+Variant.
*/
sku: string;
/**
* Product SKU
*/
productSku: string;
/**
* Brand ID
*/
brand: string;
/**
* Brand name
*/
brandName: string;
/**
* Brand URI. Unique URI for the brand
*/
brandUri: string;
/**
* Collection ID
*/
collection: string;
/**
* Collection name
*/
collectionName: string;
/**
* Collection URI. Unique URI for the collection
*/
collectionUri: string;
/**
* Variant Name
*/
variantName: string;
/**
* Country ISO 3166-1 alpha-2, for example SE. Product Origin
*/
countryOfOrigin: string;
/**
* Short description of the product
*/
excerpt: string;
/**
* Short description of the product, formatted as HTML
*/
excerptHtml: string;
/**
* Description of the product
*/
description: string;
/**
* Description of the product, formatted as HTML
*/
descriptionHtml: string;
/**
* Meta title for the product page
*/
metaTitle: string;
/**
* Meta description for the product page
*/
metaDescription: string;
/**
* Meta keywords for the product page
*/
metaKeywords: string;
/**
* The stock unit for this product, default empty
*/
stockUnit: string;
/**
* Category ID for the canonical category
*/
category: string;
/**
* Category name for the canonical category,
* each sub category name as an element. Root category first.
*/
categoryName: string[];
/**
* Datetime, "YYYY-MM-DD HH:ii:ss" like "2015-12-24 13:25:01"
*/
createdAt: string;
/**
* Date of modification
*/
modifiedAt: string;
/**
* Category URI for the canonical category
*/
categoryUri: string;
/**
* Product ID in Centra
*/
centraProduct: string;
/**
* Variant ID in Centra
*/
centraVariant: string;
/**
* Default 1, minimum allowed quantity for purchase
*/
itemQuantityMinimum: number;
/**
* Default 1, allowed quantity multiple for purchase
*/
itemQuantityMultipleOf: string;
/**
* The price after discounts for this product in this pricelist
* represented as a string with the proper currency formatting.
*/
price: string;
/**
* Price value as a float, example: `14.11`.
* Price for the product
*/
priceAsNumber: number;
/**
* Price value as a float, example: `14.11?.
* Price before discount
*/
priceBeforeDiscountAsNumber: number;
/**
* Formatted price with currency prefix/suffix.
* Price before discount
*/
priceBeforeDiscount: number;
/**
* Percent of discount on this product's price
*/
discountPercent: number;
/**
* If product should be marked with sale
*/
showAsOnSale: boolean;
/**
* If product should be marked with new
*/
showAsNew: boolean;
/**
* If any item for this product is available for purchase
*/
available: boolean;
/**
* If product is in preview mode or not
*/
preview: boolean;
/**
* Size table to sort sizes properly, supports
* both X and Y axes.
*/
itemTable: {
/**
* Size table units
*/
unit: string;
/**
* Each X-axis
*/
x: string[];
/**
* Each Y-axis
*/
y: string[];
/**
* The divider between X and Y
*/
dividerSymbol: string;
},
/**
* The product variant items
*
* ---
*
* @see {@link IProductItem}
*/
items: IProductItem[];
/**
* Smaller category object compared to CategoryModel,
* used for products.
*/
categories: Array<{
/**
* Category ID
*/
category: string;
/**
* Sort order for the product in this category
*/
sortOrder:number;
/**
* Each sub category name as an element. Root category first.
*/
name: string[],
/**
* Full category URI
*/
uri: string
}>,
/**
* For each image size key, an array with URLs to
* the images for the product
*/
media: { [size: string]: string[] },
/**
* Measurement chart of the product
*/
measurementChart: {
/**
* Removed if `measurementChart=false` for product list,
* always on single product view.
*/
description?: string;
/**
* The unit for the measurement chart
*/
unit: string;
/**
* Chart contents
*/
contents: Array<{
/**
* The location in the table on the X-axis
*/
x: string[],
/**
* The location in the table on the Y-axis
*/
y: string[],
/**
* The content for this matrix item
*/
content: string
}>,
/**
* Header for each X-axis column.
*/
x: string[],
/**
* Header for each Y-axis column.
*/
y: string[]
},
/**
* What type of relation type this product has
*/
relation: string;
/**
* If the product has relations. If `relatedProducts=true` the
* full product model is used, else a small object containing
* information about the related product and its availability is shown.
*/
relatedProducts: IProduct | {
/**
* Product Item ID
*/
product: string;
/**
* If any item for this product is available for purchase
*/
avaiable: boolean
/**
* For each image size key, an array with URLs to the
* images for the product
*/
media: { [size: string]: string[] }
/**
* What type of relation type this product has.
* Default is `variant`
*/
relation: string
};
/**
* Bundle information object
*/
bundleInfo: {
/**
* bundle id
*/
bundle: number;
/**
* Possible values: 'fixed', 'flexible'
*/
type: LiteralUnion<'fixed' | 'flexible', string>;
/**
* Possible values: 'static', 'dynamic
*/
priceType: LiteralUnion<'static' | 'dynamic', string>;
/**
* Minimal sum of item prices inside the bundle when bought alone
*/
priceOfItems: string;
/**
* Number. Minimal sum of item prices inside the bundle when bought alone
*/
priceOfItemsAsNumber: number;
/**
* Currency formatted minimal price for this bundle
*/
minPrice: string
/**
* Minimal price for this bundle
*/
minPriceAsNumber: number
/**
* Currency formatted maximal price for this bundle
*/
maxPrice: string
/**
* Number. Maximal price for this bundle
*/
maxPriceAsNumber: number
}
}
/**
* **Products Filter** (Checkout API)
*
* The JSON body to filter and search products for the **Checkout API** endpoints following a POST Request.
*
* ---
*
* Documentation (centra.dev):
*
* - [Checkout API](https://centra.dev/docs/checkout-api/api-reference#products-endpoint)
*
* Centra Swagger UI:
*
* - [Checkout API](https://docs.centra.com/swagger-ui/?api=CheckoutAPI#/5.%20product%20catalog/post_products)
*
*/
export declare interface IProductsFilter {
/**
* Skip the first number of products, useful together with `limit`
*/
skipFirst?: number,
/**
* Return no more than this amount of products
*/
limit?: 10,
/**
* Returns products with these ids
*/
products?: string[] | number[];
/**
* Category ID or array of Category IDs. Filter to products in these categories, including subcategories
*/
categories?: number | number[],
/**
* Collection ID or array of Category IDs. Filter to products only in these collections
*/
collections?: number[],
/**
* Returns products in of these brand ids
*/
brands?: [1, 2, 3],
/**
* Centra Product ID
*/
centraProduct?: string;
/**
* Free text search of products
*/
search?: string,
/**
* Specify what fields to free text search. When not provided, the default selection will be used.
* `fuzzy` will allow certain differences between the search string and the result
*/
searchFields?: Array<
| 'name'
| 'brandName'
| 'collectionName'
| 'sku'
| 'excerpt'
| 'description'
| 'variantName'
| 'items.sku'
| 'categoryName'
| 'fuzzy:name'
| 'fuzzy:variantName'
>;
/**
* Value of `true` returns only products available now.
* Value of `false ` returns all.
*/
onlyAvailable?: boolean;
/**
* Value of `true` will only return products with `showAsNew = true`.
* Valie of `false` will return all products
*/
showAsNew?: boolean;
/**
* Value of `true` will only return products with `showAsOnSale = true`.
* Value of `false` will return all products
*/
showAsOnSale?: boolean;
/**
* To show measurement charts. Default is `true`
*/
measurementCharts?: boolean;
/**
* When a product has relatedProducts and this is true,
* you get the complete data for those releated products.
* Otherwise you will get a small subset of the data back:
* only the media and product id.
*/
relatedProducts?: boolean;
/**
* Filter on a product or category with a specific URI
*/
uri?: { uri: string, for: string[] };
/**
* Language ID, if not provided the current session language is used.
*/
language?: string;
/**
* Integer or string "all". Market ID. Requires shared secret
*/
market?: number | 'all';
/**
* Integer or string "all". Pricelist ID. Requires shared secret
*/
pricelist?: number | 'all';
/**
* Sorting order of the response
*/
sortOrder?: {
/**
* The field to sort, this is required
*/
field: | 'uri' | 'categoryItemSort' | 'collectionUri' | 'priceAsNumber' | 'createdAt' | 'modifiedAt';
/**
* Default is ascending, from lowest to highest
*/
order?: 'asc' | 'desc';
};
/**
* Limit to products with specific item names (usually sizes)
*/
'items.name'?: string[]
}
/**
* **Products** (Checkout API)
*
* The **Response** returned by the **Checkout API** product/s endpoint following a POST request.
*
* @see {@link IProduct}
*/
export declare interface IProducts {
/**
* The session token that of the API.
*/
token: string;
/**
* The total number of products without paging.
*/
productsCount: number;
/**
* An array list of products
*
* @see {@link IProduct}
*/
products: IProduct[];
}
/* -------------------------------------------- */
/* STOCK */
/* -------------------------------------------- */
/**
* **Stock**
*
* The data model for stock items returned by the **Order API** endpoint.
*
* ---
*
* Documentation Centra:
*
* - [Order API](https://docs.centra.com/api-references/order-api/api-reference/get-stock)
*/
export declare interface IStock {
/**
* SKU for this product.
*/
sku: string;
/**
* The internal name for this product.
*/
productId: number;
/**
* SKU for this variant.
*/
variantSku: string;
/**
* ID for this variant.
*/
variantId: number;
/**
* SKU for this size.
*/
sizeSku: string;
/**
* The brand of this product
*/
brand: string;
/**
* This collection of this product
*/
collection: string;
/**
* The ID for this product.
* The internal name for this product.
*/
product: string;
/**
* The variant of this product
*/
variant: string;
/**
* The size of the product
*/
size: string;
/**
* ID for this specific stock item.
*/
stockItemId: number;
/**
* The EAN for this product item size.
*/
ean: string;
/**
* The weight specified for this product.
*/
weight: number;
/**
* The unit used for the weight.
*/
weightUnit: string;
/**
* ISO-Alpha-2 (SE, US, GB etc)
*/
countryOfOrigin: CountryCodes;
/**
* Harmonization Code
*/
harmCode: string;
/**
* Harmonization Description
*/
harmDescription: string;
/**
* If the product item is active or not.
*
* ---
*
* **NOTE**
*
* _The value is returned as number; Centra documentation lists the value as boolean._
*/
active: number;
/**
* The amount of items in the physical stock.
* If an order is placed without being shipped, the
* physical stock of the product does not change.
* However, as soon as a shipment is completed, the physical
* stock will decrease.
*/
physicalStock: number;
/**
* The amount of items in the physical stock that
* is currently allocated against orders.
*/
allocatedStock: number;
/**
* The amount of items in the physical stock that
* is currently available to sell.
*/
availableStock: number;
}
/**
* **Stock Parameters** (Order API)
*
* Stock parameters to filter stock items returned by the **Order API** endpoint via GET request.
*
* @see {@link IStock}
*/
export declare interface IStockParams {
/**
* Get products with a specific SKU.
*/
sku?: string;
/**
* Get all products modified after a certain date.
* Allowed formats YYYY-mm-dd and YYYY-mm-dd HH:MM:SS.
* Timezone is system-wide and decided by the company using Centra.
*/
modified?: string;
/**
* Get all products which had stock changes after a certain date.
* Allowed formats YYYY-mm-dd and YYYY-mm-dd HH:MM:SS.
* Timezone is system-wide and decided by the company using Centra.
*/
stock_modified?: string;
/**
* Get all products added after a certain date.
* Allowed formats YYYY-mm-dd and YYYY-mm-dd HH:MM:SS.
* Timezone is system-wide and decided by the company using Centra.
*/
created?: string;
/**
* Get a product with specified EAN code.
*/
ean?: string;
/**
* Get a product with specified productId
*/
productId?: number;
/**
* Get a product with specified variantId
*/
variantId?: number | string;
/**
* Get a product with specified stockItemId.
*/
stockItemId?: number | string;
/**
* You will get this amount of products, and a `"next"` parameter in return
* if there are multiple pages. This will go a lot faster to fetch,
* instead of fetching all products at once.
*/
limit?: number;
/**
* `include=attributes` will also make the products include the
* custom attributes defined for each product and variant.
*/
include?: string;
/**
* `exclude=physicalStock` will exclude fetching physical stock which
* will speed up the fetching of the stock values.
*/
exclude?: string;
/**
* Response in xml format instead of json.
*/
xml?: boolean;
}
/**
* **Stock List** (Order API)
*
* The **Response** returned by the **Order API** stock endpoint following a GET request.
*
* @see {@link IStock}
*/
export declare interface IStockList {
/**
* `ok` if success, else `no`.
*/
status?: 'ok' | 'no';
/**
* List of the products.
*
* @see {@link IStock}
*/
products: IStock[];
/**
* Previous page pathname, this is included when using
* `limit` parameter, by default the API will return
* all stock items.
*
* Value example: `?limit=2&page=2"`
*/
previous?: string;
/**
* Next page pathname, this is included when using
* `limit` parameter, by default the API will return
* all stock items.
*
* Value example:`?limit=2&page=3"`
*/
next?: string;
}
/* -------------------------------------------- */
/* ORDERS */
/* -------------------------------------------- */
/**
* **Order Address**
*
* Represents an address contained within `orders` model, applies to:
*
* - `invoiceAddress`
* - `deliveryAddress`
* - `address`
*
* ---
*
* @see {@link IOrderCreate}
* @see {@link IOrder}
*/
export declare interface IOrderAddress {
/**
* Customer e-mail
*/
email: string;
/**
* Customer first name
*/
firstName?: string;
/**
* Customer last name
*/
lastName?: string
/**
* Customer telephone
*/
tele?: string
/**
*Customer cellphone
*/
cell?: string
/**
* Attention (addressing memorandum)
*/
attn?: string
/**
* Street Address
*/
address?: string
/**
* CO Street Address
*/
coaddress?: string
/**
* City
*/
city?: string
/**
* Zipcode
*/
zipcode?: string
/**
* Country state, might be required by the `country`
*/
state?: string
/**
* ISO-Alpha-2 (SE, US, GB etc)
*/
country?: string;
}
/**
* **Order Create Product**
*
* Represents an order product on `products[]` contained within an `order` create model.
*
* @see {@link IOrderCreate}
*
*/
export declare interface IOrderCreateProduct {
/**
* Quantity ordered for this product
*/
qty: number;
/**
* ID specific to the product size.
* Either id, ean or sku must be used.
*/
id?: number;
/**
* EAN of product item. Either id, ean or sku must be used.
*/
ean?: string;
/**
* SKU of product item. Should either be the Size SKU or a
* combination of Product SKU + Variant SKU + Size SKU.
* Either id, ean or sku must be used.
*/
sku?: string;
/**
* Unit price used for the sale of this product. If not set,
* the pricelist value (in combination with current campaign
* discounts set up in Centra) will be used.
*/
unitPrice?: number;
/**
* The original unit price used for the product. Will calculate what
* discount the customer got when the order was placed. If not set,
* the price from the current pricelist will be used.
*/
originalPrice?: number;
/**
* A specific comment for the product. Can be used to define a
* specific date for each product, or a customized comment.
* Will show up on delivery notes and pack-lists.
*/
comment?: string;
/**
* Ability to define every column specifying the product information.
* Very useful when importing old orders for products not in Centra.
*/
itemText?: {
/**
* The SKU for this product.
*/
sku?: string;
/**
* The Brand name for this product
*/
brand?: string;
/**
* Product name
*/
product?: string;
/**
* The variant name of the product
*/
variant?: string;
/**
* The size name for this product. To make sure all visual representations
* in Centra looks good, please make sure this size exists on the sizechart
* selected for the product you used inside id, ean or sku.
*/
size?: string;
}
}
/**
* **Order Create Payment**
*
* Represents an order payment on `payment` contained within an `order` create model, applied to:
*
* - `payment.auth`
* - `payment.capture`
*
* ---
*
* @see {@link IOrderCreate}
*/
export declare interface IOrderCreatePayment {
/**
* The response string from the payment type.
* Will be shown verbose inside Centra.
*/
response?: string;
/**
* If the authorization/capture went through or not.
* `0` means pending, `1` means success, `2` means failed.
*/
status: 0 | 1 | 2;
/**
* The transaction ID of the authorization/capture.
*/
transaction?: string | number;
/**
* Will be shown on reports to summarize what payment
* method was used.
*/
method?: string;
/**
* The amount that was authorized
*/
amount: number;
/**
* If an external invoice was created, insert the URL to the invoice here.
*/
external_url?: string;
}
/**
* **Order Create** (Order API)
*
* The data model for an order creation by the **Order API** endpoint.
*
* ---
*
* Centra Documentation
*
* - [Order API](https://docs.centra.com/api-references/order-api/api-reference/create-order)
*/
export declare interface IOrderCreate {
/**
* Invoice address
*
* ---
*
* @see {@link IOrderAddress}
*/
invoiceAddress?: IOrderAddress;
/**
* Delivery address
*
* ---
*
* @see {@link IOrderAddress}
*
*/
deliveryAddress?: IOrderAddress;
/**
* Address
*
* ---
*
* @see {@link IOrderAddress}
*/
address?: IOrderAddress,
/**
* ID of pricelist to use for the order, if not provided,
* the pricelist for the current country will be used.
*/
pricelistId?: number;
/**
* Name of pricelist to use for the order. Will only be
* used if `pricelistId` is not provided. If not provided,
* the pricelist for the current country will be used.
*/
pricelist?: string;
/**
* ID of the market to use for the order. If not provided,
* the market for the current country will be used.
*/
marketId?: number;
/**
* Name of the market to use for the order. Will only be used
* if `marketId` is not provided. If not provided, the market
* for the current country will be used.
*/
market?: string;
/**
* Default `false`. If `true`, the order will attach to the customer
* registered with the same e-mail provided in the API-call. If
* `customerRegister` is `false`, the order will be created as a
* auto-created one and will not be visible by the signed in customer
* having the same e-mail.
*/
customerRegister?: boolean;
/**
* If this one is set, the customer ID will be used as the way to
* attach the order to a customer, independently of the e-mail provided.
*/
customerId?: number;
/**
* Default `false`. Will flag the customer so the customer will
* receive a password reset e-mail when they try to sign in.
* This can be used when migrating customers over from another system.
*/
customerSetNewPassword?: boolean;
/**
* Specifies the origin that the order was created from.
* If used, it needs to refer to an internal object in Centra.
*/
createdFromOrigin?: {
/**
* ID of internal origin of the origin type. If Return `#123` was used to
* create the order, id should be `123`.
*/
id: number;
/**
* Type of origin the order was created from.
*
* - `return`
* - `order`
* - `plugin`
*/
type: 'return' | 'order' | 'plugin';
};
/**
* Account ID for B2B-customer. Required if order is placed for B2B.
*/
accountId?: number;
/**
* Buyer ID for B2B-customer. If not provided, the default
* buyer of the account will be used.
*/
buyerId?: number;
/**
* Name of the buyer that placed the order.
*/
buyerName?: string;
/**
* Name of the Delivery Window being used when placing the order.
* Depending if the products are set to preorder or not, the order
* might extract stock or not.
*/
deliveryWindow?: string;
/**
* Contains the products for the order.
*
* {@link IOrderCreateProduct}
*/
products: IOrderCreateProduct[];
/**
* Shipping option URI, for example: ups-standard, without this one,
* the default shipping option for the products and country will be used.
*/
shippingList?: string;
/**
* Shipping cost, for example: 12.43, without this one, the default
* shipping cost for the products and country will be used.
*/
shippingValue?: number;
/**
* Voucher value, should always be positive value, even though the value
* ends up reducing the order value. Without this one, the default shipping
* cost for the products and country will be used.
*/
voucherValue?: number;
/**
* Explictly set the order number for the order. Will only work if the order
* does not already exist in Centra.
*/
orderNumber?: number;
/**
* Send order confirmation or not, if not provided, the store settings
* will be used.
*/
sendEmail?: boolean;
/**
* Default `true`. If Centra should calculate the voucher value depending
* on automatic voucher rules.
*/
applyVouchers?: boolean;
/**
* Default `true`. Extract products from stock and fail with error if
* stock does not exist. If `deliveryWindow` is set as preorder this setting
* will not matter.
*/
adjustStock?: boolean;
/**
* Default `false`. Create the order even though products did not exist.
* These products will be marked as back ordered.
*/
forceCreate?: boolean;
/**
* Text to place inside the "Other Information" field. Might show up on
* pack-lists and delivery notes depending on store settings.
*/
comment?: string;
/**
* Text for the "Internal comment" field. Will only be shown internally in Centra
*/
internalComment?: string;
/**
* PO number used when placing the order. Will be visible on delivery
* notes and invoices.
*/
poNumber?: string;
/**
* The time when the order was placed. Timezone is based on the
* location of the organization's Centra settings.
*/
orderDate?: string;
/**
* Expected time of delivery.
*/
deliveryDate?: string;
/**
* Object for sending in custom order attributes.
*
* List of key-value pairs for every attribute element you want to set.
* Send it as an empty string to remove the current content.
*/
extraAttributes?: { [key: string]: string; }
/**
* Date when order should be cancelled if not confirmed
*/
cancelDate?: string;
/**
* Used to define which allocation rule (previously known as "warehouse group")
* it should use. Default will use the one set for the market.
*/
warehouseGroup?: string;
/**
* Default `false`. Only prepare the order with all data, can be finalized
* later using :doc:completeOrder `</reference/stable/order-api/complete-order>`.
*/
createOnly?: boolean;
/**
* Default `false`. Mark the order as internal, will show up in reports as
* an internal order.
*/
internalOrder?: boolean;
/**
* Will contain information that should be inserted in regards
* to how the payment was handled outside of Centra.
*/
payment?: {
/**
* The ID of the payment plugin used from Centra. If not used,
* the order will not be marked with a payment type at all.
*/
id?: number;
/**
* Information about the authorization and capture of the order.
* Authorization was the reservation of the order, capture is when the
* value also has been charged.
*
* ---
*
* @see {@link IOrderCreateProduct}
*/
auth?: IOrderCreatePayment;
/**
* Information about the authorization and capture of the order.
* Authorization was the reservation of the order, capture is when the
* value also has been charged.
*
* ---
*
* @see {@link IOrderCreateProduct}
*/
capture?: IOrderCreatePayment;
}
}
/**
* **Order Create Response** (Order API)
*
* The response will return an array of orders when the call was successful
* (unless you used `createOnly` set as true). This is because the order might
* have been split into different orders depending on rules inside Centra.
*
* ---
*
* Centra Documentation:
*
* - [Order API](https://docs.centra.com/api-references/order-api/api-reference/create-order#response)
*/
export declare interface IOrderCreateResponse {
/**
* `ok` if success, else `no`.
*/
status: 'ok' | 'no';
/**
* If status returns `no`, this value should send back a message why it failed.
*/
msg?: string;
/**
* Errors will always be returned with "status" as "no" it will also contain
* a code and a message with more details the codes and their general
* meaning is as follows:
*
* - `-1` Some of the provided products are not possible to add to the order,
* product status, market or pricelist might not be properly configured inside centra.
* - `-2` Stock error, one or more products are missing stock.
* - `-3` Order is empty
* - `-4` One or more required fields are missing
* - `-5` An order with the provided order number already exists
* - `-6`Customer registration failed
* - `-7` General error, see message for details
*/
code?: string;
/**
* Will return if `createOnly` was set as `true`.
*/
order?: number;
/**
* List of order numbers created. An order might split
* up in multiple orders after completing it, this is why
* you might get multiple orders back.
*/
orders?: number[];
}
/**
* **Order Batch Create** (Order API)
*
* You are able to insert multiple orders at the same time by changing the endpoint from `/order` to `/orders`
* and sending data for each order inside an object with defined keys.
*
* ---
*
* Centra Documentation:
*
* - [Order API](https://docs.centra.com/api-references/order-api/api-reference/create-orders#batch-create-orders)
*/
export declare interface IOrderBatchCreateParams {
/**
* The name of each element could be anything you like.
* The content of each element are exactly like the parameters for Create Order.
*/
[orderNameElement: string]: IOrderCreate;
}
/**
* **Order Batch Create Response** (Order API)
*
* The **Response** model after an order batch create POST request was processed.
*
* ---
*
* Centra Documentation:
*
* - [Order API](https://docs.centra.com/api-references/order-api/api-reference/create-orders#response-examples)
*/
export declare interface IOrderBratchCreateResponse {
/**
* Object with fields for each order using the names from the request.
*
* @see {@link IOrderCreateResponse}
*/
[orderNameElement: string]: IOrderCreateResponse;
}
/**
* **Order Product**
*
* Represents an order product on `products[]` returns on an `order` model.
*
* ---
*
* @see {@link IOrder}
*/
export declare interface IOrderProduct {
/**
* ID of the specific product item in this order.
*/
lineId?: string;
/**
* Quantity of this specific product item.
*/
qty?: number;
/**
* Flag showing if product is bundle
*/
isBundle?: boolean;
/**
* Bundle id
*/
isPartOfBundle?: number;
/**
* Array of containing items for bundle
*
* @todo NOT YET TYPED
*/
bundle?: any[]
/**
* The localized size information for this product size.
* It contains the localized size `localizedSize` and localized size
* chart name `localizationDefinitionName`.
*
* @todo NOT YET TYPED
*/
localizedSize?: object;
}
/**
* **Order Parameters** (Order API)
*
* Order parameters to filter order items returned by the **Order API** endpoint via GET request.
*
* @see {@link IOrder}
*/
export declare interface IOrderParams {
/**
* Limit amount of orders returned.
*
* @default 20.
*/
limit?: number;
/**
* Offset how far in to start returning orders.
*/
offset?: number;
/**
* Return a specific order from its ID.
*/
order?: number;
/**
* Return orders for specified customer id.
*/
customer_id?: number;
/**
* Return order newer than date. Timezone is system-wide and
* decided by the company using Centra.
*
* Allowed Formats:
*
* - `YYYY-mm-dd`
* - `YYYY-mm-dd HH:MM:SS`
*/
newer_than?: string;
/**
* Return order older than date. Timezone is system-wide and
* decided by the company using Centra.
*
* Allowed Formats:
*
* - `YYYY-mm-dd`
* - `YYYY-mm-dd HH:MM:SS`
*/
older_than?: string;
/**
* Response in xml format instead of json.
*/
xml?: boolean;
}
/**
* **Order** (Order API)
*
* The data model for an order returned by the **Order API** endpoint.
*
* ---
*
* Centra Documentation:
*
* - [Order API](https://docs.centra.com/api-references/order-api/api-reference/get-orders)
*/
export declare interface IOrder {
/**
* The customer ID reference of the order.
*/
customerId?: number;
/**
* The account ID (I don't know what this is?)
*/
accountId?: LiteralUnion<'0', string>;
/**
* Selection ID of the order.
*/
selectionId?: string;
/**
* ID of the order.
*/
orderId?: number;
/**
* Status of the order.
*/
orderStatus?: string;
/**
* Date when order was created.
*/
orderDate?: string;
/**
* The order store reference, for brixtol this is `retail`
*/
orderStore?: string;
/**
* The order currency
*/
orderCurrency?: Uppercase<string>;
/**
* Preferred delivery date
*/
preferredDeliveryDate?: string;
/**
* Estimated delivery date
*/
estimatedDeliveryDate?: string;
/**
* Products inside the order.
*
* ---
*
* @see {@link IOrderProduct}
*/
products?: IOrderProduct[];
/**
* Lists all tax rules applied to the order.
*/
taxBreakdown?: Array<{
/**
* Text description of tax rule. ex: VAT
*/
description?: string;
/**
* Percentage of tax. ex 25
*/
taxPercent?: number;
/**
* How much tax. ex 20
*/
value?: number;
}>;
/**
* The order `poNumber` value.
*/
poNumber?: string;
/**
* Payment plugin type, eg: `adyen_drop_in`,
* `klarna_checkout_v1`, `paypal_v1`, etc.
*/
paymentPlugin?: string;
/**
* Payment method type, one of: cc, inv, 3rd, free, prepaid.
* Where `cc = credit card`, `inv = invoice`, `3rd = third party`.
* Value is not unique, more than one payment method can have.
*/
paymentType?: string;
/**
* Payment method description from plugin configuration.
*/
paymentDescription?: string;
/**
* Payment reference ID from external service provider. Can be `null`.
*/
paymentReference?: string;
/**
* Payment method ID - unique name of payment provider. Can be `null`.
*/
paymentMethod?: string;
/**
* The order grand total value
*/
grandTotalValue?: number;
/**
* The order grand total TAX value
*/
grandTotalTaxValue?: number;
/**
* The order grand TAX added value
*/
taxAdded?: number;
/**
* Tax deducted
*/
taxDeducted?: number;
/**
* The shipping default carrier. `null` if undefined.
*/
defaultCarrier?: string;
/**
* Total items price including TAX
*/
totalItemsPriceTax?: number;
/**
* Total items price
*/
totalItemsPrice?: number;
/**
* Total items price withour TAX
*/
totalItemsWithoutTax?: number;
/**
* Total items discount
*/
totalItemsDiscount?: number;
/**
* Combined order `address.firstName` and `address.lastName`
* or `deliveryAddress.firstName` and `deliveryAddress.lastName` values.
*/
deliveryName?: string;
/**
* The order `address.company` or `deliveryAddress.company` value.
*/
deliveryCompany?: string;
/**
* The order street address `address.address` or `deliveryAddress.address` value.
*/
deliveryAddress?: string;
/**
* The order CO street address `address.coaddress` or `deliveryAddress.coaddress` value.
*/
deliveryCoaddress?: string;
/**
* The order `address.city` or `deliveryAddress.city` value.
*/
deliveryCity?: string;
/**
* The order `address.state` or `deliveryAddress.state` value.
*/
deliveryState?: string;
/**
* The order `address.zipcode` or `deliveryAddress.zipcode` value.
*/
deliveryZipcode?: string;
/**
* The order `address.country` or `deliveryAddress.country` value.
*/
deliveryCountry?: CountryCodes;
/**
* The order `address.email` or `deliveryAddress.email` value.
*/
deliveryEmail?: string;
/**
* The order `address.tele` or `deliveryAddress.tele` value.
*/
deliveryTele?: string;
/**
* The order `address.cell` or `deliveryAddress.cell` value.
*/
deliveryCell: string;
/**
* Combined order `address.firstName` and `address.lastName`
* or `billingAddress.firstName` and `billingAddress.lastName` values.
*/
billingName?: string;
/**
* The order `address.company` or `billingAddress.company` value.
*/
billingCompany?: string;
/**
* The order street address `address.address` or `billingAddress.address` value.
*/
billingAddress?: string;
/**
* The order street address `address.coaddress` or CO `billingAddress.coaddress` value.
*/
billingCoaddress?: string;
/**
* The order `address.city` or `billingAddress.city` value.
*/
billingCity?: string;
/**
* The order `address.state` or `billingAddress.state` value.
*/
billingState?: string;
/**
* The order `address.zipcode` or `billingAddress.zipcode` value.
*/
billingZipcode?: string;
/**
* The order `address.country` or `billingAddress.country` value.
*/
billingCountry?: CountryCodes;
/**
* The order `address.email` or `billingAddress.email` value.
*/
billingEmail?: string;
/**
* The order `address.tele` or `billingAddress.tele` value.
*/
billingTele?: string;
/**
* The order `address.cell` or `billingAddress.cell` value.
*/
billingCell: string;
/**
* The billing VAT number,
*/
billingVAT: string;
/**
* Pricelist ID
*/
pricelistId?: string;
/**
* I.P Address
*/
ipAddress?: string;
/**
* Waiting for payment, default is `0` (unsure what this means?)
*/
waitingForPayment?: number;
/**
* Whether the order has been placed on hold or not, default is `0`
*/
hold?: number;
/**
* Suspect value, (unsure what this means?)
*/
suspect?: 0;
/**
* The shipping value
*/
shippingValue: number;
/**
* The voucher value, is `-0` when no vouched is provided
*/
voucherValue: number;
/**
* Whether the order was marked as internal. default is `0`
*/
internalOrder?: number;
}
/**
* **Orders** (Order API)
*
* The **Response** returned by the **Order API** orders/s endpoint following a GET request.
*
* @see {@link IOrder}
*/
export declare interface IOrders {
/**
* `ok` if success, else `no`.
*/
status: 'ok' | 'no';
/**
* Array of orders returned
*
* @see {@link IOrder}
*/
orders: IOrder[];
}
/**
* **Order Update** (Order API)
*
* The JSON Body data model for an order update via the **Order API** endpoint following a PUT request.
*
* ---
*
* Centra Documentation:
*
* - [Order API](https://docs.centra.com/api-references/order-api/api-reference/update-order)
*/
export declare interface IOrderUpdate {
/**
* Order ID to update.
*
* **REQUIRED**
*/
order: number;
/**
* Append some text to the internal comment field.
*/
internalComment?: string;
/**
* Replace the full content of the internal comment field with the `internalComment` value.
*
* @default false
*/
replaceInternalComment?: boolean;
/**
* Append some text to the comment field.
*/
comment?: string;
/**
* Replace the full content of the comment field with the `comment` value.
*
* @default false
*/
replaceComment?: boolean;
/**
* Object for sending in custom order attributes.
*/
extraAttributes?: object | {
/**
* List of key-value pairs for every attribute element you want to set.
* Send it as an empty string to remove the current content.
*/
[attributeName_elementName: string]: string
};
/**
* Response in xml format instead of json.
*/
xml?: boolean;
}
/**
* **Order Update Response** (Order API)
*
* The **Response** model after an order update request was processed via the **Order API** endpoint.
*
* ---
*
* Centra Documentation:
*
* - [Order API](https://docs.centra.com/api-references/order-api/api-reference/update-order#response-example)
*/
export declare interface IOrderUpdateResponse {
/**
* `ok` if success, else `no`.
*/
status: 'ok' | 'no';
/**
* If status returns `no`, this value should send back a message why it failed.
*/
msg?: string;
/**
* Order ID that was updated.
*/
order?: number;
}
/**
* **Order Complete Parameters** (Order API)
*
* If {@link IOrderCreate} was used with **createOnly** set as `true`, the order will only
* be prepared but not finalized. By using the **Complete** Order-endpoint you
* can finalize the order to be placed properly as a second step from creating
* the order.
*
* ---
*
* Centra Documentation:
*
* [Order API](https://docs.centra.com/api-references/order-api/api-reference/complete-order)
*/
export declare interface IOrderComplete extends IOrderCreate {}
/**
* **Order Complete Response** (Order API)
*
* If Create Order was used with createOnly set as true, the order will only
* be prepared but not finalized. By using the Complete Order-endpoint you
* can finalize the order to be placed properly as a second step from creating
* the order.
*
* @see {@link IOrderCompleteParams}
*/
export declare interface IOrderCompleteResponse {
/**
* `ok` if success, else `no`.
*/
status: 'ok' | 'no';
/**
* List of order numbers created. An order might split up in multiple
* orders after completing it, this is why you might get multiple orders back.
*/
orders: string | string[];
/**
* If status returns no, this value should send back a message why it failed.
*/
msg?: string;
}
/* -------------------------------------------- */
/* SHIPMENTS */
/* -------------------------------------------- */
/**
* **Shipment Create** (Order API)
*
* The data model for shipment creation used by the **Order API** on POST requests to the `shipments` endpoint.
*
* ---
*
* Centra Documentation:
*
* - [Order API](https://docs.centra.com/api-references/order-api/api-reference/get-shipments)
*/
export declare interface IShipmentCreate {
/**
* Order ID to create shipment on.
*/
order: number;
/**
* Key is `lineID` from the Get orders response and value is the quantity.
* See below example, which will create a shipment of 2 products from
* the line item `1441`.
*
* @example
* {
* "products": {
* "1441": 2
* }
* }
*/
products: {
/**
* The `lineID` from the Get orders response referring to a specific
* product item in the order.
*
* See: [get-orders](https://docs.centra.com/api-references/order-api/api-reference/get-orders#response)
*
*/
[lineId: string]: number;
};
/**
* Mark the shipment as good to go. This will allow for the pick and pack to fill
* in the shipping information etc.
*
* @default false
*/
gtg?: boolean;
/**
* If Centra should capture the shipment amount from the payment provider.
*
* > Should not be turned off unless you are capturing the money somewhere else.
*
* @default true
*/
capture?: boolean;
/**
* Mark the shipment as sent.
*
* @default false
*/
shipped?: boolean;
/**
* Carrier used for shipping.
*
* **IMPORTANT**
*
* Only used if `shipped` is `true`.
*/
carrier?: boolean;
/**
* Service level used for shipping.
*
* > **IMPORTANT**
* >
* > Only used if `shipped` is `true`.
*/
service?: string;
/**
* Number of packages in shipment.
*
* > **IMPORTANT**
* >
* > Only used if `shipped` is `true`.
*/
packages?: number;
/**
* Tracking number for shipment.
*
* > **IMPORTANT**
* >
* > Only used if `shipped` is `true`.
*/
tracking?: string;
/**
* Return slip tracking number for shipment.
*
* > **IMPORTANT**
* >
* > Only used if `shipped` is `true`.
*/
returnSlipTracking?:string;
/**
* Decide if Shipping Confirmation e-mail should be sent.
* If not defined, Store setting "Send Shipping Confirmation" will be used instead.
*
* > **IMPORTANT**
* >
* > Only used if `shipped` is `true`.
*/
sendEmail?:boolean;
/**
* Used together with the capture param, necessary when your order is split into
* multiple shipments. If the first shipment you created and captured contained
* the shipping cost, you can use this param to skip it in the subsequent shipments.
*
* This is necessary, since the payment providers will not allow you to capture more
* than was authorised, so you can only charge the shipping cost once.
*/
deductPreviousCosts?: boolean;
/**
* Response in xml format instead of json.
*/
xml?: boolean;
}
/**
* **Shipment Create Response** (Order API)
*
* This returned response after creating a shipment on an order.
*
* ---
*
* Centra Documentation:
*
* - [Order API](https://docs.centra.com/api-references/order-api/api-reference/create-shipment#response)
*/
export declare interface IShipmentCreateResponse {
/**
* `ok` if success, else `no`.
*/
status: 'ok' | 'no';
/**
* Order ID that the shipment was created on.
*/
order?: number;
/**
* The shipment ID for the create shipment.
*/
shipment?: string;
/**
* URL to a PDF delivery note for the shipment.
*/
deliveryNote?: string;
/**
* URL to a PDF delivery note for the shipment.
*/
proforma?: string;
/**
* URL to a PDF invoice for the shipment. Will only be set if an invoice exists.
*/
invoice?: string;
/**
* If status returns `no`, this value should send back a message why it failed.
*/
msg?: string;
}
/**
* **Shipment Parameters** (Order API)
*
* Parameters for fetching shipments. Will list all **Good to Go** shipments
*
* ---
*
* Centra Documentation:
*
* - [Order API](https://docs.centra.com/api-references/order-api/api-reference/get-shipments)
*/
export declare interface IShipmentParams {
/**
* Limit amount of shipments returned. For statuses inprogress and
* completed a positive value between `1` and `100`.
*/
limit?: number;
/**
* Return shipments for a specific order.
*/
order?: number;
/**
* Offset how far in to start returning orders.
*/
offset?: number;
/**
* The current status of the shipment.
*
* @default 'goodtogo'
*/
status?: 'inprogress' | 'goodtogo' | 'completed';
/**
* Only return shipments newer than provided date
*/
newer_than?: string;
/**
* Only return shipments older than provided date
*/
older_than?: string;
/**
* Response in xml format instead of json.
*/
xml?: string;
}
/**
* **Shipment** (Order API)
*
* The data model for a shipment used by the **Order API** and returned by the `shipments` endpoint.
* Extends the {@link IOrder} interface.
*
* ---
*
* Centra Documentation:
*
* - [Order API](https://docs.centra.com/api-references/order-api/api-reference/get-shipments)
*/
export declare interface IShipment extends IOrder {
/**
* ID of the order.
*/
orderId?: number;
/**
* ID of the shipment.
*/
shipmentId?: string;
/**
* Selection ID of the order.
*/
selectionId?: string;
/**
* Date when order was created.
*/
orderDate?: string;
/**
* If the shipment needs to be captured before being shipped.
*/
shouldCapture?: boolean;
/**
* URL to a PDF delivery note for the shipment.
*/
deliveryNote?: string;
/**
* Shipping Terms object selected on this shipment.
*/
shippingTerms?: {
/**
* Id of the specific shipping terms object.
*/
id?: string;
/**
* Name of the specific shipping terms object.
*/
name?: string;
/**
* Description of the specific shipping terms object.
*/
description?: string;
};
/**
* Payment Terms object selected on this shipment.
*/
paymentTerms?: {
/**
* ID of the specific payment terms object.
*/
id?: string;
/**
* Name of the specific payment terms object.
*/
name?: string;
/**
* Description of the specific payment terms object.
*/
description?: string;
};
/**
* URL to a PDF proforma for the shipment.
*/
proforma?: string;
/**
* Name of the carrier for this shipment.
*/
defaultCarrier?: string;
/**
* Name of the delivery service for this shipment.
*/
deliveryService?: string;
/**
* URLs to PDF invoices for the shipment. Will only be set if any invoices exists.
*/
invoices?: string[];
}
/**
* **Shipments** (Order API)
*
* The shipment response. Will list all **Good to Go** shipments that are not sent. Oldest first.
*
* @see {@link IShipment}
*/
export declare interface IShipments {
/**
* `ok` if success, else `no`.
*/
status: 'ok' | 'no';
/**
* Array of shipments returned.
*/
shipments: IShipment[]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment