@epilot/pricing-client 2.1.2 → 2.1.3

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.
package/dist/openapi.d.ts CHANGED
@@ -157,6 +157,50 @@ declare namespace Components {
157
157
  };
158
158
  }[];
159
159
  }
160
+ /**
161
+ * Represents a valid base price item from a client.
162
+ */
163
+ export interface BasePriceItemDto {
164
+ /**
165
+ * An additional structure to keep metadata related with the price item.
166
+ */
167
+ metadata?: /* A set of key-value pairs used to store meta data information about an entity. */ MetaData;
168
+ /**
169
+ * The quantity of products being purchased.
170
+ */
171
+ quantity?: number;
172
+ /**
173
+ * An arbitrary string attached to the price item. Often useful for displaying to users. Defaults to product name.
174
+ */
175
+ description?: string;
176
+ /**
177
+ * The id of the product.
178
+ */
179
+ product_id?: string;
180
+ /**
181
+ * The id of the price.
182
+ */
183
+ price_id?: string;
184
+ /**
185
+ * The taxes applied to the price item.
186
+ */
187
+ taxes?: (/* A valid tax rate from a client. */ TaxAmountDto)[];
188
+ /**
189
+ * The taxes applied to the price item.
190
+ */
191
+ recurrences?: (/* An amount associated with a specific recurrence. */ RecurrenceAmountDto)[];
192
+ /**
193
+ * The snapshot of the product linked to the price item.
194
+ */
195
+ _product?: /**
196
+ * The product entity
197
+ * example:
198
+ * {
199
+ * "$ref": "#/components/examples/product"
200
+ * }
201
+ */
202
+ Product;
203
+ }
160
204
  export type BillingPeriod = "weekly" | "monthly" | "every_quarter" | "every_6_months" | "yearly" | "one_time";
161
205
  /**
162
206
  * Supports shopping for products and services until ready for checkout.
@@ -373,7 +417,14 @@ declare namespace Components {
373
417
  /**
374
418
  * A set of [price](/api/pricing#tag/simple_price_schema) components that define the composite price.
375
419
  */
376
- price_components?: {
420
+ price_components?: /* A set of [price](/api/pricing#tag/simple_price_schema) components that define the composite price. */ /**
421
+ * The price entity schema for simple pricing
422
+ * example:
423
+ * {
424
+ * "$ref": "#/components/examples/price"
425
+ * }
426
+ */
427
+ Price[] | {
377
428
  $relation?: PriceComponentRelation[];
378
429
  };
379
430
  /**
@@ -543,14 +594,6 @@ declare namespace Components {
543
594
  * The id of the price.
544
595
  */
545
596
  price_id?: string;
546
- /**
547
- * The unit amount value
548
- */
549
- unit_amount?: number;
550
- /**
551
- * The unit amount in cents to be charged, represented as a decimal string with at most 12 decimal places.
552
- */
553
- unit_amount_decimal?: string;
554
597
  /**
555
598
  * The taxes applied to the price item.
556
599
  */
@@ -559,21 +602,6 @@ declare namespace Components {
559
602
  * The taxes applied to the price item.
560
603
  */
561
604
  recurrences?: (/* An amount associated with a specific recurrence. */ RecurrenceAmountDto)[];
562
- _price?: /**
563
- * The price entity schema for simple pricing
564
- * example:
565
- * {
566
- * "$ref": "#/components/examples/price"
567
- * }
568
- */
569
- Price | /**
570
- * The price entity schema for dynamic pricing
571
- * example:
572
- * {
573
- * "$ref": "#/components/examples/composite-price"
574
- * }
575
- */
576
- CompositePrice;
577
605
  _product?: /**
578
606
  * The product entity
579
607
  * example:
@@ -585,7 +613,15 @@ declare namespace Components {
585
613
  /**
586
614
  * Contains price item configurations, per price component, when the main price item is a [composite price](/api/pricing#tag/dynamic_price_schema).
587
615
  */
588
- item_components?: /* Represents a valid price item from a client. */ PriceItemDto[];
616
+ item_components?: /* Represents a price input to the pricing library. */ PriceItemDto[];
617
+ _price?: /**
618
+ * The price entity schema for dynamic pricing
619
+ * example:
620
+ * {
621
+ * "$ref": "#/components/examples/composite-price"
622
+ * }
623
+ */
624
+ CompositePrice;
589
625
  }
590
626
  /**
591
627
  * Three-letter ISO currency code, in lowercase. Must be a supported currency.
@@ -606,6 +642,36 @@ declare namespace Components {
606
642
  email?: string;
607
643
  phone?: string;
608
644
  }
645
+ export type EntityId = string; // uuid
646
+ /**
647
+ * example:
648
+ * {
649
+ * "_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
650
+ * "_org": "123",
651
+ * "_schema": "contact",
652
+ * "_tags": [
653
+ * "example",
654
+ * "mock"
655
+ * ],
656
+ * "_created_at": "2021-02-09T12:41:43.662Z",
657
+ * "_updated_at": "2021-02-09T12:41:43.662Z"
658
+ * }
659
+ */
660
+ export interface EntityItem {
661
+ _id: EntityId /* uuid */;
662
+ /**
663
+ * Title of entity
664
+ */
665
+ _title: string;
666
+ /**
667
+ * Organization Id the entity belongs to
668
+ */
669
+ _org: string;
670
+ _schema: string;
671
+ _tags?: string[];
672
+ _created_at: string; // date-time
673
+ _updated_at: string; // date-time
674
+ }
609
675
  export interface EntityRelation {
610
676
  [name: string]: any;
611
677
  entity_id?: string;
@@ -616,6 +682,14 @@ declare namespace Components {
616
682
  * Error message
617
683
  */
618
684
  message: string;
685
+ /**
686
+ * The HTTP status code
687
+ */
688
+ status?: number;
689
+ /**
690
+ * The cause of the error (visible for bad requests - http 400)
691
+ */
692
+ cause?: string;
619
693
  }
620
694
  export interface File {
621
695
  [name: string]: any;
@@ -1104,9 +1178,30 @@ declare namespace Components {
1104
1178
  /**
1105
1179
  * The default tax rate applied to the price
1106
1180
  */
1107
- tax?: {
1181
+ tax?: /* The default tax rate applied to the price */ {
1108
1182
  $relation?: EntityRelation[];
1109
- };
1183
+ } | /**
1184
+ * the tax configuration
1185
+ * example:
1186
+ * {
1187
+ * "_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
1188
+ * "type": "VAT",
1189
+ * "description": "Tax description",
1190
+ * "behavior": "Exclusive",
1191
+ * "active": "true",
1192
+ * "region": "DE",
1193
+ * "region_label": "Germany",
1194
+ * "_org": "123",
1195
+ * "_schema": "tax",
1196
+ * "_tags": [
1197
+ * "example",
1198
+ * "mock"
1199
+ * ],
1200
+ * "_created_at": "2021-02-09T12:41:43.662Z",
1201
+ * "_updated_at": "2021-02-09T12:41:43.662Z"
1202
+ * }
1203
+ */
1204
+ Tax[];
1110
1205
  /**
1111
1206
  * Specifies whether the price is considered `inclusive` of taxes or `exclusive` of taxes.
1112
1207
  * One of `inclusive`, `exclusive`, or `unspecified`.
@@ -1216,14 +1311,6 @@ declare namespace Components {
1216
1311
  *
1217
1312
  */
1218
1313
  quantity?: number;
1219
- item?: /**
1220
- * The price entity schema for simple pricing
1221
- * example:
1222
- * {
1223
- * "$ref": "#/components/examples/price"
1224
- * }
1225
- */
1226
- Price;
1227
1314
  /**
1228
1315
  * An arbitrary set of tags attached to the composite price - component relation
1229
1316
  */
@@ -1329,7 +1416,7 @@ declare namespace Components {
1329
1416
  recurrences?: (/* An amount associated with a specific recurrence. */ RecurrenceAmount)[];
1330
1417
  }
1331
1418
  /**
1332
- * Represents a valid price item from a client.
1419
+ * Represents a price input to the pricing library.
1333
1420
  */
1334
1421
  export interface PriceItemDto {
1335
1422
  metadata?: /* A set of key-value pairs used to store meta data information about an entity. */ MetaData;
@@ -1349,14 +1436,6 @@ declare namespace Components {
1349
1436
  * The id of the price.
1350
1437
  */
1351
1438
  price_id?: string;
1352
- /**
1353
- * The unit amount value
1354
- */
1355
- unit_amount?: number;
1356
- /**
1357
- * The unit amount in cents to be charged, represented as a decimal string with at most 12 decimal places.
1358
- */
1359
- unit_amount_decimal?: string;
1360
1439
  /**
1361
1440
  * The taxes applied to the price item.
1362
1441
  */
@@ -1365,25 +1444,30 @@ declare namespace Components {
1365
1444
  * The taxes applied to the price item.
1366
1445
  */
1367
1446
  recurrences?: (/* An amount associated with a specific recurrence. */ RecurrenceAmountDto)[];
1368
- _price?: /**
1369
- * The price entity schema for simple pricing
1447
+ _product?: /**
1448
+ * The product entity
1370
1449
  * example:
1371
1450
  * {
1372
- * "$ref": "#/components/examples/price"
1451
+ * "$ref": "#/components/examples/product"
1373
1452
  * }
1374
1453
  */
1375
- Price;
1454
+ Product;
1376
1455
  /**
1377
- * The product linked to the price item.
1456
+ * The unit amount value
1378
1457
  */
1379
- _product?: /**
1380
- * The product entity
1458
+ unit_amount?: number;
1459
+ /**
1460
+ * The unit amount in cents to be charged, represented as a decimal string with at most 12 decimal places.
1461
+ */
1462
+ unit_amount_decimal?: string;
1463
+ _price?: /**
1464
+ * The price entity schema for simple pricing
1381
1465
  * example:
1382
1466
  * {
1383
- * "$ref": "#/components/examples/product"
1467
+ * "$ref": "#/components/examples/price"
1384
1468
  * }
1385
1469
  */
1386
- Product;
1470
+ Price;
1387
1471
  }
1388
1472
  /**
1389
1473
  * Tracks a set of product prices, quantities, (discounts) and taxes.
@@ -1406,7 +1490,7 @@ declare namespace Components {
1406
1490
  /**
1407
1491
  * A valid set of product prices, quantities, (discounts) and taxes from a client.
1408
1492
  */
1409
- export type PriceItemsDto = (/* Represents a valid price item from a client. */ PriceItemDto)[];
1493
+ export type PriceItemsDto = (/* Represents a price input to the pricing library. */ PriceItemDto)[];
1410
1494
  /**
1411
1495
  * The result from the calculation of a set of price items.
1412
1496
  */
@@ -1523,7 +1607,7 @@ declare namespace Components {
1523
1607
  /**
1524
1608
  * The price type.
1525
1609
  */
1526
- type: string;
1610
+ type?: string;
1527
1611
  /**
1528
1612
  * The price billing period.
1529
1613
  */
@@ -1548,7 +1632,7 @@ declare namespace Components {
1548
1632
  /**
1549
1633
  * The price type.
1550
1634
  */
1551
- type: string;
1635
+ type?: string;
1552
1636
  /**
1553
1637
  * The price billing period.
1554
1638
  */
@@ -1569,13 +1653,44 @@ declare namespace Components {
1569
1653
  export type SalesTax = "nontaxable" | "reduced" | "standard";
1570
1654
  /**
1571
1655
  * the tax configuration
1656
+ * example:
1657
+ * {
1658
+ * "_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
1659
+ * "type": "VAT",
1660
+ * "description": "Tax description",
1661
+ * "behavior": "Exclusive",
1662
+ * "active": "true",
1663
+ * "region": "DE",
1664
+ * "region_label": "Germany",
1665
+ * "_org": "123",
1666
+ * "_schema": "tax",
1667
+ * "_tags": [
1668
+ * "example",
1669
+ * "mock"
1670
+ * ],
1671
+ * "_created_at": "2021-02-09T12:41:43.662Z",
1672
+ * "_updated_at": "2021-02-09T12:41:43.662Z"
1673
+ * }
1572
1674
  */
1573
1675
  export interface Tax {
1574
1676
  [name: string]: any;
1677
+ _id: EntityId /* uuid */;
1678
+ /**
1679
+ * Title of entity
1680
+ */
1681
+ _title: string;
1682
+ /**
1683
+ * Organization Id the entity belongs to
1684
+ */
1685
+ _org: string;
1686
+ _schema: string;
1687
+ _tags?: string[];
1688
+ _created_at: string; // date-time
1689
+ _updated_at: string; // date-time
1575
1690
  type: "VAT" | "GST" | "Custom";
1576
1691
  description?: string;
1577
1692
  rate: number;
1578
- behavior: "Exclusive" | "Inclusive";
1693
+ behavior: "Exclusive" | "Inclusive" | "exclusive" | "inclusive";
1579
1694
  active?: boolean;
1580
1695
  region?: string;
1581
1696
  region_label?: string;
@@ -1589,26 +1704,104 @@ declare namespace Components {
1589
1704
  */
1590
1705
  amount?: number;
1591
1706
  /**
1592
- * The tax rate applied.
1707
+ * The tax rate applied. With the release of the tax management feature this field is being deprecated in favor of the tax field.
1593
1708
  */
1594
1709
  rate?: string;
1710
+ /**
1711
+ * The tax rate value applied (represented as an integer percentage, e.g, 19 or 7).
1712
+ * With the release of the tax management feature this field is being deprecated in favor of the tax field.
1713
+ *
1714
+ * example:
1715
+ * 19
1716
+ */
1717
+ rateValue?: number;
1595
1718
  /**
1596
1719
  * The tax applied.
1597
1720
  */
1598
- tax?: /* The tax applied. */ /* the tax configuration */ Tax;
1721
+ tax?: /* The tax applied. */ /**
1722
+ * the tax configuration
1723
+ * example:
1724
+ * {
1725
+ * "_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
1726
+ * "type": "VAT",
1727
+ * "description": "Tax description",
1728
+ * "behavior": "Exclusive",
1729
+ * "active": "true",
1730
+ * "region": "DE",
1731
+ * "region_label": "Germany",
1732
+ * "_org": "123",
1733
+ * "_schema": "tax",
1734
+ * "_tags": [
1735
+ * "example",
1736
+ * "mock"
1737
+ * ],
1738
+ * "_created_at": "2021-02-09T12:41:43.662Z",
1739
+ * "_updated_at": "2021-02-09T12:41:43.662Z"
1740
+ * }
1741
+ */
1742
+ Tax;
1743
+ }
1744
+ /**
1745
+ * A tax amount associated with a specific tax rate.
1746
+ */
1747
+ export interface TaxAmountBreakdown {
1748
+ /**
1749
+ * The tax amount.
1750
+ */
1751
+ amount?: number;
1752
+ /**
1753
+ * The tax rate applied. With the release of the tax manager feature this field is being deprecated in favor of the tax field.
1754
+ */
1755
+ rate?: string;
1756
+ /**
1757
+ * The tax rate value applied. With the release of the tax manager feature this field is being deprecated in favor of the tax field.
1758
+ */
1759
+ rateValue?: number;
1760
+ /**
1761
+ * The tax applied.
1762
+ */
1763
+ tax?: /* The tax applied. */ TaxBreakdownInfo;
1599
1764
  }
1600
1765
  /**
1601
1766
  * A valid tax rate from a client.
1602
1767
  */
1603
1768
  export interface TaxAmountDto {
1604
1769
  /**
1605
- * The tax rate applied.
1770
+ * The deprecated tax rate applied.
1771
+ * This field has been deprecated in favor of the new Tax Management. You should use the new tax fields pointing to a proper tax entity.
1772
+ *
1606
1773
  */
1607
1774
  rate?: string;
1608
1775
  /**
1609
1776
  * The tax applied.
1610
1777
  */
1611
- tax?: /* The tax applied. */ /* the tax configuration */ Tax;
1778
+ tax?: /* The tax applied. */ /**
1779
+ * the tax configuration
1780
+ * example:
1781
+ * {
1782
+ * "_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
1783
+ * "type": "VAT",
1784
+ * "description": "Tax description",
1785
+ * "behavior": "Exclusive",
1786
+ * "active": "true",
1787
+ * "region": "DE",
1788
+ * "region_label": "Germany",
1789
+ * "_org": "123",
1790
+ * "_schema": "tax",
1791
+ * "_tags": [
1792
+ * "example",
1793
+ * "mock"
1794
+ * ],
1795
+ * "_created_at": "2021-02-09T12:41:43.662Z",
1796
+ * "_updated_at": "2021-02-09T12:41:43.662Z"
1797
+ * }
1798
+ */
1799
+ Tax;
1800
+ }
1801
+ export interface TaxBreakdownInfo {
1802
+ rate?: number;
1803
+ type?: "VAT" | "GST" | "Custom";
1804
+ _id?: string;
1612
1805
  }
1613
1806
  /**
1614
1807
  * The total details with tax (and discount) aggregated totals.
@@ -1629,7 +1822,7 @@ declare namespace Components {
1629
1822
  /**
1630
1823
  * The aggregated price items tax amount per rate.
1631
1824
  */
1632
- taxes?: (/* A tax amount associated with a specific tax rate. */ TaxAmount)[];
1825
+ taxes?: (/* A tax amount associated with a specific tax rate. */ TaxAmountBreakdown)[];
1633
1826
  /**
1634
1827
  * The aggregated price items tax amount per rate.
1635
1828
  */