@commercelayer/sdk 5.35.0 → 5.37.0

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.
@@ -2,14 +2,14 @@ import * as api from './api';
2
2
  import type { ApiError } from './error';
3
3
  import type { ErrorInterceptor, InterceptorType, RawResponseReader, RequestInterceptor, ResponseInterceptor } from './interceptor';
4
4
  import { type ResourcesInitConfig } from './resource';
5
- declare const OPEN_API_SCHEMA_VERSION = "5.1.0";
5
+ declare const OPEN_API_SCHEMA_VERSION = "5.2.1";
6
6
  export { OPEN_API_SCHEMA_VERSION };
7
7
  type SdkConfig = {};
8
8
  type CommerceLayerInitConfig = SdkConfig & ResourcesInitConfig;
9
9
  type CommerceLayerConfig = Partial<CommerceLayerInitConfig>;
10
10
  declare class CommerceLayerClient {
11
11
  #private;
12
- readonly openApiSchemaVersion = "5.1.0";
12
+ readonly openApiSchemaVersion = "5.2.1";
13
13
  addresses: api.Addresses;
14
14
  adjustments: api.Adjustments;
15
15
  adyen_gateways: api.AdyenGateways;
@@ -45,7 +45,7 @@ const resource_1 = __importDefault(require("./resource"));
45
45
  const debug_1 = __importDefault(require("./debug"));
46
46
  const debug = (0, debug_1.default)('commercelayer');
47
47
  // Autogenerated schema version number, do not remove this line
48
- const OPEN_API_SCHEMA_VERSION = '5.1.0';
48
+ const OPEN_API_SCHEMA_VERSION = '5.2.1';
49
49
  exports.OPEN_API_SCHEMA_VERSION = OPEN_API_SCHEMA_VERSION;
50
50
  class CommerceLayerClient {
51
51
  // ##__CL_RESOURCES_DEF_STOP__##
@@ -20,9 +20,6 @@ interface AxervePayment extends Resource {
20
20
  buyer_details?: Record<string, any> | null;
21
21
  request_token?: boolean | null;
22
22
  mismatched_amounts?: boolean | null;
23
- intent_amount_cents: number;
24
- intent_amount_float?: number | null;
25
- formatted_intent_amount?: string | null;
26
23
  payment_instrument?: Record<string, any> | null;
27
24
  order?: Order | null;
28
25
  payment_gateway?: PaymentGateway | null;
@@ -18,9 +18,6 @@ interface KlarnaPayment extends Resource {
18
18
  payment_methods: Array<Record<string, any>>;
19
19
  auth_token?: string | null;
20
20
  mismatched_amounts?: boolean | null;
21
- intent_amount_cents: number;
22
- intent_amount_float?: number | null;
23
- formatted_intent_amount?: string | null;
24
21
  payment_instrument?: Record<string, any> | null;
25
22
  order?: Order | null;
26
23
  payment_gateway?: PaymentGateway | null;
@@ -24,6 +24,8 @@ type SkuRel = ResourceRel & {
24
24
  };
25
25
  interface OrderSubscriptionItem extends Resource {
26
26
  readonly type: OrderSubscriptionItemType;
27
+ sku_code?: string | null;
28
+ bundle_code?: string | null;
27
29
  quantity: number;
28
30
  unit_amount_cents?: number | null;
29
31
  unit_amount_float?: number | null;
@@ -35,6 +37,7 @@ interface OrderSubscriptionItem extends Resource {
35
37
  item?: Adjustment | Bundle | Sku | null;
36
38
  sku?: Sku | null;
37
39
  bundle?: Bundle | null;
40
+ adjustment?: Adjustment | null;
38
41
  source_line_item?: LineItem | null;
39
42
  }
40
43
  interface OrderSubscriptionItemCreate extends ResourceCreate {
@@ -46,6 +49,7 @@ interface OrderSubscriptionItemCreate extends ResourceCreate {
46
49
  item: AdjustmentRel | BundleRel | SkuRel;
47
50
  sku?: SkuRel | null;
48
51
  bundle?: BundleRel | null;
52
+ adjustment?: AdjustmentRel | null;
49
53
  }
50
54
  interface OrderSubscriptionItemUpdate extends ResourceUpdate {
51
55
  sku_code?: string | null;
@@ -30,6 +30,7 @@ interface OrderSubscription extends Resource {
30
30
  status: 'draft' | 'inactive' | 'active' | 'cancelled';
31
31
  frequency: string;
32
32
  activate_by_source_order?: boolean | null;
33
+ place_target_order?: boolean | null;
33
34
  customer_email?: string | null;
34
35
  starts_at?: string | null;
35
36
  expires_at?: string | null;
@@ -38,7 +39,6 @@ interface OrderSubscription extends Resource {
38
39
  occurrencies?: number | null;
39
40
  errors_count?: number | null;
40
41
  succeeded_on_last_run?: boolean | null;
41
- options?: Record<string, any> | null;
42
42
  market?: Market | null;
43
43
  subscription_model?: SubscriptionModel | null;
44
44
  source_order?: Order | null;
@@ -54,14 +54,16 @@ interface OrderSubscription extends Resource {
54
54
  interface OrderSubscriptionCreate extends ResourceCreate {
55
55
  frequency: string;
56
56
  activate_by_source_order?: boolean | null;
57
+ place_target_order?: boolean | null;
57
58
  starts_at?: string | null;
58
59
  expires_at?: string | null;
59
- options?: Record<string, any> | null;
60
60
  market?: MarketRel | null;
61
61
  source_order: OrderRel;
62
62
  }
63
63
  interface OrderSubscriptionUpdate extends ResourceUpdate {
64
64
  frequency?: string | null;
65
+ activate_by_source_order?: boolean | null;
66
+ place_target_order?: boolean | null;
65
67
  expires_at?: string | null;
66
68
  next_run_at?: string | null;
67
69
  _activate?: boolean | null;
@@ -22,9 +22,6 @@ interface PaypalPayment extends Resource {
22
22
  status: 'created' | 'approved';
23
23
  approval_url?: string | null;
24
24
  mismatched_amounts?: boolean | null;
25
- intent_amount_cents: number;
26
- intent_amount_float?: number | null;
27
- formatted_intent_amount?: string | null;
28
25
  payment_instrument?: Record<string, any> | null;
29
26
  order?: Order | null;
30
27
  payment_gateway?: PaymentGateway | null;
@@ -8,6 +8,9 @@ import type { PriceVolumeTier } from './price_volume_tiers';
8
8
  import type { PriceFrequencyTier } from './price_frequency_tiers';
9
9
  import type { Attachment } from './attachments';
10
10
  import type { Version } from './versions';
11
+ import type { Customer } from './customers';
12
+ import type { Market } from './markets';
13
+ import type { StockLocation } from './stock_locations';
11
14
  type PriceType = 'prices';
12
15
  type PriceRel = ResourceRel & {
13
16
  type: PriceType;
@@ -38,6 +41,9 @@ interface Price extends Resource {
38
41
  price_frequency_tiers?: PriceFrequencyTier[] | null;
39
42
  attachments?: Attachment[] | null;
40
43
  versions?: Version[] | null;
44
+ jwt_customer?: Customer | null;
45
+ jwt_markets?: Market[] | null;
46
+ jwt_stock_locations?: StockLocation[] | null;
41
47
  }
42
48
  interface PriceCreate extends ResourceCreate {
43
49
  sku_code?: string | null;
@@ -67,6 +73,9 @@ declare class Prices extends ApiResource<Price> {
67
73
  price_frequency_tiers(priceId: string | Price, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<PriceFrequencyTier>>;
68
74
  attachments(priceId: string | Price, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
69
75
  versions(priceId: string | Price, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
76
+ jwt_customer(priceId: string | Price, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Customer>;
77
+ jwt_markets(priceId: string | Price, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Market>>;
78
+ jwt_stock_locations(priceId: string | Price, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<StockLocation>>;
70
79
  isPrice(resource: any): resource is Price;
71
80
  relationship(id: string | ResourceId | null): PriceRel;
72
81
  type(): PriceType;
@@ -39,6 +39,18 @@ class Prices extends resource_1.ApiResource {
39
39
  const _priceId = priceId.id || priceId;
40
40
  return this.resources.fetch({ type: 'versions' }, `prices/${_priceId}/versions`, params, options);
41
41
  }
42
+ async jwt_customer(priceId, params, options) {
43
+ const _priceId = priceId.id || priceId;
44
+ return this.resources.fetch({ type: 'customers' }, `prices/${_priceId}/jwt_customer`, params, options);
45
+ }
46
+ async jwt_markets(priceId, params, options) {
47
+ const _priceId = priceId.id || priceId;
48
+ return this.resources.fetch({ type: 'markets' }, `prices/${_priceId}/jwt_markets`, params, options);
49
+ }
50
+ async jwt_stock_locations(priceId, params, options) {
51
+ const _priceId = priceId.id || priceId;
52
+ return this.resources.fetch({ type: 'stock_locations' }, `prices/${_priceId}/jwt_stock_locations`, params, options);
53
+ }
42
54
  isPrice(resource) {
43
55
  return resource.type && (resource.type === Prices.TYPE);
44
56
  }
@@ -18,9 +18,6 @@ interface SatispayPayment extends Resource {
18
18
  status?: string | null;
19
19
  redirect_url?: string | null;
20
20
  payment_url?: string | null;
21
- intent_amount_cents: number;
22
- intent_amount_float?: number | null;
23
- formatted_intent_amount?: string | null;
24
21
  payment_response?: Record<string, any> | null;
25
22
  order?: Order | null;
26
23
  payment_gateway?: PaymentGateway | null;
@@ -37,6 +37,7 @@ interface StockItemCreate extends ResourceCreate {
37
37
  interface StockItemUpdate extends ResourceUpdate {
38
38
  sku_code?: string | null;
39
39
  quantity?: number | null;
40
+ _validate?: boolean | null;
40
41
  stock_location?: StockLocationRel | null;
41
42
  sku?: SkuRel | null;
42
43
  }
@@ -51,6 +52,7 @@ declare class StockItems extends ApiResource<StockItem> {
51
52
  stock_reservations(stockItemId: string | StockItem, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<StockReservation>>;
52
53
  attachments(stockItemId: string | StockItem, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
53
54
  versions(stockItemId: string | StockItem, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
55
+ _validate(id: string | StockItem, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<StockItem>;
54
56
  isStockItem(resource: any): resource is StockItem;
55
57
  relationship(id: string | ResourceId | null): StockItemRel;
56
58
  type(): StockItemType;
@@ -35,6 +35,9 @@ class StockItems extends resource_1.ApiResource {
35
35
  const _stockItemId = stockItemId.id || stockItemId;
36
36
  return this.resources.fetch({ type: 'versions' }, `stock_items/${_stockItemId}/versions`, params, options);
37
37
  }
38
+ async _validate(id, params, options) {
39
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: StockItems.TYPE, _validate: true }, params, options);
40
+ }
38
41
  isStockItem(resource) {
39
42
  return resource.type && (resource.type === StockItems.TYPE);
40
43
  }
@@ -19,9 +19,6 @@ interface StripePayment extends Resource {
19
19
  options?: Record<string, any> | null;
20
20
  payment_method?: Record<string, any> | null;
21
21
  mismatched_amounts?: boolean | null;
22
- intent_amount_cents: number;
23
- intent_amount_float?: number | null;
24
- formatted_intent_amount?: string | null;
25
22
  return_url?: string | null;
26
23
  receipt_email?: string | null;
27
24
  payment_instrument?: Record<string, any> | null;
@@ -2,14 +2,14 @@ import * as api from './api';
2
2
  import type { ApiError } from './error';
3
3
  import type { ErrorInterceptor, InterceptorType, RawResponseReader, RequestInterceptor, ResponseInterceptor } from './interceptor';
4
4
  import { type ResourcesInitConfig } from './resource';
5
- declare const OPEN_API_SCHEMA_VERSION = "5.1.0";
5
+ declare const OPEN_API_SCHEMA_VERSION = "5.2.1";
6
6
  export { OPEN_API_SCHEMA_VERSION };
7
7
  type SdkConfig = {};
8
8
  type CommerceLayerInitConfig = SdkConfig & ResourcesInitConfig;
9
9
  type CommerceLayerConfig = Partial<CommerceLayerInitConfig>;
10
10
  declare class CommerceLayerClient {
11
11
  #private;
12
- readonly openApiSchemaVersion = "5.1.0";
12
+ readonly openApiSchemaVersion = "5.2.1";
13
13
  addresses: api.Addresses;
14
14
  adjustments: api.Adjustments;
15
15
  adyen_gateways: api.AdyenGateways;
@@ -16,7 +16,7 @@ import ResourceAdapter from './resource';
16
16
  import Debug from './debug';
17
17
  const debug = Debug('commercelayer');
18
18
  // Autogenerated schema version number, do not remove this line
19
- const OPEN_API_SCHEMA_VERSION = '5.1.0';
19
+ const OPEN_API_SCHEMA_VERSION = '5.2.1';
20
20
  export { OPEN_API_SCHEMA_VERSION };
21
21
  class CommerceLayerClient {
22
22
  // ##__CL_RESOURCES_DEF_STOP__##
@@ -20,9 +20,6 @@ interface AxervePayment extends Resource {
20
20
  buyer_details?: Record<string, any> | null;
21
21
  request_token?: boolean | null;
22
22
  mismatched_amounts?: boolean | null;
23
- intent_amount_cents: number;
24
- intent_amount_float?: number | null;
25
- formatted_intent_amount?: string | null;
26
23
  payment_instrument?: Record<string, any> | null;
27
24
  order?: Order | null;
28
25
  payment_gateway?: PaymentGateway | null;
@@ -18,9 +18,6 @@ interface KlarnaPayment extends Resource {
18
18
  payment_methods: Array<Record<string, any>>;
19
19
  auth_token?: string | null;
20
20
  mismatched_amounts?: boolean | null;
21
- intent_amount_cents: number;
22
- intent_amount_float?: number | null;
23
- formatted_intent_amount?: string | null;
24
21
  payment_instrument?: Record<string, any> | null;
25
22
  order?: Order | null;
26
23
  payment_gateway?: PaymentGateway | null;
@@ -24,6 +24,8 @@ type SkuRel = ResourceRel & {
24
24
  };
25
25
  interface OrderSubscriptionItem extends Resource {
26
26
  readonly type: OrderSubscriptionItemType;
27
+ sku_code?: string | null;
28
+ bundle_code?: string | null;
27
29
  quantity: number;
28
30
  unit_amount_cents?: number | null;
29
31
  unit_amount_float?: number | null;
@@ -35,6 +37,7 @@ interface OrderSubscriptionItem extends Resource {
35
37
  item?: Adjustment | Bundle | Sku | null;
36
38
  sku?: Sku | null;
37
39
  bundle?: Bundle | null;
40
+ adjustment?: Adjustment | null;
38
41
  source_line_item?: LineItem | null;
39
42
  }
40
43
  interface OrderSubscriptionItemCreate extends ResourceCreate {
@@ -46,6 +49,7 @@ interface OrderSubscriptionItemCreate extends ResourceCreate {
46
49
  item: AdjustmentRel | BundleRel | SkuRel;
47
50
  sku?: SkuRel | null;
48
51
  bundle?: BundleRel | null;
52
+ adjustment?: AdjustmentRel | null;
49
53
  }
50
54
  interface OrderSubscriptionItemUpdate extends ResourceUpdate {
51
55
  sku_code?: string | null;
@@ -30,6 +30,7 @@ interface OrderSubscription extends Resource {
30
30
  status: 'draft' | 'inactive' | 'active' | 'cancelled';
31
31
  frequency: string;
32
32
  activate_by_source_order?: boolean | null;
33
+ place_target_order?: boolean | null;
33
34
  customer_email?: string | null;
34
35
  starts_at?: string | null;
35
36
  expires_at?: string | null;
@@ -38,7 +39,6 @@ interface OrderSubscription extends Resource {
38
39
  occurrencies?: number | null;
39
40
  errors_count?: number | null;
40
41
  succeeded_on_last_run?: boolean | null;
41
- options?: Record<string, any> | null;
42
42
  market?: Market | null;
43
43
  subscription_model?: SubscriptionModel | null;
44
44
  source_order?: Order | null;
@@ -54,14 +54,16 @@ interface OrderSubscription extends Resource {
54
54
  interface OrderSubscriptionCreate extends ResourceCreate {
55
55
  frequency: string;
56
56
  activate_by_source_order?: boolean | null;
57
+ place_target_order?: boolean | null;
57
58
  starts_at?: string | null;
58
59
  expires_at?: string | null;
59
- options?: Record<string, any> | null;
60
60
  market?: MarketRel | null;
61
61
  source_order: OrderRel;
62
62
  }
63
63
  interface OrderSubscriptionUpdate extends ResourceUpdate {
64
64
  frequency?: string | null;
65
+ activate_by_source_order?: boolean | null;
66
+ place_target_order?: boolean | null;
65
67
  expires_at?: string | null;
66
68
  next_run_at?: string | null;
67
69
  _activate?: boolean | null;
@@ -22,9 +22,6 @@ interface PaypalPayment extends Resource {
22
22
  status: 'created' | 'approved';
23
23
  approval_url?: string | null;
24
24
  mismatched_amounts?: boolean | null;
25
- intent_amount_cents: number;
26
- intent_amount_float?: number | null;
27
- formatted_intent_amount?: string | null;
28
25
  payment_instrument?: Record<string, any> | null;
29
26
  order?: Order | null;
30
27
  payment_gateway?: PaymentGateway | null;
@@ -8,6 +8,9 @@ import type { PriceVolumeTier } from './price_volume_tiers';
8
8
  import type { PriceFrequencyTier } from './price_frequency_tiers';
9
9
  import type { Attachment } from './attachments';
10
10
  import type { Version } from './versions';
11
+ import type { Customer } from './customers';
12
+ import type { Market } from './markets';
13
+ import type { StockLocation } from './stock_locations';
11
14
  type PriceType = 'prices';
12
15
  type PriceRel = ResourceRel & {
13
16
  type: PriceType;
@@ -38,6 +41,9 @@ interface Price extends Resource {
38
41
  price_frequency_tiers?: PriceFrequencyTier[] | null;
39
42
  attachments?: Attachment[] | null;
40
43
  versions?: Version[] | null;
44
+ jwt_customer?: Customer | null;
45
+ jwt_markets?: Market[] | null;
46
+ jwt_stock_locations?: StockLocation[] | null;
41
47
  }
42
48
  interface PriceCreate extends ResourceCreate {
43
49
  sku_code?: string | null;
@@ -67,6 +73,9 @@ declare class Prices extends ApiResource<Price> {
67
73
  price_frequency_tiers(priceId: string | Price, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<PriceFrequencyTier>>;
68
74
  attachments(priceId: string | Price, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
69
75
  versions(priceId: string | Price, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
76
+ jwt_customer(priceId: string | Price, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Customer>;
77
+ jwt_markets(priceId: string | Price, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Market>>;
78
+ jwt_stock_locations(priceId: string | Price, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<StockLocation>>;
70
79
  isPrice(resource: any): resource is Price;
71
80
  relationship(id: string | ResourceId | null): PriceRel;
72
81
  type(): PriceType;
@@ -37,6 +37,18 @@ class Prices extends ApiResource {
37
37
  const _priceId = priceId.id || priceId;
38
38
  return this.resources.fetch({ type: 'versions' }, `prices/${_priceId}/versions`, params, options);
39
39
  }
40
+ async jwt_customer(priceId, params, options) {
41
+ const _priceId = priceId.id || priceId;
42
+ return this.resources.fetch({ type: 'customers' }, `prices/${_priceId}/jwt_customer`, params, options);
43
+ }
44
+ async jwt_markets(priceId, params, options) {
45
+ const _priceId = priceId.id || priceId;
46
+ return this.resources.fetch({ type: 'markets' }, `prices/${_priceId}/jwt_markets`, params, options);
47
+ }
48
+ async jwt_stock_locations(priceId, params, options) {
49
+ const _priceId = priceId.id || priceId;
50
+ return this.resources.fetch({ type: 'stock_locations' }, `prices/${_priceId}/jwt_stock_locations`, params, options);
51
+ }
40
52
  isPrice(resource) {
41
53
  return resource.type && (resource.type === Prices.TYPE);
42
54
  }
@@ -18,9 +18,6 @@ interface SatispayPayment extends Resource {
18
18
  status?: string | null;
19
19
  redirect_url?: string | null;
20
20
  payment_url?: string | null;
21
- intent_amount_cents: number;
22
- intent_amount_float?: number | null;
23
- formatted_intent_amount?: string | null;
24
21
  payment_response?: Record<string, any> | null;
25
22
  order?: Order | null;
26
23
  payment_gateway?: PaymentGateway | null;
@@ -37,6 +37,7 @@ interface StockItemCreate extends ResourceCreate {
37
37
  interface StockItemUpdate extends ResourceUpdate {
38
38
  sku_code?: string | null;
39
39
  quantity?: number | null;
40
+ _validate?: boolean | null;
40
41
  stock_location?: StockLocationRel | null;
41
42
  sku?: SkuRel | null;
42
43
  }
@@ -51,6 +52,7 @@ declare class StockItems extends ApiResource<StockItem> {
51
52
  stock_reservations(stockItemId: string | StockItem, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<StockReservation>>;
52
53
  attachments(stockItemId: string | StockItem, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
53
54
  versions(stockItemId: string | StockItem, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Version>>;
55
+ _validate(id: string | StockItem, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<StockItem>;
54
56
  isStockItem(resource: any): resource is StockItem;
55
57
  relationship(id: string | ResourceId | null): StockItemRel;
56
58
  type(): StockItemType;
@@ -33,6 +33,9 @@ class StockItems extends ApiResource {
33
33
  const _stockItemId = stockItemId.id || stockItemId;
34
34
  return this.resources.fetch({ type: 'versions' }, `stock_items/${_stockItemId}/versions`, params, options);
35
35
  }
36
+ async _validate(id, params, options) {
37
+ return this.resources.update({ id: (typeof id === 'string') ? id : id.id, type: StockItems.TYPE, _validate: true }, params, options);
38
+ }
36
39
  isStockItem(resource) {
37
40
  return resource.type && (resource.type === StockItems.TYPE);
38
41
  }
@@ -19,9 +19,6 @@ interface StripePayment extends Resource {
19
19
  options?: Record<string, any> | null;
20
20
  payment_method?: Record<string, any> | null;
21
21
  mismatched_amounts?: boolean | null;
22
- intent_amount_cents: number;
23
- intent_amount_float?: number | null;
24
- formatted_intent_amount?: string | null;
25
22
  return_url?: string | null;
26
23
  receipt_email?: string | null;
27
24
  payment_instrument?: Record<string, any> | null;