@epilot/pricing-client 3.38.0 → 3.40.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.
@@ -1 +1 @@
1
- (()=>{"use strict";var e={914:function(e,r,t){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0});var a=i(t(240));r.default=a.default},240:e=>{e.exports=JSON.parse('{"openapi":"3.0.3","info":{"title":"","version":""},"servers":[{"url":"https://pricing-api.sls.epilot.io"}],"paths":{"/v1/pricing:compute":{"post":{"operationId":"$calculatePricingDetails","requestBody":{"required":false,"content":{"application/json":{}}},"responses":{}}},"/v1/order":{"post":{"operationId":"createOrder","requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}},"/v1/order/{id}":{"put":{"operationId":"putOrder","parameters":[{"in":"path","name":"id","required":true}],"requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}},"/v1/public/cart:checkout":{"post":{"operationId":"$checkoutCart","parameters":[{"in":"header","name":"X-Ivy-Org-ID","required":true}],"requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}},"/v1/public/catalog":{"post":{"operationId":"$searchCatalog","parameters":[{"in":"header","name":"X-Ivy-Org-ID"},{"in":"header","name":"Authorization"}],"requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}},"/v1/catalog":{"post":{"operationId":"$privateSearchCatalog","requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}},"/v1/public/availability:check":{"post":{"operationId":"$availabilityCheck","parameters":[{"in":"header","name":"X-Ivy-Org-ID","required":true}],"requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}},"/v1/validate-availability/{id}":{"get":{"operationId":"$validateAvailabilityFile","parameters":[{"in":"path","name":"id","required":true},{"in":"header","name":"X-Epilot-Org-ID","required":true}],"responses":{}}},"/v1/public/integration/{integrationId}/external-catalog":{"post":{"operationId":"$searchExternalCatalog","parameters":[{"in":"path","name":"integrationId","required":true}],"requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}},"/v1/public/integration/{integrationId}/providers:search":{"post":{"operationId":"$searchProviders","parameters":[{"in":"header","name":"X-Epilot-Org-ID","required":true},{"in":"path","name":"integrationId","required":true}],"requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}},"/v1/public/integration/{integrationId}/streets:search":{"post":{"operationId":"$searchStreets","parameters":[{"in":"header","name":"X-Epilot-Org-ID","required":true},{"in":"path","name":"integrationId","required":true}],"requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}},"/v1/public/integration/{integrationId}/compute-price":{"post":{"operationId":"$computePrice","parameters":[{"in":"header","name":"X-Epilot-Org-ID","required":true},{"in":"path","name":"integrationId","required":true}],"requestBody":{"content":{"application/json":{}}},"responses":{}}},"/v1/integration/{integrationId}/credentials":{"get":{"operationId":"$getCredentials","parameters":[{"in":"path","name":"integrationId","required":true}],"responses":{}}},"/v1/integration/{integrationId}/credentials:save":{"put":{"operationId":"$saveCredentials","parameters":[{"in":"path","name":"integrationId","required":true}],"requestBody":{"content":{"application/json":{}}},"responses":{}}},"/v1/integration/{integrationId}/credentials:delete":{"delete":{"operationId":"$deleteCredentials","parameters":[{"in":"path","name":"integrationId","required":true}],"responses":{}}}},"components":{}}')}},r={},t=function t(i){var a=r[i];if(void 0!==a)return a.exports;var n=r[i]={exports:{}};return e[i].call(n.exports,n,n.exports,t),n.exports}(914),i=exports;for(var a in t)i[a]=t[a];t.__esModule&&Object.defineProperty(i,"__esModule",{value:!0})})();
1
+ (()=>{"use strict";var e={914:function(e,r,t){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0});var a=i(t(240));r.default=a.default},240:e=>{e.exports=JSON.parse('{"openapi":"3.0.3","info":{"title":"","version":""},"servers":[{"url":"https://pricing-api.sls.epilot.io"}],"paths":{"/v1/pricing:compute":{"post":{"operationId":"$calculatePricingDetails","requestBody":{"required":false,"content":{"application/json":{}}},"responses":{}}},"/v1/order":{"post":{"operationId":"createOrder","requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}},"/v1/order/{id}":{"put":{"operationId":"putOrder","parameters":[{"in":"path","name":"id","required":true}],"requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}},"/v1/public/cart:checkout":{"post":{"operationId":"$checkoutCart","parameters":[{"in":"header","name":"X-Ivy-Org-ID","required":true}],"requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}},"/v1/public/catalog":{"post":{"operationId":"$searchCatalog","parameters":[{"in":"header","name":"X-Ivy-Org-ID"},{"in":"header","name":"Authorization"}],"requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}},"/v1/catalog":{"post":{"operationId":"$privateSearchCatalog","requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}},"/v1/validate-promo-codes":{"post":{"operationId":"$validatePromoCodes","requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}},"/v1/public/availability:check":{"post":{"operationId":"$availabilityCheck","parameters":[{"in":"header","name":"X-Ivy-Org-ID","required":true}],"requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}},"/v1/validate-availability/{id}":{"get":{"operationId":"$validateAvailabilityFile","parameters":[{"in":"path","name":"id","required":true},{"in":"header","name":"X-Epilot-Org-ID","required":true}],"responses":{}}},"/v1/public/integration/{integrationId}/external-catalog":{"post":{"operationId":"$searchExternalCatalog","parameters":[{"in":"path","name":"integrationId","required":true}],"requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}},"/v1/public/integration/{integrationId}/providers:search":{"post":{"operationId":"$searchProviders","parameters":[{"in":"header","name":"X-Epilot-Org-ID","required":true},{"in":"path","name":"integrationId","required":true}],"requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}},"/v1/public/integration/{integrationId}/streets:search":{"post":{"operationId":"$searchStreets","parameters":[{"in":"header","name":"X-Epilot-Org-ID","required":true},{"in":"path","name":"integrationId","required":true}],"requestBody":{"required":true,"content":{"application/json":{}}},"responses":{}}},"/v1/public/integration/{integrationId}/compute-price":{"post":{"operationId":"$computePrice","parameters":[{"in":"header","name":"X-Epilot-Org-ID","required":true},{"in":"path","name":"integrationId","required":true}],"requestBody":{"content":{"application/json":{}}},"responses":{}}},"/v1/integration/{integrationId}/credentials":{"get":{"operationId":"$getCredentials","parameters":[{"in":"path","name":"integrationId","required":true}],"responses":{}}},"/v1/integration/{integrationId}/credentials:save":{"put":{"operationId":"$saveCredentials","parameters":[{"in":"path","name":"integrationId","required":true}],"requestBody":{"content":{"application/json":{}}},"responses":{}}},"/v1/integration/{integrationId}/credentials:delete":{"delete":{"operationId":"$deleteCredentials","parameters":[{"in":"path","name":"integrationId","required":true}],"responses":{}}}},"components":{}}')}},r={},t=function t(i){var a=r[i];if(void 0!==a)return a.exports;var n=r[i]={exports:{}};return e[i].call(n.exports,n,n.exports,t),n.exports}(914),i=exports;for(var a in t)i[a]=t[a];t.__esModule&&Object.defineProperty(i,"__esModule",{value:!0})})();
@@ -106,6 +106,18 @@
106
106
  "responses": {}
107
107
  }
108
108
  },
109
+ "/v1/validate-promo-codes": {
110
+ "post": {
111
+ "operationId": "$validatePromoCodes",
112
+ "requestBody": {
113
+ "required": true,
114
+ "content": {
115
+ "application/json": {}
116
+ }
117
+ },
118
+ "responses": {}
119
+ }
120
+ },
109
121
  "/v1/public/availability:check": {
110
122
  "post": {
111
123
  "operationId": "$availabilityCheck",
package/dist/openapi.d.ts CHANGED
@@ -216,6 +216,110 @@ declare namespace Components {
216
216
  };
217
217
  }[];
218
218
  }
219
+ /**
220
+ * The coupon configuration
221
+ * example:
222
+ * {
223
+ * "_id": "123e4567-e89b-12d3-a456-426614174000",
224
+ * "_schema": "coupon",
225
+ * "_org": "org_12345",
226
+ * "_created_at": "2024-01-15T10:00:00.000Z",
227
+ * "_updated_at": "2024-01-20T12:00:00.000Z",
228
+ * "_title": "Sample Coupon",
229
+ * "name": "Sample Coupon",
230
+ * "type": "fixed",
231
+ * "fixed_value": 555,
232
+ * "fixed_value_currency": "USD",
233
+ * "fixed_value_decimal": "5.55",
234
+ * "active": true,
235
+ * "prices": {
236
+ * "$relation": [
237
+ * {
238
+ * "entity_id": "abc12345-def6-7890-gh12-ijklmnopqrst",
239
+ * "_tags": [
240
+ * "discount",
241
+ * "special"
242
+ * ],
243
+ * "_schema": "price"
244
+ * }
245
+ * ]
246
+ * }
247
+ * }
248
+ */
249
+ export interface BaseCoupon {
250
+ [name: string]: any;
251
+ _id: EntityId /* uuid */;
252
+ /**
253
+ * The auto-generated title for the title
254
+ */
255
+ _title: string;
256
+ /**
257
+ * Organization Id the entity belongs to
258
+ */
259
+ _org: string;
260
+ /**
261
+ * The schema of the entity, for coupons it is always `coupon`
262
+ */
263
+ _schema: "coupon";
264
+ _tags?: string[];
265
+ /**
266
+ * The creation date for the opportunity
267
+ */
268
+ _created_at: string; // date-time
269
+ /**
270
+ * The date the coupon was last updated
271
+ */
272
+ _updated_at: string; // date-time
273
+ name: string;
274
+ description?: string;
275
+ type?: "fixed" | "percentage";
276
+ category?: "discount" | "cashback";
277
+ /**
278
+ * Use if type is set to percentage. The percentage to be discounted, represented as a whole integer.
279
+ */
280
+ percentage_value?: string;
281
+ /**
282
+ * Use if type is set to fixed. The fixed amount in cents to be discounted, represented as a whole integer.
283
+ */
284
+ fixed_value?: number;
285
+ /**
286
+ * Use if type is set to fixed. The unit amount in cents to be discounted, represented as a decimal string with at most 12 decimal places.
287
+ */
288
+ fixed_value_decimal?: string;
289
+ /**
290
+ * Use if type is set to fixed. Three-letter ISO currency code, in lowercase.
291
+ */
292
+ fixed_value_currency?: /* Use if type is set to fixed. Three-letter ISO currency code, in lowercase. */ /**
293
+ * Three-letter ISO currency code, in lowercase. Must be a supported currency.
294
+ * ISO 4217 CURRENCY CODES as specified in the documentation: https://www.iso.org/iso-4217-currency-codes.html
295
+ *
296
+ * example:
297
+ * EUR
298
+ */
299
+ Currency;
300
+ /**
301
+ * The cashback period, for now it's limited to either 0 months or 12 months
302
+ */
303
+ cashback_period?: "0" | "12";
304
+ active?: boolean;
305
+ /**
306
+ * Whether the coupon requires a promo code to be applied
307
+ */
308
+ requires_promo_code?: boolean;
309
+ /**
310
+ * The prices associated with the coupon. Will hold price entities if hydrated, relations otherwise.
311
+ */
312
+ prices?: /* The prices associated with the coupon. Will hold price entities if hydrated, relations otherwise. */ {
313
+ $relation?: EntityRelation[];
314
+ } | /**
315
+ * The price entity schema for simple pricing
316
+ * example:
317
+ * {
318
+ * "$ref": "#/components/examples/price"
319
+ * }
320
+ */
321
+ Price[];
322
+ }
219
323
  /**
220
324
  * Represents a price item
221
325
  * example:
@@ -2217,15 +2321,125 @@ declare namespace Components {
2217
2321
  */
2218
2322
  requires_promo_code?: boolean;
2219
2323
  /**
2220
- * The promo codes associated with the coupon
2324
+ * The prices associated with the coupon. Will hold price entities if hydrated, relations otherwise.
2325
+ */
2326
+ prices?: /* The prices associated with the coupon. Will hold price entities if hydrated, relations otherwise. */ {
2327
+ $relation?: EntityRelation[];
2328
+ } | /**
2329
+ * The price entity schema for simple pricing
2330
+ * example:
2331
+ * {
2332
+ * "$ref": "#/components/examples/price"
2333
+ * }
2334
+ */
2335
+ Price[];
2336
+ promo_codes?: /**
2337
+ * example:
2338
+ * {
2339
+ * "id": "123e4567-e89b-12d3-a456-426614174000",
2340
+ * "code": "123456",
2341
+ * "has_usage_limit": true,
2342
+ * "usage_limit": 10
2343
+ * }
2221
2344
  */
2222
- promo_codes?: PromoCode[];
2345
+ PromoCode[];
2223
2346
  /**
2224
2347
  * Map of ids of promo codes with their usage count
2225
2348
  */
2226
2349
  promo_code_usage?: {
2227
2350
  [name: string]: number;
2228
2351
  };
2352
+ }
2353
+ /**
2354
+ * The coupon configuration
2355
+ * example:
2356
+ * {
2357
+ * "_id": "123e4567-e89b-12d3-a456-426614174000",
2358
+ * "_schema": "coupon",
2359
+ * "_org": "org_12345",
2360
+ * "_created_at": "2024-01-15T10:00:00.000Z",
2361
+ * "_updated_at": "2024-01-20T12:00:00.000Z",
2362
+ * "_title": "Sample Coupon",
2363
+ * "name": "Sample Coupon",
2364
+ * "type": "fixed",
2365
+ * "fixed_value": 555,
2366
+ * "fixed_value_currency": "USD",
2367
+ * "fixed_value_decimal": "5.55",
2368
+ * "active": true,
2369
+ * "prices": {
2370
+ * "$relation": [
2371
+ * {
2372
+ * "entity_id": "abc12345-def6-7890-gh12-ijklmnopqrst",
2373
+ * "_tags": [
2374
+ * "discount",
2375
+ * "special"
2376
+ * ],
2377
+ * "_schema": "price"
2378
+ * }
2379
+ * ]
2380
+ * }
2381
+ * }
2382
+ */
2383
+ export interface CouponWithoutPromoCodes {
2384
+ [name: string]: any;
2385
+ _id: EntityId /* uuid */;
2386
+ /**
2387
+ * The auto-generated title for the title
2388
+ */
2389
+ _title: string;
2390
+ /**
2391
+ * Organization Id the entity belongs to
2392
+ */
2393
+ _org: string;
2394
+ /**
2395
+ * The schema of the entity, for coupons it is always `coupon`
2396
+ */
2397
+ _schema: "coupon";
2398
+ _tags?: string[];
2399
+ /**
2400
+ * The creation date for the opportunity
2401
+ */
2402
+ _created_at: string; // date-time
2403
+ /**
2404
+ * The date the coupon was last updated
2405
+ */
2406
+ _updated_at: string; // date-time
2407
+ name: string;
2408
+ description?: string;
2409
+ type?: "fixed" | "percentage";
2410
+ category?: "discount" | "cashback";
2411
+ /**
2412
+ * Use if type is set to percentage. The percentage to be discounted, represented as a whole integer.
2413
+ */
2414
+ percentage_value?: string;
2415
+ /**
2416
+ * Use if type is set to fixed. The fixed amount in cents to be discounted, represented as a whole integer.
2417
+ */
2418
+ fixed_value?: number;
2419
+ /**
2420
+ * Use if type is set to fixed. The unit amount in cents to be discounted, represented as a decimal string with at most 12 decimal places.
2421
+ */
2422
+ fixed_value_decimal?: string;
2423
+ /**
2424
+ * Use if type is set to fixed. Three-letter ISO currency code, in lowercase.
2425
+ */
2426
+ fixed_value_currency?: /* Use if type is set to fixed. Three-letter ISO currency code, in lowercase. */ /**
2427
+ * Three-letter ISO currency code, in lowercase. Must be a supported currency.
2428
+ * ISO 4217 CURRENCY CODES as specified in the documentation: https://www.iso.org/iso-4217-currency-codes.html
2429
+ *
2430
+ * example:
2431
+ * EUR
2432
+ */
2433
+ Currency;
2434
+ /**
2435
+ * The cashback period, for now it's limited to either 0 months or 12 months
2436
+ */
2437
+ cashback_period?: "0" | "12";
2438
+ active?: boolean;
2439
+ /**
2440
+ * Whether the coupon requires a promo code to be applied
2441
+ */
2442
+ requires_promo_code?: boolean;
2229
2443
  /**
2230
2444
  * The prices associated with the coupon. Will hold price entities if hydrated, relations otherwise.
2231
2445
  */
@@ -4318,6 +4532,15 @@ declare namespace Components {
4318
4532
  _updated_at?: string;
4319
4533
  }
4320
4534
  export type ProductCategory = "power" | "gas";
4535
+ /**
4536
+ * example:
4537
+ * {
4538
+ * "id": "123e4567-e89b-12d3-a456-426614174000",
4539
+ * "code": "123456",
4540
+ * "has_usage_limit": true,
4541
+ * "usage_limit": 10
4542
+ * }
4543
+ */
4321
4544
  export interface PromoCode {
4322
4545
  /**
4323
4546
  * The id of the promo code
@@ -4336,6 +4559,42 @@ declare namespace Components {
4336
4559
  */
4337
4560
  usage_limit?: number | null;
4338
4561
  }
4562
+ /**
4563
+ * The result from the validation of a set of promo codes.
4564
+ */
4565
+ export interface PromoCodeValidationResponse {
4566
+ matched_coupons?: /**
4567
+ * The coupon configuration
4568
+ * example:
4569
+ * {
4570
+ * "_id": "123e4567-e89b-12d3-a456-426614174000",
4571
+ * "_schema": "coupon",
4572
+ * "_org": "org_12345",
4573
+ * "_created_at": "2024-01-15T10:00:00.000Z",
4574
+ * "_updated_at": "2024-01-20T12:00:00.000Z",
4575
+ * "_title": "Sample Coupon",
4576
+ * "name": "Sample Coupon",
4577
+ * "type": "fixed",
4578
+ * "fixed_value": 555,
4579
+ * "fixed_value_currency": "USD",
4580
+ * "fixed_value_decimal": "5.55",
4581
+ * "active": true,
4582
+ * "prices": {
4583
+ * "$relation": [
4584
+ * {
4585
+ * "entity_id": "abc12345-def6-7890-gh12-ijklmnopqrst",
4586
+ * "_tags": [
4587
+ * "discount",
4588
+ * "special"
4589
+ * ],
4590
+ * "_schema": "price"
4591
+ * }
4592
+ * ]
4593
+ * }
4594
+ * }
4595
+ */
4596
+ BaseCoupon[];
4597
+ }
4339
4598
  /**
4340
4599
  * The provider entity
4341
4600
  */
@@ -5128,6 +5387,22 @@ declare namespace Paths {
5128
5387
  export type $400 = Components.Schemas.Error;
5129
5388
  }
5130
5389
  }
5390
+ namespace $ValidatePromoCodes {
5391
+ export interface RequestBody {
5392
+ /**
5393
+ * The list of coupon ids to unlock with promo codes
5394
+ */
5395
+ coupon_ids?: string[];
5396
+ /**
5397
+ * The list of promo codes to validate against the coupons
5398
+ */
5399
+ promo_codes?: string[];
5400
+ }
5401
+ namespace Responses {
5402
+ export type $200 = /* The result from the validation of a set of promo codes. */ Components.Schemas.PromoCodeValidationResponse;
5403
+ export type $400 = Components.Schemas.Error;
5404
+ }
5405
+ }
5131
5406
  namespace CreateOrder {
5132
5407
  export type RequestBody = /* Order Entity Payload */ Components.Schemas.OrderPayload;
5133
5408
  namespace Responses {
@@ -5236,6 +5511,16 @@ export interface OperationMethods {
5236
5511
  data?: Paths.$PrivateSearchCatalog.RequestBody,
5237
5512
  config?: AxiosRequestConfig
5238
5513
  ): OperationResponse<Paths.$PrivateSearchCatalog.Responses.$200>
5514
+ /**
5515
+ * $validatePromoCodes - validatePromoCodes
5516
+ *
5517
+ * Validate a list of promo codes against a list of coupons
5518
+ */
5519
+ '$validatePromoCodes'(
5520
+ parameters?: Parameters<UnknownParamsObject> | null,
5521
+ data?: Paths.$ValidatePromoCodes.RequestBody,
5522
+ config?: AxiosRequestConfig
5523
+ ): OperationResponse<Paths.$ValidatePromoCodes.Responses.$200>
5239
5524
  /**
5240
5525
  * $availabilityCheck - availabilityCheck
5241
5526
  *
@@ -5412,6 +5697,18 @@ export interface PathsDictionary {
5412
5697
  config?: AxiosRequestConfig
5413
5698
  ): OperationResponse<Paths.$PrivateSearchCatalog.Responses.$200>
5414
5699
  }
5700
+ ['/v1/validate-promo-codes']: {
5701
+ /**
5702
+ * $validatePromoCodes - validatePromoCodes
5703
+ *
5704
+ * Validate a list of promo codes against a list of coupons
5705
+ */
5706
+ 'post'(
5707
+ parameters?: Parameters<UnknownParamsObject> | null,
5708
+ data?: Paths.$ValidatePromoCodes.RequestBody,
5709
+ config?: AxiosRequestConfig
5710
+ ): OperationResponse<Paths.$ValidatePromoCodes.Responses.$200>
5711
+ }
5415
5712
  ['/v1/public/availability:check']: {
5416
5713
  /**
5417
5714
  * $availabilityCheck - availabilityCheck
@@ -5531,6 +5828,7 @@ export type AvailabilityDate = Components.Schemas.AvailabilityDate;
5531
5828
  export type AvailabilityFilters = Components.Schemas.AvailabilityFilters;
5532
5829
  export type AvailabilityLocation = Components.Schemas.AvailabilityLocation;
5533
5830
  export type AvailabilityResult = Components.Schemas.AvailabilityResult;
5831
+ export type BaseCoupon = Components.Schemas.BaseCoupon;
5534
5832
  export type BasePriceItem = Components.Schemas.BasePriceItem;
5535
5833
  export type BasePriceItemCommon = Components.Schemas.BasePriceItemCommon;
5536
5834
  export type BasePriceItemDto = Components.Schemas.BasePriceItemDto;
@@ -5557,6 +5855,7 @@ export type ComputedPriceBreakdown = Components.Schemas.ComputedPriceBreakdown;
5557
5855
  export type ComputedPriceComponents = Components.Schemas.ComputedPriceComponents;
5558
5856
  export type ConsumptionTypeGetAg = Components.Schemas.ConsumptionTypeGetAg;
5559
5857
  export type Coupon = Components.Schemas.Coupon;
5858
+ export type CouponWithoutPromoCodes = Components.Schemas.CouponWithoutPromoCodes;
5560
5859
  export type Currency = Components.Schemas.Currency;
5561
5860
  export type Customer = Components.Schemas.Customer;
5562
5861
  export type DynamicTariffInterval = Components.Schemas.DynamicTariffInterval;
@@ -5604,6 +5903,7 @@ export type PricingModel = Components.Schemas.PricingModel;
5604
5903
  export type Product = Components.Schemas.Product;
5605
5904
  export type ProductCategory = Components.Schemas.ProductCategory;
5606
5905
  export type PromoCode = Components.Schemas.PromoCode;
5906
+ export type PromoCodeValidationResponse = Components.Schemas.PromoCodeValidationResponse;
5607
5907
  export type Provider = Components.Schemas.Provider;
5608
5908
  export type RecurrenceAmount = Components.Schemas.RecurrenceAmount;
5609
5909
  export type RecurrenceAmountDto = Components.Schemas.RecurrenceAmountDto;
package/dist/openapi.json CHANGED
@@ -24,6 +24,10 @@
24
24
  "name": "Catalog API",
25
25
  "description": "Provides a way to query the entire catalog of products and prices.\n"
26
26
  },
27
+ {
28
+ "name": "Promo Codes API",
29
+ "description": "This API enables the validation of promo codes within journeys, their uniqueness and availability\n"
30
+ },
27
31
  {
28
32
  "name": "Availability API",
29
33
  "description": "Provides endpoints for querying products availability by a set of predefined dimensions.\n"
@@ -867,6 +871,105 @@
867
871
  }
868
872
  }
869
873
  },
874
+ "/v1/validate-promo-codes": {
875
+ "post": {
876
+ "description": "Validate a list of promo codes against a list of coupons",
877
+ "summary": "validatePromoCodes",
878
+ "operationId": "$validatePromoCodes",
879
+ "tags": [
880
+ "Promo Codes API"
881
+ ],
882
+ "requestBody": {
883
+ "required": true,
884
+ "content": {
885
+ "application/json": {
886
+ "schema": {
887
+ "properties": {
888
+ "coupon_ids": {
889
+ "type": "array",
890
+ "description": "The list of coupon ids to unlock with promo codes",
891
+ "items": {
892
+ "type": "string"
893
+ }
894
+ },
895
+ "promo_codes": {
896
+ "type": "array",
897
+ "description": "The list of promo codes to validate against the coupons",
898
+ "items": {
899
+ "type": "string"
900
+ }
901
+ }
902
+ }
903
+ },
904
+ "examples": {
905
+ "Find coupons matching codes": {
906
+ "value": {
907
+ "coupon_ids": [
908
+ "81b8e841-5926-4a73-ac77-6607c1037b65",
909
+ "45964a30-1a42-4e59-9362-7d954baf4ea1"
910
+ ],
911
+ "promo_codes": [
912
+ "ABC",
913
+ "DEF"
914
+ ]
915
+ }
916
+ }
917
+ }
918
+ }
919
+ }
920
+ },
921
+ "responses": {
922
+ "200": {
923
+ "description": "Pricing details result",
924
+ "content": {
925
+ "application/json": {
926
+ "schema": {
927
+ "$ref": "#/components/schemas/PromoCodeValidationResponse"
928
+ },
929
+ "example": {
930
+ "matched_coupons": [
931
+ {
932
+ "name": "Coupon with promo-codes",
933
+ "type": "fixed",
934
+ "percentage_value": null,
935
+ "fixed_value": 10,
936
+ "fixed_value_currency": "EUR",
937
+ "fixed_value_decimal": "10.00",
938
+ "category": "discount",
939
+ "cashback_period": null,
940
+ "active": true,
941
+ "_schema": "coupon",
942
+ "requires_promo_code": true,
943
+ "_id": "81b8e841-5926-4a73-ac77-6607c1037b65",
944
+ "_org": "739224",
945
+ "_owners": [
946
+ {
947
+ "org_id": "739224",
948
+ "user_id": "11000622"
949
+ }
950
+ ],
951
+ "_created_at": "2025-01-29T15:46:41.014Z",
952
+ "_updated_at": "2025-01-29T15:46:41.014Z",
953
+ "_title": "Coupon with promo-codes"
954
+ }
955
+ ]
956
+ }
957
+ }
958
+ }
959
+ },
960
+ "400": {
961
+ "description": "Invalid payload",
962
+ "content": {
963
+ "application/json": {
964
+ "schema": {
965
+ "$ref": "#/components/schemas/Error"
966
+ }
967
+ }
968
+ }
969
+ }
970
+ }
971
+ }
972
+ },
870
973
  "/v1/public/availability:check": {
871
974
  "post": {
872
975
  "description": "The availability check endpoint",
@@ -4573,6 +4676,18 @@
4573
4676
  }
4574
4677
  }
4575
4678
  },
4679
+ "PromoCodeValidationResponse": {
4680
+ "type": "object",
4681
+ "description": "The result from the validation of a set of promo codes.",
4682
+ "properties": {
4683
+ "matched_coupons": {
4684
+ "type": "array",
4685
+ "items": {
4686
+ "$ref": "#/components/schemas/BaseCoupon"
4687
+ }
4688
+ }
4689
+ }
4690
+ },
4576
4691
  "PricingDetailsResponse": {
4577
4692
  "type": "object",
4578
4693
  "description": "The result from the calculation of a set of price items.",
@@ -5051,7 +5166,7 @@
5051
5166
  }
5052
5167
  }
5053
5168
  },
5054
- "Coupon": {
5169
+ "BaseCoupon": {
5055
5170
  "type": "object",
5056
5171
  "description": "The coupon configuration",
5057
5172
  "additionalProperties": true,
@@ -5160,20 +5275,6 @@
5160
5275
  "type": "boolean",
5161
5276
  "description": "Whether the coupon requires a promo code to be applied"
5162
5277
  },
5163
- "promo_codes": {
5164
- "type": "array",
5165
- "description": "The promo codes associated with the coupon",
5166
- "items": {
5167
- "$ref": "#/components/schemas/PromoCode"
5168
- }
5169
- },
5170
- "promo_code_usage": {
5171
- "type": "object",
5172
- "additionalProperties": {
5173
- "type": "number"
5174
- },
5175
- "description": "Map of ids of promo codes with their usage count"
5176
- },
5177
5278
  "prices": {
5178
5279
  "description": "The prices associated with the coupon. Will hold price entities if hydrated, relations otherwise.",
5179
5280
  "oneOf": [
@@ -5224,6 +5325,36 @@
5224
5325
  }
5225
5326
  }
5226
5327
  },
5328
+ "Coupon": {
5329
+ "allOf": [
5330
+ {
5331
+ "$ref": "#/components/schemas/BaseCoupon"
5332
+ }
5333
+ ],
5334
+ "type": "object",
5335
+ "properties": {
5336
+ "promo_codes": {
5337
+ "type": "array",
5338
+ "items": {
5339
+ "$ref": "#/components/schemas/PromoCode"
5340
+ }
5341
+ },
5342
+ "promo_code_usage": {
5343
+ "type": "object",
5344
+ "additionalProperties": {
5345
+ "type": "number"
5346
+ },
5347
+ "description": "Map of ids of promo codes with their usage count"
5348
+ }
5349
+ }
5350
+ },
5351
+ "CouponWithoutPromoCodes": {
5352
+ "allOf": [
5353
+ {
5354
+ "$ref": "#/components/schemas/BaseCoupon"
5355
+ }
5356
+ ]
5357
+ },
5227
5358
  "PromoCode": {
5228
5359
  "type": "object",
5229
5360
  "required": [
@@ -5248,6 +5379,12 @@
5248
5379
  "nullable": true,
5249
5380
  "description": "The usage limit of the promo code"
5250
5381
  }
5382
+ },
5383
+ "example": {
5384
+ "id": "123e4567-e89b-12d3-a456-426614174000",
5385
+ "code": "123456",
5386
+ "has_usage_limit": true,
5387
+ "usage_limit": 10
5251
5388
  }
5252
5389
  },
5253
5390
  "PriceTier": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epilot/pricing-client",
3
- "version": "3.38.0",
3
+ "version": "3.40.0",
4
4
  "description": "Client for epilot Pricing APIs",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",