@commercelayer/sdk 5.0.0-beta.10 → 5.0.0-beta.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/lib/cjs/api.d.ts +10 -5
  2. package/lib/cjs/api.js +17 -2
  3. package/lib/cjs/commercelayer.d.ts +7 -2
  4. package/lib/cjs/commercelayer.js +6 -1
  5. package/lib/cjs/model.d.ts +6 -1
  6. package/lib/cjs/resources/fixed_price_promotions.d.ts +3 -3
  7. package/lib/cjs/resources/fixed_price_promotions.js +4 -4
  8. package/lib/cjs/resources/free_gift_promotions.d.ts +3 -3
  9. package/lib/cjs/resources/free_gift_promotions.js +4 -4
  10. package/lib/cjs/resources/free_shipping_promotions.d.ts +3 -0
  11. package/lib/cjs/resources/free_shipping_promotions.js +4 -0
  12. package/lib/cjs/resources/line_items.d.ts +3 -0
  13. package/lib/cjs/resources/markets.d.ts +8 -0
  14. package/lib/cjs/resources/markets.js +4 -0
  15. package/lib/cjs/resources/order_copies.d.ts +11 -9
  16. package/lib/cjs/resources/order_copies.js +7 -4
  17. package/lib/cjs/resources/order_factories.d.ts +33 -0
  18. package/lib/cjs/resources/order_factories.js +28 -0
  19. package/lib/cjs/resources/order_subscription_items.d.ts +60 -0
  20. package/lib/cjs/resources/order_subscription_items.js +29 -0
  21. package/lib/cjs/resources/order_subscriptions.d.ts +25 -3
  22. package/lib/cjs/resources/order_subscriptions.js +18 -2
  23. package/lib/cjs/resources/orders.d.ts +9 -1
  24. package/lib/cjs/resources/orders.js +8 -0
  25. package/lib/cjs/resources/percentage_discount_promotions.d.ts +3 -3
  26. package/lib/cjs/resources/percentage_discount_promotions.js +4 -4
  27. package/lib/cjs/resources/price_frequency_tiers.d.ts +49 -0
  28. package/lib/cjs/resources/price_frequency_tiers.js +37 -0
  29. package/lib/cjs/resources/price_volume_tiers.d.ts +3 -0
  30. package/lib/cjs/resources/price_volume_tiers.js +4 -0
  31. package/lib/cjs/resources/prices.d.ts +3 -0
  32. package/lib/cjs/resources/prices.js +4 -0
  33. package/lib/cjs/resources/promotions.d.ts +3 -0
  34. package/lib/cjs/resources/promotions.js +4 -0
  35. package/lib/cjs/resources/recurring_order_copies.d.ts +52 -0
  36. package/lib/cjs/resources/recurring_order_copies.js +41 -0
  37. package/lib/cjs/resources/subscription_models.d.ts +48 -0
  38. package/lib/cjs/resources/subscription_models.js +37 -0
  39. package/lib/esm/api.d.ts +10 -5
  40. package/lib/esm/api.js +10 -0
  41. package/lib/esm/commercelayer.d.ts +7 -2
  42. package/lib/esm/commercelayer.js +6 -1
  43. package/lib/esm/model.d.ts +6 -1
  44. package/lib/esm/resources/fixed_price_promotions.d.ts +3 -3
  45. package/lib/esm/resources/fixed_price_promotions.js +4 -4
  46. package/lib/esm/resources/free_gift_promotions.d.ts +3 -3
  47. package/lib/esm/resources/free_gift_promotions.js +4 -4
  48. package/lib/esm/resources/free_shipping_promotions.d.ts +3 -0
  49. package/lib/esm/resources/free_shipping_promotions.js +4 -0
  50. package/lib/esm/resources/line_items.d.ts +3 -0
  51. package/lib/esm/resources/markets.d.ts +8 -0
  52. package/lib/esm/resources/markets.js +4 -0
  53. package/lib/esm/resources/order_copies.d.ts +11 -9
  54. package/lib/esm/resources/order_copies.js +7 -4
  55. package/lib/esm/resources/order_factories.d.ts +33 -0
  56. package/lib/esm/resources/order_factories.js +26 -0
  57. package/lib/esm/resources/order_subscription_items.d.ts +60 -0
  58. package/lib/esm/resources/order_subscription_items.js +27 -0
  59. package/lib/esm/resources/order_subscriptions.d.ts +25 -3
  60. package/lib/esm/resources/order_subscriptions.js +18 -2
  61. package/lib/esm/resources/orders.d.ts +9 -1
  62. package/lib/esm/resources/orders.js +8 -0
  63. package/lib/esm/resources/percentage_discount_promotions.d.ts +3 -3
  64. package/lib/esm/resources/percentage_discount_promotions.js +4 -4
  65. package/lib/esm/resources/price_frequency_tiers.d.ts +49 -0
  66. package/lib/esm/resources/price_frequency_tiers.js +35 -0
  67. package/lib/esm/resources/price_volume_tiers.d.ts +3 -0
  68. package/lib/esm/resources/price_volume_tiers.js +4 -0
  69. package/lib/esm/resources/prices.d.ts +3 -0
  70. package/lib/esm/resources/prices.js +4 -0
  71. package/lib/esm/resources/promotions.d.ts +3 -0
  72. package/lib/esm/resources/promotions.js +4 -0
  73. package/lib/esm/resources/recurring_order_copies.d.ts +52 -0
  74. package/lib/esm/resources/recurring_order_copies.js +39 -0
  75. package/lib/esm/resources/subscription_models.d.ts +48 -0
  76. package/lib/esm/resources/subscription_models.js +35 -0
  77. package/lib/tsconfig.esm.tsbuildinfo +1 -1
  78. package/lib/tsconfig.tsbuildinfo +1 -1
  79. package/package.json +1 -1
@@ -1,8 +1,8 @@
1
- import { ApiResource, Resource, ResourceCreate, ResourceId, ResourcesConfig, ResourceRel, ListResponse } from '../resource';
1
+ import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourceId, ResourcesConfig, ResourceRel, ListResponse } from '../resource';
2
2
  import type { QueryParamsRetrieve, QueryParamsList } from '../query';
3
3
  import type { Order, OrderType } from './orders';
4
- import type { OrderSubscription } from './order_subscriptions';
5
4
  import type { Event } from './events';
5
+ import type { OrderSubscription } from './order_subscriptions';
6
6
  type OrderCopyType = 'order_copies';
7
7
  type OrderCopyRel = ResourceRel & {
8
8
  type: OrderCopyType;
@@ -16,33 +16,35 @@ interface OrderCopy extends Resource {
16
16
  started_at?: string | null;
17
17
  completed_at?: string | null;
18
18
  failed_at?: string | null;
19
- place_target_order?: boolean | null;
20
- cancel_source_order?: boolean | null;
21
- reuse_wallet?: boolean | null;
22
19
  errors_log?: object | null;
23
20
  errors_count?: number | null;
21
+ place_target_order?: boolean | null;
22
+ reuse_wallet?: boolean | null;
23
+ cancel_source_order?: boolean | null;
24
24
  source_order?: Order | null;
25
25
  target_order?: Order | null;
26
- order_subscription?: OrderSubscription | null;
27
26
  events?: Event[] | null;
27
+ order_subscription?: OrderSubscription | null;
28
28
  }
29
29
  interface OrderCopyCreate extends ResourceCreate {
30
30
  place_target_order?: boolean | null;
31
- cancel_source_order?: boolean | null;
32
31
  reuse_wallet?: boolean | null;
32
+ cancel_source_order?: boolean | null;
33
33
  source_order: OrderRel;
34
34
  }
35
+ type OrderCopyUpdate = ResourceUpdate;
35
36
  declare class OrderCopies extends ApiResource<OrderCopy> {
36
37
  static readonly TYPE: OrderCopyType;
37
38
  create(resource: OrderCopyCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<OrderCopy>;
39
+ update(resource: OrderCopyUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<OrderCopy>;
38
40
  delete(id: string | ResourceId, options?: ResourcesConfig): Promise<void>;
39
41
  source_order(orderCopyId: string | OrderCopy, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
40
42
  target_order(orderCopyId: string | OrderCopy, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
41
- order_subscription(orderCopyId: string | OrderCopy, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<OrderSubscription>;
42
43
  events(orderCopyId: string | OrderCopy, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
44
+ order_subscription(orderCopyId: string | OrderCopy, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<OrderSubscription>;
43
45
  isOrderCopy(resource: any): resource is OrderCopy;
44
46
  relationship(id: string | ResourceId | null): OrderCopyRel;
45
47
  type(): OrderCopyType;
46
48
  }
47
49
  export default OrderCopies;
48
- export type { OrderCopy, OrderCopyCreate, OrderCopyType };
50
+ export type { OrderCopy, OrderCopyCreate, OrderCopyUpdate, OrderCopyType };
@@ -5,6 +5,9 @@ class OrderCopies extends resource_1.ApiResource {
5
5
  async create(resource, params, options) {
6
6
  return this.resources.create({ ...resource, type: OrderCopies.TYPE }, params, options);
7
7
  }
8
+ async update(resource, params, options) {
9
+ return this.resources.update({ ...resource, type: OrderCopies.TYPE }, params, options);
10
+ }
8
11
  async delete(id, options) {
9
12
  await this.resources.delete((typeof id === 'string') ? { id, type: OrderCopies.TYPE } : id, options);
10
13
  }
@@ -16,14 +19,14 @@ class OrderCopies extends resource_1.ApiResource {
16
19
  const _orderCopyId = orderCopyId.id || orderCopyId;
17
20
  return this.resources.fetch({ type: 'orders' }, `order_copies/${_orderCopyId}/target_order`, params, options);
18
21
  }
19
- async order_subscription(orderCopyId, params, options) {
20
- const _orderCopyId = orderCopyId.id || orderCopyId;
21
- return this.resources.fetch({ type: 'order_subscriptions' }, `order_copies/${_orderCopyId}/order_subscription`, params, options);
22
- }
23
22
  async events(orderCopyId, params, options) {
24
23
  const _orderCopyId = orderCopyId.id || orderCopyId;
25
24
  return this.resources.fetch({ type: 'events' }, `order_copies/${_orderCopyId}/events`, params, options);
26
25
  }
26
+ async order_subscription(orderCopyId, params, options) {
27
+ const _orderCopyId = orderCopyId.id || orderCopyId;
28
+ return this.resources.fetch({ type: 'order_subscriptions' }, `order_copies/${_orderCopyId}/order_subscription`, params, options);
29
+ }
27
30
  isOrderCopy(resource) {
28
31
  return resource.type && (resource.type === OrderCopies.TYPE);
29
32
  }
@@ -0,0 +1,33 @@
1
+ import { ApiResource, Resource, ResourceId, ResourcesConfig, ResourceRel, ListResponse } from '../resource';
2
+ import type { QueryParamsRetrieve, QueryParamsList } from '../query';
3
+ import type { Order } from './orders';
4
+ import type { Event } from './events';
5
+ type OrderFactoryType = 'order_factories';
6
+ type OrderFactoryRel = ResourceRel & {
7
+ type: OrderFactoryType;
8
+ };
9
+ interface OrderFactory extends Resource {
10
+ readonly type: OrderFactoryType;
11
+ status?: string | null;
12
+ started_at?: string | null;
13
+ completed_at?: string | null;
14
+ failed_at?: string | null;
15
+ errors_log?: object | null;
16
+ errors_count?: number | null;
17
+ place_target_order?: boolean | null;
18
+ reuse_wallet?: boolean | null;
19
+ source_order?: Order | null;
20
+ target_order?: Order | null;
21
+ events?: Event[] | null;
22
+ }
23
+ declare class OrderFactories extends ApiResource<OrderFactory> {
24
+ static readonly TYPE: OrderFactoryType;
25
+ source_order(orderFactoryId: string | OrderFactory, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
26
+ target_order(orderFactoryId: string | OrderFactory, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
27
+ events(orderFactoryId: string | OrderFactory, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
28
+ isOrderFactory(resource: any): resource is OrderFactory;
29
+ relationship(id: string | ResourceId | null): OrderFactoryRel;
30
+ type(): OrderFactoryType;
31
+ }
32
+ export default OrderFactories;
33
+ export type { OrderFactory, OrderFactoryType };
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const resource_1 = require("../resource");
4
+ class OrderFactories extends resource_1.ApiResource {
5
+ async source_order(orderFactoryId, params, options) {
6
+ const _orderFactoryId = orderFactoryId.id || orderFactoryId;
7
+ return this.resources.fetch({ type: 'orders' }, `order_factories/${_orderFactoryId}/source_order`, params, options);
8
+ }
9
+ async target_order(orderFactoryId, params, options) {
10
+ const _orderFactoryId = orderFactoryId.id || orderFactoryId;
11
+ return this.resources.fetch({ type: 'orders' }, `order_factories/${_orderFactoryId}/target_order`, params, options);
12
+ }
13
+ async events(orderFactoryId, params, options) {
14
+ const _orderFactoryId = orderFactoryId.id || orderFactoryId;
15
+ return this.resources.fetch({ type: 'events' }, `order_factories/${_orderFactoryId}/events`, params, options);
16
+ }
17
+ isOrderFactory(resource) {
18
+ return resource.type && (resource.type === OrderFactories.TYPE);
19
+ }
20
+ relationship(id) {
21
+ return ((id === null) || (typeof id === 'string')) ? { id, type: OrderFactories.TYPE } : { id: id.id, type: OrderFactories.TYPE };
22
+ }
23
+ type() {
24
+ return OrderFactories.TYPE;
25
+ }
26
+ }
27
+ OrderFactories.TYPE = 'order_factories';
28
+ exports.default = OrderFactories;
@@ -0,0 +1,60 @@
1
+ import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourceId, ResourcesConfig, ResourceRel } from '../resource';
2
+ import type { QueryParamsRetrieve } from '../query';
3
+ import type { OrderSubscription, OrderSubscriptionType } from './order_subscriptions';
4
+ import type { Adjustment, AdjustmentType } from './adjustments';
5
+ import type { Bundle, BundleType } from './bundles';
6
+ import type { Sku, SkuType } from './skus';
7
+ type OrderSubscriptionItemType = 'order_subscription_items';
8
+ type OrderSubscriptionItemRel = ResourceRel & {
9
+ type: OrderSubscriptionItemType;
10
+ };
11
+ type OrderSubscriptionRel = ResourceRel & {
12
+ type: OrderSubscriptionType;
13
+ };
14
+ type AdjustmentRel = ResourceRel & {
15
+ type: AdjustmentType;
16
+ };
17
+ type BundleRel = ResourceRel & {
18
+ type: BundleType;
19
+ };
20
+ type SkuRel = ResourceRel & {
21
+ type: SkuType;
22
+ };
23
+ interface OrderSubscriptionItem extends Resource {
24
+ readonly type: OrderSubscriptionItemType;
25
+ quantity: number;
26
+ unit_amount_cents?: number | null;
27
+ unit_amount_float?: number | null;
28
+ formatted_unit_amount?: string | null;
29
+ total_amount_cents?: number | null;
30
+ total_amount_float: number;
31
+ formatted_total_amount?: string | null;
32
+ order_subscription?: OrderSubscription | null;
33
+ item?: Adjustment | Bundle | Sku | null;
34
+ }
35
+ interface OrderSubscriptionItemCreate extends ResourceCreate {
36
+ sku_code?: string | null;
37
+ bundle_code?: string | null;
38
+ quantity: number;
39
+ unit_amount_cents?: number | null;
40
+ order_subscription: OrderSubscriptionRel;
41
+ item: AdjustmentRel | BundleRel | SkuRel;
42
+ }
43
+ interface OrderSubscriptionItemUpdate extends ResourceUpdate {
44
+ sku_code?: string | null;
45
+ bundle_code?: string | null;
46
+ quantity?: number | null;
47
+ unit_amount_cents?: number | null;
48
+ }
49
+ declare class OrderSubscriptionItems extends ApiResource<OrderSubscriptionItem> {
50
+ static readonly TYPE: OrderSubscriptionItemType;
51
+ create(resource: OrderSubscriptionItemCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<OrderSubscriptionItem>;
52
+ update(resource: OrderSubscriptionItemUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<OrderSubscriptionItem>;
53
+ delete(id: string | ResourceId, options?: ResourcesConfig): Promise<void>;
54
+ order_subscription(orderSubscriptionItemId: string | OrderSubscriptionItem, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<OrderSubscription>;
55
+ isOrderSubscriptionItem(resource: any): resource is OrderSubscriptionItem;
56
+ relationship(id: string | ResourceId | null): OrderSubscriptionItemRel;
57
+ type(): OrderSubscriptionItemType;
58
+ }
59
+ export default OrderSubscriptionItems;
60
+ export type { OrderSubscriptionItem, OrderSubscriptionItemCreate, OrderSubscriptionItemUpdate, OrderSubscriptionItemType };
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const resource_1 = require("../resource");
4
+ class OrderSubscriptionItems extends resource_1.ApiResource {
5
+ async create(resource, params, options) {
6
+ return this.resources.create({ ...resource, type: OrderSubscriptionItems.TYPE }, params, options);
7
+ }
8
+ async update(resource, params, options) {
9
+ return this.resources.update({ ...resource, type: OrderSubscriptionItems.TYPE }, params, options);
10
+ }
11
+ async delete(id, options) {
12
+ await this.resources.delete((typeof id === 'string') ? { id, type: OrderSubscriptionItems.TYPE } : id, options);
13
+ }
14
+ async order_subscription(orderSubscriptionItemId, params, options) {
15
+ const _orderSubscriptionItemId = orderSubscriptionItemId.id || orderSubscriptionItemId;
16
+ return this.resources.fetch({ type: 'order_subscriptions' }, `order_subscription_items/${_orderSubscriptionItemId}/order_subscription`, params, options);
17
+ }
18
+ isOrderSubscriptionItem(resource) {
19
+ return resource.type && (resource.type === OrderSubscriptionItems.TYPE);
20
+ }
21
+ relationship(id) {
22
+ return ((id === null) || (typeof id === 'string')) ? { id, type: OrderSubscriptionItems.TYPE } : { id: id.id, type: OrderSubscriptionItems.TYPE };
23
+ }
24
+ type() {
25
+ return OrderSubscriptionItems.TYPE;
26
+ }
27
+ }
28
+ OrderSubscriptionItems.TYPE = 'order_subscription_items';
29
+ exports.default = OrderSubscriptionItems;
@@ -1,9 +1,13 @@
1
1
  import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourceId, ResourcesConfig, ResourceRel, ListResponse } from '../resource';
2
2
  import type { QueryParamsRetrieve, QueryParamsList } from '../query';
3
3
  import type { Market, MarketType } from './markets';
4
+ import type { SubscriptionModel } from './subscription_models';
4
5
  import type { Order, OrderType } from './orders';
5
6
  import type { Customer } from './customers';
6
- import type { OrderCopy } from './order_copies';
7
+ import type { CustomerPaymentSource, CustomerPaymentSourceType } from './customer_payment_sources';
8
+ import type { OrderSubscriptionItem } from './order_subscription_items';
9
+ import type { OrderFactory } from './order_factories';
10
+ import type { RecurringOrderCopy } from './recurring_order_copies';
7
11
  import type { Event } from './events';
8
12
  type OrderSubscriptionType = 'order_subscriptions';
9
13
  type OrderSubscriptionRel = ResourceRel & {
@@ -15,6 +19,9 @@ type MarketRel = ResourceRel & {
15
19
  type OrderRel = ResourceRel & {
16
20
  type: OrderType;
17
21
  };
22
+ type CustomerPaymentSourceRel = ResourceRel & {
23
+ type: CustomerPaymentSourceType;
24
+ };
18
25
  interface OrderSubscription extends Resource {
19
26
  readonly type: OrderSubscriptionType;
20
27
  number?: string | null;
@@ -30,9 +37,17 @@ interface OrderSubscription extends Resource {
30
37
  succeeded_on_last_run?: boolean | null;
31
38
  options?: object | null;
32
39
  market?: Market | null;
40
+ subscription_model?: SubscriptionModel | null;
33
41
  source_order?: Order | null;
34
42
  customer?: Customer | null;
35
- order_copies?: OrderCopy[] | null;
43
+ customer_payment_source?: CustomerPaymentSource | null;
44
+ order_subscription_items?: OrderSubscriptionItem[] | null;
45
+ order_factories?: OrderFactory[] | null;
46
+ /**
47
+ * @deprecated This field should not be used as it may be removed in the future without notice
48
+ */
49
+ order_copies?: object[];
50
+ recurring_order_copies?: RecurringOrderCopy[] | null;
36
51
  orders?: Order[] | null;
37
52
  events?: Event[] | null;
38
53
  }
@@ -46,10 +61,13 @@ interface OrderSubscriptionCreate extends ResourceCreate {
46
61
  source_order: OrderRel;
47
62
  }
48
63
  interface OrderSubscriptionUpdate extends ResourceUpdate {
64
+ frequency?: string | null;
49
65
  expires_at?: string | null;
66
+ next_run_at?: string | null;
50
67
  _activate?: boolean | null;
51
68
  _deactivate?: boolean | null;
52
69
  _cancel?: boolean | null;
70
+ customer_payment_source?: CustomerPaymentSourceRel | null;
53
71
  }
54
72
  declare class OrderSubscriptions extends ApiResource<OrderSubscription> {
55
73
  static readonly TYPE: OrderSubscriptionType;
@@ -57,9 +75,13 @@ declare class OrderSubscriptions extends ApiResource<OrderSubscription> {
57
75
  update(resource: OrderSubscriptionUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<OrderSubscription>;
58
76
  delete(id: string | ResourceId, options?: ResourcesConfig): Promise<void>;
59
77
  market(orderSubscriptionId: string | OrderSubscription, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Market>;
78
+ subscription_model(orderSubscriptionId: string | OrderSubscription, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SubscriptionModel>;
60
79
  source_order(orderSubscriptionId: string | OrderSubscription, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
61
80
  customer(orderSubscriptionId: string | OrderSubscription, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Customer>;
62
- order_copies(orderSubscriptionId: string | OrderSubscription, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<OrderCopy>>;
81
+ customer_payment_source(orderSubscriptionId: string | OrderSubscription, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CustomerPaymentSource>;
82
+ order_subscription_items(orderSubscriptionId: string | OrderSubscription, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<OrderSubscriptionItem>>;
83
+ order_factories(orderSubscriptionId: string | OrderSubscription, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<OrderFactory>>;
84
+ recurring_order_copies(orderSubscriptionId: string | OrderSubscription, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<RecurringOrderCopy>>;
63
85
  orders(orderSubscriptionId: string | OrderSubscription, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Order>>;
64
86
  events(orderSubscriptionId: string | OrderSubscription, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
65
87
  isOrderSubscription(resource: any): resource is OrderSubscription;
@@ -15,6 +15,10 @@ class OrderSubscriptions extends resource_1.ApiResource {
15
15
  const _orderSubscriptionId = orderSubscriptionId.id || orderSubscriptionId;
16
16
  return this.resources.fetch({ type: 'markets' }, `order_subscriptions/${_orderSubscriptionId}/market`, params, options);
17
17
  }
18
+ async subscription_model(orderSubscriptionId, params, options) {
19
+ const _orderSubscriptionId = orderSubscriptionId.id || orderSubscriptionId;
20
+ return this.resources.fetch({ type: 'subscription_models' }, `order_subscriptions/${_orderSubscriptionId}/subscription_model`, params, options);
21
+ }
18
22
  async source_order(orderSubscriptionId, params, options) {
19
23
  const _orderSubscriptionId = orderSubscriptionId.id || orderSubscriptionId;
20
24
  return this.resources.fetch({ type: 'orders' }, `order_subscriptions/${_orderSubscriptionId}/source_order`, params, options);
@@ -23,9 +27,21 @@ class OrderSubscriptions extends resource_1.ApiResource {
23
27
  const _orderSubscriptionId = orderSubscriptionId.id || orderSubscriptionId;
24
28
  return this.resources.fetch({ type: 'customers' }, `order_subscriptions/${_orderSubscriptionId}/customer`, params, options);
25
29
  }
26
- async order_copies(orderSubscriptionId, params, options) {
30
+ async customer_payment_source(orderSubscriptionId, params, options) {
31
+ const _orderSubscriptionId = orderSubscriptionId.id || orderSubscriptionId;
32
+ return this.resources.fetch({ type: 'customer_payment_sources' }, `order_subscriptions/${_orderSubscriptionId}/customer_payment_source`, params, options);
33
+ }
34
+ async order_subscription_items(orderSubscriptionId, params, options) {
35
+ const _orderSubscriptionId = orderSubscriptionId.id || orderSubscriptionId;
36
+ return this.resources.fetch({ type: 'order_subscription_items' }, `order_subscriptions/${_orderSubscriptionId}/order_subscription_items`, params, options);
37
+ }
38
+ async order_factories(orderSubscriptionId, params, options) {
39
+ const _orderSubscriptionId = orderSubscriptionId.id || orderSubscriptionId;
40
+ return this.resources.fetch({ type: 'order_factories' }, `order_subscriptions/${_orderSubscriptionId}/order_factories`, params, options);
41
+ }
42
+ async recurring_order_copies(orderSubscriptionId, params, options) {
27
43
  const _orderSubscriptionId = orderSubscriptionId.id || orderSubscriptionId;
28
- return this.resources.fetch({ type: 'order_copies' }, `order_subscriptions/${_orderSubscriptionId}/order_copies`, params, options);
44
+ return this.resources.fetch({ type: 'recurring_order_copies' }, `order_subscriptions/${_orderSubscriptionId}/recurring_order_copies`, params, options);
29
45
  }
30
46
  async orders(orderSubscriptionId, params, options) {
31
47
  const _orderSubscriptionId = orderSubscriptionId.id || orderSubscriptionId;
@@ -25,7 +25,9 @@ import type { Capture } from './captures';
25
25
  import type { Refund } from './refunds';
26
26
  import type { Return } from './returns';
27
27
  import type { OrderSubscription } from './order_subscriptions';
28
+ import type { OrderFactory } from './order_factories';
28
29
  import type { OrderCopy } from './order_copies';
30
+ import type { RecurringOrderCopy } from './recurring_order_copies';
29
31
  import type { Attachment } from './attachments';
30
32
  import type { Event } from './events';
31
33
  type OrderType = 'orders';
@@ -79,7 +81,7 @@ interface Order extends Resource {
79
81
  number?: number | null;
80
82
  autorefresh?: boolean | null;
81
83
  status?: 'draft' | 'pending' | 'placed' | 'approved' | 'cancelled' | null;
82
- payment_status?: 'unpaid' | 'authorized' | 'paid' | 'voided' | 'refunded' | 'free' | null;
84
+ payment_status?: 'unpaid' | 'authorized' | 'partially_authorized' | 'paid' | 'partially_paid' | 'voided' | 'partially_voided' | 'refunded' | 'partially_refunded' | 'free' | null;
83
85
  fulfillment_status?: 'unfulfilled' | 'in_progress' | 'fulfilled' | 'not_required' | null;
84
86
  guest?: boolean | null;
85
87
  editable?: boolean | null;
@@ -174,6 +176,7 @@ interface Order extends Resource {
174
176
  refreshed_at?: string | null;
175
177
  archived_at?: string | null;
176
178
  expires_at?: string | null;
179
+ subscription_created_at?: string | null;
177
180
  market?: Market | null;
178
181
  customer?: Customer | null;
179
182
  shipping_address?: Address | null;
@@ -193,7 +196,9 @@ interface Order extends Resource {
193
196
  refunds?: Refund[] | null;
194
197
  returns?: Return[] | null;
195
198
  order_subscriptions?: OrderSubscription[] | null;
199
+ order_factories?: OrderFactory[] | null;
196
200
  order_copies?: OrderCopy[] | null;
201
+ recurring_order_copies?: RecurringOrderCopy[] | null;
197
202
  attachments?: Attachment[] | null;
198
203
  events?: Event[] | null;
199
204
  }
@@ -256,6 +261,7 @@ interface OrderUpdate extends ResourceUpdate {
256
261
  _save_billing_address_to_customer_address_book?: boolean | null;
257
262
  _refresh?: boolean | null;
258
263
  _validate?: boolean | null;
264
+ _create_subscriptions?: boolean | null;
259
265
  market?: MarketRel | null;
260
266
  customer?: CustomerRel | null;
261
267
  shipping_address?: AddressRel | null;
@@ -285,7 +291,9 @@ declare class Orders extends ApiResource<Order> {
285
291
  refunds(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Refund>>;
286
292
  returns(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Return>>;
287
293
  order_subscriptions(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<OrderSubscription>>;
294
+ order_factories(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<OrderFactory>>;
288
295
  order_copies(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<OrderCopy>>;
296
+ recurring_order_copies(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<RecurringOrderCopy>>;
289
297
  attachments(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
290
298
  events(orderId: string | Order, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
291
299
  isOrder(resource: any): resource is Order;
@@ -79,10 +79,18 @@ class Orders extends resource_1.ApiResource {
79
79
  const _orderId = orderId.id || orderId;
80
80
  return this.resources.fetch({ type: 'order_subscriptions' }, `orders/${_orderId}/order_subscriptions`, params, options);
81
81
  }
82
+ async order_factories(orderId, params, options) {
83
+ const _orderId = orderId.id || orderId;
84
+ return this.resources.fetch({ type: 'order_factories' }, `orders/${_orderId}/order_factories`, params, options);
85
+ }
82
86
  async order_copies(orderId, params, options) {
83
87
  const _orderId = orderId.id || orderId;
84
88
  return this.resources.fetch({ type: 'order_copies' }, `orders/${_orderId}/order_copies`, params, options);
85
89
  }
90
+ async recurring_order_copies(orderId, params, options) {
91
+ const _orderId = orderId.id || orderId;
92
+ return this.resources.fetch({ type: 'recurring_order_copies' }, `orders/${_orderId}/recurring_order_copies`, params, options);
93
+ }
86
94
  async attachments(orderId, params, options) {
87
95
  const _orderId = orderId.id || orderId;
88
96
  return this.resources.fetch({ type: 'attachments' }, `orders/${_orderId}/attachments`, params, options);
@@ -6,9 +6,9 @@ import type { OrderAmountPromotionRule, OrderAmountPromotionRuleType } from './o
6
6
  import type { SkuListPromotionRule, SkuListPromotionRuleType } from './sku_list_promotion_rules';
7
7
  import type { CouponCodesPromotionRule, CouponCodesPromotionRuleType } from './coupon_codes_promotion_rules';
8
8
  import type { Attachment } from './attachments';
9
+ import type { Event } from './events';
9
10
  import type { SkuList, SkuListType } from './sku_lists';
10
11
  import type { Sku } from './skus';
11
- import type { Event } from './events';
12
12
  type PercentageDiscountPromotionType = 'percentage_discount_promotions';
13
13
  type PercentageDiscountPromotionRel = ResourceRel & {
14
14
  type: PercentageDiscountPromotionType;
@@ -47,9 +47,9 @@ interface PercentageDiscountPromotion extends Resource {
47
47
  sku_list_promotion_rule?: SkuListPromotionRule | null;
48
48
  coupon_codes_promotion_rule?: CouponCodesPromotionRule | null;
49
49
  attachments?: Attachment[] | null;
50
+ events?: Event[] | null;
50
51
  sku_list?: SkuList | null;
51
52
  skus?: Sku[] | null;
52
- events?: Event[] | null;
53
53
  }
54
54
  interface PercentageDiscountPromotionCreate extends ResourceCreate {
55
55
  name: string;
@@ -89,9 +89,9 @@ declare class PercentageDiscountPromotions extends ApiResource<PercentageDiscoun
89
89
  sku_list_promotion_rule(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuListPromotionRule>;
90
90
  coupon_codes_promotion_rule(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CouponCodesPromotionRule>;
91
91
  attachments(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
92
+ events(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
92
93
  sku_list(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuList>;
93
94
  skus(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Sku>>;
94
- events(percentageDiscountPromotionId: string | PercentageDiscountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
95
95
  isPercentageDiscountPromotion(resource: any): resource is PercentageDiscountPromotion;
96
96
  relationship(id: string | ResourceId | null): PercentageDiscountPromotionRel;
97
97
  type(): PercentageDiscountPromotionType;
@@ -31,6 +31,10 @@ class PercentageDiscountPromotions extends resource_1.ApiResource {
31
31
  const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId;
32
32
  return this.resources.fetch({ type: 'attachments' }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/attachments`, params, options);
33
33
  }
34
+ async events(percentageDiscountPromotionId, params, options) {
35
+ const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId;
36
+ return this.resources.fetch({ type: 'events' }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/events`, params, options);
37
+ }
34
38
  async sku_list(percentageDiscountPromotionId, params, options) {
35
39
  const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId;
36
40
  return this.resources.fetch({ type: 'sku_lists' }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/sku_list`, params, options);
@@ -39,10 +43,6 @@ class PercentageDiscountPromotions extends resource_1.ApiResource {
39
43
  const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId;
40
44
  return this.resources.fetch({ type: 'skus' }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/skus`, params, options);
41
45
  }
42
- async events(percentageDiscountPromotionId, params, options) {
43
- const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId;
44
- return this.resources.fetch({ type: 'events' }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/events`, params, options);
45
- }
46
46
  isPercentageDiscountPromotion(resource) {
47
47
  return resource.type && (resource.type === PercentageDiscountPromotions.TYPE);
48
48
  }
@@ -0,0 +1,49 @@
1
+ import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourceId, ResourcesConfig, ResourceRel, ListResponse } from '../resource';
2
+ import type { QueryParamsRetrieve, QueryParamsList } from '../query';
3
+ import type { Price, PriceType } from './prices';
4
+ import type { Attachment } from './attachments';
5
+ import type { Event } from './events';
6
+ type PriceFrequencyTierType = 'price_frequency_tiers';
7
+ type PriceFrequencyTierRel = ResourceRel & {
8
+ type: PriceFrequencyTierType;
9
+ };
10
+ type PriceRel = ResourceRel & {
11
+ type: PriceType;
12
+ };
13
+ interface PriceFrequencyTier extends Resource {
14
+ readonly type: PriceFrequencyTierType;
15
+ name: string;
16
+ up_to?: number | null;
17
+ price_amount_cents: number;
18
+ price_amount_float?: number | null;
19
+ formatted_price_amount?: string | null;
20
+ price?: Price | null;
21
+ attachments?: Attachment[] | null;
22
+ events?: Event[] | null;
23
+ }
24
+ interface PriceFrequencyTierCreate extends ResourceCreate {
25
+ name: string;
26
+ up_to?: number | null;
27
+ price_amount_cents: number;
28
+ price: PriceRel;
29
+ }
30
+ interface PriceFrequencyTierUpdate extends ResourceUpdate {
31
+ name?: string | null;
32
+ up_to?: number | null;
33
+ price_amount_cents?: number | null;
34
+ price?: PriceRel | null;
35
+ }
36
+ declare class PriceFrequencyTiers extends ApiResource<PriceFrequencyTier> {
37
+ static readonly TYPE: PriceFrequencyTierType;
38
+ create(resource: PriceFrequencyTierCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<PriceFrequencyTier>;
39
+ update(resource: PriceFrequencyTierUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<PriceFrequencyTier>;
40
+ delete(id: string | ResourceId, options?: ResourcesConfig): Promise<void>;
41
+ price(priceFrequencyTierId: string | PriceFrequencyTier, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Price>;
42
+ attachments(priceFrequencyTierId: string | PriceFrequencyTier, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
43
+ events(priceFrequencyTierId: string | PriceFrequencyTier, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
44
+ isPriceFrequencyTier(resource: any): resource is PriceFrequencyTier;
45
+ relationship(id: string | ResourceId | null): PriceFrequencyTierRel;
46
+ type(): PriceFrequencyTierType;
47
+ }
48
+ export default PriceFrequencyTiers;
49
+ export type { PriceFrequencyTier, PriceFrequencyTierCreate, PriceFrequencyTierUpdate, PriceFrequencyTierType };
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const resource_1 = require("../resource");
4
+ class PriceFrequencyTiers extends resource_1.ApiResource {
5
+ async create(resource, params, options) {
6
+ return this.resources.create({ ...resource, type: PriceFrequencyTiers.TYPE }, params, options);
7
+ }
8
+ async update(resource, params, options) {
9
+ return this.resources.update({ ...resource, type: PriceFrequencyTiers.TYPE }, params, options);
10
+ }
11
+ async delete(id, options) {
12
+ await this.resources.delete((typeof id === 'string') ? { id, type: PriceFrequencyTiers.TYPE } : id, options);
13
+ }
14
+ async price(priceFrequencyTierId, params, options) {
15
+ const _priceFrequencyTierId = priceFrequencyTierId.id || priceFrequencyTierId;
16
+ return this.resources.fetch({ type: 'prices' }, `price_frequency_tiers/${_priceFrequencyTierId}/price`, params, options);
17
+ }
18
+ async attachments(priceFrequencyTierId, params, options) {
19
+ const _priceFrequencyTierId = priceFrequencyTierId.id || priceFrequencyTierId;
20
+ return this.resources.fetch({ type: 'attachments' }, `price_frequency_tiers/${_priceFrequencyTierId}/attachments`, params, options);
21
+ }
22
+ async events(priceFrequencyTierId, params, options) {
23
+ const _priceFrequencyTierId = priceFrequencyTierId.id || priceFrequencyTierId;
24
+ return this.resources.fetch({ type: 'events' }, `price_frequency_tiers/${_priceFrequencyTierId}/events`, params, options);
25
+ }
26
+ isPriceFrequencyTier(resource) {
27
+ return resource.type && (resource.type === PriceFrequencyTiers.TYPE);
28
+ }
29
+ relationship(id) {
30
+ return ((id === null) || (typeof id === 'string')) ? { id, type: PriceFrequencyTiers.TYPE } : { id: id.id, type: PriceFrequencyTiers.TYPE };
31
+ }
32
+ type() {
33
+ return PriceFrequencyTiers.TYPE;
34
+ }
35
+ }
36
+ PriceFrequencyTiers.TYPE = 'price_frequency_tiers';
37
+ exports.default = PriceFrequencyTiers;
@@ -2,6 +2,7 @@ import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourceId, Reso
2
2
  import type { QueryParamsRetrieve, QueryParamsList } from '../query';
3
3
  import type { Price, PriceType } from './prices';
4
4
  import type { Attachment } from './attachments';
5
+ import type { Event } from './events';
5
6
  type PriceVolumeTierType = 'price_volume_tiers';
6
7
  type PriceVolumeTierRel = ResourceRel & {
7
8
  type: PriceVolumeTierType;
@@ -18,6 +19,7 @@ interface PriceVolumeTier extends Resource {
18
19
  formatted_price_amount?: string | null;
19
20
  price?: Price | null;
20
21
  attachments?: Attachment[] | null;
22
+ events?: Event[] | null;
21
23
  }
22
24
  interface PriceVolumeTierCreate extends ResourceCreate {
23
25
  name: string;
@@ -38,6 +40,7 @@ declare class PriceVolumeTiers extends ApiResource<PriceVolumeTier> {
38
40
  delete(id: string | ResourceId, options?: ResourcesConfig): Promise<void>;
39
41
  price(priceVolumeTierId: string | PriceVolumeTier, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Price>;
40
42
  attachments(priceVolumeTierId: string | PriceVolumeTier, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
43
+ events(priceVolumeTierId: string | PriceVolumeTier, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
41
44
  isPriceVolumeTier(resource: any): resource is PriceVolumeTier;
42
45
  relationship(id: string | ResourceId | null): PriceVolumeTierRel;
43
46
  type(): PriceVolumeTierType;
@@ -19,6 +19,10 @@ class PriceVolumeTiers extends resource_1.ApiResource {
19
19
  const _priceVolumeTierId = priceVolumeTierId.id || priceVolumeTierId;
20
20
  return this.resources.fetch({ type: 'attachments' }, `price_volume_tiers/${_priceVolumeTierId}/attachments`, params, options);
21
21
  }
22
+ async events(priceVolumeTierId, params, options) {
23
+ const _priceVolumeTierId = priceVolumeTierId.id || priceVolumeTierId;
24
+ return this.resources.fetch({ type: 'events' }, `price_volume_tiers/${_priceVolumeTierId}/events`, params, options);
25
+ }
22
26
  isPriceVolumeTier(resource) {
23
27
  return resource.type && (resource.type === PriceVolumeTiers.TYPE);
24
28
  }
@@ -4,6 +4,7 @@ import type { PriceList, PriceListType } from './price_lists';
4
4
  import type { Sku, SkuType } from './skus';
5
5
  import type { PriceTier, PriceTierType } from './price_tiers';
6
6
  import type { PriceVolumeTier } from './price_volume_tiers';
7
+ import type { PriceFrequencyTier } from './price_frequency_tiers';
7
8
  import type { Attachment } from './attachments';
8
9
  type PriceType = 'prices';
9
10
  type PriceRel = ResourceRel & {
@@ -32,6 +33,7 @@ interface Price extends Resource {
32
33
  sku?: Sku | null;
33
34
  price_tiers?: PriceTier[] | null;
34
35
  price_volume_tiers?: PriceVolumeTier[] | null;
36
+ price_frequency_tiers?: PriceFrequencyTier[] | null;
35
37
  attachments?: Attachment[] | null;
36
38
  }
37
39
  interface PriceCreate extends ResourceCreate {
@@ -59,6 +61,7 @@ declare class Prices extends ApiResource<Price> {
59
61
  sku(priceId: string | Price, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Sku>;
60
62
  price_tiers(priceId: string | Price, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<PriceTier>>;
61
63
  price_volume_tiers(priceId: string | Price, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<PriceVolumeTier>>;
64
+ price_frequency_tiers(priceId: string | Price, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<PriceFrequencyTier>>;
62
65
  attachments(priceId: string | Price, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
63
66
  isPrice(resource: any): resource is Price;
64
67
  relationship(id: string | ResourceId | null): PriceRel;
@@ -27,6 +27,10 @@ class Prices extends resource_1.ApiResource {
27
27
  const _priceId = priceId.id || priceId;
28
28
  return this.resources.fetch({ type: 'price_volume_tiers' }, `prices/${_priceId}/price_volume_tiers`, params, options);
29
29
  }
30
+ async price_frequency_tiers(priceId, params, options) {
31
+ const _priceId = priceId.id || priceId;
32
+ return this.resources.fetch({ type: 'price_frequency_tiers' }, `prices/${_priceId}/price_frequency_tiers`, params, options);
33
+ }
30
34
  async attachments(priceId, params, options) {
31
35
  const _priceId = priceId.id || priceId;
32
36
  return this.resources.fetch({ type: 'attachments' }, `prices/${_priceId}/attachments`, params, options);