UNPKG

@commercelayer/sdk

Version:
286 lines (283 loc) 15.7 kB
'use strict'; var chunkU22VLCMN_cjs = require('./chunk-U22VLCMN.cjs'); // src/resources/orders.ts var Orders = class _Orders extends chunkU22VLCMN_cjs.ApiResource { static TYPE = "orders"; async create(resource, params, options) { return this.resources.create({ ...resource, type: _Orders.TYPE }, params, options); } async update(resource, params, options) { return this.resources.update({ ...resource, type: _Orders.TYPE }, params, options); } async delete(id, options) { await this.resources.delete(typeof id === "string" ? { id, type: _Orders.TYPE } : id, options); } async market(orderId, params, options) { const _orderId = orderId.id || orderId; return this.resources.fetch({ type: "markets" }, `orders/${_orderId}/market`, params, options); } async customer(orderId, params, options) { const _orderId = orderId.id || orderId; return this.resources.fetch({ type: "customers" }, `orders/${_orderId}/customer`, params, options); } async shipping_address(orderId, params, options) { const _orderId = orderId.id || orderId; return this.resources.fetch({ type: "addresses" }, `orders/${_orderId}/shipping_address`, params, options); } async billing_address(orderId, params, options) { const _orderId = orderId.id || orderId; return this.resources.fetch({ type: "addresses" }, `orders/${_orderId}/billing_address`, params, options); } async store(orderId, params, options) { const _orderId = orderId.id || orderId; return this.resources.fetch({ type: "stores" }, `orders/${_orderId}/store`, params, options); } async default_shipping_method(orderId, params, options) { const _orderId = orderId.id || orderId; return this.resources.fetch({ type: "shipping_methods" }, `orders/${_orderId}/default_shipping_method`, params, options); } async default_payment_method(orderId, params, options) { const _orderId = orderId.id || orderId; return this.resources.fetch({ type: "payment_methods" }, `orders/${_orderId}/default_payment_method`, params, options); } async available_payment_methods(orderId, params, options) { const _orderId = orderId.id || orderId; return this.resources.fetch({ type: "payment_methods" }, `orders/${_orderId}/available_payment_methods`, params, options); } async available_customer_payment_sources(orderId, params, options) { const _orderId = orderId.id || orderId; return this.resources.fetch({ type: "customer_payment_sources" }, `orders/${_orderId}/available_customer_payment_sources`, params, options); } async available_free_skus(orderId, params, options) { const _orderId = orderId.id || orderId; return this.resources.fetch({ type: "skus" }, `orders/${_orderId}/available_free_skus`, params, options); } async available_free_bundles(orderId, params, options) { const _orderId = orderId.id || orderId; return this.resources.fetch({ type: "bundles" }, `orders/${_orderId}/available_free_bundles`, params, options); } async payment_method(orderId, params, options) { const _orderId = orderId.id || orderId; return this.resources.fetch({ type: "payment_methods" }, `orders/${_orderId}/payment_method`, params, options); } async discount_engine_item(orderId, params, options) { const _orderId = orderId.id || orderId; return this.resources.fetch({ type: "discount_engine_items" }, `orders/${_orderId}/discount_engine_item`, params, options); } async line_items(orderId, params, options) { const _orderId = orderId.id || orderId; return this.resources.fetch({ type: "line_items" }, `orders/${_orderId}/line_items`, params, options); } async line_item_options(orderId, params, options) { const _orderId = orderId.id || orderId; return this.resources.fetch({ type: "line_item_options" }, `orders/${_orderId}/line_item_options`, params, options); } async stock_reservations(orderId, params, options) { const _orderId = orderId.id || orderId; return this.resources.fetch({ type: "stock_reservations" }, `orders/${_orderId}/stock_reservations`, params, options); } async stock_line_items(orderId, params, options) { const _orderId = orderId.id || orderId; return this.resources.fetch({ type: "stock_line_items" }, `orders/${_orderId}/stock_line_items`, params, options); } async stock_transfers(orderId, params, options) { const _orderId = orderId.id || orderId; return this.resources.fetch({ type: "stock_transfers" }, `orders/${_orderId}/stock_transfers`, params, options); } async shipments(orderId, params, options) { const _orderId = orderId.id || orderId; return this.resources.fetch({ type: "shipments" }, `orders/${_orderId}/shipments`, params, options); } async payment_options(orderId, params, options) { const _orderId = orderId.id || orderId; return this.resources.fetch({ type: "payment_options" }, `orders/${_orderId}/payment_options`, params, options); } async authorizations(orderId, params, options) { const _orderId = orderId.id || orderId; return this.resources.fetch({ type: "authorizations" }, `orders/${_orderId}/authorizations`, params, options); } async captures(orderId, params, options) { const _orderId = orderId.id || orderId; return this.resources.fetch({ type: "captures" }, `orders/${_orderId}/captures`, params, options); } async voids(orderId, params, options) { const _orderId = orderId.id || orderId; return this.resources.fetch({ type: "voids" }, `orders/${_orderId}/voids`, params, options); } async refunds(orderId, params, options) { const _orderId = orderId.id || orderId; return this.resources.fetch({ type: "refunds" }, `orders/${_orderId}/refunds`, params, options); } async returns(orderId, params, options) { const _orderId = orderId.id || orderId; return this.resources.fetch({ type: "returns" }, `orders/${_orderId}/returns`, params, options); } async order_subscription(orderId, params, options) { const _orderId = orderId.id || orderId; return this.resources.fetch({ type: "order_subscriptions" }, `orders/${_orderId}/order_subscription`, params, options); } async order_subscriptions(orderId, params, options) { const _orderId = orderId.id || orderId; return this.resources.fetch({ type: "order_subscriptions" }, `orders/${_orderId}/order_subscriptions`, params, options); } async order_factories(orderId, params, options) { const _orderId = orderId.id || orderId; return this.resources.fetch({ type: "order_factories" }, `orders/${_orderId}/order_factories`, params, options); } async order_copies(orderId, params, options) { const _orderId = orderId.id || orderId; return this.resources.fetch({ type: "order_copies" }, `orders/${_orderId}/order_copies`, params, options); } async recurring_order_copies(orderId, params, options) { const _orderId = orderId.id || orderId; return this.resources.fetch({ type: "recurring_order_copies" }, `orders/${_orderId}/recurring_order_copies`, params, options); } async attachments(orderId, params, options) { const _orderId = orderId.id || orderId; return this.resources.fetch({ type: "attachments" }, `orders/${_orderId}/attachments`, params, options); } async notifications(orderId, params, options) { const _orderId = orderId.id || orderId; return this.resources.fetch({ type: "notifications" }, `orders/${_orderId}/notifications`, params, options); } async links(orderId, params, options) { const _orderId = orderId.id || orderId; return this.resources.fetch({ type: "links" }, `orders/${_orderId}/links`, params, options); } async resource_errors(orderId, params, options) { const _orderId = orderId.id || orderId; return this.resources.fetch({ type: "resource_errors" }, `orders/${_orderId}/resource_errors`, params, options); } async events(orderId, params, options) { const _orderId = orderId.id || orderId; return this.resources.fetch({ type: "events" }, `orders/${_orderId}/events`, params, options); } async tags(orderId, params, options) { const _orderId = orderId.id || orderId; return this.resources.fetch({ type: "tags" }, `orders/${_orderId}/tags`, params, options); } async versions(orderId, params, options) { const _orderId = orderId.id || orderId; return this.resources.fetch({ type: "versions" }, `orders/${_orderId}/versions`, params, options); } async event_stores(orderId, params, options) { const _orderId = orderId.id || orderId; return this.resources.fetch({ type: "event_stores" }, `orders/${_orderId}/event_stores`, params, options); } async _archive(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Orders.TYPE, _archive: true }, params, options); } async _unarchive(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Orders.TYPE, _unarchive: true }, params, options); } async _pending(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Orders.TYPE, _pending: true }, params, options); } async _place(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Orders.TYPE, _place: true }, params, options); } async _cancel(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Orders.TYPE, _cancel: true }, params, options); } async _approve(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Orders.TYPE, _approve: true }, params, options); } async _approve_and_capture(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Orders.TYPE, _approve_and_capture: true }, params, options); } async _authorize(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Orders.TYPE, _authorize: true }, params, options); } async _authorization_amount_cents(id, triggerValue, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Orders.TYPE, _authorization_amount_cents: triggerValue }, params, options); } async _capture(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Orders.TYPE, _capture: true }, params, options); } async _refund(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Orders.TYPE, _refund: true }, params, options); } async _fulfill(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Orders.TYPE, _fulfill: true }, params, options); } async _update_taxes(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Orders.TYPE, _update_taxes: true }, params, options); } async _nullify_payment_source(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Orders.TYPE, _nullify_payment_source: true }, params, options); } async _fix_payment_source(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Orders.TYPE, _fix_payment_source: true }, params, options); } async _billing_address_clone_id(id, triggerValue, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Orders.TYPE, _billing_address_clone_id: triggerValue }, params, options); } async _shipping_address_clone_id(id, triggerValue, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Orders.TYPE, _shipping_address_clone_id: triggerValue }, params, options); } async _customer_payment_source_id(id, triggerValue, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Orders.TYPE, _customer_payment_source_id: triggerValue }, params, options); } async _shipping_address_same_as_billing(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Orders.TYPE, _shipping_address_same_as_billing: true }, params, options); } async _billing_address_same_as_shipping(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Orders.TYPE, _billing_address_same_as_shipping: true }, params, options); } async _commit_invoice(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Orders.TYPE, _commit_invoice: true }, params, options); } async _refund_invoice(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Orders.TYPE, _refund_invoice: true }, params, options); } async _save_payment_source_to_customer_wallet(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Orders.TYPE, _save_payment_source_to_customer_wallet: true }, params, options); } async _save_shipping_address_to_customer_address_book(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Orders.TYPE, _save_shipping_address_to_customer_address_book: true }, params, options); } async _save_billing_address_to_customer_address_book(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Orders.TYPE, _save_billing_address_to_customer_address_book: true }, params, options); } async _refresh(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Orders.TYPE, _refresh: true }, params, options); } async _validate(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Orders.TYPE, _validate: true }, params, options); } async _create_subscriptions(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Orders.TYPE, _create_subscriptions: true }, params, options); } async _start_editing(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Orders.TYPE, _start_editing: true }, params, options); } async _stop_editing(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Orders.TYPE, _stop_editing: true }, params, options); } async _reset_circuit(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Orders.TYPE, _reset_circuit: true }, params, options); } async _add_tags(id, triggerValue, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Orders.TYPE, _add_tags: triggerValue }, params, options); } async _remove_tags(id, triggerValue, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Orders.TYPE, _remove_tags: triggerValue }, params, options); } isOrder(resource) { return resource.type && resource.type === _Orders.TYPE; } relationship(id) { return super.relationshipOneToOne(id); } relationshipToMany(...ids) { return super.relationshipOneToMany(...ids); } type() { return _Orders.TYPE; } }; var instance = new Orders(); var orders_default = instance; exports.orders_default = orders_default; //# sourceMappingURL=chunk-LIIFLHEH.cjs.map //# sourceMappingURL=chunk-LIIFLHEH.cjs.map