UNPKG

@shipengine/connect-order-source-api

Version:

This is the typescript/javascript definitions for the order source api

169 lines 9.5 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SalesOrderSchema = exports.SalesOrder = exports.RequestedFulfillmentSchema = exports.RequestedFulfillment = exports.DutiesSchema = exports.RequestedFulfillmentExtensionsSchema = exports.RequestedFulfillmentExtensions = exports.OriginalOrderSourceSchema = exports.OriginalOrderSource = exports.SalesOrderStatusSchema = exports.RequestedFulfillmentStatus = exports.SalesOrderStatus = void 0; const tslib_1 = require("tslib"); const address_1 = require("./address"); const shipping_preferences_1 = require("./shipping-preferences"); const sales_order_item_1 = require("./sales-order-item"); const buyer_1 = require("./buyer"); const bill_to_1 = require("./bill-to"); const payment_1 = require("./payment"); const note_1 = require("./note"); const branding_1 = require("./branding"); const joi_1 = tslib_1.__importDefault(require("joi")); const tax_identifier_1 = require("./tax-identifier"); /** @description The status of a sales order */ var SalesOrderStatus; (function (SalesOrderStatus) { SalesOrderStatus["AwaitingPayment"] = "AwaitingPayment"; SalesOrderStatus["AwaitingShipment"] = "AwaitingShipment"; SalesOrderStatus["Cancelled"] = "Cancelled"; SalesOrderStatus["Completed"] = "Completed"; SalesOrderStatus["OnHold"] = "OnHold"; SalesOrderStatus["PendingFulfillment"] = "PendingFulfillment"; })(SalesOrderStatus || (exports.SalesOrderStatus = SalesOrderStatus = {})); /** @description The status of a requested fulfillment */ var RequestedFulfillmentStatus; (function (RequestedFulfillmentStatus) { RequestedFulfillmentStatus["AwaitingShipment"] = "AwaitingShipment"; RequestedFulfillmentStatus["Cancelled"] = "Cancelled"; RequestedFulfillmentStatus["Completed"] = "Completed"; RequestedFulfillmentStatus["OnHold"] = "OnHold"; RequestedFulfillmentStatus["PendingFulfillment"] = "PendingFulfillment"; RequestedFulfillmentStatus["PartiallyFulfilled"] = "PartiallyFulfilled"; })(RequestedFulfillmentStatus || (exports.RequestedFulfillmentStatus = RequestedFulfillmentStatus = {})); exports.SalesOrderStatusSchema = joi_1.default.string().valid(...Object.values(SalesOrderStatus)); /** @description If this order came from a marketplace other than the one this integration talks to directly, * information about the original marketplace goes here. For instance, if an order is placed with another 3rd * party such as Amazon or Ebay but shows up in the data from the marketplace this integration talks to * directly, any identifiers that link the order back to those original marketplaces goes here. If the order * is not from an upstream marketplace and originates at the marketplace you are integrating with directly, * do not populate these fields. */ class OriginalOrderSource { /** @description A unique identifier for the store inside of the original marketplace. */ source_id; /** @description The ShipEngine API Code of the original marketplace. Check with the Engine team for allowed values. */ marketplace_code; /** @description The unique identifier for the order at the original marketplace. */ order_id; } exports.OriginalOrderSource = OriginalOrderSource; exports.OriginalOrderSourceSchema = joi_1.default.object({ source_id: joi_1.default.string().optional().empty(), marketplace_code: joi_1.default.string().optional().empty(), order_id: joi_1.default.string().optional().empty(), }); /** @description Additional information necessary for a requested fulfillment */ class RequestedFulfillmentExtensions { /** @description Custom field 1 */ custom_field_1; /** @description Custom field 2 */ custom_field_2; /** @description Custom field 3 */ custom_field_3; } exports.RequestedFulfillmentExtensions = RequestedFulfillmentExtensions; exports.RequestedFulfillmentExtensionsSchema = joi_1.default.object({ custom_field_1: joi_1.default.string().optional().empty(), custom_field_2: joi_1.default.string().optional().empty(), custom_field_3: joi_1.default.string().optional().empty(), }); exports.DutiesSchema = joi_1.default.object({ duties_displayed_at_checkout: joi_1.default.boolean().optional(), delivered_duty_paid: joi_1.default.boolean().optional(), duties_total: joi_1.default.number().optional(), }); /** @description The fulfillment requested by the marketplace or the buyer */ class RequestedFulfillment { /** @description Identifier for the requested fulfillment from the order source */ requested_fulfillment_id; /** @description Who the order should be shipped to */ ship_to; /** @description The items that should be shipped */ items; /** @description Additional information about this fulfillment */ extensions; /** @description Preferences about how the order is shipped */ shipping_preferences; /** @description Brand information about this fulfillment */ branding; /** @description The requested fulfillment status*/ requested_fulfillment_status; /** @description Information related to duties for the fulfillment */ duties; } exports.RequestedFulfillment = RequestedFulfillment; exports.RequestedFulfillmentSchema = joi_1.default.object({ requested_fulfillment_id: joi_1.default.string().optional().empty(), ship_to: address_1.AddressSchema.required(), items: joi_1.default.array().required().items(sales_order_item_1.SalesOrderItemSchema), extensions: exports.RequestedFulfillmentExtensionsSchema.optional(), shipping_preferences: shipping_preferences_1.ShippingPreferencesSchema, branding: branding_1.BrandingSchema.optional(), duties: exports.DutiesSchema.optional(), }); /** @description This represents a sales order */ class SalesOrder { /** @description The unique identifier of the sales order from the order source */ order_id; /** @description The customer facing identifier of the sales order */ order_number; /** @description The sales order status */ status; /** @description The (ISO 8601) datetime (UTC) associated with when this sales order was paid for @example "2021-03-31T18:21:14.858Z" */ paid_date; /** @description The (ISO 8601) datetime (UTC) associated with when this order shipped @example "2021-03-31T18:21:14.858Z" */ fulfilled_date; /** @description Represents information from the source marketplace. (This is common with reselling goods) */ original_order_source; /** @description The fulfillment requested by the marketplace or the buyer */ requested_fulfillments; /** @description The buyer of this sales order */ buyer; /** @description The person being billed for this sales order */ bill_to; /** @description The three character ISO 4217 code of the currency used for all monetary amounts @example "USD", "EUR", "NZD" */ currency; /** @description Tax id information corresponding to tax (such as prepaid VAT) */ tax_identifier; /** @description Information about the payment */ payment; /** @description The source that the order is shipping from */ ship_from; /** @description A unique url associated with the order */ order_url; /** @description Notes about the order */ notes; /** @description Data provided by the order source that should be included in calls back to the order source. This data is only meaningful to the integration and not otherwise used by the platform. */ integration_context; /** @description The (ISO 8601) datetime (UTC) associated with when this order was created @example "2021-03-31T18:21:14.858Z" */ created_date_time; /** @description The (ISO 8601) datetime (UTC) associated with when this order was last modified @example "2021-03-31T18:21:14.858Z" */ modified_date_time; /** @description A value, specific to the order source, that indicates who is expected to fulfill the order. This value can represent whether an order will be fulfilled by seller fulfillment, merchant fulfillment or other fulfillment network. @example "SellerFulfilled" */ fulfillment_channel; } exports.SalesOrder = SalesOrder; exports.SalesOrderSchema = joi_1.default.object({ order_id: joi_1.default.string().required(), order_number: joi_1.default.string().optional().empty(), status: exports.SalesOrderStatusSchema.required(), paid_date: joi_1.default.string().optional().empty().isoDate(), fulfilled_date: joi_1.default.string().optional().empty().isoDate(), original_order_source: exports.OriginalOrderSourceSchema.optional(), requested_fulfillments: joi_1.default.array().required().min(1).items(exports.RequestedFulfillmentSchema), buyer: buyer_1.BuyerSchema.optional(), bill_to: bill_to_1.BillToSchema.optional(), currency: joi_1.default.string().optional().empty(), prepaid_tax_identifier: tax_identifier_1.TaxIdentifierSchema.optional(), payment: payment_1.PaymentSchema.optional(), ship_from: address_1.AddressSchema.optional(), order_url: joi_1.default.string().optional().empty(), notes: joi_1.default.array().optional().items(note_1.NoteSchema), integration_context: joi_1.default.string().optional().empty(), created_date_time: joi_1.default.string().optional().empty().isoDate(), modified_date_time: joi_1.default.string().optional().empty().isoDate(), fulfillment_channel: joi_1.default.string().optional().empty(), }); //# sourceMappingURL=sales-order.js.map