@epilot/pricing-client 3.27.8 → 3.29.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,t,r){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=i(r(240));t.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/order":{"post":{"operationId":"createOrder","requestBody":{"required":true,"content":{"application/json":{}}}}},"/v1/order/{id}":{"put":{"operationId":"putOrder","parameters":[{"in":"path","name":"id","required":true}],"requestBody":{"required":true,"content":{"application/json":{}}}}},"/v1/public/cart:checkout":{"post":{"operationId":"$checkoutCart","parameters":[{"in":"header","name":"X-Ivy-Org-ID","required":true}],"requestBody":{"required":true,"content":{"application/json":{}}}}},"/v1/public/catalog":{"post":{"operationId":"$searchCatalog","parameters":[{"in":"header","name":"X-Ivy-Org-ID","required":true}],"requestBody":{"required":true,"content":{"application/json":{}}}}},"/v1/catalog":{"post":{"operationId":"$privateSearchCatalog","requestBody":{"required":true,"content":{"application/json":{}}}}},"/v1/public/availability:check":{"post":{"operationId":"$availabilityCheck","parameters":[{"in":"header","name":"X-Ivy-Org-ID","required":true}],"requestBody":{"required":true,"content":{"application/json":{}}}}},"/v1/validate-availability/{id}":{"get":{"operationId":"$validateAvailabilityFile","parameters":[{"in":"path","name":"id","required":true},{"in":"header","name":"X-Epilot-Org-ID","required":true}]}},"/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":{}}}}},"/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":{}}}}},"/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":{}}}}},"/v1/integration/{integrationId}/credentials":{"get":{"operationId":"$getCredentials","parameters":[{"in":"path","name":"integrationId","required":true}]}},"/v1/integration/{integrationId}/credentials:save":{"put":{"operationId":"$saveCredentials","parameters":[{"in":"path","name":"integrationId","required":true}],"requestBody":{"content":{"application/json":{}}}}},"/v1/integration/{integrationId}/credentials:delete":{"delete":{"operationId":"$deleteCredentials","parameters":[{"in":"path","name":"integrationId","required":true}]}},"/v1/public/opportunity":{"post":{"deprecated":true,"operationId":"$createOpportunity","parameters":[{"in":"header","name":"X-Ivy-Org-ID","required":true}],"requestBody":{"required":true,"content":{"application/json":{}}}}}},"components":{}}')}},t={},r=function r(i){var a=t[i];if(void 0!==a)return a.exports;var n=t[i]={exports:{}};return e[i].call(n.exports,n,n.exports,r),n.exports}(914),i=exports;for(var a in r)i[a]=r[a];r.__esModule&&Object.defineProperty(i,"__esModule",{value:!0})})();
1
+ (()=>{"use strict";var e={914:function(e,t,r){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=i(r(240));t.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":{}}}}},"/v1/order":{"post":{"operationId":"createOrder","requestBody":{"required":true,"content":{"application/json":{}}}}},"/v1/order/{id}":{"put":{"operationId":"putOrder","parameters":[{"in":"path","name":"id","required":true}],"requestBody":{"required":true,"content":{"application/json":{}}}}},"/v1/public/cart:checkout":{"post":{"operationId":"$checkoutCart","parameters":[{"in":"header","name":"X-Ivy-Org-ID","required":true}],"requestBody":{"required":true,"content":{"application/json":{}}}}},"/v1/public/catalog":{"post":{"operationId":"$searchCatalog","parameters":[{"in":"header","name":"X-Ivy-Org-ID"},{"in":"header","name":"Authorization"}],"requestBody":{"required":true,"content":{"application/json":{}}}}},"/v1/catalog":{"post":{"operationId":"$privateSearchCatalog","requestBody":{"required":true,"content":{"application/json":{}}}}},"/v1/public/availability:check":{"post":{"operationId":"$availabilityCheck","parameters":[{"in":"header","name":"X-Ivy-Org-ID","required":true}],"requestBody":{"required":true,"content":{"application/json":{}}}}},"/v1/validate-availability/{id}":{"get":{"operationId":"$validateAvailabilityFile","parameters":[{"in":"path","name":"id","required":true},{"in":"header","name":"X-Epilot-Org-ID","required":true}]}},"/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":{}}}}},"/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":{}}}}},"/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":{}}}}},"/v1/integration/{integrationId}/credentials":{"get":{"operationId":"$getCredentials","parameters":[{"in":"path","name":"integrationId","required":true}]}},"/v1/integration/{integrationId}/credentials:save":{"put":{"operationId":"$saveCredentials","parameters":[{"in":"path","name":"integrationId","required":true}],"requestBody":{"content":{"application/json":{}}}}},"/v1/integration/{integrationId}/credentials:delete":{"delete":{"operationId":"$deleteCredentials","parameters":[{"in":"path","name":"integrationId","required":true}]}}},"components":{}}')}},t={},r=function r(i){var a=t[i];if(void 0!==a)return a.exports;var n=t[i]={exports:{}};return e[i].call(n.exports,n,n.exports,r),n.exports}(914),i=exports;for(var a in r)i[a]=r[a];r.__esModule&&Object.defineProperty(i,"__esModule",{value:!0})})();
@@ -10,6 +10,17 @@
10
10
  }
11
11
  ],
12
12
  "paths": {
13
+ "/v1/pricing:compute": {
14
+ "post": {
15
+ "operationId": "$calculatePricingDetails",
16
+ "requestBody": {
17
+ "required": false,
18
+ "content": {
19
+ "application/json": {}
20
+ }
21
+ }
22
+ }
23
+ },
13
24
  "/v1/order": {
14
25
  "post": {
15
26
  "operationId": "createOrder",
@@ -63,8 +74,11 @@
63
74
  "parameters": [
64
75
  {
65
76
  "in": "header",
66
- "name": "X-Ivy-Org-ID",
67
- "required": true
77
+ "name": "X-Ivy-Org-ID"
78
+ },
79
+ {
80
+ "in": "header",
81
+ "name": "Authorization"
68
82
  }
69
83
  ],
70
84
  "requestBody": {
@@ -229,25 +243,6 @@
229
243
  }
230
244
  ]
231
245
  }
232
- },
233
- "/v1/public/opportunity": {
234
- "post": {
235
- "deprecated": true,
236
- "operationId": "$createOpportunity",
237
- "parameters": [
238
- {
239
- "in": "header",
240
- "name": "X-Ivy-Org-ID",
241
- "required": true
242
- }
243
- ],
244
- "requestBody": {
245
- "required": true,
246
- "content": {
247
- "application/json": {}
248
- }
249
- }
250
- }
251
246
  }
252
247
  },
253
248
  "components": {}
package/dist/openapi.d.ts CHANGED
@@ -179,7 +179,7 @@ declare namespace Components {
179
179
  * Represents a price item
180
180
  * example:
181
181
  * {
182
- * "$ref": "#/components/examples/price-item"
182
+ * "$ref": "#/components/examples/price-item/value"
183
183
  * }
184
184
  */
185
185
  export interface BasePriceItem {
@@ -670,7 +670,37 @@ declare namespace Components {
670
670
  * "$ref": "#/components/examples/price"
671
671
  * }
672
672
  */
673
- Price)[];
673
+ Price | /**
674
+ * The coupon configuration
675
+ * example:
676
+ * {
677
+ * "_id": "123e4567-e89b-12d3-a456-426614174000",
678
+ * "_schema": "coupon",
679
+ * "_org": "org_12345",
680
+ * "_created_at": "2024-01-15T10:00:00.000Z",
681
+ * "_updated_at": "2024-01-20T12:00:00.000Z",
682
+ * "_title": "Sample Coupon",
683
+ * "name": "Sample Coupon",
684
+ * "type": "fixed",
685
+ * "fixed_value": 555,
686
+ * "fixed_value_currency": "USD",
687
+ * "fixed_value_decimal": "5.55",
688
+ * "active": true,
689
+ * "prices": {
690
+ * "$relation": [
691
+ * {
692
+ * "entity_id": "abc12345-def6-7890-gh12-ijklmnopqrst",
693
+ * "_tags": [
694
+ * "discount",
695
+ * "special"
696
+ * ],
697
+ * "_schema": "price"
698
+ * }
699
+ * ]
700
+ * }
701
+ * }
702
+ */
703
+ Coupon)[];
674
704
  }
675
705
  /**
676
706
  * The cart checkout request payload
@@ -770,7 +800,7 @@ declare namespace Components {
770
800
  * Represents a composite price input to the pricing library.
771
801
  * example:
772
802
  * {
773
- * "$ref": "#/components/examples/price-item"
803
+ * "$ref": "#/components/examples/price-item/value"
774
804
  * }
775
805
  */
776
806
  export interface CompositePriceItem {
@@ -916,7 +946,7 @@ declare namespace Components {
916
946
  * Represents a price item
917
947
  * example:
918
948
  * {
919
- * "$ref": "#/components/examples/price-item"
949
+ * "$ref": "#/components/examples/price-item/value"
920
950
  * }
921
951
  */
922
952
  PriceItem[];
@@ -1290,6 +1320,101 @@ declare namespace Components {
1290
1320
  [name: string]: /* The computed price */ ComputedBasePrice;
1291
1321
  }
1292
1322
  export type ConsumptionTypeGetAg = "household" | "heating_pump" | "night_storage_heating" | "night_storage_heating_common_meter";
1323
+ /**
1324
+ * The coupon configuration
1325
+ * example:
1326
+ * {
1327
+ * "_id": "123e4567-e89b-12d3-a456-426614174000",
1328
+ * "_schema": "coupon",
1329
+ * "_org": "org_12345",
1330
+ * "_created_at": "2024-01-15T10:00:00.000Z",
1331
+ * "_updated_at": "2024-01-20T12:00:00.000Z",
1332
+ * "_title": "Sample Coupon",
1333
+ * "name": "Sample Coupon",
1334
+ * "type": "fixed",
1335
+ * "fixed_value": 555,
1336
+ * "fixed_value_currency": "USD",
1337
+ * "fixed_value_decimal": "5.55",
1338
+ * "active": true,
1339
+ * "prices": {
1340
+ * "$relation": [
1341
+ * {
1342
+ * "entity_id": "abc12345-def6-7890-gh12-ijklmnopqrst",
1343
+ * "_tags": [
1344
+ * "discount",
1345
+ * "special"
1346
+ * ],
1347
+ * "_schema": "price"
1348
+ * }
1349
+ * ]
1350
+ * }
1351
+ * }
1352
+ */
1353
+ export interface Coupon {
1354
+ [name: string]: any;
1355
+ _id: EntityId /* uuid */;
1356
+ /**
1357
+ * The auto-generated title for the title
1358
+ */
1359
+ _title: string;
1360
+ /**
1361
+ * Organization Id the entity belongs to
1362
+ */
1363
+ _org: string;
1364
+ /**
1365
+ * The schema of the entity, for coupons it is always `coupon`
1366
+ */
1367
+ _schema: "coupon";
1368
+ _tags?: string[];
1369
+ /**
1370
+ * The creation date for the opportunity
1371
+ */
1372
+ _created_at: string; // date-time
1373
+ /**
1374
+ * The date the coupon was last updated
1375
+ */
1376
+ _updated_at: string; // date-time
1377
+ name: string;
1378
+ description?: string;
1379
+ type: "fixed" | "percentage";
1380
+ /**
1381
+ * Use if type is set to percentage. The percentage to be discounted, represented as a whole integer.
1382
+ */
1383
+ percentage_value?: number;
1384
+ /**
1385
+ * Use if type is set to fixed. The fixed amount in cents to be discounted, represented as a whole integer.
1386
+ */
1387
+ fixed_value?: number;
1388
+ /**
1389
+ * 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.
1390
+ */
1391
+ fixed_value_decimal?: string;
1392
+ /**
1393
+ * Use if type is set to fixed. Three-letter ISO currency code, in lowercase.
1394
+ */
1395
+ fixed_value_currency?: /* Use if type is set to fixed. Three-letter ISO currency code, in lowercase. */ /**
1396
+ * Three-letter ISO currency code, in lowercase. Must be a supported currency.
1397
+ * ISO 4217 CURRENCY CODES as specified in the documentation: https://www.iso.org/iso-4217-currency-codes.html
1398
+ *
1399
+ * example:
1400
+ * EUR
1401
+ */
1402
+ Currency;
1403
+ active?: boolean;
1404
+ /**
1405
+ * The prices associated with the coupon. Will hold price entities if hydrated, relations otherwise.
1406
+ */
1407
+ prices?: /* The prices associated with the coupon. Will hold price entities if hydrated, relations otherwise. */ {
1408
+ $relation?: EntityRelation[];
1409
+ } | /**
1410
+ * The price entity schema for simple pricing
1411
+ * example:
1412
+ * {
1413
+ * "$ref": "#/components/examples/price"
1414
+ * }
1415
+ */
1416
+ Price[];
1417
+ }
1293
1418
  /**
1294
1419
  * Three-letter ISO currency code, in lowercase. Must be a supported currency.
1295
1420
  * ISO 4217 CURRENCY CODES as specified in the documentation: https://www.iso.org/iso-4217-currency-codes.html
@@ -2204,7 +2329,7 @@ declare namespace Components {
2204
2329
  * Represents a price item
2205
2330
  * example:
2206
2331
  * {
2207
- * "$ref": "#/components/examples/price-item"
2332
+ * "$ref": "#/components/examples/price-item/value"
2208
2333
  * }
2209
2334
  */
2210
2335
  export interface PriceItem {
@@ -2745,14 +2870,14 @@ declare namespace Components {
2745
2870
  * Represents a price item
2746
2871
  * example:
2747
2872
  * {
2748
- * "$ref": "#/components/examples/price-item"
2873
+ * "$ref": "#/components/examples/price-item/value"
2749
2874
  * }
2750
2875
  */
2751
2876
  PriceItem | /**
2752
2877
  * Represents a composite price input to the pricing library.
2753
2878
  * example:
2754
2879
  * {
2755
- * "$ref": "#/components/examples/price-item"
2880
+ * "$ref": "#/components/examples/price-item/value"
2756
2881
  * }
2757
2882
  */
2758
2883
  CompositePriceItem)[];
@@ -2789,14 +2914,63 @@ declare namespace Components {
2789
2914
  * Represents a price item
2790
2915
  * example:
2791
2916
  * {
2792
- * "$ref": "#/components/examples/price-item"
2917
+ * "$ref": "#/components/examples/price-item/value"
2918
+ * }
2919
+ */
2920
+ PriceItem | /**
2921
+ * Represents a composite price input to the pricing library.
2922
+ * example:
2923
+ * {
2924
+ * "$ref": "#/components/examples/price-item/value"
2925
+ * }
2926
+ */
2927
+ CompositePriceItem)[];
2928
+ /**
2929
+ * Total of all items before (discounts or) taxes are applied.
2930
+ */
2931
+ amount_subtotal?: number;
2932
+ /**
2933
+ * Total of all items after (discounts and) taxes are applied.
2934
+ */
2935
+ amount_total?: number;
2936
+ /**
2937
+ * The unit gross amount value.
2938
+ */
2939
+ unit_amount_gross?: number;
2940
+ /**
2941
+ * The unit net amount value.
2942
+ */
2943
+ unit_amount_net?: number;
2944
+ /**
2945
+ * This is the sum of all the price item tax amounts.
2946
+ */
2947
+ amount_tax?: number;
2948
+ total_details?: /* The total details with tax (and discount) aggregated totals. */ TotalDetails;
2949
+ currency?: /**
2950
+ * Three-letter ISO currency code, in lowercase. Must be a supported currency.
2951
+ * ISO 4217 CURRENCY CODES as specified in the documentation: https://www.iso.org/iso-4217-currency-codes.html
2952
+ *
2953
+ * example:
2954
+ * EUR
2955
+ */
2956
+ Currency;
2957
+ }
2958
+ /**
2959
+ * The result from the calculation of a set of price items.
2960
+ */
2961
+ export interface PricingDetailsResponse {
2962
+ items?: (/**
2963
+ * Represents a price item
2964
+ * example:
2965
+ * {
2966
+ * "$ref": "#/components/examples/price-item/value"
2793
2967
  * }
2794
2968
  */
2795
2969
  PriceItem | /**
2796
2970
  * Represents a composite price input to the pricing library.
2797
2971
  * example:
2798
2972
  * {
2799
- * "$ref": "#/components/examples/price-item"
2973
+ * "$ref": "#/components/examples/price-item/value"
2800
2974
  * }
2801
2975
  */
2802
2976
  CompositePriceItem)[];
@@ -3396,6 +3570,15 @@ declare namespace Paths {
3396
3570
  export type $400 = Components.Schemas.Error;
3397
3571
  }
3398
3572
  }
3573
+ namespace $CalculatePricingDetails {
3574
+ export interface RequestBody {
3575
+ line_items?: /* A valid set of product prices, quantities, (discounts) and taxes from a client. */ Components.Schemas.PriceItemsDto;
3576
+ }
3577
+ namespace Responses {
3578
+ export type $200 = /* The result from the calculation of a set of price items. */ Components.Schemas.PricingDetailsResponse;
3579
+ export type $400 = Components.Schemas.Error;
3580
+ }
3581
+ }
3399
3582
  namespace $CheckoutCart {
3400
3583
  export interface HeaderParameters {
3401
3584
  "X-Ivy-Org-ID": Parameters.XIvyOrgID;
@@ -3427,33 +3610,6 @@ declare namespace Paths {
3427
3610
  export type $403 = Components.Schemas.Error;
3428
3611
  }
3429
3612
  }
3430
- namespace $CreateOpportunity {
3431
- export interface HeaderParameters {
3432
- "X-Ivy-Org-ID": Parameters.XIvyOrgID;
3433
- }
3434
- namespace Parameters {
3435
- export type XIvyOrgID = string;
3436
- }
3437
- export type RequestBody = /**
3438
- * The opportunity entity
3439
- * example:
3440
- * {
3441
- * "$ref": "#/components/examples/opportunity"
3442
- * }
3443
- */
3444
- Components.Schemas.Opportunity;
3445
- namespace Responses {
3446
- export type $201 = /**
3447
- * The opportunity entity
3448
- * example:
3449
- * {
3450
- * "$ref": "#/components/examples/opportunity"
3451
- * }
3452
- */
3453
- Components.Schemas.Opportunity;
3454
- export type $400 = Components.Schemas.Error;
3455
- }
3456
- }
3457
3613
  namespace $DeleteCredentials {
3458
3614
  namespace Parameters {
3459
3615
  export type IntegrationId = Components.Schemas.IntegrationId;
@@ -3671,6 +3827,16 @@ declare namespace Paths {
3671
3827
  }
3672
3828
 
3673
3829
  export interface OperationMethods {
3830
+ /**
3831
+ * $calculatePricingDetails - calculatePricingDetails
3832
+ *
3833
+ * Computes a set of pricing details that can be persisted on an entity with the pricing capability enabled, e.g: Orders or Contracts.
3834
+ */
3835
+ '$calculatePricingDetails'(
3836
+ parameters?: Parameters<UnknownParamsObject> | null,
3837
+ data?: Paths.$CalculatePricingDetails.RequestBody,
3838
+ config?: AxiosRequestConfig
3839
+ ): OperationResponse<Paths.$CalculatePricingDetails.Responses.$200>
3674
3840
  /**
3675
3841
  * createOrder - createOrder
3676
3842
  *
@@ -3773,7 +3939,7 @@ export interface OperationMethods {
3773
3939
  config?: AxiosRequestConfig
3774
3940
  ): OperationResponse<Paths.$SearchStreets.Responses.$200>
3775
3941
  /**
3776
- * $computePrice - computePrice
3942
+ * $computePrice - calculatePricingDetails
3777
3943
  *
3778
3944
  * Returns the price for a given product type based on location and consumption
3779
3945
  */
@@ -3812,23 +3978,21 @@ export interface OperationMethods {
3812
3978
  data?: any,
3813
3979
  config?: AxiosRequestConfig
3814
3980
  ): OperationResponse<Paths.$DeleteCredentials.Responses.$204>
3815
- /**
3816
- * $createOpportunity - createOpportunity
3817
- *
3818
- * This API is Deprecated. Please use the Entity API or Submission API to create opportunities.
3819
- *
3820
- * Enables the creation of a new opportunity. During the creation of an opportunity, an unique customer-readable `opportunity_number` will be generated.
3821
- * The `opportunity_number` can be used to universally identify an opportunity within epilot platform.
3822
- *
3823
- */
3824
- '$createOpportunity'(
3825
- parameters?: Parameters<Paths.$CreateOpportunity.HeaderParameters> | null,
3826
- data?: Paths.$CreateOpportunity.RequestBody,
3827
- config?: AxiosRequestConfig
3828
- ): OperationResponse<Paths.$CreateOpportunity.Responses.$201>
3829
3981
  }
3830
3982
 
3831
3983
  export interface PathsDictionary {
3984
+ ['/v1/pricing:compute']: {
3985
+ /**
3986
+ * $calculatePricingDetails - calculatePricingDetails
3987
+ *
3988
+ * Computes a set of pricing details that can be persisted on an entity with the pricing capability enabled, e.g: Orders or Contracts.
3989
+ */
3990
+ 'post'(
3991
+ parameters?: Parameters<UnknownParamsObject> | null,
3992
+ data?: Paths.$CalculatePricingDetails.RequestBody,
3993
+ config?: AxiosRequestConfig
3994
+ ): OperationResponse<Paths.$CalculatePricingDetails.Responses.$200>
3995
+ }
3832
3996
  ['/v1/order']: {
3833
3997
  /**
3834
3998
  * createOrder - createOrder
@@ -3950,7 +4114,7 @@ export interface PathsDictionary {
3950
4114
  }
3951
4115
  ['/v1/public/integration/{integrationId}/compute-price']: {
3952
4116
  /**
3953
- * $computePrice - computePrice
4117
+ * $computePrice - calculatePricingDetails
3954
4118
  *
3955
4119
  * Returns the price for a given product type based on location and consumption
3956
4120
  */
@@ -3996,22 +4160,6 @@ export interface PathsDictionary {
3996
4160
  config?: AxiosRequestConfig
3997
4161
  ): OperationResponse<Paths.$DeleteCredentials.Responses.$204>
3998
4162
  }
3999
- ['/v1/public/opportunity']: {
4000
- /**
4001
- * $createOpportunity - createOpportunity
4002
- *
4003
- * This API is Deprecated. Please use the Entity API or Submission API to create opportunities.
4004
- *
4005
- * Enables the creation of a new opportunity. During the creation of an opportunity, an unique customer-readable `opportunity_number` will be generated.
4006
- * The `opportunity_number` can be used to universally identify an opportunity within epilot platform.
4007
- *
4008
- */
4009
- 'post'(
4010
- parameters?: Parameters<Paths.$CreateOpportunity.HeaderParameters> | null,
4011
- data?: Paths.$CreateOpportunity.RequestBody,
4012
- config?: AxiosRequestConfig
4013
- ): OperationResponse<Paths.$CreateOpportunity.Responses.$201>
4014
- }
4015
4163
  }
4016
4164
 
4017
4165
  export type Client = OpenAPIClient<OperationMethods, PathsDictionary>
package/dist/openapi.json CHANGED
@@ -111,6 +111,199 @@
111
111
  }
112
112
  ],
113
113
  "paths": {
114
+ "/v1/pricing:compute": {
115
+ "post": {
116
+ "description": "Computes a set of pricing details that can be persisted on an entity with the pricing capability enabled, e.g: Orders or Contracts.",
117
+ "summary": "calculatePricingDetails",
118
+ "operationId": "$calculatePricingDetails",
119
+ "tags": [
120
+ "Order API"
121
+ ],
122
+ "requestBody": {
123
+ "required": false,
124
+ "content": {
125
+ "application/json": {
126
+ "schema": {
127
+ "properties": {
128
+ "line_items": {
129
+ "$ref": "#/components/schemas/PriceItemsDto"
130
+ }
131
+ }
132
+ },
133
+ "examples": {
134
+ "Compute price": {
135
+ "value": {
136
+ "line_items": [
137
+ {
138
+ "product_id": "c5695fb5-f02d-4e46-9fb2-a36dc4e9876f",
139
+ "price_id": "396cb5f3-ea0b-4629-99ca-303661de5a9b",
140
+ "quantity": 2
141
+ },
142
+ {
143
+ "product_id": "c5695fb5-f02d-4e46-9fb2-a36dc4e9876f",
144
+ "price_id": "2abe0c6f-63ef-417b-8c85-5546359382d9",
145
+ "quantity": 1,
146
+ "price_mappings": [
147
+ {
148
+ "price_id": "2abe0c6f-63ef-417b-8c85-5546359382d9",
149
+ "frequency_unit": "one_time",
150
+ "value": 2,
151
+ "name": "Estimated consumption",
152
+ "metadata": {
153
+ "journey_title": "P&G",
154
+ "step_name": "Number Inputs"
155
+ }
156
+ }
157
+ ]
158
+ }
159
+ ]
160
+ }
161
+ }
162
+ }
163
+ }
164
+ }
165
+ },
166
+ "responses": {
167
+ "200": {
168
+ "description": "Pricing details result",
169
+ "content": {
170
+ "application/json": {
171
+ "schema": {
172
+ "$ref": "#/components/schemas/PricingDetailsResponse"
173
+ },
174
+ "example": {
175
+ "amount_subtotal": 1000,
176
+ "amount_total": 1000,
177
+ "amount_tax": 0,
178
+ "total_details": {
179
+ "amount_tax": 0,
180
+ "breakdown": {
181
+ "taxes": [
182
+ {
183
+ "tax": {
184
+ "rate": 0
185
+ },
186
+ "amount": 0
187
+ }
188
+ ],
189
+ "recurrences": [
190
+ {
191
+ "type": "one_time",
192
+ "unit_amount_gross": 1000,
193
+ "unit_amount_net": 1000,
194
+ "amount_subtotal": 1000,
195
+ "amount_total": 1000,
196
+ "amount_subtotal_decimal": "10",
197
+ "amount_total_decimal": "10",
198
+ "amount_tax": 0
199
+ }
200
+ ],
201
+ "recurrencesByTax": [
202
+ {
203
+ "type": "one_time",
204
+ "amount_total": 1000,
205
+ "amount_subtotal": 1000,
206
+ "amount_tax": 0,
207
+ "tax": {
208
+ "tax": {
209
+ "rate": 0
210
+ },
211
+ "amount": 0
212
+ }
213
+ }
214
+ ]
215
+ }
216
+ },
217
+ "line_items": [
218
+ {
219
+ "product_id": "c5695fb5-f02d-4e46-9fb2-a36dc4e9876f",
220
+ "price_id": "396cb5f3-ea0b-4629-99ca-303661de5a9b",
221
+ "quantity": 1,
222
+ "currency": "EUR",
223
+ "_price": {
224
+ "description": "Standard price component",
225
+ "pricing_model": "per_unit",
226
+ "unit_amount_currency": "EUR",
227
+ "unit_amount": 1000,
228
+ "unit_amount_decimal": "10",
229
+ "is_tax_inclusive": true,
230
+ "price_display_in_journeys": "show_price",
231
+ "active": true,
232
+ "variable_price": false,
233
+ "type": "one_time",
234
+ "billing_period": null,
235
+ "billing_duration_amount": null,
236
+ "billing_duration_unit": null,
237
+ "notice_time_amount": null,
238
+ "notice_time_unit": null,
239
+ "termination_time_amount": null,
240
+ "termination_time_unit": null,
241
+ "renewal_duration_amount": null,
242
+ "renewal_duration_unit": null,
243
+ "price_components": null,
244
+ "_tags": [],
245
+ "_title": "Standard price component",
246
+ "_id": "396cb5f3-ea0b-4629-99ca-303661de5a9b",
247
+ "internal_description": "Standard price component"
248
+ },
249
+ "_product": {
250
+ "type": "product",
251
+ "_title": "Product PH",
252
+ "name": "Product PH ",
253
+ "price_options": {
254
+ "$relation": [
255
+ {
256
+ "entity_id": "396cb5f3-ea0b-4629-99ca-303661de5a9b",
257
+ "_tags": [],
258
+ "_schema": "price"
259
+ }
260
+ ]
261
+ },
262
+ "_id": "c5695fb5-f02d-4e46-9fb2-a36dc4e9876f",
263
+ "active": true,
264
+ "internal_name": "Product PH",
265
+ "description": ""
266
+ },
267
+ "description": "Standard price component",
268
+ "unit_amount": 1000,
269
+ "unit_amount_net": 1000,
270
+ "unit_amount_net_decimal": "10",
271
+ "unit_amount_gross": 1000,
272
+ "unit_amount_gross_decimal": "10",
273
+ "unit_amount_decimal": "10",
274
+ "amount_subtotal": 1000,
275
+ "amount_total": 1000,
276
+ "amount_tax": 0,
277
+ "taxes": [
278
+ {
279
+ "rate": "nontaxable",
280
+ "rateValue": 0,
281
+ "amount": 0
282
+ }
283
+ ],
284
+ "is_tax_inclusive": true,
285
+ "amount_subtotal_decimal": "10",
286
+ "amount_total_decimal": "10"
287
+ }
288
+ ],
289
+ "currency": "EUR"
290
+ }
291
+ }
292
+ }
293
+ },
294
+ "400": {
295
+ "description": "Invalid payload",
296
+ "content": {
297
+ "application/json": {
298
+ "schema": {
299
+ "$ref": "#/components/schemas/Error"
300
+ }
301
+ }
302
+ }
303
+ }
304
+ }
305
+ }
306
+ },
114
307
  "/v1/order": {
115
308
  "post": {
116
309
  "description": "Create an order",
@@ -1115,7 +1308,7 @@
1115
1308
  "example": "getag"
1116
1309
  }
1117
1310
  ],
1118
- "summary": "computePrice",
1311
+ "summary": "calculatePricingDetails",
1119
1312
  "tags": [
1120
1313
  "External Integrations API"
1121
1314
  ],
@@ -1353,102 +1546,6 @@
1353
1546
  }
1354
1547
  }
1355
1548
  }
1356
- },
1357
- "/v1/public/opportunity": {
1358
- "post": {
1359
- "deprecated": true,
1360
- "description": "This API is Deprecated. Please use the Entity API or Submission API to create opportunities.\n\nEnables the creation of a new opportunity. During the creation of an opportunity, an unique customer-readable `opportunity_number` will be generated.\nThe `opportunity_number` can be used to universally identify an opportunity within epilot platform.\n",
1361
- "operationId": "$createOpportunity",
1362
- "summary": "createOpportunity",
1363
- "security": [
1364
- {},
1365
- {
1366
- "EpilotPublicAuth": []
1367
- }
1368
- ],
1369
- "tags": [
1370
- "Deprecated"
1371
- ],
1372
- "parameters": [
1373
- {
1374
- "in": "header",
1375
- "name": "X-Ivy-Org-ID",
1376
- "description": "The target Organization Id represented by the caller",
1377
- "schema": {
1378
- "type": "string"
1379
- },
1380
- "required": true
1381
- }
1382
- ],
1383
- "requestBody": {
1384
- "required": true,
1385
- "content": {
1386
- "application/json": {
1387
- "schema": {
1388
- "$ref": "#/components/schemas/Opportunity"
1389
- },
1390
- "examples": {
1391
- "Opportunity containing one Order": {
1392
- "value": {
1393
- "billing_address": {
1394
- "street": "sdf",
1395
- "street_number": "1",
1396
- "city": "Berlin",
1397
- "postal_code": "12045",
1398
- "country": "de",
1399
- "additional_info": "adasd"
1400
- },
1401
- "delivery_address": {
1402
- "street": "sdf",
1403
- "street_number": "1",
1404
- "city": "Berlin",
1405
- "postal_code": "12045",
1406
- "country": "de",
1407
- "additional_info": "adasd"
1408
- },
1409
- "items": {
1410
- "$relation": [
1411
- {
1412
- "entity_id": "c8dbe8f3-28b6-4d77-aae8-47bc24a2532f",
1413
- "_tags": [
1414
- "journey"
1415
- ]
1416
- }
1417
- ]
1418
- },
1419
- "_tags": [
1420
- "journey",
1421
- "ORWNr4iCN"
1422
- ]
1423
- }
1424
- }
1425
- }
1426
- }
1427
- }
1428
- },
1429
- "responses": {
1430
- "201": {
1431
- "description": "The new Opportunity.",
1432
- "content": {
1433
- "application/json": {
1434
- "schema": {
1435
- "$ref": "#/components/schemas/Opportunity"
1436
- }
1437
- }
1438
- }
1439
- },
1440
- "400": {
1441
- "description": "Invalid payload",
1442
- "content": {
1443
- "application/json": {
1444
- "schema": {
1445
- "$ref": "#/components/schemas/Error"
1446
- }
1447
- }
1448
- }
1449
- }
1450
- }
1451
- }
1452
1549
  }
1453
1550
  },
1454
1551
  "components": {
@@ -2566,6 +2663,9 @@
2566
2663
  },
2567
2664
  {
2568
2665
  "$ref": "#/components/schemas/Price"
2666
+ },
2667
+ {
2668
+ "$ref": "#/components/schemas/Coupon"
2569
2669
  }
2570
2670
  ]
2571
2671
  }
@@ -3680,7 +3780,7 @@
3680
3780
  "description": "Represents a price item",
3681
3781
  "type": "object",
3682
3782
  "example": {
3683
- "$ref": "#/components/examples/price-item"
3783
+ "$ref": "#/components/examples/price-item/value"
3684
3784
  },
3685
3785
  "allOf": [
3686
3786
  {
@@ -3834,7 +3934,7 @@
3834
3934
  "description": "Represents a price item",
3835
3935
  "type": "object",
3836
3936
  "example": {
3837
- "$ref": "#/components/examples/price-item"
3937
+ "$ref": "#/components/examples/price-item/value"
3838
3938
  },
3839
3939
  "properties": {
3840
3940
  "type": {
@@ -4123,6 +4223,51 @@
4123
4223
  }
4124
4224
  }
4125
4225
  },
4226
+ "PricingDetailsResponse": {
4227
+ "type": "object",
4228
+ "description": "The result from the calculation of a set of price items.",
4229
+ "properties": {
4230
+ "items": {
4231
+ "type": "array",
4232
+ "items": {
4233
+ "oneOf": [
4234
+ {
4235
+ "$ref": "#/components/schemas/PriceItem"
4236
+ },
4237
+ {
4238
+ "$ref": "#/components/schemas/CompositePriceItem"
4239
+ }
4240
+ ]
4241
+ }
4242
+ },
4243
+ "amount_subtotal": {
4244
+ "type": "integer",
4245
+ "description": "Total of all items before (discounts or) taxes are applied."
4246
+ },
4247
+ "amount_total": {
4248
+ "type": "integer",
4249
+ "description": "Total of all items after (discounts and) taxes are applied."
4250
+ },
4251
+ "unit_amount_gross": {
4252
+ "type": "integer",
4253
+ "description": "The unit gross amount value."
4254
+ },
4255
+ "unit_amount_net": {
4256
+ "type": "integer",
4257
+ "description": "The unit net amount value."
4258
+ },
4259
+ "amount_tax": {
4260
+ "type": "integer",
4261
+ "description": "This is the sum of all the price item tax amounts."
4262
+ },
4263
+ "total_details": {
4264
+ "$ref": "#/components/schemas/TotalDetails"
4265
+ },
4266
+ "currency": {
4267
+ "$ref": "#/components/schemas/Currency"
4268
+ }
4269
+ }
4270
+ },
4126
4271
  "BillingPeriod": {
4127
4272
  "type": "string",
4128
4273
  "enum": [
@@ -4556,6 +4701,147 @@
4556
4701
  }
4557
4702
  }
4558
4703
  },
4704
+ "Coupon": {
4705
+ "type": "object",
4706
+ "description": "The coupon configuration",
4707
+ "additionalProperties": true,
4708
+ "required": [
4709
+ "name",
4710
+ "type",
4711
+ "_id",
4712
+ "_title",
4713
+ "_org",
4714
+ "_schema",
4715
+ "_created_at",
4716
+ "_updated_at"
4717
+ ],
4718
+ "properties": {
4719
+ "_id": {
4720
+ "$ref": "#/components/schemas/EntityId",
4721
+ "readOnly": true
4722
+ },
4723
+ "_title": {
4724
+ "type": "string",
4725
+ "description": "The auto-generated title for the title",
4726
+ "readOnly": true
4727
+ },
4728
+ "_org": {
4729
+ "type": "string",
4730
+ "description": "Organization Id the entity belongs to",
4731
+ "readOnly": true
4732
+ },
4733
+ "_schema": {
4734
+ "type": "string",
4735
+ "enum": [
4736
+ "coupon"
4737
+ ],
4738
+ "readOnly": true,
4739
+ "description": "The schema of the entity, for coupons it is always `coupon`"
4740
+ },
4741
+ "_tags": {
4742
+ "type": "array",
4743
+ "items": {
4744
+ "type": "string"
4745
+ }
4746
+ },
4747
+ "_created_at": {
4748
+ "type": "string",
4749
+ "format": "date-time",
4750
+ "readOnly": true,
4751
+ "description": "The creation date for the opportunity"
4752
+ },
4753
+ "_updated_at": {
4754
+ "type": "string",
4755
+ "format": "date-time",
4756
+ "readOnly": true,
4757
+ "description": "The date the coupon was last updated"
4758
+ },
4759
+ "name": {
4760
+ "type": "string"
4761
+ },
4762
+ "description": {
4763
+ "type": "string"
4764
+ },
4765
+ "type": {
4766
+ "type": "string",
4767
+ "enum": [
4768
+ "fixed",
4769
+ "percentage"
4770
+ ]
4771
+ },
4772
+ "percentage_value": {
4773
+ "type": "number",
4774
+ "description": "Use if type is set to percentage. The percentage to be discounted, represented as a whole integer."
4775
+ },
4776
+ "fixed_value": {
4777
+ "description": "Use if type is set to fixed. The fixed amount in cents to be discounted, represented as a whole integer.",
4778
+ "type": "number"
4779
+ },
4780
+ "fixed_value_decimal": {
4781
+ "description": "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.",
4782
+ "type": "string"
4783
+ },
4784
+ "fixed_value_currency": {
4785
+ "description": "Use if type is set to fixed. Three-letter ISO currency code, in lowercase.",
4786
+ "oneOf": [
4787
+ {
4788
+ "$ref": "#/components/schemas/Currency"
4789
+ }
4790
+ ]
4791
+ },
4792
+ "active": {
4793
+ "type": "boolean"
4794
+ },
4795
+ "prices": {
4796
+ "description": "The prices associated with the coupon. Will hold price entities if hydrated, relations otherwise.",
4797
+ "oneOf": [
4798
+ {
4799
+ "type": "object",
4800
+ "properties": {
4801
+ "$relation": {
4802
+ "type": "array",
4803
+ "items": {
4804
+ "$ref": "#/components/schemas/EntityRelation"
4805
+ }
4806
+ }
4807
+ }
4808
+ },
4809
+ {
4810
+ "type": "array",
4811
+ "items": {
4812
+ "$ref": "#/components/schemas/Price"
4813
+ }
4814
+ }
4815
+ ]
4816
+ }
4817
+ },
4818
+ "example": {
4819
+ "_id": "123e4567-e89b-12d3-a456-426614174000",
4820
+ "_schema": "coupon",
4821
+ "_org": "org_12345",
4822
+ "_created_at": "2024-01-15T10:00:00.000Z",
4823
+ "_updated_at": "2024-01-20T12:00:00.000Z",
4824
+ "_title": "Sample Coupon",
4825
+ "name": "Sample Coupon",
4826
+ "type": "fixed",
4827
+ "fixed_value": 555,
4828
+ "fixed_value_currency": "USD",
4829
+ "fixed_value_decimal": "5.55",
4830
+ "active": true,
4831
+ "prices": {
4832
+ "$relation": [
4833
+ {
4834
+ "entity_id": "abc12345-def6-7890-gh12-ijklmnopqrst",
4835
+ "_tags": [
4836
+ "discount",
4837
+ "special"
4838
+ ],
4839
+ "_schema": "price"
4840
+ }
4841
+ ]
4842
+ }
4843
+ }
4844
+ },
4559
4845
  "PriceTier": {
4560
4846
  "type": "object",
4561
4847
  "properties": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epilot/pricing-client",
3
- "version": "3.27.8",
3
+ "version": "3.29.0",
4
4
  "description": "Client for epilot Pricing APIs",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",