@openmeter/sdk 1.0.0-beta.213 → 1.0.0-beta.214

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/dist/cjs/src/client/addons.cjs +105 -0
  2. package/dist/cjs/src/client/addons.d.cts +152 -0
  3. package/dist/cjs/src/client/addons.js.map +1 -0
  4. package/dist/cjs/src/client/billing.cjs +11 -3
  5. package/dist/cjs/src/client/billing.d.cts +32 -59
  6. package/dist/cjs/src/client/billing.js.map +1 -1
  7. package/dist/cjs/src/client/customers.cjs +17 -0
  8. package/dist/cjs/src/client/customers.d.cts +11 -0
  9. package/dist/cjs/src/client/customers.js.map +1 -1
  10. package/dist/cjs/src/client/events.cjs +19 -7
  11. package/dist/cjs/src/client/events.d.cts +15 -4
  12. package/dist/cjs/src/client/events.js.map +1 -1
  13. package/dist/cjs/src/client/index.cjs +6 -0
  14. package/dist/cjs/src/client/index.d.cts +4 -0
  15. package/dist/cjs/src/client/index.js.map +1 -1
  16. package/dist/cjs/src/client/notifications.d.cts +214 -36
  17. package/dist/cjs/src/client/plans.cjs +127 -50
  18. package/dist/cjs/src/client/plans.d.cts +129 -24
  19. package/dist/cjs/src/client/plans.js.map +1 -1
  20. package/dist/cjs/src/client/schemas.d.cts +1950 -1351
  21. package/dist/cjs/src/client/subscription-addons.cjs +70 -0
  22. package/dist/cjs/src/client/subscription-addons.d.cts +123 -0
  23. package/dist/cjs/src/client/subscription-addons.js.map +1 -0
  24. package/dist/cjs/src/client/subscriptions.cjs +16 -0
  25. package/dist/cjs/src/client/subscriptions.d.cts +23 -0
  26. package/dist/cjs/src/client/subscriptions.js.map +1 -1
  27. package/dist/cjs/src/portal/index.cjs +35 -6
  28. package/dist/cjs/src/portal/index.js.map +1 -1
  29. package/dist/cjs/src/zod/index.cjs +1680 -1874
  30. package/dist/cjs/src/zod/index.d.cts +2173 -3772
  31. package/dist/cjs/src/zod/index.js.map +1 -1
  32. package/dist/cjs/tsconfig.4615b2f8.tsbuildinfo +1 -0
  33. package/dist/cjs/tsconfig.9c445eac.tsbuildinfo +1 -0
  34. package/dist/src/client/addons.d.ts +152 -0
  35. package/dist/src/client/addons.js +101 -0
  36. package/dist/src/client/addons.js.map +1 -0
  37. package/dist/src/client/billing.d.ts +32 -59
  38. package/dist/src/client/billing.js +11 -3
  39. package/dist/src/client/billing.js.map +1 -1
  40. package/dist/src/client/customers.d.ts +11 -0
  41. package/dist/src/client/customers.js +17 -0
  42. package/dist/src/client/customers.js.map +1 -1
  43. package/dist/src/client/events.d.ts +15 -4
  44. package/dist/src/client/events.js +19 -7
  45. package/dist/src/client/events.js.map +1 -1
  46. package/dist/src/client/index.d.ts +4 -0
  47. package/dist/src/client/index.js +6 -0
  48. package/dist/src/client/index.js.map +1 -1
  49. package/dist/src/client/notifications.d.ts +214 -36
  50. package/dist/src/client/plans.d.ts +129 -24
  51. package/dist/src/client/plans.js +124 -48
  52. package/dist/src/client/plans.js.map +1 -1
  53. package/dist/src/client/schemas.d.ts +1950 -1351
  54. package/dist/src/client/subscription-addons.d.ts +123 -0
  55. package/dist/src/client/subscription-addons.js +66 -0
  56. package/dist/src/client/subscription-addons.js.map +1 -0
  57. package/dist/src/client/subscriptions.d.ts +23 -0
  58. package/dist/src/client/subscriptions.js +16 -0
  59. package/dist/src/client/subscriptions.js.map +1 -1
  60. package/dist/src/portal/index.js +1 -2
  61. package/dist/src/portal/index.js.map +1 -1
  62. package/dist/src/zod/index.d.ts +2173 -3772
  63. package/dist/src/zod/index.js +1659 -1853
  64. package/dist/src/zod/index.js.map +1 -1
  65. package/dist/tsconfig.tsbuildinfo +1 -1
  66. package/package.json +17 -17
  67. package/dist/cjs/tsconfig.2452f99b.tsbuildinfo +0 -1
  68. package/dist/cjs/tsconfig.4cad059c.tsbuildinfo +0 -1
@@ -1442,9 +1442,6 @@ export const updateAppBody = zod
1442
1442
  .discriminatedUnion('type', [
1443
1443
  zod
1444
1444
  .object({
1445
- default: zod
1446
- .boolean()
1447
- .describe('Default for the app type\nOnly one app of each type can be default.'),
1448
1445
  description: zod
1449
1446
  .string()
1450
1447
  .max(updateAppBodyDescriptionMax)
@@ -1466,9 +1463,6 @@ export const updateAppBody = zod
1466
1463
  .describe('Resource update operation model.'),
1467
1464
  zod
1468
1465
  .object({
1469
- default: zod
1470
- .boolean()
1471
- .describe('Default for the app type\nOnly one app of each type can be default.'),
1472
1466
  description: zod
1473
1467
  .string()
1474
1468
  .max(updateAppBodyDescriptionMaxOne)
@@ -1489,9 +1483,6 @@ export const updateAppBody = zod
1489
1483
  .describe('Resource update operation model.'),
1490
1484
  zod
1491
1485
  .object({
1492
- default: zod
1493
- .boolean()
1494
- .describe('Default for the app type\nOnly one app of each type can be default.'),
1495
1486
  description: zod
1496
1487
  .string()
1497
1488
  .max(updateAppBodyDescriptionMaxTwo)
@@ -1562,7 +1553,13 @@ export const appStripeWebhookBody = zod
1562
1553
  })
1563
1554
  .describe('Stripe webhook event.');
1564
1555
  /**
1565
- * List customer overrides
1556
+ * List customer overrides using the specified filters.
1557
+
1558
+ The response will include the customer override values and the merged billing profile values.
1559
+
1560
+ If the includeAllCustomers is set to true, the list contains all customers. This mode is
1561
+ useful for getting the current effective billing workflow settings for all users regardless
1562
+ if they have customer orverrides or not.
1566
1563
  * @summary List customer overrides
1567
1564
  */
1568
1565
  export const listBillingProfileCustomerOverridesQueryBillingProfileItemRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
@@ -1626,7 +1623,11 @@ export const listBillingProfileCustomerOverridesQueryParams = zod.object({
1626
1623
  .describe('The maximum number of items per page.\n\nDefault is 100.'),
1627
1624
  });
1628
1625
  /**
1629
- * Create a new or update an existing customer override.
1626
+ * The customer override can be used to pin a given customer to a billing profile
1627
+ different from the default one.
1628
+
1629
+ This can be used to test the effect of different billing profiles before making them
1630
+ the default ones or have different workflow settings for example for enterprise customers.
1630
1631
  * @summary Create a new or update a customer override
1631
1632
  */
1632
1633
  export const upsertBillingProfileCustomerOverridePathCustomerIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
@@ -1647,6 +1648,11 @@ export const upsertBillingProfileCustomerOverrideBody = zod
1647
1648
  .describe('Payload for creating a new or updating an existing customer override.');
1648
1649
  /**
1649
1650
  * Get a customer override by customer id.
1651
+
1652
+ The response will include the customer override values and the merged billing profile values.
1653
+
1654
+ If the customer override is not found, the default billing profile's values are returned. This behavior
1655
+ allows for getting a merged profile regardless of the customer override existence.
1650
1656
  * @summary Get a customer override
1651
1657
  */
1652
1658
  export const getBillingProfileCustomerOverridePathCustomerIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
@@ -1664,6 +1670,9 @@ export const getBillingProfileCustomerOverrideQueryParams = zod.object({
1664
1670
  });
1665
1671
  /**
1666
1672
  * Delete a customer override by customer id.
1673
+
1674
+ This will remove the customer override and the customer will be subject to the default
1675
+ billing profile's settings again.
1667
1676
  * @summary Delete a customer override
1668
1677
  */
1669
1678
  export const deleteBillingProfileCustomerOverridePathCustomerIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
@@ -1673,195 +1682,367 @@ export const deleteBillingProfileCustomerOverrideParams = zod.object({
1673
1682
  .regex(deleteBillingProfileCustomerOverridePathCustomerIdRegExp),
1674
1683
  });
1675
1684
  /**
1676
- * Simulate an invoice for a customer.
1685
+ * Create a new pending line item (charge).
1677
1686
 
1678
- This call will simulate an invoice for a customer based on the pending line items.
1687
+ This call is used to create a new pending line item for the customer if required a new
1688
+ gathering invoice will be created.
1679
1689
 
1680
- The call will return the total amount of the invoice and the line items that will be included in the invoice.
1681
- * @summary Simulate an invoice for a customer
1690
+ A new invoice will be created if:
1691
+ - there is no invoice in gathering state
1692
+ - the currency of the line item doesn't match the currency of any invoices in gathering state
1693
+ * @summary Create pending line items
1682
1694
  */
1683
- export const simulateInvoicePathCustomerIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
1684
- export const simulateInvoiceParams = zod.object({
1685
- customerId: zod.string().regex(simulateInvoicePathCustomerIdRegExp),
1695
+ export const createPendingInvoiceLinePathCustomerIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
1696
+ export const createPendingInvoiceLineParams = zod.object({
1697
+ customerId: zod.string().regex(createPendingInvoiceLinePathCustomerIdRegExp),
1686
1698
  });
1687
- export const simulateInvoiceBodyNumberMaxOne = 256;
1688
- export const simulateInvoiceBodyCurrencyMinOne = 3;
1689
- export const simulateInvoiceBodyCurrencyMaxOne = 3;
1690
- export const simulateInvoiceBodyCurrencyRegExpOne = new RegExp('^[A-Z]{3}$');
1691
- export const simulateInvoiceBodyLinesItemNameMax = 256;
1692
- export const simulateInvoiceBodyLinesItemDescriptionMax = 1024;
1693
- export const simulateInvoiceBodyLinesItemTaxConfigStripeCodeRegExp = new RegExp('^txcd_\\d{8}$');
1694
- export const simulateInvoiceBodyLinesItemPriceAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1695
- export const simulateInvoiceBodyLinesItemPricePaymentTermDefault = 'in_advance';
1696
- export const simulateInvoiceBodyLinesItemPriceAmountRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1697
- export const simulateInvoiceBodyLinesItemPriceMinimumAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1698
- export const simulateInvoiceBodyLinesItemPriceMaximumAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1699
- export const simulateInvoiceBodyLinesItemPriceTiersItemUpToAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1700
- export const simulateInvoiceBodyLinesItemPriceTiersItemFlatPriceAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1701
- export const simulateInvoiceBodyLinesItemPriceTiersItemUnitPriceAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1702
- export const simulateInvoiceBodyLinesItemPriceMinimumAmountRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1703
- export const simulateInvoiceBodyLinesItemPriceMaximumAmountRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1704
- export const simulateInvoiceBodyLinesItemPriceMultiplierRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1705
- export const simulateInvoiceBodyLinesItemPriceMultiplierDefault = '1';
1706
- export const simulateInvoiceBodyLinesItemPriceMinimumAmountRegExpFive = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1707
- export const simulateInvoiceBodyLinesItemPriceMaximumAmountRegExpFive = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1708
- export const simulateInvoiceBodyLinesItemPriceAmountRegExpFive = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1709
- export const simulateInvoiceBodyLinesItemPriceQuantityPerPackageRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1710
- export const simulateInvoiceBodyLinesItemPriceMinimumAmountRegExpSeven = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1711
- export const simulateInvoiceBodyLinesItemPriceMaximumAmountRegExpSeven = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1712
- export const simulateInvoiceBodyLinesItemFeatureKeyMax = 64;
1713
- export const simulateInvoiceBodyLinesItemFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
1714
- export const simulateInvoiceBodyLinesItemRateCardFeatureKeyMax = 64;
1715
- export const simulateInvoiceBodyLinesItemRateCardFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
1716
- export const simulateInvoiceBodyLinesItemRateCardTaxConfigStripeCodeRegExp = new RegExp('^txcd_\\d{8}$');
1717
- export const simulateInvoiceBodyLinesItemRateCardPriceAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1718
- export const simulateInvoiceBodyLinesItemRateCardPricePaymentTermDefault = 'in_advance';
1719
- export const simulateInvoiceBodyLinesItemRateCardPriceAmountRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1720
- export const simulateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1721
- export const simulateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1722
- export const simulateInvoiceBodyLinesItemRateCardPriceTiersItemUpToAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1723
- export const simulateInvoiceBodyLinesItemRateCardPriceTiersItemFlatPriceAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1724
- export const simulateInvoiceBodyLinesItemRateCardPriceTiersItemUnitPriceAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1725
- export const simulateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1726
- export const simulateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1727
- export const simulateInvoiceBodyLinesItemRateCardPriceMultiplierRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1728
- export const simulateInvoiceBodyLinesItemRateCardPriceMultiplierDefault = '1';
1729
- export const simulateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpFive = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1730
- export const simulateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpFive = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1731
- export const simulateInvoiceBodyLinesItemRateCardPriceAmountRegExpFive = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1732
- export const simulateInvoiceBodyLinesItemRateCardPriceQuantityPerPackageRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1733
- export const simulateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpSeven = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1734
- export const simulateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpSeven = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1735
- export const simulateInvoiceBodyLinesItemRateCardDiscountsPercentageCorrelationIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
1736
- export const simulateInvoiceBodyLinesItemRateCardDiscountsUsageQuantityRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1737
- export const simulateInvoiceBodyLinesItemRateCardDiscountsUsageCorrelationIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
1738
- export const simulateInvoiceBodyLinesItemQuantityRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1739
- export const simulateInvoiceBodyLinesItemPreLinePeriodQuantityRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1740
- export const simulateInvoiceBodyLinesItemIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
1741
- export const simulateInvoiceBodyLinesItemNameMaxOne = 256;
1742
- export const simulateInvoiceBodyLinesItemDescriptionMaxOne = 1024;
1743
- export const simulateInvoiceBodyLinesItemTaxConfigStripeCodeRegExpOne = new RegExp('^txcd_\\d{8}$');
1744
- export const simulateInvoiceBodyLinesItemPerUnitAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1745
- export const simulateInvoiceBodyLinesItemPaymentTermDefault = 'in_advance';
1746
- export const simulateInvoiceBodyLinesItemQuantityRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1747
- export const simulateInvoiceBodyLinesItemRateCardTaxConfigStripeCodeRegExpOne = new RegExp('^txcd_\\d{8}$');
1748
- export const simulateInvoiceBodyLinesItemRateCardPriceAmountRegExpSeven = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1749
- export const simulateInvoiceBodyLinesItemRateCardPricePaymentTermDefaultTwo = 'in_advance';
1750
- export const simulateInvoiceBodyLinesItemRateCardQuantityRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1751
- export const simulateInvoiceBodyLinesItemRateCardDiscountsPercentageCorrelationIdRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
1752
- export const simulateInvoiceBodyLinesItemRateCardDiscountsUsageQuantityRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1753
- export const simulateInvoiceBodyLinesItemRateCardDiscountsUsageCorrelationIdRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
1754
- export const simulateInvoiceBodyLinesItemCategoryDefault = 'regular';
1755
- export const simulateInvoiceBodyLinesItemIdRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
1756
- export const simulateInvoiceBody = zod
1699
+ export const createPendingInvoiceLineBodyCurrencyMinOne = 3;
1700
+ export const createPendingInvoiceLineBodyCurrencyMaxOne = 3;
1701
+ export const createPendingInvoiceLineBodyCurrencyRegExpOne = new RegExp('^[A-Z]{3}$');
1702
+ export const createPendingInvoiceLineBodyLinesItemNameMax = 256;
1703
+ export const createPendingInvoiceLineBodyLinesItemDescriptionMax = 1024;
1704
+ export const createPendingInvoiceLineBodyLinesItemTaxConfigStripeCodeRegExp = new RegExp('^txcd_\\d{8}$');
1705
+ export const createPendingInvoiceLineBodyLinesItemPriceAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1706
+ export const createPendingInvoiceLineBodyLinesItemPricePaymentTermDefault = 'in_advance';
1707
+ export const createPendingInvoiceLineBodyLinesItemPriceAmountRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1708
+ export const createPendingInvoiceLineBodyLinesItemPriceMinimumAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1709
+ export const createPendingInvoiceLineBodyLinesItemPriceMaximumAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1710
+ export const createPendingInvoiceLineBodyLinesItemPriceTiersItemUpToAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1711
+ export const createPendingInvoiceLineBodyLinesItemPriceTiersItemFlatPriceAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1712
+ export const createPendingInvoiceLineBodyLinesItemPriceTiersItemUnitPriceAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1713
+ export const createPendingInvoiceLineBodyLinesItemPriceMinimumAmountRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1714
+ export const createPendingInvoiceLineBodyLinesItemPriceMaximumAmountRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1715
+ export const createPendingInvoiceLineBodyLinesItemPriceMultiplierRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1716
+ export const createPendingInvoiceLineBodyLinesItemPriceMultiplierDefault = '1';
1717
+ export const createPendingInvoiceLineBodyLinesItemPriceMinimumAmountRegExpFive = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1718
+ export const createPendingInvoiceLineBodyLinesItemPriceMaximumAmountRegExpFive = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1719
+ export const createPendingInvoiceLineBodyLinesItemPriceAmountRegExpFive = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1720
+ export const createPendingInvoiceLineBodyLinesItemPriceQuantityPerPackageRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1721
+ export const createPendingInvoiceLineBodyLinesItemPriceMinimumAmountRegExpSeven = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1722
+ export const createPendingInvoiceLineBodyLinesItemPriceMaximumAmountRegExpSeven = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1723
+ export const createPendingInvoiceLineBodyLinesItemFeatureKeyMax = 64;
1724
+ export const createPendingInvoiceLineBodyLinesItemFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
1725
+ export const createPendingInvoiceLineBodyLinesItemRateCardFeatureKeyMax = 64;
1726
+ export const createPendingInvoiceLineBodyLinesItemRateCardFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
1727
+ export const createPendingInvoiceLineBodyLinesItemRateCardTaxConfigStripeCodeRegExp = new RegExp('^txcd_\\d{8}$');
1728
+ export const createPendingInvoiceLineBodyLinesItemRateCardPriceAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1729
+ export const createPendingInvoiceLineBodyLinesItemRateCardPricePaymentTermDefault = 'in_advance';
1730
+ export const createPendingInvoiceLineBodyLinesItemRateCardPriceAmountRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1731
+ export const createPendingInvoiceLineBodyLinesItemRateCardPriceMinimumAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1732
+ export const createPendingInvoiceLineBodyLinesItemRateCardPriceMaximumAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1733
+ export const createPendingInvoiceLineBodyLinesItemRateCardPriceTiersItemUpToAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1734
+ export const createPendingInvoiceLineBodyLinesItemRateCardPriceTiersItemFlatPriceAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1735
+ export const createPendingInvoiceLineBodyLinesItemRateCardPriceTiersItemUnitPriceAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1736
+ export const createPendingInvoiceLineBodyLinesItemRateCardPriceMinimumAmountRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1737
+ export const createPendingInvoiceLineBodyLinesItemRateCardPriceMaximumAmountRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1738
+ export const createPendingInvoiceLineBodyLinesItemRateCardPriceMultiplierRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1739
+ export const createPendingInvoiceLineBodyLinesItemRateCardPriceMultiplierDefault = '1';
1740
+ export const createPendingInvoiceLineBodyLinesItemRateCardPriceMinimumAmountRegExpFive = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1741
+ export const createPendingInvoiceLineBodyLinesItemRateCardPriceMaximumAmountRegExpFive = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1742
+ export const createPendingInvoiceLineBodyLinesItemRateCardPriceAmountRegExpFive = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1743
+ export const createPendingInvoiceLineBodyLinesItemRateCardPriceQuantityPerPackageRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1744
+ export const createPendingInvoiceLineBodyLinesItemRateCardPriceMinimumAmountRegExpSeven = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1745
+ export const createPendingInvoiceLineBodyLinesItemRateCardPriceMaximumAmountRegExpSeven = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1746
+ export const createPendingInvoiceLineBodyLinesItemRateCardDiscountsPercentageCorrelationIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
1747
+ export const createPendingInvoiceLineBodyLinesItemRateCardDiscountsUsageQuantityRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1748
+ export const createPendingInvoiceLineBodyLinesItemRateCardDiscountsUsageCorrelationIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
1749
+ export const createPendingInvoiceLineBody = zod
1757
1750
  .object({
1758
1751
  currency: zod
1759
1752
  .string()
1760
- .min(simulateInvoiceBodyCurrencyMinOne)
1761
- .max(simulateInvoiceBodyCurrencyMaxOne)
1762
- .regex(simulateInvoiceBodyCurrencyRegExpOne)
1753
+ .min(createPendingInvoiceLineBodyCurrencyMinOne)
1754
+ .max(createPendingInvoiceLineBodyCurrencyMaxOne)
1755
+ .regex(createPendingInvoiceLineBodyCurrencyRegExpOne)
1763
1756
  .describe('Three-letter [ISO4217](https://www.iso.org/iso-4217-currency-codes.html) currency code.\nCustom three-letter currency codes are also supported for convenience.')
1764
- .describe('Currency for all invoice line items.\n\nMulti currency invoices are not supported yet.'),
1757
+ .describe('The currency of the lines to be created.'),
1765
1758
  lines: zod
1766
1759
  .array(zod
1767
- .discriminatedUnion('type', [
1768
- zod
1760
+ .object({
1761
+ description: zod
1762
+ .string()
1763
+ .max(createPendingInvoiceLineBodyLinesItemDescriptionMax)
1764
+ .optional()
1765
+ .describe('Optional description of the resource. Maximum 1024 characters.'),
1766
+ featureKey: zod
1767
+ .string()
1768
+ .min(1)
1769
+ .max(createPendingInvoiceLineBodyLinesItemFeatureKeyMax)
1770
+ .regex(createPendingInvoiceLineBodyLinesItemFeatureKeyRegExp)
1771
+ .optional()
1772
+ .describe('The feature that the usage is based on.'),
1773
+ invoiceAt: zod
1774
+ .date()
1775
+ .describe('The time this line item should be invoiced.'),
1776
+ metadata: zod
1777
+ .record(zod.string(), zod.string())
1778
+ .describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
1779
+ .nullish()
1780
+ .describe('Additional metadata for the resource.'),
1781
+ name: zod
1782
+ .string()
1783
+ .min(1)
1784
+ .max(createPendingInvoiceLineBodyLinesItemNameMax)
1785
+ .describe('Human-readable name for the resource. Between 1 and 256 characters.'),
1786
+ period: zod
1769
1787
  .object({
1770
- description: zod
1771
- .string()
1772
- .max(simulateInvoiceBodyLinesItemDescriptionMax)
1773
- .optional()
1774
- .describe('Optional description of the resource. Maximum 1024 characters.'),
1775
- featureKey: zod
1776
- .string()
1777
- .min(1)
1778
- .max(simulateInvoiceBodyLinesItemFeatureKeyMax)
1779
- .regex(simulateInvoiceBodyLinesItemFeatureKeyRegExp)
1780
- .optional()
1781
- .describe('The feature that the usage is based on.'),
1782
- id: zod
1783
- .string()
1784
- .regex(simulateInvoiceBodyLinesItemIdRegExp)
1785
- .optional()
1786
- .describe('ID of the line. If not specified it will be auto-generated.\n\nWhen discounts are specified, this must be provided, so that the discount can reference it.'),
1787
- invoiceAt: zod
1788
- .date()
1789
- .describe('The time this line item should be invoiced.'),
1790
- metadata: zod
1791
- .record(zod.string(), zod.string())
1792
- .describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
1793
- .nullish()
1794
- .describe('Additional metadata for the resource.'),
1795
- name: zod
1796
- .string()
1797
- .min(1)
1798
- .max(simulateInvoiceBodyLinesItemNameMax)
1799
- .describe('Human-readable name for the resource. Between 1 and 256 characters.'),
1800
- period: zod
1788
+ from: zod.date().describe('Period start time.'),
1789
+ to: zod.date().describe('Period end time.'),
1790
+ })
1791
+ .describe('A period with a start and end time.')
1792
+ .describe('Period of the line item applies to for revenue recognition pruposes.\n\nBilling always treats periods as start being inclusive and end being exclusive.'),
1793
+ price: zod
1794
+ .discriminatedUnion('type', [
1795
+ zod
1801
1796
  .object({
1802
- from: zod.date().describe('Period start time.'),
1803
- to: zod.date().describe('Period end time.'),
1797
+ amount: zod
1798
+ .string()
1799
+ .regex(createPendingInvoiceLineBodyLinesItemPriceAmountRegExpOne)
1800
+ .describe('Numeric represents an arbitrary precision number.')
1801
+ .describe('The amount of the flat price.'),
1802
+ paymentTerm: zod
1803
+ .enum(['in_advance', 'in_arrears'])
1804
+ .describe('The payment term of a flat price.\nOne of: in_advance or in_arrears.')
1805
+ .default(createPendingInvoiceLineBodyLinesItemPricePaymentTermDefault)
1806
+ .describe('The payment term of the flat price.\nDefaults to in advance.'),
1807
+ type: zod.enum(['flat']),
1804
1808
  })
1805
- .describe('A period with a start and end time.')
1806
- .describe('Period of the line item applies to for revenue recognition pruposes.\n\nBilling always treats periods as start being inclusive and end being exclusive.'),
1807
- preLinePeriodQuantity: zod
1808
- .string()
1809
- .regex(simulateInvoiceBodyLinesItemPreLinePeriodQuantityRegExpOne)
1810
- .describe('Numeric represents an arbitrary precision number.')
1811
- .optional()
1812
- .describe("The quantity of the item used before this line's period, if the line is billed progressively."),
1813
- price: zod
1814
- .discriminatedUnion('type', [
1815
- zod
1816
- .object({
1817
- amount: zod
1818
- .string()
1819
- .regex(simulateInvoiceBodyLinesItemPriceAmountRegExpOne)
1820
- .describe('Numeric represents an arbitrary precision number.')
1821
- .describe('The amount of the flat price.'),
1822
- paymentTerm: zod
1823
- .enum(['in_advance', 'in_arrears'])
1824
- .describe('The payment term of a flat price.\nOne of: in_advance or in_arrears.')
1825
- .default(simulateInvoiceBodyLinesItemPricePaymentTermDefault)
1826
- .describe('The payment term of the flat price.\nDefaults to in advance.'),
1827
- type: zod.enum(['flat']),
1828
- })
1829
- .describe('Flat price with payment term.'),
1830
- zod
1809
+ .describe('Flat price with payment term.'),
1810
+ zod
1811
+ .object({
1812
+ amount: zod
1813
+ .string()
1814
+ .regex(createPendingInvoiceLineBodyLinesItemPriceAmountRegExpThree)
1815
+ .describe('Numeric represents an arbitrary precision number.')
1816
+ .describe('The amount of the unit price.'),
1817
+ maximumAmount: zod
1818
+ .string()
1819
+ .regex(createPendingInvoiceLineBodyLinesItemPriceMaximumAmountRegExpOne)
1820
+ .describe('Numeric represents an arbitrary precision number.')
1821
+ .optional()
1822
+ .describe('The customer is limited to spend at most the amount.'),
1823
+ minimumAmount: zod
1824
+ .string()
1825
+ .regex(createPendingInvoiceLineBodyLinesItemPriceMinimumAmountRegExpOne)
1826
+ .describe('Numeric represents an arbitrary precision number.')
1827
+ .optional()
1828
+ .describe('The customer is committed to spend at least the amount.'),
1829
+ type: zod.enum(['unit']),
1830
+ })
1831
+ .describe('Unit price with spend commitments.'),
1832
+ zod
1833
+ .object({
1834
+ maximumAmount: zod
1835
+ .string()
1836
+ .regex(createPendingInvoiceLineBodyLinesItemPriceMaximumAmountRegExpThree)
1837
+ .describe('Numeric represents an arbitrary precision number.')
1838
+ .optional()
1839
+ .describe('The customer is limited to spend at most the amount.'),
1840
+ minimumAmount: zod
1841
+ .string()
1842
+ .regex(createPendingInvoiceLineBodyLinesItemPriceMinimumAmountRegExpThree)
1843
+ .describe('Numeric represents an arbitrary precision number.')
1844
+ .optional()
1845
+ .describe('The customer is committed to spend at least the amount.'),
1846
+ mode: zod
1847
+ .enum(['volume', 'graduated'])
1848
+ .describe('The mode of the tiered price.')
1849
+ .describe('Defines if the tiering mode is volume-based or graduated:\n- In `volume`-based tiering, the maximum quantity within a period determines the per unit price.\n- In `graduated` tiering, pricing can change as the quantity grows.'),
1850
+ tiers: zod
1851
+ .array(zod
1831
1852
  .object({
1832
- amount: zod
1833
- .string()
1834
- .regex(simulateInvoiceBodyLinesItemPriceAmountRegExpThree)
1835
- .describe('Numeric represents an arbitrary precision number.')
1836
- .describe('The amount of the unit price.'),
1837
- maximumAmount: zod
1838
- .string()
1839
- .regex(simulateInvoiceBodyLinesItemPriceMaximumAmountRegExpOne)
1840
- .describe('Numeric represents an arbitrary precision number.')
1841
- .optional()
1842
- .describe('The customer is limited to spend at most the amount.'),
1843
- minimumAmount: zod
1853
+ flatPrice: zod
1854
+ .object({
1855
+ amount: zod
1856
+ .string()
1857
+ .regex(createPendingInvoiceLineBodyLinesItemPriceTiersItemFlatPriceAmountRegExpOne)
1858
+ .describe('Numeric represents an arbitrary precision number.')
1859
+ .describe('The amount of the flat price.'),
1860
+ type: zod
1861
+ .enum(['flat'])
1862
+ .describe('The type of the price.'),
1863
+ })
1864
+ .describe('Flat price.')
1865
+ .nullable()
1866
+ .describe('The flat price component of the tier.'),
1867
+ unitPrice: zod
1868
+ .object({
1869
+ amount: zod
1870
+ .string()
1871
+ .regex(createPendingInvoiceLineBodyLinesItemPriceTiersItemUnitPriceAmountRegExpOne)
1872
+ .describe('Numeric represents an arbitrary precision number.')
1873
+ .describe('The amount of the unit price.'),
1874
+ type: zod
1875
+ .enum(['unit'])
1876
+ .describe('The type of the price.'),
1877
+ })
1878
+ .describe('Unit price.')
1879
+ .nullable()
1880
+ .describe('The unit price component of the tier.'),
1881
+ upToAmount: zod
1844
1882
  .string()
1845
- .regex(simulateInvoiceBodyLinesItemPriceMinimumAmountRegExpOne)
1883
+ .regex(createPendingInvoiceLineBodyLinesItemPriceTiersItemUpToAmountRegExpOne)
1846
1884
  .describe('Numeric represents an arbitrary precision number.')
1847
1885
  .optional()
1848
- .describe('The customer is committed to spend at least the amount.'),
1849
- type: zod.enum(['unit']),
1886
+ .describe('Up to and including to this quantity will be contained in the tier.\nIf null, the tier is open-ended.'),
1850
1887
  })
1851
- .describe('Unit price with spend commitments.'),
1852
- zod
1853
- .object({
1854
- maximumAmount: zod
1855
- .string()
1856
- .regex(simulateInvoiceBodyLinesItemPriceMaximumAmountRegExpThree)
1857
- .describe('Numeric represents an arbitrary precision number.')
1858
- .optional()
1859
- .describe('The customer is limited to spend at most the amount.'),
1860
- minimumAmount: zod
1861
- .string()
1862
- .regex(simulateInvoiceBodyLinesItemPriceMinimumAmountRegExpThree)
1863
- .describe('Numeric represents an arbitrary precision number.')
1864
- .optional()
1888
+ .describe('A price tier.\nAt least one price component is required in each tier.'))
1889
+ .min(1)
1890
+ .describe('The tiers of the tiered price.\nAt least one price component is required in each tier.'),
1891
+ type: zod.enum(['tiered']),
1892
+ })
1893
+ .describe('Tiered price with spend commitments.'),
1894
+ zod
1895
+ .object({
1896
+ maximumAmount: zod
1897
+ .string()
1898
+ .regex(createPendingInvoiceLineBodyLinesItemPriceMaximumAmountRegExpFive)
1899
+ .describe('Numeric represents an arbitrary precision number.')
1900
+ .optional()
1901
+ .describe('The customer is limited to spend at most the amount.'),
1902
+ minimumAmount: zod
1903
+ .string()
1904
+ .regex(createPendingInvoiceLineBodyLinesItemPriceMinimumAmountRegExpFive)
1905
+ .describe('Numeric represents an arbitrary precision number.')
1906
+ .optional()
1907
+ .describe('The customer is committed to spend at least the amount.'),
1908
+ multiplier: zod
1909
+ .string()
1910
+ .regex(createPendingInvoiceLineBodyLinesItemPriceMultiplierRegExpOne)
1911
+ .describe('Numeric represents an arbitrary precision number.')
1912
+ .default(createPendingInvoiceLineBodyLinesItemPriceMultiplierDefault)
1913
+ .describe('The multiplier to apply to the base price to get the dynamic price.\n\nExamples:\n- 0.0: the price is zero\n- 0.5: the price is 50% of the base price\n- 1.0: the price is the same as the base price\n- 1.5: the price is 150% of the base price'),
1914
+ type: zod.enum(['dynamic']),
1915
+ })
1916
+ .describe('Dynamic price with spend commitments.'),
1917
+ zod
1918
+ .object({
1919
+ amount: zod
1920
+ .string()
1921
+ .regex(createPendingInvoiceLineBodyLinesItemPriceAmountRegExpFive)
1922
+ .describe('Numeric represents an arbitrary precision number.')
1923
+ .describe('The price of one package.'),
1924
+ maximumAmount: zod
1925
+ .string()
1926
+ .regex(createPendingInvoiceLineBodyLinesItemPriceMaximumAmountRegExpSeven)
1927
+ .describe('Numeric represents an arbitrary precision number.')
1928
+ .optional()
1929
+ .describe('The customer is limited to spend at most the amount.'),
1930
+ minimumAmount: zod
1931
+ .string()
1932
+ .regex(createPendingInvoiceLineBodyLinesItemPriceMinimumAmountRegExpSeven)
1933
+ .describe('Numeric represents an arbitrary precision number.')
1934
+ .optional()
1935
+ .describe('The customer is committed to spend at least the amount.'),
1936
+ quantityPerPackage: zod
1937
+ .string()
1938
+ .regex(createPendingInvoiceLineBodyLinesItemPriceQuantityPerPackageRegExpOne)
1939
+ .describe('Numeric represents an arbitrary precision number.')
1940
+ .describe('The quantity per package.'),
1941
+ type: zod.enum(['package']),
1942
+ })
1943
+ .describe('Package price with spend commitments.'),
1944
+ ])
1945
+ .describe('The price of the usage based rate card.')
1946
+ .optional()
1947
+ .describe('Price of the usage-based item being sold.'),
1948
+ rateCard: zod
1949
+ .object({
1950
+ discounts: zod
1951
+ .object({
1952
+ percentage: zod
1953
+ .object({
1954
+ correlationId: zod
1955
+ .string()
1956
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardDiscountsPercentageCorrelationIdRegExp)
1957
+ .optional()
1958
+ .describe('Correlation ID for the discount.\n\nThis is used to link discounts across different invoices (progressive billing use case).\n\nIf not provided, the invoicing engine will auto-generate one. When editing an invoice line,\nplease make sure to keep the same correlation ID of the discount or in progressive billing\nsetups the discount amounts might be incorrect.'),
1959
+ percentage: zod
1960
+ .number()
1961
+ .describe('Numeric representation of a percentage\n\n50% is represented as 50')
1962
+ .describe('The percentage of the discount.'),
1963
+ })
1964
+ .describe('A percentage discount.')
1965
+ .optional()
1966
+ .describe('The percentage discount.'),
1967
+ usage: zod
1968
+ .object({
1969
+ correlationId: zod
1970
+ .string()
1971
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardDiscountsUsageCorrelationIdRegExp)
1972
+ .optional()
1973
+ .describe('Correlation ID for the discount.\n\nThis is used to link discounts across different invoices (progressive billing use case).\n\nIf not provided, the invoicing engine will auto-generate one. When editing an invoice line,\nplease make sure to keep the same correlation ID of the discount or in progressive billing\nsetups the discount amounts might be incorrect.'),
1974
+ quantity: zod
1975
+ .string()
1976
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardDiscountsUsageQuantityRegExpOne)
1977
+ .describe('Numeric represents an arbitrary precision number.')
1978
+ .describe('The quantity of the usage discount.\n\nMust be positive.'),
1979
+ })
1980
+ .describe('A usage discount.')
1981
+ .optional()
1982
+ .describe('The usage discount.'),
1983
+ })
1984
+ .describe('A discount by type.')
1985
+ .optional()
1986
+ .describe('The discounts that are applied to the line.'),
1987
+ featureKey: zod
1988
+ .string()
1989
+ .min(1)
1990
+ .max(createPendingInvoiceLineBodyLinesItemRateCardFeatureKeyMax)
1991
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardFeatureKeyRegExp)
1992
+ .optional()
1993
+ .describe('The feature the customer is entitled to use.'),
1994
+ price: zod
1995
+ .discriminatedUnion('type', [
1996
+ zod
1997
+ .object({
1998
+ amount: zod
1999
+ .string()
2000
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceAmountRegExpOne)
2001
+ .describe('Numeric represents an arbitrary precision number.')
2002
+ .describe('The amount of the flat price.'),
2003
+ paymentTerm: zod
2004
+ .enum(['in_advance', 'in_arrears'])
2005
+ .describe('The payment term of a flat price.\nOne of: in_advance or in_arrears.')
2006
+ .default(createPendingInvoiceLineBodyLinesItemRateCardPricePaymentTermDefault)
2007
+ .describe('The payment term of the flat price.\nDefaults to in advance.'),
2008
+ type: zod.enum(['flat']),
2009
+ })
2010
+ .describe('Flat price with payment term.'),
2011
+ zod
2012
+ .object({
2013
+ amount: zod
2014
+ .string()
2015
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceAmountRegExpThree)
2016
+ .describe('Numeric represents an arbitrary precision number.')
2017
+ .describe('The amount of the unit price.'),
2018
+ maximumAmount: zod
2019
+ .string()
2020
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceMaximumAmountRegExpOne)
2021
+ .describe('Numeric represents an arbitrary precision number.')
2022
+ .optional()
2023
+ .describe('The customer is limited to spend at most the amount.'),
2024
+ minimumAmount: zod
2025
+ .string()
2026
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceMinimumAmountRegExpOne)
2027
+ .describe('Numeric represents an arbitrary precision number.')
2028
+ .optional()
2029
+ .describe('The customer is committed to spend at least the amount.'),
2030
+ type: zod.enum(['unit']),
2031
+ })
2032
+ .describe('Unit price with spend commitments.'),
2033
+ zod
2034
+ .object({
2035
+ maximumAmount: zod
2036
+ .string()
2037
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceMaximumAmountRegExpThree)
2038
+ .describe('Numeric represents an arbitrary precision number.')
2039
+ .optional()
2040
+ .describe('The customer is limited to spend at most the amount.'),
2041
+ minimumAmount: zod
2042
+ .string()
2043
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceMinimumAmountRegExpThree)
2044
+ .describe('Numeric represents an arbitrary precision number.')
2045
+ .optional()
1865
2046
  .describe('The customer is committed to spend at least the amount.'),
1866
2047
  mode: zod
1867
2048
  .enum(['volume', 'graduated'])
@@ -1874,7 +2055,7 @@ export const simulateInvoiceBody = zod
1874
2055
  .object({
1875
2056
  amount: zod
1876
2057
  .string()
1877
- .regex(simulateInvoiceBodyLinesItemPriceTiersItemFlatPriceAmountRegExpOne)
2058
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceTiersItemFlatPriceAmountRegExpOne)
1878
2059
  .describe('Numeric represents an arbitrary precision number.')
1879
2060
  .describe('The amount of the flat price.'),
1880
2061
  type: zod
@@ -1888,7 +2069,7 @@ export const simulateInvoiceBody = zod
1888
2069
  .object({
1889
2070
  amount: zod
1890
2071
  .string()
1891
- .regex(simulateInvoiceBodyLinesItemPriceTiersItemUnitPriceAmountRegExpOne)
2072
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceTiersItemUnitPriceAmountRegExpOne)
1892
2073
  .describe('Numeric represents an arbitrary precision number.')
1893
2074
  .describe('The amount of the unit price.'),
1894
2075
  type: zod
@@ -1900,7 +2081,7 @@ export const simulateInvoiceBody = zod
1900
2081
  .describe('The unit price component of the tier.'),
1901
2082
  upToAmount: zod
1902
2083
  .string()
1903
- .regex(simulateInvoiceBodyLinesItemPriceTiersItemUpToAmountRegExpOne)
2084
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceTiersItemUpToAmountRegExpOne)
1904
2085
  .describe('Numeric represents an arbitrary precision number.')
1905
2086
  .optional()
1906
2087
  .describe('Up to and including to this quantity will be contained in the tier.\nIf null, the tier is open-ended.'),
@@ -1915,21 +2096,21 @@ export const simulateInvoiceBody = zod
1915
2096
  .object({
1916
2097
  maximumAmount: zod
1917
2098
  .string()
1918
- .regex(simulateInvoiceBodyLinesItemPriceMaximumAmountRegExpFive)
2099
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceMaximumAmountRegExpFive)
1919
2100
  .describe('Numeric represents an arbitrary precision number.')
1920
2101
  .optional()
1921
2102
  .describe('The customer is limited to spend at most the amount.'),
1922
2103
  minimumAmount: zod
1923
2104
  .string()
1924
- .regex(simulateInvoiceBodyLinesItemPriceMinimumAmountRegExpFive)
2105
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceMinimumAmountRegExpFive)
1925
2106
  .describe('Numeric represents an arbitrary precision number.')
1926
2107
  .optional()
1927
2108
  .describe('The customer is committed to spend at least the amount.'),
1928
2109
  multiplier: zod
1929
2110
  .string()
1930
- .regex(simulateInvoiceBodyLinesItemPriceMultiplierRegExpOne)
2111
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceMultiplierRegExpOne)
1931
2112
  .describe('Numeric represents an arbitrary precision number.')
1932
- .default(simulateInvoiceBodyLinesItemPriceMultiplierDefault)
2113
+ .default(createPendingInvoiceLineBodyLinesItemRateCardPriceMultiplierDefault)
1933
2114
  .describe('The multiplier to apply to the base price to get the dynamic price.\n\nExamples:\n- 0.0: the price is zero\n- 0.5: the price is 50% of the base price\n- 1.0: the price is the same as the base price\n- 1.5: the price is 150% of the base price'),
1934
2115
  type: zod.enum(['dynamic']),
1935
2116
  })
@@ -1938,24 +2119,24 @@ export const simulateInvoiceBody = zod
1938
2119
  .object({
1939
2120
  amount: zod
1940
2121
  .string()
1941
- .regex(simulateInvoiceBodyLinesItemPriceAmountRegExpFive)
2122
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceAmountRegExpFive)
1942
2123
  .describe('Numeric represents an arbitrary precision number.')
1943
2124
  .describe('The price of one package.'),
1944
2125
  maximumAmount: zod
1945
2126
  .string()
1946
- .regex(simulateInvoiceBodyLinesItemPriceMaximumAmountRegExpSeven)
2127
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceMaximumAmountRegExpSeven)
1947
2128
  .describe('Numeric represents an arbitrary precision number.')
1948
2129
  .optional()
1949
2130
  .describe('The customer is limited to spend at most the amount.'),
1950
2131
  minimumAmount: zod
1951
2132
  .string()
1952
- .regex(simulateInvoiceBodyLinesItemPriceMinimumAmountRegExpSeven)
2133
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceMinimumAmountRegExpSeven)
1953
2134
  .describe('Numeric represents an arbitrary precision number.')
1954
2135
  .optional()
1955
2136
  .describe('The customer is committed to spend at least the amount.'),
1956
2137
  quantityPerPackage: zod
1957
2138
  .string()
1958
- .regex(simulateInvoiceBodyLinesItemPriceQuantityPerPackageRegExpOne)
2139
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceQuantityPerPackageRegExpOne)
1959
2140
  .describe('Numeric represents an arbitrary precision number.')
1960
2141
  .describe('The quantity per package.'),
1961
2142
  type: zod.enum(['package']),
@@ -1963,690 +2144,173 @@ export const simulateInvoiceBody = zod
1963
2144
  .describe('Package price with spend commitments.'),
1964
2145
  ])
1965
2146
  .describe('The price of the usage based rate card.')
1966
- .optional()
1967
- .describe('Price of the usage-based item being sold.'),
1968
- quantity: zod
1969
- .string()
1970
- .regex(simulateInvoiceBodyLinesItemQuantityRegExpOne)
1971
- .describe('Numeric represents an arbitrary precision number.')
1972
- .describe('The quantity of the item being sold.'),
1973
- rateCard: zod
2147
+ .nullable()
2148
+ .describe('The price of the rate card.\nWhen null, the feature or service is free.'),
2149
+ taxConfig: zod
1974
2150
  .object({
1975
- discounts: zod
2151
+ behavior: zod
2152
+ .enum(['inclusive', 'exclusive'])
2153
+ .describe('Tax behavior.\n\nThis enum is used to specify whether tax is included in the price or excluded from the price.')
2154
+ .optional()
2155
+ .describe("Tax behavior.\n\nIf not specified the billing profile is used to determine the tax behavior.\nIf not specified in the billing profile, the provider's default behavior is used."),
2156
+ customInvoicing: zod
1976
2157
  .object({
1977
- percentage: zod
1978
- .object({
1979
- correlationId: zod
1980
- .string()
1981
- .regex(simulateInvoiceBodyLinesItemRateCardDiscountsPercentageCorrelationIdRegExp)
1982
- .optional()
1983
- .describe('Correlation ID for the discount.\n\nThis is used to link discounts across different invoices (progressive billing use case).\n\nIf not provided, the invoicing engine will auto-generate one. When editing an invoice line,\nplease make sure to keep the same correlation ID of the discount or in progressive billing\nsetups the discount amounts might be incorrect.'),
1984
- percentage: zod
1985
- .number()
1986
- .describe('Numeric representation of a percentage\n\n50% is represented as 50')
1987
- .describe('The percentage of the discount.'),
1988
- })
1989
- .describe('A percentage discount.')
1990
- .optional()
1991
- .describe('The percentage discount.'),
1992
- usage: zod
1993
- .object({
1994
- correlationId: zod
1995
- .string()
1996
- .regex(simulateInvoiceBodyLinesItemRateCardDiscountsUsageCorrelationIdRegExp)
1997
- .optional()
1998
- .describe('Correlation ID for the discount.\n\nThis is used to link discounts across different invoices (progressive billing use case).\n\nIf not provided, the invoicing engine will auto-generate one. When editing an invoice line,\nplease make sure to keep the same correlation ID of the discount or in progressive billing\nsetups the discount amounts might be incorrect.'),
1999
- quantity: zod
2000
- .string()
2001
- .regex(simulateInvoiceBodyLinesItemRateCardDiscountsUsageQuantityRegExpOne)
2002
- .describe('Numeric represents an arbitrary precision number.')
2003
- .describe('The quantity of the usage discount.\n\nMust be positive.'),
2004
- })
2005
- .describe('A usage discount.')
2006
- .optional()
2007
- .describe('The usage discount.'),
2158
+ code: zod
2159
+ .string()
2160
+ .describe('Tax code.\n\nThe tax code should be interpreted by the custom invoicing provider.'),
2008
2161
  })
2009
- .describe('A discount by type.')
2162
+ .describe('Custom invoicing tax config.')
2010
2163
  .optional()
2011
- .describe('The discounts that are applied to the line.'),
2012
- featureKey: zod
2013
- .string()
2014
- .min(1)
2015
- .max(simulateInvoiceBodyLinesItemRateCardFeatureKeyMax)
2016
- .regex(simulateInvoiceBodyLinesItemRateCardFeatureKeyRegExp)
2017
- .optional()
2018
- .describe('The feature the customer is entitled to use.'),
2019
- price: zod
2020
- .discriminatedUnion('type', [
2021
- zod
2022
- .object({
2023
- amount: zod
2024
- .string()
2025
- .regex(simulateInvoiceBodyLinesItemRateCardPriceAmountRegExpOne)
2026
- .describe('Numeric represents an arbitrary precision number.')
2027
- .describe('The amount of the flat price.'),
2028
- paymentTerm: zod
2029
- .enum(['in_advance', 'in_arrears'])
2030
- .describe('The payment term of a flat price.\nOne of: in_advance or in_arrears.')
2031
- .default(simulateInvoiceBodyLinesItemRateCardPricePaymentTermDefault)
2032
- .describe('The payment term of the flat price.\nDefaults to in advance.'),
2033
- type: zod.enum(['flat']),
2034
- })
2035
- .describe('Flat price with payment term.'),
2036
- zod
2037
- .object({
2038
- amount: zod
2039
- .string()
2040
- .regex(simulateInvoiceBodyLinesItemRateCardPriceAmountRegExpThree)
2041
- .describe('Numeric represents an arbitrary precision number.')
2042
- .describe('The amount of the unit price.'),
2043
- maximumAmount: zod
2044
- .string()
2045
- .regex(simulateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpOne)
2046
- .describe('Numeric represents an arbitrary precision number.')
2047
- .optional()
2048
- .describe('The customer is limited to spend at most the amount.'),
2049
- minimumAmount: zod
2050
- .string()
2051
- .regex(simulateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpOne)
2052
- .describe('Numeric represents an arbitrary precision number.')
2053
- .optional()
2054
- .describe('The customer is committed to spend at least the amount.'),
2055
- type: zod.enum(['unit']),
2056
- })
2057
- .describe('Unit price with spend commitments.'),
2058
- zod
2059
- .object({
2060
- maximumAmount: zod
2061
- .string()
2062
- .regex(simulateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpThree)
2063
- .describe('Numeric represents an arbitrary precision number.')
2064
- .optional()
2065
- .describe('The customer is limited to spend at most the amount.'),
2066
- minimumAmount: zod
2067
- .string()
2068
- .regex(simulateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpThree)
2069
- .describe('Numeric represents an arbitrary precision number.')
2070
- .optional()
2071
- .describe('The customer is committed to spend at least the amount.'),
2072
- mode: zod
2073
- .enum(['volume', 'graduated'])
2074
- .describe('The mode of the tiered price.')
2075
- .describe('Defines if the tiering mode is volume-based or graduated:\n- In `volume`-based tiering, the maximum quantity within a period determines the per unit price.\n- In `graduated` tiering, pricing can change as the quantity grows.'),
2076
- tiers: zod
2077
- .array(zod
2078
- .object({
2079
- flatPrice: zod
2080
- .object({
2081
- amount: zod
2082
- .string()
2083
- .regex(simulateInvoiceBodyLinesItemRateCardPriceTiersItemFlatPriceAmountRegExpOne)
2084
- .describe('Numeric represents an arbitrary precision number.')
2085
- .describe('The amount of the flat price.'),
2086
- type: zod
2087
- .enum(['flat'])
2088
- .describe('The type of the price.'),
2089
- })
2090
- .describe('Flat price.')
2091
- .nullable()
2092
- .describe('The flat price component of the tier.'),
2093
- unitPrice: zod
2094
- .object({
2095
- amount: zod
2096
- .string()
2097
- .regex(simulateInvoiceBodyLinesItemRateCardPriceTiersItemUnitPriceAmountRegExpOne)
2098
- .describe('Numeric represents an arbitrary precision number.')
2099
- .describe('The amount of the unit price.'),
2100
- type: zod
2101
- .enum(['unit'])
2102
- .describe('The type of the price.'),
2103
- })
2104
- .describe('Unit price.')
2105
- .nullable()
2106
- .describe('The unit price component of the tier.'),
2107
- upToAmount: zod
2108
- .string()
2109
- .regex(simulateInvoiceBodyLinesItemRateCardPriceTiersItemUpToAmountRegExpOne)
2110
- .describe('Numeric represents an arbitrary precision number.')
2111
- .optional()
2112
- .describe('Up to and including to this quantity will be contained in the tier.\nIf null, the tier is open-ended.'),
2113
- })
2114
- .describe('A price tier.\nAt least one price component is required in each tier.'))
2115
- .min(1)
2116
- .describe('The tiers of the tiered price.\nAt least one price component is required in each tier.'),
2117
- type: zod.enum(['tiered']),
2118
- })
2119
- .describe('Tiered price with spend commitments.'),
2120
- zod
2121
- .object({
2122
- maximumAmount: zod
2123
- .string()
2124
- .regex(simulateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpFive)
2125
- .describe('Numeric represents an arbitrary precision number.')
2126
- .optional()
2127
- .describe('The customer is limited to spend at most the amount.'),
2128
- minimumAmount: zod
2129
- .string()
2130
- .regex(simulateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpFive)
2131
- .describe('Numeric represents an arbitrary precision number.')
2132
- .optional()
2133
- .describe('The customer is committed to spend at least the amount.'),
2134
- multiplier: zod
2135
- .string()
2136
- .regex(simulateInvoiceBodyLinesItemRateCardPriceMultiplierRegExpOne)
2137
- .describe('Numeric represents an arbitrary precision number.')
2138
- .default(simulateInvoiceBodyLinesItemRateCardPriceMultiplierDefault)
2139
- .describe('The multiplier to apply to the base price to get the dynamic price.\n\nExamples:\n- 0.0: the price is zero\n- 0.5: the price is 50% of the base price\n- 1.0: the price is the same as the base price\n- 1.5: the price is 150% of the base price'),
2140
- type: zod.enum(['dynamic']),
2141
- })
2142
- .describe('Dynamic price with spend commitments.'),
2143
- zod
2144
- .object({
2145
- amount: zod
2146
- .string()
2147
- .regex(simulateInvoiceBodyLinesItemRateCardPriceAmountRegExpFive)
2148
- .describe('Numeric represents an arbitrary precision number.')
2149
- .describe('The price of one package.'),
2150
- maximumAmount: zod
2151
- .string()
2152
- .regex(simulateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpSeven)
2153
- .describe('Numeric represents an arbitrary precision number.')
2154
- .optional()
2155
- .describe('The customer is limited to spend at most the amount.'),
2156
- minimumAmount: zod
2157
- .string()
2158
- .regex(simulateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpSeven)
2159
- .describe('Numeric represents an arbitrary precision number.')
2160
- .optional()
2161
- .describe('The customer is committed to spend at least the amount.'),
2162
- quantityPerPackage: zod
2163
- .string()
2164
- .regex(simulateInvoiceBodyLinesItemRateCardPriceQuantityPerPackageRegExpOne)
2165
- .describe('Numeric represents an arbitrary precision number.')
2166
- .describe('The quantity per package.'),
2167
- type: zod.enum(['package']),
2168
- })
2169
- .describe('Package price with spend commitments.'),
2170
- ])
2171
- .describe('The price of the usage based rate card.')
2172
- .nullable()
2173
- .describe('The price of the rate card.\nWhen null, the feature or service is free.'),
2174
- taxConfig: zod
2175
- .object({
2176
- behavior: zod
2177
- .enum(['inclusive', 'exclusive'])
2178
- .describe('Tax behavior.\n\nThis enum is used to specify whether tax is included in the price or excluded from the price.')
2179
- .optional()
2180
- .describe("Tax behavior.\n\nIf not specified the billing profile is used to determine the tax behavior.\nIf not specified in the billing profile, the provider's default behavior is used."),
2181
- customInvoicing: zod
2182
- .object({
2183
- code: zod
2184
- .string()
2185
- .describe('Tax code.\n\nThe tax code should be interpreted by the custom invoicing provider.'),
2186
- })
2187
- .describe('Custom invoicing tax config.')
2188
- .optional()
2189
- .describe('Custom invoicing tax config.'),
2190
- stripe: zod
2191
- .object({
2192
- code: zod
2193
- .string()
2194
- .regex(simulateInvoiceBodyLinesItemRateCardTaxConfigStripeCodeRegExp)
2195
- .describe('Product tax code.\n\nSee: https://docs.stripe.com/tax/tax-codes'),
2196
- })
2197
- .describe('The tax config for Stripe.')
2198
- .optional()
2199
- .describe('Stripe tax config.'),
2200
- })
2201
- .describe('Set of provider specific tax configs.')
2202
- .optional()
2203
- .describe('The tax config of the rate card.\nWhen undefined, the tax config of the feature or the default tax config of the plan is used.'),
2204
- })
2205
- .describe('InvoiceUsageBasedRateCard represents the rate card (intent) for an usage-based line.')
2206
- .optional()
2207
- .describe('The rate card that is used for this line.\n\nThe rate card captures the intent of the price and discounts for the usage-based item.'),
2208
- taxConfig: zod
2209
- .object({
2210
- behavior: zod
2211
- .enum(['inclusive', 'exclusive'])
2212
- .describe('Tax behavior.\n\nThis enum is used to specify whether tax is included in the price or excluded from the price.')
2213
- .optional()
2214
- .describe("Tax behavior.\n\nIf not specified the billing profile is used to determine the tax behavior.\nIf not specified in the billing profile, the provider's default behavior is used."),
2215
- customInvoicing: zod
2216
- .object({
2217
- code: zod
2218
- .string()
2219
- .describe('Tax code.\n\nThe tax code should be interpreted by the custom invoicing provider.'),
2220
- })
2221
- .describe('Custom invoicing tax config.')
2222
- .optional()
2223
- .describe('Custom invoicing tax config.'),
2224
- stripe: zod
2225
- .object({
2226
- code: zod
2227
- .string()
2228
- .regex(simulateInvoiceBodyLinesItemTaxConfigStripeCodeRegExp)
2229
- .describe('Product tax code.\n\nSee: https://docs.stripe.com/tax/tax-codes'),
2230
- })
2231
- .describe('The tax config for Stripe.')
2164
+ .describe('Custom invoicing tax config.'),
2165
+ stripe: zod
2166
+ .object({
2167
+ code: zod
2168
+ .string()
2169
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardTaxConfigStripeCodeRegExp)
2170
+ .describe('Product tax code.\n\nSee: https://docs.stripe.com/tax/tax-codes'),
2171
+ })
2172
+ .describe('The tax config for Stripe.')
2232
2173
  .optional()
2233
2174
  .describe('Stripe tax config.'),
2234
2175
  })
2235
2176
  .describe('Set of provider specific tax configs.')
2236
2177
  .optional()
2237
- .describe('Tax config specify the tax configuration for this line.'),
2238
- type: zod.enum(['usage_based']),
2178
+ .describe('The tax config of the rate card.\nWhen undefined, the tax config of the feature or the default tax config of the plan is used.'),
2239
2179
  })
2240
- .describe('InvoiceSimulationUsageBasedLine represents a usage-based line item that can be input to the simulation endpoint.'),
2241
- zod
2180
+ .describe('InvoiceUsageBasedRateCard represents the rate card (intent) for an usage-based line.')
2181
+ .optional()
2182
+ .describe('The rate card that is used for this line.\n\nThe rate card captures the intent of the price and discounts for the usage-based item.'),
2183
+ taxConfig: zod
2242
2184
  .object({
2243
- category: zod
2244
- .enum(['regular', 'commitment'])
2245
- .describe('InvoiceFlatFeeCategory determines if the flat fee is a regular fee due to use due to a\ncommitment.')
2246
- .default(simulateInvoiceBodyLinesItemCategoryDefault)
2247
- .describe('Category of the flat fee.'),
2248
- description: zod
2249
- .string()
2250
- .max(simulateInvoiceBodyLinesItemDescriptionMaxOne)
2251
- .optional()
2252
- .describe('Optional description of the resource. Maximum 1024 characters.'),
2253
- id: zod
2254
- .string()
2255
- .regex(simulateInvoiceBodyLinesItemIdRegExpOne)
2185
+ behavior: zod
2186
+ .enum(['inclusive', 'exclusive'])
2187
+ .describe('Tax behavior.\n\nThis enum is used to specify whether tax is included in the price or excluded from the price.')
2256
2188
  .optional()
2257
- .describe('ID of the line. If not specified it will be auto-generated.\n\nWhen discounts are specified, this must be provided, so that the discount can reference it.'),
2258
- invoiceAt: zod
2259
- .date()
2260
- .describe('The time this line item should be invoiced.'),
2261
- metadata: zod
2262
- .record(zod.string(), zod.string())
2263
- .describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
2264
- .nullish()
2265
- .describe('Additional metadata for the resource.'),
2266
- name: zod
2267
- .string()
2268
- .min(1)
2269
- .max(simulateInvoiceBodyLinesItemNameMaxOne)
2270
- .describe('Human-readable name for the resource. Between 1 and 256 characters.'),
2271
- paymentTerm: zod
2272
- .enum(['in_advance', 'in_arrears'])
2273
- .describe('The payment term of a flat price.\nOne of: in_advance or in_arrears.')
2274
- .default(simulateInvoiceBodyLinesItemPaymentTermDefault)
2275
- .describe('Payment term of the line.'),
2276
- period: zod
2189
+ .describe("Tax behavior.\n\nIf not specified the billing profile is used to determine the tax behavior.\nIf not specified in the billing profile, the provider's default behavior is used."),
2190
+ customInvoicing: zod
2277
2191
  .object({
2278
- from: zod.date().describe('Period start time.'),
2279
- to: zod.date().describe('Period end time.'),
2192
+ code: zod
2193
+ .string()
2194
+ .describe('Tax code.\n\nThe tax code should be interpreted by the custom invoicing provider.'),
2280
2195
  })
2281
- .describe('A period with a start and end time.')
2282
- .describe('Period of the line item applies to for revenue recognition pruposes.\n\nBilling always treats periods as start being inclusive and end being exclusive.'),
2283
- perUnitAmount: zod
2284
- .string()
2285
- .regex(simulateInvoiceBodyLinesItemPerUnitAmountRegExpOne)
2286
- .describe('Numeric represents an arbitrary precision number.')
2287
- .optional()
2288
- .describe('Price of the item being sold.'),
2289
- quantity: zod
2290
- .string()
2291
- .regex(simulateInvoiceBodyLinesItemQuantityRegExpThree)
2292
- .describe('Numeric represents an arbitrary precision number.')
2196
+ .describe('Custom invoicing tax config.')
2293
2197
  .optional()
2294
- .describe('Quantity of the item being sold.'),
2295
- rateCard: zod
2198
+ .describe('Custom invoicing tax config.'),
2199
+ stripe: zod
2296
2200
  .object({
2297
- discounts: zod
2298
- .object({
2299
- percentage: zod
2300
- .object({
2301
- correlationId: zod
2302
- .string()
2303
- .regex(simulateInvoiceBodyLinesItemRateCardDiscountsPercentageCorrelationIdRegExpOne)
2304
- .optional()
2305
- .describe('Correlation ID for the discount.\n\nThis is used to link discounts across different invoices (progressive billing use case).\n\nIf not provided, the invoicing engine will auto-generate one. When editing an invoice line,\nplease make sure to keep the same correlation ID of the discount or in progressive billing\nsetups the discount amounts might be incorrect.'),
2306
- percentage: zod
2307
- .number()
2308
- .describe('Numeric representation of a percentage\n\n50% is represented as 50')
2309
- .describe('The percentage of the discount.'),
2310
- })
2311
- .describe('A percentage discount.')
2312
- .optional()
2313
- .describe('The percentage discount.'),
2314
- usage: zod
2315
- .object({
2316
- correlationId: zod
2317
- .string()
2318
- .regex(simulateInvoiceBodyLinesItemRateCardDiscountsUsageCorrelationIdRegExpOne)
2319
- .optional()
2320
- .describe('Correlation ID for the discount.\n\nThis is used to link discounts across different invoices (progressive billing use case).\n\nIf not provided, the invoicing engine will auto-generate one. When editing an invoice line,\nplease make sure to keep the same correlation ID of the discount or in progressive billing\nsetups the discount amounts might be incorrect.'),
2321
- quantity: zod
2322
- .string()
2323
- .regex(simulateInvoiceBodyLinesItemRateCardDiscountsUsageQuantityRegExpThree)
2324
- .describe('Numeric represents an arbitrary precision number.')
2325
- .describe('The quantity of the usage discount.\n\nMust be positive.'),
2326
- })
2327
- .describe('A usage discount.')
2328
- .optional()
2329
- .describe('The usage discount.'),
2330
- })
2331
- .describe('A discount by type.')
2332
- .optional()
2333
- .describe('The discounts that are applied to the line.'),
2334
- price: zod
2335
- .object({
2336
- amount: zod
2337
- .string()
2338
- .regex(simulateInvoiceBodyLinesItemRateCardPriceAmountRegExpSeven)
2339
- .describe('Numeric represents an arbitrary precision number.')
2340
- .describe('The amount of the flat price.'),
2341
- paymentTerm: zod
2342
- .enum(['in_advance', 'in_arrears'])
2343
- .describe('The payment term of a flat price.\nOne of: in_advance or in_arrears.')
2344
- .default(simulateInvoiceBodyLinesItemRateCardPricePaymentTermDefaultTwo)
2345
- .describe('The payment term of the flat price.\nDefaults to in advance.'),
2346
- type: zod.enum(['flat']),
2347
- })
2348
- .describe('Flat price with payment term.')
2349
- .nullable()
2350
- .describe('The price of the rate card.\nWhen null, the feature or service is free.'),
2351
- quantity: zod
2201
+ code: zod
2352
2202
  .string()
2353
- .regex(simulateInvoiceBodyLinesItemRateCardQuantityRegExpOne)
2354
- .describe('Numeric represents an arbitrary precision number.')
2355
- .optional()
2356
- .describe('Quantity of the item being sold.\n\nDefault: 1'),
2357
- taxConfig: zod
2358
- .object({
2359
- behavior: zod
2360
- .enum(['inclusive', 'exclusive'])
2361
- .describe('Tax behavior.\n\nThis enum is used to specify whether tax is included in the price or excluded from the price.')
2362
- .optional()
2363
- .describe("Tax behavior.\n\nIf not specified the billing profile is used to determine the tax behavior.\nIf not specified in the billing profile, the provider's default behavior is used."),
2364
- customInvoicing: zod
2365
- .object({
2366
- code: zod
2367
- .string()
2368
- .describe('Tax code.\n\nThe tax code should be interpreted by the custom invoicing provider.'),
2369
- })
2370
- .describe('Custom invoicing tax config.')
2371
- .optional()
2372
- .describe('Custom invoicing tax config.'),
2373
- stripe: zod
2374
- .object({
2375
- code: zod
2376
- .string()
2377
- .regex(simulateInvoiceBodyLinesItemRateCardTaxConfigStripeCodeRegExpOne)
2378
- .describe('Product tax code.\n\nSee: https://docs.stripe.com/tax/tax-codes'),
2379
- })
2380
- .describe('The tax config for Stripe.')
2381
- .optional()
2382
- .describe('Stripe tax config.'),
2383
- })
2384
- .describe('Set of provider specific tax configs.')
2385
- .optional()
2386
- .describe('The tax config of the rate card.\nWhen undefined, the tax config of the feature or the default tax config of the plan is used.'),
2203
+ .regex(createPendingInvoiceLineBodyLinesItemTaxConfigStripeCodeRegExp)
2204
+ .describe('Product tax code.\n\nSee: https://docs.stripe.com/tax/tax-codes'),
2387
2205
  })
2388
- .describe('InvoiceFlatFeeRateCard represents the rate card (intent) for a flat fee line.')
2206
+ .describe('The tax config for Stripe.')
2389
2207
  .optional()
2390
- .describe('The rate card that is used for this line.'),
2391
- taxConfig: zod
2392
- .object({
2393
- behavior: zod
2394
- .enum(['inclusive', 'exclusive'])
2395
- .describe('Tax behavior.\n\nThis enum is used to specify whether tax is included in the price or excluded from the price.')
2396
- .optional()
2397
- .describe("Tax behavior.\n\nIf not specified the billing profile is used to determine the tax behavior.\nIf not specified in the billing profile, the provider's default behavior is used."),
2398
- customInvoicing: zod
2399
- .object({
2400
- code: zod
2401
- .string()
2402
- .describe('Tax code.\n\nThe tax code should be interpreted by the custom invoicing provider.'),
2403
- })
2404
- .describe('Custom invoicing tax config.')
2405
- .optional()
2406
- .describe('Custom invoicing tax config.'),
2407
- stripe: zod
2408
- .object({
2409
- code: zod
2410
- .string()
2411
- .regex(simulateInvoiceBodyLinesItemTaxConfigStripeCodeRegExpOne)
2412
- .describe('Product tax code.\n\nSee: https://docs.stripe.com/tax/tax-codes'),
2413
- })
2414
- .describe('The tax config for Stripe.')
2415
- .optional()
2416
- .describe('Stripe tax config.'),
2417
- })
2418
- .describe('Set of provider specific tax configs.')
2419
- .optional()
2420
- .describe('Tax config specify the tax configuration for this line.'),
2421
- type: zod.enum(['flat_fee']),
2208
+ .describe('Stripe tax config.'),
2422
2209
  })
2423
- .describe('InvoiceSimulationFlatFeeLine represents a flat fee line item that can be input to the simulation endpoint.'),
2424
- ])
2425
- .describe('InvoiceSimulationInput represents a line item that can be input to the simulation endpoint.'))
2426
- .describe('Lines to be included in the generated invoice.'),
2427
- number: zod
2428
- .string()
2210
+ .describe('Set of provider specific tax configs.')
2211
+ .optional()
2212
+ .describe('Tax config specify the tax configuration for this line.'),
2213
+ })
2214
+ .describe('InvoicePendingLineCreate represents the create model for an invoice line that is sold to the customer based on usage.'))
2429
2215
  .min(1)
2430
- .max(simulateInvoiceBodyNumberMaxOne)
2431
- .describe('InvoiceNumber is a unique identifier for the invoice, generated by the\ninvoicing app.\n\nThe uniqueness depends on a lot of factors:\n- app setting (unique per app or unique per customer)\n- multiple app scenarios (multiple apps generating invoices with the same prefix)')
2432
- .optional()
2433
- .describe('The number of the invoice.'),
2216
+ .describe('The lines to be created.'),
2434
2217
  })
2435
- .describe('InvoiceSimulationInput is the input for simulating an invoice.');
2436
- /**
2437
- * List invoices for a specific customer
2438
- * @summary List invoices
2439
- */
2440
- export const listInvoicesQueryCustomersItemRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
2441
- export const listInvoicesQueryPageDefault = 1;
2442
- export const listInvoicesQueryPageSizeDefault = 100;
2443
- export const listInvoicesQueryPageSizeMax = 1000;
2444
- export const listInvoicesQueryParams = zod.object({
2445
- customers: zod
2446
- .array(zod
2447
- .string()
2448
- .regex(listInvoicesQueryCustomersItemRegExp)
2449
- .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'))
2450
- .optional()
2451
- .describe('Filter by customer ID'),
2452
- expand: zod
2453
- .array(zod
2454
- .enum(['lines', 'preceding', 'workflow.apps'])
2455
- .describe('InvoiceExpand specifies the parts of the invoice to expand in the list output.'))
2456
- .optional()
2457
- .describe('What parts of the list output to expand in listings'),
2458
- extendedStatuses: zod
2459
- .array(zod.string())
2460
- .optional()
2461
- .describe('Filter by invoice extended statuses'),
2462
- includeDeleted: zod.boolean().optional().describe('Include deleted invoices'),
2463
- issuedAfter: zod
2464
- .date()
2465
- .optional()
2466
- .describe('Filter by invoice creation time'),
2467
- issuedBefore: zod
2468
- .date()
2469
- .optional()
2470
- .describe('Filter by invoice creation time'),
2471
- order: zod.enum(['ASC', 'DESC']).optional().describe('The order direction.'),
2472
- orderBy: zod
2473
- .enum(['customer.name', 'issuedAt', 'status', 'createdAt', 'updatedAt'])
2474
- .optional()
2475
- .describe('The order by field.'),
2476
- page: zod
2477
- .number()
2478
- .min(1)
2479
- .default(listInvoicesQueryPageDefault)
2480
- .describe('Page index.\n\nDefault is 1.'),
2481
- pageSize: zod
2482
- .number()
2483
- .min(1)
2484
- .max(listInvoicesQueryPageSizeMax)
2485
- .default(listInvoicesQueryPageSizeDefault)
2486
- .describe('The maximum number of items per page.\n\nDefault is 100.'),
2487
- statuses: zod
2488
- .array(zod
2489
- .enum([
2490
- 'gathering',
2491
- 'draft',
2492
- 'issuing',
2493
- 'issued',
2494
- 'payment_processing',
2495
- 'overdue',
2496
- 'paid',
2497
- 'uncollectible',
2498
- 'voided',
2499
- ])
2500
- .describe('InvoiceStatus describes the status of an invoice.'))
2501
- .optional()
2502
- .describe('Filter by the invoice status.'),
2503
- });
2218
+ .describe('InvoicePendingLineCreate represents the create model for a pending invoice line.');
2504
2219
  /**
2505
- * Create a new invoice from the pending line items.
2506
-
2507
- This should be only called if for some reason we need to invoice a customer outside of the normal billing cycle.
2508
-
2509
- When creating an invoice, the pending line items will be marked as invoiced and the invoice will be created with the total amount of the pending items.
2220
+ * Simulate an invoice for a customer.
2510
2221
 
2511
- New pending line items will be created for the period between now() and the next billing cycle's begining date for any metered item.
2222
+ This call will simulate an invoice for a customer based on the pending line items.
2512
2223
 
2513
- The call can return multiple invoices if the pending line items are in different currencies.
2514
- * @summary Invoice a customer based on the pending line items
2224
+ The call will return the total amount of the invoice and the line items that will be included in the invoice.
2225
+ * @summary Simulate an invoice for a customer
2515
2226
  */
2516
- export const invoicePendingLinesActionBodyFiltersLineIdsItemRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
2517
- export const invoicePendingLinesActionBodyCustomerIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
2518
- export const invoicePendingLinesActionBody = zod
2227
+ export const simulateInvoicePathCustomerIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
2228
+ export const simulateInvoiceParams = zod.object({
2229
+ customerId: zod.string().regex(simulateInvoicePathCustomerIdRegExp),
2230
+ });
2231
+ export const simulateInvoiceBodyNumberMaxOne = 256;
2232
+ export const simulateInvoiceBodyCurrencyMinOne = 3;
2233
+ export const simulateInvoiceBodyCurrencyMaxOne = 3;
2234
+ export const simulateInvoiceBodyCurrencyRegExpOne = new RegExp('^[A-Z]{3}$');
2235
+ export const simulateInvoiceBodyLinesItemNameMax = 256;
2236
+ export const simulateInvoiceBodyLinesItemDescriptionMax = 1024;
2237
+ export const simulateInvoiceBodyLinesItemTaxConfigStripeCodeRegExp = new RegExp('^txcd_\\d{8}$');
2238
+ export const simulateInvoiceBodyLinesItemPriceAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2239
+ export const simulateInvoiceBodyLinesItemPricePaymentTermDefault = 'in_advance';
2240
+ export const simulateInvoiceBodyLinesItemPriceAmountRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2241
+ export const simulateInvoiceBodyLinesItemPriceMinimumAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2242
+ export const simulateInvoiceBodyLinesItemPriceMaximumAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2243
+ export const simulateInvoiceBodyLinesItemPriceTiersItemUpToAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2244
+ export const simulateInvoiceBodyLinesItemPriceTiersItemFlatPriceAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2245
+ export const simulateInvoiceBodyLinesItemPriceTiersItemUnitPriceAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2246
+ export const simulateInvoiceBodyLinesItemPriceMinimumAmountRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2247
+ export const simulateInvoiceBodyLinesItemPriceMaximumAmountRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2248
+ export const simulateInvoiceBodyLinesItemPriceMultiplierRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2249
+ export const simulateInvoiceBodyLinesItemPriceMultiplierDefault = '1';
2250
+ export const simulateInvoiceBodyLinesItemPriceMinimumAmountRegExpFive = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2251
+ export const simulateInvoiceBodyLinesItemPriceMaximumAmountRegExpFive = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2252
+ export const simulateInvoiceBodyLinesItemPriceAmountRegExpFive = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2253
+ export const simulateInvoiceBodyLinesItemPriceQuantityPerPackageRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2254
+ export const simulateInvoiceBodyLinesItemPriceMinimumAmountRegExpSeven = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2255
+ export const simulateInvoiceBodyLinesItemPriceMaximumAmountRegExpSeven = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2256
+ export const simulateInvoiceBodyLinesItemFeatureKeyMax = 64;
2257
+ export const simulateInvoiceBodyLinesItemFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
2258
+ export const simulateInvoiceBodyLinesItemRateCardFeatureKeyMax = 64;
2259
+ export const simulateInvoiceBodyLinesItemRateCardFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
2260
+ export const simulateInvoiceBodyLinesItemRateCardTaxConfigStripeCodeRegExp = new RegExp('^txcd_\\d{8}$');
2261
+ export const simulateInvoiceBodyLinesItemRateCardPriceAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2262
+ export const simulateInvoiceBodyLinesItemRateCardPricePaymentTermDefault = 'in_advance';
2263
+ export const simulateInvoiceBodyLinesItemRateCardPriceAmountRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2264
+ export const simulateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2265
+ export const simulateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2266
+ export const simulateInvoiceBodyLinesItemRateCardPriceTiersItemUpToAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2267
+ export const simulateInvoiceBodyLinesItemRateCardPriceTiersItemFlatPriceAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2268
+ export const simulateInvoiceBodyLinesItemRateCardPriceTiersItemUnitPriceAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2269
+ export const simulateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2270
+ export const simulateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2271
+ export const simulateInvoiceBodyLinesItemRateCardPriceMultiplierRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2272
+ export const simulateInvoiceBodyLinesItemRateCardPriceMultiplierDefault = '1';
2273
+ export const simulateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpFive = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2274
+ export const simulateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpFive = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2275
+ export const simulateInvoiceBodyLinesItemRateCardPriceAmountRegExpFive = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2276
+ export const simulateInvoiceBodyLinesItemRateCardPriceQuantityPerPackageRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2277
+ export const simulateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpSeven = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2278
+ export const simulateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpSeven = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2279
+ export const simulateInvoiceBodyLinesItemRateCardDiscountsPercentageCorrelationIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
2280
+ export const simulateInvoiceBodyLinesItemRateCardDiscountsUsageQuantityRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2281
+ export const simulateInvoiceBodyLinesItemRateCardDiscountsUsageCorrelationIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
2282
+ export const simulateInvoiceBodyLinesItemQuantityRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2283
+ export const simulateInvoiceBodyLinesItemPreLinePeriodQuantityRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2284
+ export const simulateInvoiceBodyLinesItemIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
2285
+ export const simulateInvoiceBody = zod
2519
2286
  .object({
2520
- asOf: zod
2521
- .date()
2522
- .optional()
2523
- .describe('The time as of which the invoice is created.\n\nIf not provided, the current time is used.'),
2524
- customerId: zod
2287
+ currency: zod
2525
2288
  .string()
2526
- .regex(invoicePendingLinesActionBodyCustomerIdRegExp)
2527
- .describe('The customer ID for which to create the invoice.'),
2528
- filters: zod
2529
- .object({
2530
- lineIds: zod
2531
- .array(zod
2532
- .string()
2533
- .regex(invoicePendingLinesActionBodyFiltersLineIdsItemRegExp)
2534
- .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'))
2535
- .optional()
2536
- .describe('The pending line items to include in the invoice, if not provided:\n- all line items that have invoice_at < asOf will be included\n- [progressive billing only] all usage based line items will be included up to asOf, new\nusage-based line items will be staged for the rest of the billing cycle\n\nAll lineIDs present in the list, must exists and must be invoicable as of asOf, or the action will fail.'),
2537
- })
2538
- .describe('InvoicePendingLinesActionFiltersInput specifies which lines to include in the invoice.')
2539
- .optional()
2540
- .describe('Filters to apply when creating the invoice.'),
2541
- })
2542
- .describe('BillingInvoiceActionInput is the input for creating an invoice.\n\nInvoice creation is always based on already pending line items created by the billingCreateLineByCustomer\noperation. Empty invoices are not allowed.');
2543
- /**
2544
- * Create a new pending line item (charge).
2545
-
2546
- This call is used to create a new pending line item for the customer if required a new
2547
- gathering invoice will be created.
2548
-
2549
- A new invoice will be created if:
2550
- - there is no invoice in gathering state
2551
- - the currency of the line item doesn't match the currency of any invoices in gathering state
2552
- * @summary Create pending line items
2553
- */
2554
- export const createPendingInvoiceLineBodyNameMax = 256;
2555
- export const createPendingInvoiceLineBodyDescriptionMax = 1024;
2556
- export const createPendingInvoiceLineBodyCurrencyMinOne = 3;
2557
- export const createPendingInvoiceLineBodyCurrencyMaxOne = 3;
2558
- export const createPendingInvoiceLineBodyCurrencyRegExpOne = new RegExp('^[A-Z]{3}$');
2559
- export const createPendingInvoiceLineBodyTaxConfigStripeCodeRegExp = new RegExp('^txcd_\\d{8}$');
2560
- export const createPendingInvoiceLineBodyPriceAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2561
- export const createPendingInvoiceLineBodyPricePaymentTermDefault = 'in_advance';
2562
- export const createPendingInvoiceLineBodyPriceAmountRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2563
- export const createPendingInvoiceLineBodyPriceMinimumAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2564
- export const createPendingInvoiceLineBodyPriceMaximumAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2565
- export const createPendingInvoiceLineBodyPriceTiersItemUpToAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2566
- export const createPendingInvoiceLineBodyPriceTiersItemFlatPriceAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2567
- export const createPendingInvoiceLineBodyPriceTiersItemUnitPriceAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2568
- export const createPendingInvoiceLineBodyPriceMinimumAmountRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2569
- export const createPendingInvoiceLineBodyPriceMaximumAmountRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2570
- export const createPendingInvoiceLineBodyPriceMultiplierRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2571
- export const createPendingInvoiceLineBodyPriceMultiplierDefault = '1';
2572
- export const createPendingInvoiceLineBodyPriceMinimumAmountRegExpFive = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2573
- export const createPendingInvoiceLineBodyPriceMaximumAmountRegExpFive = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2574
- export const createPendingInvoiceLineBodyPriceAmountRegExpFive = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2575
- export const createPendingInvoiceLineBodyPriceQuantityPerPackageRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2576
- export const createPendingInvoiceLineBodyPriceMinimumAmountRegExpSeven = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2577
- export const createPendingInvoiceLineBodyPriceMaximumAmountRegExpSeven = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2578
- export const createPendingInvoiceLineBodyFeatureKeyMax = 64;
2579
- export const createPendingInvoiceLineBodyFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
2580
- export const createPendingInvoiceLineBodyRateCardFeatureKeyMax = 64;
2581
- export const createPendingInvoiceLineBodyRateCardFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
2582
- export const createPendingInvoiceLineBodyRateCardTaxConfigStripeCodeRegExp = new RegExp('^txcd_\\d{8}$');
2583
- export const createPendingInvoiceLineBodyRateCardPriceAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2584
- export const createPendingInvoiceLineBodyRateCardPricePaymentTermDefault = 'in_advance';
2585
- export const createPendingInvoiceLineBodyRateCardPriceAmountRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2586
- export const createPendingInvoiceLineBodyRateCardPriceMinimumAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2587
- export const createPendingInvoiceLineBodyRateCardPriceMaximumAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2588
- export const createPendingInvoiceLineBodyRateCardPriceTiersItemUpToAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2589
- export const createPendingInvoiceLineBodyRateCardPriceTiersItemFlatPriceAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2590
- export const createPendingInvoiceLineBodyRateCardPriceTiersItemUnitPriceAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2591
- export const createPendingInvoiceLineBodyRateCardPriceMinimumAmountRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2592
- export const createPendingInvoiceLineBodyRateCardPriceMaximumAmountRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2593
- export const createPendingInvoiceLineBodyRateCardPriceMultiplierRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2594
- export const createPendingInvoiceLineBodyRateCardPriceMultiplierDefault = '1';
2595
- export const createPendingInvoiceLineBodyRateCardPriceMinimumAmountRegExpFive = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2596
- export const createPendingInvoiceLineBodyRateCardPriceMaximumAmountRegExpFive = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2597
- export const createPendingInvoiceLineBodyRateCardPriceAmountRegExpFive = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2598
- export const createPendingInvoiceLineBodyRateCardPriceQuantityPerPackageRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2599
- export const createPendingInvoiceLineBodyRateCardPriceMinimumAmountRegExpSeven = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2600
- export const createPendingInvoiceLineBodyRateCardPriceMaximumAmountRegExpSeven = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2601
- export const createPendingInvoiceLineBodyRateCardDiscountsPercentageCorrelationIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
2602
- export const createPendingInvoiceLineBodyRateCardDiscountsUsageQuantityRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2603
- export const createPendingInvoiceLineBodyRateCardDiscountsUsageCorrelationIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
2604
- export const createPendingInvoiceLineBodyCustomerIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
2605
- export const createPendingInvoiceLineBodyNameMaxOne = 256;
2606
- export const createPendingInvoiceLineBodyDescriptionMaxOne = 1024;
2607
- export const createPendingInvoiceLineBodyCurrencyMinThree = 3;
2608
- export const createPendingInvoiceLineBodyCurrencyMaxThree = 3;
2609
- export const createPendingInvoiceLineBodyCurrencyRegExpThree = new RegExp('^[A-Z]{3}$');
2610
- export const createPendingInvoiceLineBodyTaxConfigStripeCodeRegExpOne = new RegExp('^txcd_\\d{8}$');
2611
- export const createPendingInvoiceLineBodyPerUnitAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2612
- export const createPendingInvoiceLineBodyPaymentTermDefault = 'in_advance';
2613
- export const createPendingInvoiceLineBodyQuantityRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2614
- export const createPendingInvoiceLineBodyRateCardTaxConfigStripeCodeRegExpOne = new RegExp('^txcd_\\d{8}$');
2615
- export const createPendingInvoiceLineBodyRateCardPriceAmountRegExpSeven = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2616
- export const createPendingInvoiceLineBodyRateCardPricePaymentTermDefaultTwo = 'in_advance';
2617
- export const createPendingInvoiceLineBodyRateCardQuantityRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2618
- export const createPendingInvoiceLineBodyRateCardDiscountsPercentageCorrelationIdRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
2619
- export const createPendingInvoiceLineBodyRateCardDiscountsUsageQuantityRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2620
- export const createPendingInvoiceLineBodyRateCardDiscountsUsageCorrelationIdRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
2621
- export const createPendingInvoiceLineBodyCategoryDefault = 'regular';
2622
- export const createPendingInvoiceLineBodyCustomerIdRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
2623
- export const createPendingInvoiceLineBodyItem = zod
2624
- .discriminatedUnion('type', [
2625
- zod
2289
+ .min(simulateInvoiceBodyCurrencyMinOne)
2290
+ .max(simulateInvoiceBodyCurrencyMaxOne)
2291
+ .regex(simulateInvoiceBodyCurrencyRegExpOne)
2292
+ .describe('Three-letter [ISO4217](https://www.iso.org/iso-4217-currency-codes.html) currency code.\nCustom three-letter currency codes are also supported for convenience.')
2293
+ .describe('Currency for all invoice line items.\n\nMulti currency invoices are not supported yet.'),
2294
+ lines: zod
2295
+ .array(zod
2626
2296
  .object({
2627
- currency: zod
2628
- .string()
2629
- .min(createPendingInvoiceLineBodyCurrencyMinOne)
2630
- .max(createPendingInvoiceLineBodyCurrencyMaxOne)
2631
- .regex(createPendingInvoiceLineBodyCurrencyRegExpOne)
2632
- .describe('Three-letter [ISO4217](https://www.iso.org/iso-4217-currency-codes.html) currency code.\nCustom three-letter currency codes are also supported for convenience.')
2633
- .describe('The currency of this line.'),
2634
- customerId: zod
2635
- .string()
2636
- .regex(createPendingInvoiceLineBodyCustomerIdRegExp)
2637
- .describe('The customer this line item belongs to.'),
2638
2297
  description: zod
2639
2298
  .string()
2640
- .max(createPendingInvoiceLineBodyDescriptionMax)
2299
+ .max(simulateInvoiceBodyLinesItemDescriptionMax)
2641
2300
  .optional()
2642
2301
  .describe('Optional description of the resource. Maximum 1024 characters.'),
2643
2302
  featureKey: zod
2644
2303
  .string()
2645
2304
  .min(1)
2646
- .max(createPendingInvoiceLineBodyFeatureKeyMax)
2647
- .regex(createPendingInvoiceLineBodyFeatureKeyRegExp)
2305
+ .max(simulateInvoiceBodyLinesItemFeatureKeyMax)
2306
+ .regex(simulateInvoiceBodyLinesItemFeatureKeyRegExp)
2648
2307
  .optional()
2649
2308
  .describe('The feature that the usage is based on.'),
2309
+ id: zod
2310
+ .string()
2311
+ .regex(simulateInvoiceBodyLinesItemIdRegExp)
2312
+ .optional()
2313
+ .describe('ID of the line. If not specified it will be auto-generated.\n\nWhen discounts are specified, this must be provided, so that the discount can reference it.'),
2650
2314
  invoiceAt: zod
2651
2315
  .date()
2652
2316
  .describe('The time this line item should be invoiced.'),
@@ -2658,7 +2322,7 @@ export const createPendingInvoiceLineBodyItem = zod
2658
2322
  name: zod
2659
2323
  .string()
2660
2324
  .min(1)
2661
- .max(createPendingInvoiceLineBodyNameMax)
2325
+ .max(simulateInvoiceBodyLinesItemNameMax)
2662
2326
  .describe('Human-readable name for the resource. Between 1 and 256 characters.'),
2663
2327
  period: zod
2664
2328
  .object({
@@ -2667,19 +2331,25 @@ export const createPendingInvoiceLineBodyItem = zod
2667
2331
  })
2668
2332
  .describe('A period with a start and end time.')
2669
2333
  .describe('Period of the line item applies to for revenue recognition pruposes.\n\nBilling always treats periods as start being inclusive and end being exclusive.'),
2334
+ preLinePeriodQuantity: zod
2335
+ .string()
2336
+ .regex(simulateInvoiceBodyLinesItemPreLinePeriodQuantityRegExpOne)
2337
+ .describe('Numeric represents an arbitrary precision number.')
2338
+ .optional()
2339
+ .describe("The quantity of the item used before this line's period, if the line is billed progressively."),
2670
2340
  price: zod
2671
2341
  .discriminatedUnion('type', [
2672
2342
  zod
2673
2343
  .object({
2674
2344
  amount: zod
2675
2345
  .string()
2676
- .regex(createPendingInvoiceLineBodyPriceAmountRegExpOne)
2346
+ .regex(simulateInvoiceBodyLinesItemPriceAmountRegExpOne)
2677
2347
  .describe('Numeric represents an arbitrary precision number.')
2678
2348
  .describe('The amount of the flat price.'),
2679
2349
  paymentTerm: zod
2680
2350
  .enum(['in_advance', 'in_arrears'])
2681
2351
  .describe('The payment term of a flat price.\nOne of: in_advance or in_arrears.')
2682
- .default(createPendingInvoiceLineBodyPricePaymentTermDefault)
2352
+ .default(simulateInvoiceBodyLinesItemPricePaymentTermDefault)
2683
2353
  .describe('The payment term of the flat price.\nDefaults to in advance.'),
2684
2354
  type: zod.enum(['flat']),
2685
2355
  })
@@ -2688,18 +2358,18 @@ export const createPendingInvoiceLineBodyItem = zod
2688
2358
  .object({
2689
2359
  amount: zod
2690
2360
  .string()
2691
- .regex(createPendingInvoiceLineBodyPriceAmountRegExpThree)
2361
+ .regex(simulateInvoiceBodyLinesItemPriceAmountRegExpThree)
2692
2362
  .describe('Numeric represents an arbitrary precision number.')
2693
2363
  .describe('The amount of the unit price.'),
2694
2364
  maximumAmount: zod
2695
2365
  .string()
2696
- .regex(createPendingInvoiceLineBodyPriceMaximumAmountRegExpOne)
2366
+ .regex(simulateInvoiceBodyLinesItemPriceMaximumAmountRegExpOne)
2697
2367
  .describe('Numeric represents an arbitrary precision number.')
2698
2368
  .optional()
2699
2369
  .describe('The customer is limited to spend at most the amount.'),
2700
2370
  minimumAmount: zod
2701
2371
  .string()
2702
- .regex(createPendingInvoiceLineBodyPriceMinimumAmountRegExpOne)
2372
+ .regex(simulateInvoiceBodyLinesItemPriceMinimumAmountRegExpOne)
2703
2373
  .describe('Numeric represents an arbitrary precision number.')
2704
2374
  .optional()
2705
2375
  .describe('The customer is committed to spend at least the amount.'),
@@ -2710,13 +2380,13 @@ export const createPendingInvoiceLineBodyItem = zod
2710
2380
  .object({
2711
2381
  maximumAmount: zod
2712
2382
  .string()
2713
- .regex(createPendingInvoiceLineBodyPriceMaximumAmountRegExpThree)
2383
+ .regex(simulateInvoiceBodyLinesItemPriceMaximumAmountRegExpThree)
2714
2384
  .describe('Numeric represents an arbitrary precision number.')
2715
2385
  .optional()
2716
2386
  .describe('The customer is limited to spend at most the amount.'),
2717
2387
  minimumAmount: zod
2718
2388
  .string()
2719
- .regex(createPendingInvoiceLineBodyPriceMinimumAmountRegExpThree)
2389
+ .regex(simulateInvoiceBodyLinesItemPriceMinimumAmountRegExpThree)
2720
2390
  .describe('Numeric represents an arbitrary precision number.')
2721
2391
  .optional()
2722
2392
  .describe('The customer is committed to spend at least the amount.'),
@@ -2731,7 +2401,7 @@ export const createPendingInvoiceLineBodyItem = zod
2731
2401
  .object({
2732
2402
  amount: zod
2733
2403
  .string()
2734
- .regex(createPendingInvoiceLineBodyPriceTiersItemFlatPriceAmountRegExpOne)
2404
+ .regex(simulateInvoiceBodyLinesItemPriceTiersItemFlatPriceAmountRegExpOne)
2735
2405
  .describe('Numeric represents an arbitrary precision number.')
2736
2406
  .describe('The amount of the flat price.'),
2737
2407
  type: zod
@@ -2745,7 +2415,7 @@ export const createPendingInvoiceLineBodyItem = zod
2745
2415
  .object({
2746
2416
  amount: zod
2747
2417
  .string()
2748
- .regex(createPendingInvoiceLineBodyPriceTiersItemUnitPriceAmountRegExpOne)
2418
+ .regex(simulateInvoiceBodyLinesItemPriceTiersItemUnitPriceAmountRegExpOne)
2749
2419
  .describe('Numeric represents an arbitrary precision number.')
2750
2420
  .describe('The amount of the unit price.'),
2751
2421
  type: zod
@@ -2757,7 +2427,7 @@ export const createPendingInvoiceLineBodyItem = zod
2757
2427
  .describe('The unit price component of the tier.'),
2758
2428
  upToAmount: zod
2759
2429
  .string()
2760
- .regex(createPendingInvoiceLineBodyPriceTiersItemUpToAmountRegExpOne)
2430
+ .regex(simulateInvoiceBodyLinesItemPriceTiersItemUpToAmountRegExpOne)
2761
2431
  .describe('Numeric represents an arbitrary precision number.')
2762
2432
  .optional()
2763
2433
  .describe('Up to and including to this quantity will be contained in the tier.\nIf null, the tier is open-ended.'),
@@ -2772,21 +2442,21 @@ export const createPendingInvoiceLineBodyItem = zod
2772
2442
  .object({
2773
2443
  maximumAmount: zod
2774
2444
  .string()
2775
- .regex(createPendingInvoiceLineBodyPriceMaximumAmountRegExpFive)
2445
+ .regex(simulateInvoiceBodyLinesItemPriceMaximumAmountRegExpFive)
2776
2446
  .describe('Numeric represents an arbitrary precision number.')
2777
2447
  .optional()
2778
2448
  .describe('The customer is limited to spend at most the amount.'),
2779
2449
  minimumAmount: zod
2780
2450
  .string()
2781
- .regex(createPendingInvoiceLineBodyPriceMinimumAmountRegExpFive)
2451
+ .regex(simulateInvoiceBodyLinesItemPriceMinimumAmountRegExpFive)
2782
2452
  .describe('Numeric represents an arbitrary precision number.')
2783
2453
  .optional()
2784
2454
  .describe('The customer is committed to spend at least the amount.'),
2785
2455
  multiplier: zod
2786
2456
  .string()
2787
- .regex(createPendingInvoiceLineBodyPriceMultiplierRegExpOne)
2457
+ .regex(simulateInvoiceBodyLinesItemPriceMultiplierRegExpOne)
2788
2458
  .describe('Numeric represents an arbitrary precision number.')
2789
- .default(createPendingInvoiceLineBodyPriceMultiplierDefault)
2459
+ .default(simulateInvoiceBodyLinesItemPriceMultiplierDefault)
2790
2460
  .describe('The multiplier to apply to the base price to get the dynamic price.\n\nExamples:\n- 0.0: the price is zero\n- 0.5: the price is 50% of the base price\n- 1.0: the price is the same as the base price\n- 1.5: the price is 150% of the base price'),
2791
2461
  type: zod.enum(['dynamic']),
2792
2462
  })
@@ -2795,24 +2465,24 @@ export const createPendingInvoiceLineBodyItem = zod
2795
2465
  .object({
2796
2466
  amount: zod
2797
2467
  .string()
2798
- .regex(createPendingInvoiceLineBodyPriceAmountRegExpFive)
2468
+ .regex(simulateInvoiceBodyLinesItemPriceAmountRegExpFive)
2799
2469
  .describe('Numeric represents an arbitrary precision number.')
2800
2470
  .describe('The price of one package.'),
2801
2471
  maximumAmount: zod
2802
2472
  .string()
2803
- .regex(createPendingInvoiceLineBodyPriceMaximumAmountRegExpSeven)
2473
+ .regex(simulateInvoiceBodyLinesItemPriceMaximumAmountRegExpSeven)
2804
2474
  .describe('Numeric represents an arbitrary precision number.')
2805
2475
  .optional()
2806
2476
  .describe('The customer is limited to spend at most the amount.'),
2807
2477
  minimumAmount: zod
2808
2478
  .string()
2809
- .regex(createPendingInvoiceLineBodyPriceMinimumAmountRegExpSeven)
2479
+ .regex(simulateInvoiceBodyLinesItemPriceMinimumAmountRegExpSeven)
2810
2480
  .describe('Numeric represents an arbitrary precision number.')
2811
2481
  .optional()
2812
2482
  .describe('The customer is committed to spend at least the amount.'),
2813
2483
  quantityPerPackage: zod
2814
2484
  .string()
2815
- .regex(createPendingInvoiceLineBodyPriceQuantityPerPackageRegExpOne)
2485
+ .regex(simulateInvoiceBodyLinesItemPriceQuantityPerPackageRegExpOne)
2816
2486
  .describe('Numeric represents an arbitrary precision number.')
2817
2487
  .describe('The quantity per package.'),
2818
2488
  type: zod.enum(['package']),
@@ -2822,6 +2492,11 @@ export const createPendingInvoiceLineBodyItem = zod
2822
2492
  .describe('The price of the usage based rate card.')
2823
2493
  .optional()
2824
2494
  .describe('Price of the usage-based item being sold.'),
2495
+ quantity: zod
2496
+ .string()
2497
+ .regex(simulateInvoiceBodyLinesItemQuantityRegExpOne)
2498
+ .describe('Numeric represents an arbitrary precision number.')
2499
+ .describe('The quantity of the item being sold.'),
2825
2500
  rateCard: zod
2826
2501
  .object({
2827
2502
  discounts: zod
@@ -2830,7 +2505,7 @@ export const createPendingInvoiceLineBodyItem = zod
2830
2505
  .object({
2831
2506
  correlationId: zod
2832
2507
  .string()
2833
- .regex(createPendingInvoiceLineBodyRateCardDiscountsPercentageCorrelationIdRegExp)
2508
+ .regex(simulateInvoiceBodyLinesItemRateCardDiscountsPercentageCorrelationIdRegExp)
2834
2509
  .optional()
2835
2510
  .describe('Correlation ID for the discount.\n\nThis is used to link discounts across different invoices (progressive billing use case).\n\nIf not provided, the invoicing engine will auto-generate one. When editing an invoice line,\nplease make sure to keep the same correlation ID of the discount or in progressive billing\nsetups the discount amounts might be incorrect.'),
2836
2511
  percentage: zod
@@ -2845,12 +2520,12 @@ export const createPendingInvoiceLineBodyItem = zod
2845
2520
  .object({
2846
2521
  correlationId: zod
2847
2522
  .string()
2848
- .regex(createPendingInvoiceLineBodyRateCardDiscountsUsageCorrelationIdRegExp)
2523
+ .regex(simulateInvoiceBodyLinesItemRateCardDiscountsUsageCorrelationIdRegExp)
2849
2524
  .optional()
2850
2525
  .describe('Correlation ID for the discount.\n\nThis is used to link discounts across different invoices (progressive billing use case).\n\nIf not provided, the invoicing engine will auto-generate one. When editing an invoice line,\nplease make sure to keep the same correlation ID of the discount or in progressive billing\nsetups the discount amounts might be incorrect.'),
2851
2526
  quantity: zod
2852
2527
  .string()
2853
- .regex(createPendingInvoiceLineBodyRateCardDiscountsUsageQuantityRegExpOne)
2528
+ .regex(simulateInvoiceBodyLinesItemRateCardDiscountsUsageQuantityRegExpOne)
2854
2529
  .describe('Numeric represents an arbitrary precision number.')
2855
2530
  .describe('The quantity of the usage discount.\n\nMust be positive.'),
2856
2531
  })
@@ -2864,8 +2539,8 @@ export const createPendingInvoiceLineBodyItem = zod
2864
2539
  featureKey: zod
2865
2540
  .string()
2866
2541
  .min(1)
2867
- .max(createPendingInvoiceLineBodyRateCardFeatureKeyMax)
2868
- .regex(createPendingInvoiceLineBodyRateCardFeatureKeyRegExp)
2542
+ .max(simulateInvoiceBodyLinesItemRateCardFeatureKeyMax)
2543
+ .regex(simulateInvoiceBodyLinesItemRateCardFeatureKeyRegExp)
2869
2544
  .optional()
2870
2545
  .describe('The feature the customer is entitled to use.'),
2871
2546
  price: zod
@@ -2874,13 +2549,13 @@ export const createPendingInvoiceLineBodyItem = zod
2874
2549
  .object({
2875
2550
  amount: zod
2876
2551
  .string()
2877
- .regex(createPendingInvoiceLineBodyRateCardPriceAmountRegExpOne)
2552
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceAmountRegExpOne)
2878
2553
  .describe('Numeric represents an arbitrary precision number.')
2879
2554
  .describe('The amount of the flat price.'),
2880
2555
  paymentTerm: zod
2881
2556
  .enum(['in_advance', 'in_arrears'])
2882
2557
  .describe('The payment term of a flat price.\nOne of: in_advance or in_arrears.')
2883
- .default(createPendingInvoiceLineBodyRateCardPricePaymentTermDefault)
2558
+ .default(simulateInvoiceBodyLinesItemRateCardPricePaymentTermDefault)
2884
2559
  .describe('The payment term of the flat price.\nDefaults to in advance.'),
2885
2560
  type: zod.enum(['flat']),
2886
2561
  })
@@ -2889,18 +2564,18 @@ export const createPendingInvoiceLineBodyItem = zod
2889
2564
  .object({
2890
2565
  amount: zod
2891
2566
  .string()
2892
- .regex(createPendingInvoiceLineBodyRateCardPriceAmountRegExpThree)
2567
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceAmountRegExpThree)
2893
2568
  .describe('Numeric represents an arbitrary precision number.')
2894
2569
  .describe('The amount of the unit price.'),
2895
2570
  maximumAmount: zod
2896
2571
  .string()
2897
- .regex(createPendingInvoiceLineBodyRateCardPriceMaximumAmountRegExpOne)
2572
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpOne)
2898
2573
  .describe('Numeric represents an arbitrary precision number.')
2899
2574
  .optional()
2900
2575
  .describe('The customer is limited to spend at most the amount.'),
2901
2576
  minimumAmount: zod
2902
2577
  .string()
2903
- .regex(createPendingInvoiceLineBodyRateCardPriceMinimumAmountRegExpOne)
2578
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpOne)
2904
2579
  .describe('Numeric represents an arbitrary precision number.')
2905
2580
  .optional()
2906
2581
  .describe('The customer is committed to spend at least the amount.'),
@@ -2911,13 +2586,13 @@ export const createPendingInvoiceLineBodyItem = zod
2911
2586
  .object({
2912
2587
  maximumAmount: zod
2913
2588
  .string()
2914
- .regex(createPendingInvoiceLineBodyRateCardPriceMaximumAmountRegExpThree)
2589
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpThree)
2915
2590
  .describe('Numeric represents an arbitrary precision number.')
2916
2591
  .optional()
2917
2592
  .describe('The customer is limited to spend at most the amount.'),
2918
2593
  minimumAmount: zod
2919
2594
  .string()
2920
- .regex(createPendingInvoiceLineBodyRateCardPriceMinimumAmountRegExpThree)
2595
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpThree)
2921
2596
  .describe('Numeric represents an arbitrary precision number.')
2922
2597
  .optional()
2923
2598
  .describe('The customer is committed to spend at least the amount.'),
@@ -2932,7 +2607,7 @@ export const createPendingInvoiceLineBodyItem = zod
2932
2607
  .object({
2933
2608
  amount: zod
2934
2609
  .string()
2935
- .regex(createPendingInvoiceLineBodyRateCardPriceTiersItemFlatPriceAmountRegExpOne)
2610
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceTiersItemFlatPriceAmountRegExpOne)
2936
2611
  .describe('Numeric represents an arbitrary precision number.')
2937
2612
  .describe('The amount of the flat price.'),
2938
2613
  type: zod
@@ -2946,7 +2621,7 @@ export const createPendingInvoiceLineBodyItem = zod
2946
2621
  .object({
2947
2622
  amount: zod
2948
2623
  .string()
2949
- .regex(createPendingInvoiceLineBodyRateCardPriceTiersItemUnitPriceAmountRegExpOne)
2624
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceTiersItemUnitPriceAmountRegExpOne)
2950
2625
  .describe('Numeric represents an arbitrary precision number.')
2951
2626
  .describe('The amount of the unit price.'),
2952
2627
  type: zod
@@ -2958,7 +2633,7 @@ export const createPendingInvoiceLineBodyItem = zod
2958
2633
  .describe('The unit price component of the tier.'),
2959
2634
  upToAmount: zod
2960
2635
  .string()
2961
- .regex(createPendingInvoiceLineBodyRateCardPriceTiersItemUpToAmountRegExpOne)
2636
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceTiersItemUpToAmountRegExpOne)
2962
2637
  .describe('Numeric represents an arbitrary precision number.')
2963
2638
  .optional()
2964
2639
  .describe('Up to and including to this quantity will be contained in the tier.\nIf null, the tier is open-ended.'),
@@ -2973,21 +2648,21 @@ export const createPendingInvoiceLineBodyItem = zod
2973
2648
  .object({
2974
2649
  maximumAmount: zod
2975
2650
  .string()
2976
- .regex(createPendingInvoiceLineBodyRateCardPriceMaximumAmountRegExpFive)
2651
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpFive)
2977
2652
  .describe('Numeric represents an arbitrary precision number.')
2978
2653
  .optional()
2979
2654
  .describe('The customer is limited to spend at most the amount.'),
2980
2655
  minimumAmount: zod
2981
2656
  .string()
2982
- .regex(createPendingInvoiceLineBodyRateCardPriceMinimumAmountRegExpFive)
2657
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpFive)
2983
2658
  .describe('Numeric represents an arbitrary precision number.')
2984
2659
  .optional()
2985
2660
  .describe('The customer is committed to spend at least the amount.'),
2986
2661
  multiplier: zod
2987
2662
  .string()
2988
- .regex(createPendingInvoiceLineBodyRateCardPriceMultiplierRegExpOne)
2663
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceMultiplierRegExpOne)
2989
2664
  .describe('Numeric represents an arbitrary precision number.')
2990
- .default(createPendingInvoiceLineBodyRateCardPriceMultiplierDefault)
2665
+ .default(simulateInvoiceBodyLinesItemRateCardPriceMultiplierDefault)
2991
2666
  .describe('The multiplier to apply to the base price to get the dynamic price.\n\nExamples:\n- 0.0: the price is zero\n- 0.5: the price is 50% of the base price\n- 1.0: the price is the same as the base price\n- 1.5: the price is 150% of the base price'),
2992
2667
  type: zod.enum(['dynamic']),
2993
2668
  })
@@ -2996,24 +2671,24 @@ export const createPendingInvoiceLineBodyItem = zod
2996
2671
  .object({
2997
2672
  amount: zod
2998
2673
  .string()
2999
- .regex(createPendingInvoiceLineBodyRateCardPriceAmountRegExpFive)
2674
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceAmountRegExpFive)
3000
2675
  .describe('Numeric represents an arbitrary precision number.')
3001
2676
  .describe('The price of one package.'),
3002
2677
  maximumAmount: zod
3003
2678
  .string()
3004
- .regex(createPendingInvoiceLineBodyRateCardPriceMaximumAmountRegExpSeven)
2679
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpSeven)
3005
2680
  .describe('Numeric represents an arbitrary precision number.')
3006
2681
  .optional()
3007
2682
  .describe('The customer is limited to spend at most the amount.'),
3008
2683
  minimumAmount: zod
3009
2684
  .string()
3010
- .regex(createPendingInvoiceLineBodyRateCardPriceMinimumAmountRegExpSeven)
2685
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpSeven)
3011
2686
  .describe('Numeric represents an arbitrary precision number.')
3012
2687
  .optional()
3013
2688
  .describe('The customer is committed to spend at least the amount.'),
3014
2689
  quantityPerPackage: zod
3015
2690
  .string()
3016
- .regex(createPendingInvoiceLineBodyRateCardPriceQuantityPerPackageRegExpOne)
2691
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceQuantityPerPackageRegExpOne)
3017
2692
  .describe('Numeric represents an arbitrary precision number.')
3018
2693
  .describe('The quantity per package.'),
3019
2694
  type: zod.enum(['package']),
@@ -3043,7 +2718,7 @@ export const createPendingInvoiceLineBodyItem = zod
3043
2718
  .object({
3044
2719
  code: zod
3045
2720
  .string()
3046
- .regex(createPendingInvoiceLineBodyRateCardTaxConfigStripeCodeRegExp)
2721
+ .regex(simulateInvoiceBodyLinesItemRateCardTaxConfigStripeCodeRegExp)
3047
2722
  .describe('Product tax code.\n\nSee: https://docs.stripe.com/tax/tax-codes'),
3048
2723
  })
3049
2724
  .describe('The tax config for Stripe.')
@@ -3077,7 +2752,7 @@ export const createPendingInvoiceLineBodyItem = zod
3077
2752
  .object({
3078
2753
  code: zod
3079
2754
  .string()
3080
- .regex(createPendingInvoiceLineBodyTaxConfigStripeCodeRegExp)
2755
+ .regex(simulateInvoiceBodyLinesItemTaxConfigStripeCodeRegExp)
3081
2756
  .describe('Product tax code.\n\nSee: https://docs.stripe.com/tax/tax-codes'),
3082
2757
  })
3083
2758
  .describe('The tax config for Stripe.')
@@ -3087,203 +2762,161 @@ export const createPendingInvoiceLineBodyItem = zod
3087
2762
  .describe('Set of provider specific tax configs.')
3088
2763
  .optional()
3089
2764
  .describe('Tax config specify the tax configuration for this line.'),
3090
- type: zod.enum(['usage_based']),
3091
2765
  })
3092
- .describe('InvoiceUsageBasedLineCreateWithCustomer represents the create model for an invoice line that is sold to the customer based on usage.'),
3093
- zod
3094
- .object({
3095
- category: zod
3096
- .enum(['regular', 'commitment'])
3097
- .describe('InvoiceFlatFeeCategory determines if the flat fee is a regular fee due to use due to a\ncommitment.')
3098
- .default(createPendingInvoiceLineBodyCategoryDefault)
3099
- .describe('Category of the flat fee.'),
3100
- currency: zod
3101
- .string()
3102
- .min(createPendingInvoiceLineBodyCurrencyMinThree)
3103
- .max(createPendingInvoiceLineBodyCurrencyMaxThree)
3104
- .regex(createPendingInvoiceLineBodyCurrencyRegExpThree)
3105
- .describe('Three-letter [ISO4217](https://www.iso.org/iso-4217-currency-codes.html) currency code.\nCustom three-letter currency codes are also supported for convenience.')
3106
- .describe('The currency of this line.'),
3107
- customerId: zod
3108
- .string()
3109
- .regex(createPendingInvoiceLineBodyCustomerIdRegExpOne)
3110
- .describe('The customer this line item belongs to.'),
3111
- description: zod
3112
- .string()
3113
- .max(createPendingInvoiceLineBodyDescriptionMaxOne)
3114
- .optional()
3115
- .describe('Optional description of the resource. Maximum 1024 characters.'),
3116
- invoiceAt: zod
3117
- .date()
3118
- .describe('The time this line item should be invoiced.'),
3119
- metadata: zod
3120
- .record(zod.string(), zod.string())
3121
- .describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
3122
- .nullish()
3123
- .describe('Additional metadata for the resource.'),
3124
- name: zod
3125
- .string()
3126
- .min(1)
3127
- .max(createPendingInvoiceLineBodyNameMaxOne)
3128
- .describe('Human-readable name for the resource. Between 1 and 256 characters.'),
3129
- paymentTerm: zod
3130
- .enum(['in_advance', 'in_arrears'])
3131
- .describe('The payment term of a flat price.\nOne of: in_advance or in_arrears.')
3132
- .default(createPendingInvoiceLineBodyPaymentTermDefault)
3133
- .describe('Payment term of the line.'),
3134
- period: zod
3135
- .object({
3136
- from: zod.date().describe('Period start time.'),
3137
- to: zod.date().describe('Period end time.'),
3138
- })
3139
- .describe('A period with a start and end time.')
3140
- .describe('Period of the line item applies to for revenue recognition pruposes.\n\nBilling always treats periods as start being inclusive and end being exclusive.'),
3141
- perUnitAmount: zod
3142
- .string()
3143
- .regex(createPendingInvoiceLineBodyPerUnitAmountRegExpOne)
3144
- .describe('Numeric represents an arbitrary precision number.')
3145
- .optional()
3146
- .describe('Price of the item being sold.'),
3147
- quantity: zod
3148
- .string()
3149
- .regex(createPendingInvoiceLineBodyQuantityRegExpOne)
3150
- .describe('Numeric represents an arbitrary precision number.')
3151
- .optional()
3152
- .describe('Quantity of the item being sold.'),
3153
- rateCard: zod
3154
- .object({
3155
- discounts: zod
3156
- .object({
3157
- percentage: zod
3158
- .object({
3159
- correlationId: zod
3160
- .string()
3161
- .regex(createPendingInvoiceLineBodyRateCardDiscountsPercentageCorrelationIdRegExpOne)
3162
- .optional()
3163
- .describe('Correlation ID for the discount.\n\nThis is used to link discounts across different invoices (progressive billing use case).\n\nIf not provided, the invoicing engine will auto-generate one. When editing an invoice line,\nplease make sure to keep the same correlation ID of the discount or in progressive billing\nsetups the discount amounts might be incorrect.'),
3164
- percentage: zod
3165
- .number()
3166
- .describe('Numeric representation of a percentage\n\n50% is represented as 50')
3167
- .describe('The percentage of the discount.'),
3168
- })
3169
- .describe('A percentage discount.')
3170
- .optional()
3171
- .describe('The percentage discount.'),
3172
- usage: zod
3173
- .object({
3174
- correlationId: zod
3175
- .string()
3176
- .regex(createPendingInvoiceLineBodyRateCardDiscountsUsageCorrelationIdRegExpOne)
3177
- .optional()
3178
- .describe('Correlation ID for the discount.\n\nThis is used to link discounts across different invoices (progressive billing use case).\n\nIf not provided, the invoicing engine will auto-generate one. When editing an invoice line,\nplease make sure to keep the same correlation ID of the discount or in progressive billing\nsetups the discount amounts might be incorrect.'),
3179
- quantity: zod
3180
- .string()
3181
- .regex(createPendingInvoiceLineBodyRateCardDiscountsUsageQuantityRegExpThree)
3182
- .describe('Numeric represents an arbitrary precision number.')
3183
- .describe('The quantity of the usage discount.\n\nMust be positive.'),
3184
- })
3185
- .describe('A usage discount.')
3186
- .optional()
3187
- .describe('The usage discount.'),
3188
- })
3189
- .describe('A discount by type.')
3190
- .optional()
3191
- .describe('The discounts that are applied to the line.'),
3192
- price: zod
3193
- .object({
3194
- amount: zod
3195
- .string()
3196
- .regex(createPendingInvoiceLineBodyRateCardPriceAmountRegExpSeven)
3197
- .describe('Numeric represents an arbitrary precision number.')
3198
- .describe('The amount of the flat price.'),
3199
- paymentTerm: zod
3200
- .enum(['in_advance', 'in_arrears'])
3201
- .describe('The payment term of a flat price.\nOne of: in_advance or in_arrears.')
3202
- .default(createPendingInvoiceLineBodyRateCardPricePaymentTermDefaultTwo)
3203
- .describe('The payment term of the flat price.\nDefaults to in advance.'),
3204
- type: zod.enum(['flat']),
3205
- })
3206
- .describe('Flat price with payment term.')
3207
- .nullable()
3208
- .describe('The price of the rate card.\nWhen null, the feature or service is free.'),
3209
- quantity: zod
3210
- .string()
3211
- .regex(createPendingInvoiceLineBodyRateCardQuantityRegExpOne)
3212
- .describe('Numeric represents an arbitrary precision number.')
3213
- .optional()
3214
- .describe('Quantity of the item being sold.\n\nDefault: 1'),
3215
- taxConfig: zod
3216
- .object({
3217
- behavior: zod
3218
- .enum(['inclusive', 'exclusive'])
3219
- .describe('Tax behavior.\n\nThis enum is used to specify whether tax is included in the price or excluded from the price.')
3220
- .optional()
3221
- .describe("Tax behavior.\n\nIf not specified the billing profile is used to determine the tax behavior.\nIf not specified in the billing profile, the provider's default behavior is used."),
3222
- customInvoicing: zod
3223
- .object({
3224
- code: zod
3225
- .string()
3226
- .describe('Tax code.\n\nThe tax code should be interpreted by the custom invoicing provider.'),
3227
- })
3228
- .describe('Custom invoicing tax config.')
3229
- .optional()
3230
- .describe('Custom invoicing tax config.'),
3231
- stripe: zod
3232
- .object({
3233
- code: zod
3234
- .string()
3235
- .regex(createPendingInvoiceLineBodyRateCardTaxConfigStripeCodeRegExpOne)
3236
- .describe('Product tax code.\n\nSee: https://docs.stripe.com/tax/tax-codes'),
3237
- })
3238
- .describe('The tax config for Stripe.')
3239
- .optional()
3240
- .describe('Stripe tax config.'),
3241
- })
3242
- .describe('Set of provider specific tax configs.')
3243
- .optional()
3244
- .describe('The tax config of the rate card.\nWhen undefined, the tax config of the feature or the default tax config of the plan is used.'),
3245
- })
3246
- .describe('InvoiceFlatFeeRateCard represents the rate card (intent) for a flat fee line.')
3247
- .optional()
3248
- .describe('The rate card that is used for this line.'),
3249
- taxConfig: zod
3250
- .object({
3251
- behavior: zod
3252
- .enum(['inclusive', 'exclusive'])
3253
- .describe('Tax behavior.\n\nThis enum is used to specify whether tax is included in the price or excluded from the price.')
3254
- .optional()
3255
- .describe("Tax behavior.\n\nIf not specified the billing profile is used to determine the tax behavior.\nIf not specified in the billing profile, the provider's default behavior is used."),
3256
- customInvoicing: zod
3257
- .object({
3258
- code: zod
3259
- .string()
3260
- .describe('Tax code.\n\nThe tax code should be interpreted by the custom invoicing provider.'),
3261
- })
3262
- .describe('Custom invoicing tax config.')
3263
- .optional()
3264
- .describe('Custom invoicing tax config.'),
3265
- stripe: zod
3266
- .object({
3267
- code: zod
3268
- .string()
3269
- .regex(createPendingInvoiceLineBodyTaxConfigStripeCodeRegExpOne)
3270
- .describe('Product tax code.\n\nSee: https://docs.stripe.com/tax/tax-codes'),
3271
- })
3272
- .describe('The tax config for Stripe.')
3273
- .optional()
3274
- .describe('Stripe tax config.'),
3275
- })
3276
- .describe('Set of provider specific tax configs.')
2766
+ .describe('InvoiceSimulationLine represents a usage-based line item that can be input to the simulation endpoint.'))
2767
+ .describe('Lines to be included in the generated invoice.'),
2768
+ number: zod
2769
+ .string()
2770
+ .min(1)
2771
+ .max(simulateInvoiceBodyNumberMaxOne)
2772
+ .describe('InvoiceNumber is a unique identifier for the invoice, generated by the\ninvoicing app.\n\nThe uniqueness depends on a lot of factors:\n- app setting (unique per app or unique per customer)\n- multiple app scenarios (multiple apps generating invoices with the same prefix)')
2773
+ .optional()
2774
+ .describe('The number of the invoice.'),
2775
+ })
2776
+ .describe('InvoiceSimulationInput is the input for simulating an invoice.');
2777
+ /**
2778
+ * List invoices based on the specified filters.
2779
+
2780
+ The expand option can be used to include additional information (besides the invoice header and totals)
2781
+ in the response. For example by adding the expand=lines option the invoice lines will be included in the response.
2782
+
2783
+ Gathering invoices will always show the current usage calculated on the fly.
2784
+ * @summary List invoices
2785
+ */
2786
+ export const listInvoicesQueryCustomersItemRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
2787
+ export const listInvoicesQueryPageDefault = 1;
2788
+ export const listInvoicesQueryPageSizeDefault = 100;
2789
+ export const listInvoicesQueryPageSizeMax = 1000;
2790
+ export const listInvoicesQueryParams = zod.object({
2791
+ createdAfter: zod
2792
+ .date()
2793
+ .optional()
2794
+ .describe('Filter by invoice created time.\nInclusive.'),
2795
+ createdBefore: zod
2796
+ .date()
2797
+ .optional()
2798
+ .describe('Filter by invoice created time.\nInclusive.'),
2799
+ customers: zod
2800
+ .array(zod
2801
+ .string()
2802
+ .regex(listInvoicesQueryCustomersItemRegExp)
2803
+ .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'))
2804
+ .optional()
2805
+ .describe('Filter by customer ID'),
2806
+ expand: zod
2807
+ .array(zod
2808
+ .enum(['lines', 'preceding', 'workflow.apps'])
2809
+ .describe('InvoiceExpand specifies the parts of the invoice to expand in the list output.'))
2810
+ .optional()
2811
+ .describe('What parts of the list output to expand in listings'),
2812
+ extendedStatuses: zod
2813
+ .array(zod.string())
2814
+ .optional()
2815
+ .describe('Filter by invoice extended statuses'),
2816
+ includeDeleted: zod.boolean().optional().describe('Include deleted invoices'),
2817
+ issuedAfter: zod
2818
+ .date()
2819
+ .optional()
2820
+ .describe('Filter by invoice issued time.\nInclusive.'),
2821
+ issuedBefore: zod
2822
+ .date()
2823
+ .optional()
2824
+ .describe('Filter by invoice issued time.\nInclusive.'),
2825
+ order: zod.enum(['ASC', 'DESC']).optional().describe('The order direction.'),
2826
+ orderBy: zod
2827
+ .enum([
2828
+ 'customer.name',
2829
+ 'issuedAt',
2830
+ 'status',
2831
+ 'createdAt',
2832
+ 'updatedAt',
2833
+ 'periodStart',
2834
+ ])
2835
+ .optional()
2836
+ .describe('The order by field.'),
2837
+ page: zod
2838
+ .number()
2839
+ .min(1)
2840
+ .default(listInvoicesQueryPageDefault)
2841
+ .describe('Page index.\n\nDefault is 1.'),
2842
+ pageSize: zod
2843
+ .number()
2844
+ .min(1)
2845
+ .max(listInvoicesQueryPageSizeMax)
2846
+ .default(listInvoicesQueryPageSizeDefault)
2847
+ .describe('The maximum number of items per page.\n\nDefault is 100.'),
2848
+ periodStartAfter: zod
2849
+ .date()
2850
+ .optional()
2851
+ .describe('Filter by period start time.\nInclusive.'),
2852
+ periodStartBefore: zod
2853
+ .date()
2854
+ .optional()
2855
+ .describe('Filter by period start time.\nInclusive.'),
2856
+ statuses: zod
2857
+ .array(zod
2858
+ .enum([
2859
+ 'gathering',
2860
+ 'draft',
2861
+ 'issuing',
2862
+ 'issued',
2863
+ 'payment_processing',
2864
+ 'overdue',
2865
+ 'paid',
2866
+ 'uncollectible',
2867
+ 'voided',
2868
+ ])
2869
+ .describe('InvoiceStatus describes the status of an invoice.'))
2870
+ .optional()
2871
+ .describe('Filter by the invoice status.'),
2872
+ });
2873
+ /**
2874
+ * Create a new invoice from the pending line items.
2875
+
2876
+ This should be only called if for some reason we need to invoice a customer outside of the normal billing cycle.
2877
+
2878
+ When creating an invoice, the pending line items will be marked as invoiced and the invoice will be created with the total amount of the pending items.
2879
+
2880
+ New pending line items will be created for the period between now() and the next billing cycle's begining date for any metered item.
2881
+
2882
+ The call can return multiple invoices if the pending line items are in different currencies.
2883
+ * @summary Invoice a customer based on the pending line items
2884
+ */
2885
+ export const invoicePendingLinesActionBodyFiltersLineIdsItemRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
2886
+ export const invoicePendingLinesActionBodyCustomerIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
2887
+ export const invoicePendingLinesActionBody = zod
2888
+ .object({
2889
+ asOf: zod
2890
+ .date()
2891
+ .optional()
2892
+ .describe('The time as of which the invoice is created.\n\nIf not provided, the current time is used.'),
2893
+ customerId: zod
2894
+ .string()
2895
+ .regex(invoicePendingLinesActionBodyCustomerIdRegExp)
2896
+ .describe('The customer ID for which to create the invoice.'),
2897
+ filters: zod
2898
+ .object({
2899
+ lineIds: zod
2900
+ .array(zod
2901
+ .string()
2902
+ .regex(invoicePendingLinesActionBodyFiltersLineIdsItemRegExp)
2903
+ .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'))
3277
2904
  .optional()
3278
- .describe('Tax config specify the tax configuration for this line.'),
3279
- type: zod.enum(['flat_fee']),
2905
+ .describe('The pending line items to include in the invoice, if not provided:\n- all line items that have invoice_at < asOf will be included\n- [progressive billing only] all usage based line items will be included up to asOf, new\nusage-based line items will be staged for the rest of the billing cycle\n\nAll lineIDs present in the list, must exists and must be invoicable as of asOf, or the action will fail.'),
3280
2906
  })
3281
- .describe('InvoiceFlatFeePendingLineCreate represents the create model for an invoice line that is sold to the customer as a manually added fee.'),
3282
- ])
3283
- .describe('InvoiceLineCreate represents the create model for an invoice line.');
3284
- export const createPendingInvoiceLineBody = zod.array(createPendingInvoiceLineBodyItem);
2907
+ .describe('InvoicePendingLinesActionFiltersInput specifies which lines to include in the invoice.')
2908
+ .optional()
2909
+ .describe('Filters to apply when creating the invoice.'),
2910
+ progressiveBillingOverride: zod
2911
+ .boolean()
2912
+ .optional()
2913
+ .describe("Override the progressive billing setting of the customer.\n\nCan be used to disable/enable progressive billing in case the business logic\nrequires it, if not provided the billing profile's progressive billing setting will be used."),
2914
+ })
2915
+ .describe('BillingInvoiceActionInput is the input for creating an invoice.\n\nInvoice creation is always based on already pending line items created by the billingCreateLineByCustomer\noperation. Empty invoices are not allowed.');
3285
2916
  /**
3286
2917
  * Get an invoice by ID.
2918
+
2919
+ Gathering invoices will always show the current usage calculated on the fly.
3287
2920
  * @summary Get an invoice
3288
2921
  */
3289
2922
  export const getInvoicePathInvoiceIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
@@ -3304,6 +2937,8 @@ export const getInvoiceQueryParams = zod.object({
3304
2937
  * Delete an invoice
3305
2938
 
3306
2939
  Only invoices that are in the draft (or earlier) status can be deleted.
2940
+
2941
+ Invoices that are post finalization can only be voided.
3307
2942
  * @summary Delete an invoice
3308
2943
  */
3309
2944
  export const deleteInvoicePathInvoiceIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
@@ -3379,24 +3014,9 @@ export const updateInvoiceBodyLinesItemRateCardDiscountsPercentageCorrelationIdR
3379
3014
  export const updateInvoiceBodyLinesItemRateCardDiscountsUsageQuantityRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
3380
3015
  export const updateInvoiceBodyLinesItemRateCardDiscountsUsageCorrelationIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
3381
3016
  export const updateInvoiceBodyLinesItemIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
3382
- export const updateInvoiceBodyLinesItemNameMaxOne = 256;
3383
- export const updateInvoiceBodyLinesItemDescriptionMaxOne = 1024;
3384
- export const updateInvoiceBodyLinesItemTaxConfigStripeCodeRegExpOne = new RegExp('^txcd_\\d{8}$');
3385
- export const updateInvoiceBodyLinesItemPerUnitAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
3386
- export const updateInvoiceBodyLinesItemPaymentTermDefault = 'in_advance';
3387
- export const updateInvoiceBodyLinesItemQuantityRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
3388
- export const updateInvoiceBodyLinesItemRateCardTaxConfigStripeCodeRegExpOne = new RegExp('^txcd_\\d{8}$');
3389
- export const updateInvoiceBodyLinesItemRateCardPriceAmountRegExpSeven = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
3390
- export const updateInvoiceBodyLinesItemRateCardPricePaymentTermDefaultTwo = 'in_advance';
3391
- export const updateInvoiceBodyLinesItemRateCardQuantityRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
3392
- export const updateInvoiceBodyLinesItemRateCardDiscountsPercentageCorrelationIdRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
3393
- export const updateInvoiceBodyLinesItemRateCardDiscountsUsageQuantityRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
3394
- export const updateInvoiceBodyLinesItemRateCardDiscountsUsageCorrelationIdRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
3395
- export const updateInvoiceBodyLinesItemCategoryDefault = 'regular';
3396
- export const updateInvoiceBodyLinesItemIdRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
3397
3017
  export const updateInvoiceBodyWorkflowWorkflowInvoicingAutoAdvanceDefault = true;
3398
3018
  export const updateInvoiceBodyWorkflowWorkflowInvoicingDraftPeriodDefault = 'P0D';
3399
- export const updateInvoiceBodyWorkflowWorkflowInvoicingDueAfterDefault = 'P1W';
3019
+ export const updateInvoiceBodyWorkflowWorkflowInvoicingDueAfterDefault = 'P30D';
3400
3020
  export const updateInvoiceBodyWorkflowWorkflowInvoicingDefaultTaxConfigStripeCodeRegExp = new RegExp('^txcd_\\d{8}$');
3401
3021
  export const updateInvoiceBodyWorkflowWorkflowPaymentCollectionMethodDefault = 'charge_automatically';
3402
3022
  export const updateInvoiceBody = zod
@@ -3456,625 +3076,402 @@ export const updateInvoiceBody = zod
3456
3076
  .max(updateInvoiceBodyDescriptionMax)
3457
3077
  .optional()
3458
3078
  .describe('Optional description of the resource. Maximum 1024 characters.'),
3459
- draftUntil: zod
3460
- .date()
3461
- .optional()
3462
- .describe('The time until the invoice is in draft status.\n\nOn draft invoice creation it is calculated from the workflow settings.\n\nIf manual approval is required, the draftUntil time is set.'),
3463
3079
  lines: zod
3464
3080
  .array(zod
3465
- .discriminatedUnion('type', [
3466
- zod
3467
- .object({
3468
- description: zod
3469
- .string()
3470
- .max(updateInvoiceBodyLinesItemDescriptionMax)
3471
- .optional()
3472
- .describe('Optional description of the resource. Maximum 1024 characters.'),
3473
- featureKey: zod
3474
- .string()
3475
- .min(1)
3476
- .max(updateInvoiceBodyLinesItemFeatureKeyMax)
3477
- .regex(updateInvoiceBodyLinesItemFeatureKeyRegExp)
3478
- .optional()
3479
- .describe('The feature that the usage is based on.'),
3480
- id: zod
3481
- .string()
3482
- .regex(updateInvoiceBodyLinesItemIdRegExp)
3483
- .optional()
3484
- .describe('The ID of the line.'),
3485
- invoiceAt: zod
3486
- .date()
3487
- .describe('The time this line item should be invoiced.'),
3488
- metadata: zod
3489
- .record(zod.string(), zod.string())
3490
- .describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
3491
- .nullish()
3492
- .describe('Additional metadata for the resource.'),
3493
- name: zod
3494
- .string()
3495
- .min(1)
3496
- .max(updateInvoiceBodyLinesItemNameMax)
3497
- .describe('Human-readable name for the resource. Between 1 and 256 characters.'),
3498
- period: zod
3081
+ .object({
3082
+ description: zod
3083
+ .string()
3084
+ .max(updateInvoiceBodyLinesItemDescriptionMax)
3085
+ .optional()
3086
+ .describe('Optional description of the resource. Maximum 1024 characters.'),
3087
+ featureKey: zod
3088
+ .string()
3089
+ .min(1)
3090
+ .max(updateInvoiceBodyLinesItemFeatureKeyMax)
3091
+ .regex(updateInvoiceBodyLinesItemFeatureKeyRegExp)
3092
+ .optional()
3093
+ .describe('The feature that the usage is based on.'),
3094
+ id: zod
3095
+ .string()
3096
+ .regex(updateInvoiceBodyLinesItemIdRegExp)
3097
+ .optional()
3098
+ .describe('The ID of the line.'),
3099
+ invoiceAt: zod
3100
+ .date()
3101
+ .describe('The time this line item should be invoiced.'),
3102
+ metadata: zod
3103
+ .record(zod.string(), zod.string())
3104
+ .describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
3105
+ .nullish()
3106
+ .describe('Additional metadata for the resource.'),
3107
+ name: zod
3108
+ .string()
3109
+ .min(1)
3110
+ .max(updateInvoiceBodyLinesItemNameMax)
3111
+ .describe('Human-readable name for the resource. Between 1 and 256 characters.'),
3112
+ period: zod
3113
+ .object({
3114
+ from: zod.date().describe('Period start time.'),
3115
+ to: zod.date().describe('Period end time.'),
3116
+ })
3117
+ .describe('A period with a start and end time.')
3118
+ .describe('Period of the line item applies to for revenue recognition pruposes.\n\nBilling always treats periods as start being inclusive and end being exclusive.'),
3119
+ price: zod
3120
+ .discriminatedUnion('type', [
3121
+ zod
3499
3122
  .object({
3500
- from: zod.date().describe('Period start time.'),
3501
- to: zod.date().describe('Period end time.'),
3123
+ amount: zod
3124
+ .string()
3125
+ .regex(updateInvoiceBodyLinesItemPriceAmountRegExpOne)
3126
+ .describe('Numeric represents an arbitrary precision number.')
3127
+ .describe('The amount of the flat price.'),
3128
+ paymentTerm: zod
3129
+ .enum(['in_advance', 'in_arrears'])
3130
+ .describe('The payment term of a flat price.\nOne of: in_advance or in_arrears.')
3131
+ .default(updateInvoiceBodyLinesItemPricePaymentTermDefault)
3132
+ .describe('The payment term of the flat price.\nDefaults to in advance.'),
3133
+ type: zod.enum(['flat']),
3502
3134
  })
3503
- .describe('A period with a start and end time.')
3504
- .describe('Period of the line item applies to for revenue recognition pruposes.\n\nBilling always treats periods as start being inclusive and end being exclusive.'),
3505
- price: zod
3506
- .discriminatedUnion('type', [
3507
- zod
3508
- .object({
3509
- amount: zod
3510
- .string()
3511
- .regex(updateInvoiceBodyLinesItemPriceAmountRegExpOne)
3512
- .describe('Numeric represents an arbitrary precision number.')
3513
- .describe('The amount of the flat price.'),
3514
- paymentTerm: zod
3515
- .enum(['in_advance', 'in_arrears'])
3516
- .describe('The payment term of a flat price.\nOne of: in_advance or in_arrears.')
3517
- .default(updateInvoiceBodyLinesItemPricePaymentTermDefault)
3518
- .describe('The payment term of the flat price.\nDefaults to in advance.'),
3519
- type: zod.enum(['flat']),
3520
- })
3521
- .describe('Flat price with payment term.'),
3522
- zod
3523
- .object({
3524
- amount: zod
3525
- .string()
3526
- .regex(updateInvoiceBodyLinesItemPriceAmountRegExpThree)
3527
- .describe('Numeric represents an arbitrary precision number.')
3528
- .describe('The amount of the unit price.'),
3529
- maximumAmount: zod
3530
- .string()
3531
- .regex(updateInvoiceBodyLinesItemPriceMaximumAmountRegExpOne)
3532
- .describe('Numeric represents an arbitrary precision number.')
3533
- .optional()
3534
- .describe('The customer is limited to spend at most the amount.'),
3535
- minimumAmount: zod
3536
- .string()
3537
- .regex(updateInvoiceBodyLinesItemPriceMinimumAmountRegExpOne)
3538
- .describe('Numeric represents an arbitrary precision number.')
3539
- .optional()
3540
- .describe('The customer is committed to spend at least the amount.'),
3541
- type: zod.enum(['unit']),
3542
- })
3543
- .describe('Unit price with spend commitments.'),
3544
- zod
3545
- .object({
3546
- maximumAmount: zod
3547
- .string()
3548
- .regex(updateInvoiceBodyLinesItemPriceMaximumAmountRegExpThree)
3549
- .describe('Numeric represents an arbitrary precision number.')
3550
- .optional()
3551
- .describe('The customer is limited to spend at most the amount.'),
3552
- minimumAmount: zod
3553
- .string()
3554
- .regex(updateInvoiceBodyLinesItemPriceMinimumAmountRegExpThree)
3555
- .describe('Numeric represents an arbitrary precision number.')
3556
- .optional()
3557
- .describe('The customer is committed to spend at least the amount.'),
3558
- mode: zod
3559
- .enum(['volume', 'graduated'])
3560
- .describe('The mode of the tiered price.')
3561
- .describe('Defines if the tiering mode is volume-based or graduated:\n- In `volume`-based tiering, the maximum quantity within a period determines the per unit price.\n- In `graduated` tiering, pricing can change as the quantity grows.'),
3562
- tiers: zod
3563
- .array(zod
3564
- .object({
3565
- flatPrice: zod
3566
- .object({
3567
- amount: zod
3568
- .string()
3569
- .regex(updateInvoiceBodyLinesItemPriceTiersItemFlatPriceAmountRegExpOne)
3570
- .describe('Numeric represents an arbitrary precision number.')
3571
- .describe('The amount of the flat price.'),
3572
- type: zod
3573
- .enum(['flat'])
3574
- .describe('The type of the price.'),
3575
- })
3576
- .describe('Flat price.')
3577
- .nullable()
3578
- .describe('The flat price component of the tier.'),
3579
- unitPrice: zod
3580
- .object({
3581
- amount: zod
3582
- .string()
3583
- .regex(updateInvoiceBodyLinesItemPriceTiersItemUnitPriceAmountRegExpOne)
3584
- .describe('Numeric represents an arbitrary precision number.')
3585
- .describe('The amount of the unit price.'),
3586
- type: zod
3587
- .enum(['unit'])
3588
- .describe('The type of the price.'),
3589
- })
3590
- .describe('Unit price.')
3591
- .nullable()
3592
- .describe('The unit price component of the tier.'),
3593
- upToAmount: zod
3594
- .string()
3595
- .regex(updateInvoiceBodyLinesItemPriceTiersItemUpToAmountRegExpOne)
3596
- .describe('Numeric represents an arbitrary precision number.')
3597
- .optional()
3598
- .describe('Up to and including to this quantity will be contained in the tier.\nIf null, the tier is open-ended.'),
3599
- })
3600
- .describe('A price tier.\nAt least one price component is required in each tier.'))
3601
- .min(1)
3602
- .describe('The tiers of the tiered price.\nAt least one price component is required in each tier.'),
3603
- type: zod.enum(['tiered']),
3604
- })
3605
- .describe('Tiered price with spend commitments.'),
3606
- zod
3607
- .object({
3608
- maximumAmount: zod
3609
- .string()
3610
- .regex(updateInvoiceBodyLinesItemPriceMaximumAmountRegExpFive)
3611
- .describe('Numeric represents an arbitrary precision number.')
3612
- .optional()
3613
- .describe('The customer is limited to spend at most the amount.'),
3614
- minimumAmount: zod
3615
- .string()
3616
- .regex(updateInvoiceBodyLinesItemPriceMinimumAmountRegExpFive)
3617
- .describe('Numeric represents an arbitrary precision number.')
3618
- .optional()
3619
- .describe('The customer is committed to spend at least the amount.'),
3620
- multiplier: zod
3621
- .string()
3622
- .regex(updateInvoiceBodyLinesItemPriceMultiplierRegExpOne)
3623
- .describe('Numeric represents an arbitrary precision number.')
3624
- .default(updateInvoiceBodyLinesItemPriceMultiplierDefault)
3625
- .describe('The multiplier to apply to the base price to get the dynamic price.\n\nExamples:\n- 0.0: the price is zero\n- 0.5: the price is 50% of the base price\n- 1.0: the price is the same as the base price\n- 1.5: the price is 150% of the base price'),
3626
- type: zod.enum(['dynamic']),
3627
- })
3628
- .describe('Dynamic price with spend commitments.'),
3629
- zod
3630
- .object({
3631
- amount: zod
3632
- .string()
3633
- .regex(updateInvoiceBodyLinesItemPriceAmountRegExpFive)
3634
- .describe('Numeric represents an arbitrary precision number.')
3635
- .describe('The price of one package.'),
3636
- maximumAmount: zod
3637
- .string()
3638
- .regex(updateInvoiceBodyLinesItemPriceMaximumAmountRegExpSeven)
3639
- .describe('Numeric represents an arbitrary precision number.')
3640
- .optional()
3641
- .describe('The customer is limited to spend at most the amount.'),
3642
- minimumAmount: zod
3643
- .string()
3644
- .regex(updateInvoiceBodyLinesItemPriceMinimumAmountRegExpSeven)
3645
- .describe('Numeric represents an arbitrary precision number.')
3646
- .optional()
3647
- .describe('The customer is committed to spend at least the amount.'),
3648
- quantityPerPackage: zod
3649
- .string()
3650
- .regex(updateInvoiceBodyLinesItemPriceQuantityPerPackageRegExpOne)
3651
- .describe('Numeric represents an arbitrary precision number.')
3652
- .describe('The quantity per package.'),
3653
- type: zod.enum(['package']),
3654
- })
3655
- .describe('Package price with spend commitments.'),
3656
- ])
3657
- .describe('The price of the usage based rate card.')
3658
- .optional()
3659
- .describe('Price of the usage-based item being sold.'),
3660
- rateCard: zod
3135
+ .describe('Flat price with payment term.'),
3136
+ zod
3661
3137
  .object({
3662
- discounts: zod
3663
- .object({
3664
- percentage: zod
3665
- .object({
3666
- correlationId: zod
3667
- .string()
3668
- .regex(updateInvoiceBodyLinesItemRateCardDiscountsPercentageCorrelationIdRegExp)
3669
- .optional()
3670
- .describe('Correlation ID for the discount.\n\nThis is used to link discounts across different invoices (progressive billing use case).\n\nIf not provided, the invoicing engine will auto-generate one. When editing an invoice line,\nplease make sure to keep the same correlation ID of the discount or in progressive billing\nsetups the discount amounts might be incorrect.'),
3671
- percentage: zod
3672
- .number()
3673
- .describe('Numeric representation of a percentage\n\n50% is represented as 50')
3674
- .describe('The percentage of the discount.'),
3675
- })
3676
- .describe('A percentage discount.')
3677
- .optional()
3678
- .describe('The percentage discount.'),
3679
- usage: zod
3680
- .object({
3681
- correlationId: zod
3682
- .string()
3683
- .regex(updateInvoiceBodyLinesItemRateCardDiscountsUsageCorrelationIdRegExp)
3684
- .optional()
3685
- .describe('Correlation ID for the discount.\n\nThis is used to link discounts across different invoices (progressive billing use case).\n\nIf not provided, the invoicing engine will auto-generate one. When editing an invoice line,\nplease make sure to keep the same correlation ID of the discount or in progressive billing\nsetups the discount amounts might be incorrect.'),
3686
- quantity: zod
3687
- .string()
3688
- .regex(updateInvoiceBodyLinesItemRateCardDiscountsUsageQuantityRegExpOne)
3689
- .describe('Numeric represents an arbitrary precision number.')
3690
- .describe('The quantity of the usage discount.\n\nMust be positive.'),
3691
- })
3692
- .describe('A usage discount.')
3693
- .optional()
3694
- .describe('The usage discount.'),
3695
- })
3696
- .describe('A discount by type.')
3697
- .optional()
3698
- .describe('The discounts that are applied to the line.'),
3699
- featureKey: zod
3138
+ amount: zod
3700
3139
  .string()
3701
- .min(1)
3702
- .max(updateInvoiceBodyLinesItemRateCardFeatureKeyMax)
3703
- .regex(updateInvoiceBodyLinesItemRateCardFeatureKeyRegExp)
3140
+ .regex(updateInvoiceBodyLinesItemPriceAmountRegExpThree)
3141
+ .describe('Numeric represents an arbitrary precision number.')
3142
+ .describe('The amount of the unit price.'),
3143
+ maximumAmount: zod
3144
+ .string()
3145
+ .regex(updateInvoiceBodyLinesItemPriceMaximumAmountRegExpOne)
3146
+ .describe('Numeric represents an arbitrary precision number.')
3704
3147
  .optional()
3705
- .describe('The feature the customer is entitled to use.'),
3706
- price: zod
3707
- .discriminatedUnion('type', [
3708
- zod
3709
- .object({
3710
- amount: zod
3711
- .string()
3712
- .regex(updateInvoiceBodyLinesItemRateCardPriceAmountRegExpOne)
3713
- .describe('Numeric represents an arbitrary precision number.')
3714
- .describe('The amount of the flat price.'),
3715
- paymentTerm: zod
3716
- .enum(['in_advance', 'in_arrears'])
3717
- .describe('The payment term of a flat price.\nOne of: in_advance or in_arrears.')
3718
- .default(updateInvoiceBodyLinesItemRateCardPricePaymentTermDefault)
3719
- .describe('The payment term of the flat price.\nDefaults to in advance.'),
3720
- type: zod.enum(['flat']),
3721
- })
3722
- .describe('Flat price with payment term.'),
3723
- zod
3724
- .object({
3725
- amount: zod
3726
- .string()
3727
- .regex(updateInvoiceBodyLinesItemRateCardPriceAmountRegExpThree)
3728
- .describe('Numeric represents an arbitrary precision number.')
3729
- .describe('The amount of the unit price.'),
3730
- maximumAmount: zod
3731
- .string()
3732
- .regex(updateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpOne)
3733
- .describe('Numeric represents an arbitrary precision number.')
3734
- .optional()
3735
- .describe('The customer is limited to spend at most the amount.'),
3736
- minimumAmount: zod
3737
- .string()
3738
- .regex(updateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpOne)
3739
- .describe('Numeric represents an arbitrary precision number.')
3740
- .optional()
3741
- .describe('The customer is committed to spend at least the amount.'),
3742
- type: zod.enum(['unit']),
3743
- })
3744
- .describe('Unit price with spend commitments.'),
3745
- zod
3746
- .object({
3747
- maximumAmount: zod
3748
- .string()
3749
- .regex(updateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpThree)
3750
- .describe('Numeric represents an arbitrary precision number.')
3751
- .optional()
3752
- .describe('The customer is limited to spend at most the amount.'),
3753
- minimumAmount: zod
3754
- .string()
3755
- .regex(updateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpThree)
3756
- .describe('Numeric represents an arbitrary precision number.')
3757
- .optional()
3758
- .describe('The customer is committed to spend at least the amount.'),
3759
- mode: zod
3760
- .enum(['volume', 'graduated'])
3761
- .describe('The mode of the tiered price.')
3762
- .describe('Defines if the tiering mode is volume-based or graduated:\n- In `volume`-based tiering, the maximum quantity within a period determines the per unit price.\n- In `graduated` tiering, pricing can change as the quantity grows.'),
3763
- tiers: zod
3764
- .array(zod
3765
- .object({
3766
- flatPrice: zod
3767
- .object({
3768
- amount: zod
3769
- .string()
3770
- .regex(updateInvoiceBodyLinesItemRateCardPriceTiersItemFlatPriceAmountRegExpOne)
3771
- .describe('Numeric represents an arbitrary precision number.')
3772
- .describe('The amount of the flat price.'),
3773
- type: zod
3774
- .enum(['flat'])
3775
- .describe('The type of the price.'),
3776
- })
3777
- .describe('Flat price.')
3778
- .nullable()
3779
- .describe('The flat price component of the tier.'),
3780
- unitPrice: zod
3781
- .object({
3782
- amount: zod
3783
- .string()
3784
- .regex(updateInvoiceBodyLinesItemRateCardPriceTiersItemUnitPriceAmountRegExpOne)
3785
- .describe('Numeric represents an arbitrary precision number.')
3786
- .describe('The amount of the unit price.'),
3787
- type: zod
3788
- .enum(['unit'])
3789
- .describe('The type of the price.'),
3790
- })
3791
- .describe('Unit price.')
3792
- .nullable()
3793
- .describe('The unit price component of the tier.'),
3794
- upToAmount: zod
3795
- .string()
3796
- .regex(updateInvoiceBodyLinesItemRateCardPriceTiersItemUpToAmountRegExpOne)
3797
- .describe('Numeric represents an arbitrary precision number.')
3798
- .optional()
3799
- .describe('Up to and including to this quantity will be contained in the tier.\nIf null, the tier is open-ended.'),
3800
- })
3801
- .describe('A price tier.\nAt least one price component is required in each tier.'))
3802
- .min(1)
3803
- .describe('The tiers of the tiered price.\nAt least one price component is required in each tier.'),
3804
- type: zod.enum(['tiered']),
3805
- })
3806
- .describe('Tiered price with spend commitments.'),
3807
- zod
3148
+ .describe('The customer is limited to spend at most the amount.'),
3149
+ minimumAmount: zod
3150
+ .string()
3151
+ .regex(updateInvoiceBodyLinesItemPriceMinimumAmountRegExpOne)
3152
+ .describe('Numeric represents an arbitrary precision number.')
3153
+ .optional()
3154
+ .describe('The customer is committed to spend at least the amount.'),
3155
+ type: zod.enum(['unit']),
3156
+ })
3157
+ .describe('Unit price with spend commitments.'),
3158
+ zod
3159
+ .object({
3160
+ maximumAmount: zod
3161
+ .string()
3162
+ .regex(updateInvoiceBodyLinesItemPriceMaximumAmountRegExpThree)
3163
+ .describe('Numeric represents an arbitrary precision number.')
3164
+ .optional()
3165
+ .describe('The customer is limited to spend at most the amount.'),
3166
+ minimumAmount: zod
3167
+ .string()
3168
+ .regex(updateInvoiceBodyLinesItemPriceMinimumAmountRegExpThree)
3169
+ .describe('Numeric represents an arbitrary precision number.')
3170
+ .optional()
3171
+ .describe('The customer is committed to spend at least the amount.'),
3172
+ mode: zod
3173
+ .enum(['volume', 'graduated'])
3174
+ .describe('The mode of the tiered price.')
3175
+ .describe('Defines if the tiering mode is volume-based or graduated:\n- In `volume`-based tiering, the maximum quantity within a period determines the per unit price.\n- In `graduated` tiering, pricing can change as the quantity grows.'),
3176
+ tiers: zod
3177
+ .array(zod
3178
+ .object({
3179
+ flatPrice: zod
3808
3180
  .object({
3809
- maximumAmount: zod
3810
- .string()
3811
- .regex(updateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpFive)
3812
- .describe('Numeric represents an arbitrary precision number.')
3813
- .optional()
3814
- .describe('The customer is limited to spend at most the amount.'),
3815
- minimumAmount: zod
3816
- .string()
3817
- .regex(updateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpFive)
3818
- .describe('Numeric represents an arbitrary precision number.')
3819
- .optional()
3820
- .describe('The customer is committed to spend at least the amount.'),
3821
- multiplier: zod
3181
+ amount: zod
3822
3182
  .string()
3823
- .regex(updateInvoiceBodyLinesItemRateCardPriceMultiplierRegExpOne)
3183
+ .regex(updateInvoiceBodyLinesItemPriceTiersItemFlatPriceAmountRegExpOne)
3824
3184
  .describe('Numeric represents an arbitrary precision number.')
3825
- .default(updateInvoiceBodyLinesItemRateCardPriceMultiplierDefault)
3826
- .describe('The multiplier to apply to the base price to get the dynamic price.\n\nExamples:\n- 0.0: the price is zero\n- 0.5: the price is 50% of the base price\n- 1.0: the price is the same as the base price\n- 1.5: the price is 150% of the base price'),
3827
- type: zod.enum(['dynamic']),
3185
+ .describe('The amount of the flat price.'),
3186
+ type: zod
3187
+ .enum(['flat'])
3188
+ .describe('The type of the price.'),
3828
3189
  })
3829
- .describe('Dynamic price with spend commitments.'),
3830
- zod
3190
+ .describe('Flat price.')
3191
+ .nullable()
3192
+ .describe('The flat price component of the tier.'),
3193
+ unitPrice: zod
3831
3194
  .object({
3832
3195
  amount: zod
3833
3196
  .string()
3834
- .regex(updateInvoiceBodyLinesItemRateCardPriceAmountRegExpFive)
3835
- .describe('Numeric represents an arbitrary precision number.')
3836
- .describe('The price of one package.'),
3837
- maximumAmount: zod
3838
- .string()
3839
- .regex(updateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpSeven)
3840
- .describe('Numeric represents an arbitrary precision number.')
3841
- .optional()
3842
- .describe('The customer is limited to spend at most the amount.'),
3843
- minimumAmount: zod
3844
- .string()
3845
- .regex(updateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpSeven)
3846
- .describe('Numeric represents an arbitrary precision number.')
3847
- .optional()
3848
- .describe('The customer is committed to spend at least the amount.'),
3849
- quantityPerPackage: zod
3850
- .string()
3851
- .regex(updateInvoiceBodyLinesItemRateCardPriceQuantityPerPackageRegExpOne)
3197
+ .regex(updateInvoiceBodyLinesItemPriceTiersItemUnitPriceAmountRegExpOne)
3852
3198
  .describe('Numeric represents an arbitrary precision number.')
3853
- .describe('The quantity per package.'),
3854
- type: zod.enum(['package']),
3855
- })
3856
- .describe('Package price with spend commitments.'),
3857
- ])
3858
- .describe('The price of the usage based rate card.')
3859
- .nullable()
3860
- .describe('The price of the rate card.\nWhen null, the feature or service is free.'),
3861
- taxConfig: zod
3862
- .object({
3863
- behavior: zod
3864
- .enum(['inclusive', 'exclusive'])
3865
- .describe('Tax behavior.\n\nThis enum is used to specify whether tax is included in the price or excluded from the price.')
3866
- .optional()
3867
- .describe("Tax behavior.\n\nIf not specified the billing profile is used to determine the tax behavior.\nIf not specified in the billing profile, the provider's default behavior is used."),
3868
- customInvoicing: zod
3869
- .object({
3870
- code: zod
3871
- .string()
3872
- .describe('Tax code.\n\nThe tax code should be interpreted by the custom invoicing provider.'),
3873
- })
3874
- .describe('Custom invoicing tax config.')
3875
- .optional()
3876
- .describe('Custom invoicing tax config.'),
3877
- stripe: zod
3878
- .object({
3879
- code: zod
3880
- .string()
3881
- .regex(updateInvoiceBodyLinesItemRateCardTaxConfigStripeCodeRegExp)
3882
- .describe('Product tax code.\n\nSee: https://docs.stripe.com/tax/tax-codes'),
3199
+ .describe('The amount of the unit price.'),
3200
+ type: zod
3201
+ .enum(['unit'])
3202
+ .describe('The type of the price.'),
3883
3203
  })
3884
- .describe('The tax config for Stripe.')
3204
+ .describe('Unit price.')
3205
+ .nullable()
3206
+ .describe('The unit price component of the tier.'),
3207
+ upToAmount: zod
3208
+ .string()
3209
+ .regex(updateInvoiceBodyLinesItemPriceTiersItemUpToAmountRegExpOne)
3210
+ .describe('Numeric represents an arbitrary precision number.')
3885
3211
  .optional()
3886
- .describe('Stripe tax config.'),
3212
+ .describe('Up to and including to this quantity will be contained in the tier.\nIf null, the tier is open-ended.'),
3887
3213
  })
3888
- .describe('Set of provider specific tax configs.')
3214
+ .describe('A price tier.\nAt least one price component is required in each tier.'))
3215
+ .min(1)
3216
+ .describe('The tiers of the tiered price.\nAt least one price component is required in each tier.'),
3217
+ type: zod.enum(['tiered']),
3218
+ })
3219
+ .describe('Tiered price with spend commitments.'),
3220
+ zod
3221
+ .object({
3222
+ maximumAmount: zod
3223
+ .string()
3224
+ .regex(updateInvoiceBodyLinesItemPriceMaximumAmountRegExpFive)
3225
+ .describe('Numeric represents an arbitrary precision number.')
3889
3226
  .optional()
3890
- .describe('The tax config of the rate card.\nWhen undefined, the tax config of the feature or the default tax config of the plan is used.'),
3227
+ .describe('The customer is limited to spend at most the amount.'),
3228
+ minimumAmount: zod
3229
+ .string()
3230
+ .regex(updateInvoiceBodyLinesItemPriceMinimumAmountRegExpFive)
3231
+ .describe('Numeric represents an arbitrary precision number.')
3232
+ .optional()
3233
+ .describe('The customer is committed to spend at least the amount.'),
3234
+ multiplier: zod
3235
+ .string()
3236
+ .regex(updateInvoiceBodyLinesItemPriceMultiplierRegExpOne)
3237
+ .describe('Numeric represents an arbitrary precision number.')
3238
+ .default(updateInvoiceBodyLinesItemPriceMultiplierDefault)
3239
+ .describe('The multiplier to apply to the base price to get the dynamic price.\n\nExamples:\n- 0.0: the price is zero\n- 0.5: the price is 50% of the base price\n- 1.0: the price is the same as the base price\n- 1.5: the price is 150% of the base price'),
3240
+ type: zod.enum(['dynamic']),
3891
3241
  })
3892
- .describe('InvoiceUsageBasedRateCard represents the rate card (intent) for an usage-based line.')
3893
- .optional()
3894
- .describe('The rate card that is used for this line.\n\nThe rate card captures the intent of the price and discounts for the usage-based item.'),
3895
- taxConfig: zod
3242
+ .describe('Dynamic price with spend commitments.'),
3243
+ zod
3896
3244
  .object({
3897
- behavior: zod
3898
- .enum(['inclusive', 'exclusive'])
3899
- .describe('Tax behavior.\n\nThis enum is used to specify whether tax is included in the price or excluded from the price.')
3245
+ amount: zod
3246
+ .string()
3247
+ .regex(updateInvoiceBodyLinesItemPriceAmountRegExpFive)
3248
+ .describe('Numeric represents an arbitrary precision number.')
3249
+ .describe('The price of one package.'),
3250
+ maximumAmount: zod
3251
+ .string()
3252
+ .regex(updateInvoiceBodyLinesItemPriceMaximumAmountRegExpSeven)
3253
+ .describe('Numeric represents an arbitrary precision number.')
3900
3254
  .optional()
3901
- .describe("Tax behavior.\n\nIf not specified the billing profile is used to determine the tax behavior.\nIf not specified in the billing profile, the provider's default behavior is used."),
3902
- customInvoicing: zod
3255
+ .describe('The customer is limited to spend at most the amount.'),
3256
+ minimumAmount: zod
3257
+ .string()
3258
+ .regex(updateInvoiceBodyLinesItemPriceMinimumAmountRegExpSeven)
3259
+ .describe('Numeric represents an arbitrary precision number.')
3260
+ .optional()
3261
+ .describe('The customer is committed to spend at least the amount.'),
3262
+ quantityPerPackage: zod
3263
+ .string()
3264
+ .regex(updateInvoiceBodyLinesItemPriceQuantityPerPackageRegExpOne)
3265
+ .describe('Numeric represents an arbitrary precision number.')
3266
+ .describe('The quantity per package.'),
3267
+ type: zod.enum(['package']),
3268
+ })
3269
+ .describe('Package price with spend commitments.'),
3270
+ ])
3271
+ .describe('The price of the usage based rate card.')
3272
+ .optional()
3273
+ .describe('Price of the usage-based item being sold.'),
3274
+ rateCard: zod
3275
+ .object({
3276
+ discounts: zod
3277
+ .object({
3278
+ percentage: zod
3903
3279
  .object({
3904
- code: zod
3280
+ correlationId: zod
3905
3281
  .string()
3906
- .describe('Tax code.\n\nThe tax code should be interpreted by the custom invoicing provider.'),
3282
+ .regex(updateInvoiceBodyLinesItemRateCardDiscountsPercentageCorrelationIdRegExp)
3283
+ .optional()
3284
+ .describe('Correlation ID for the discount.\n\nThis is used to link discounts across different invoices (progressive billing use case).\n\nIf not provided, the invoicing engine will auto-generate one. When editing an invoice line,\nplease make sure to keep the same correlation ID of the discount or in progressive billing\nsetups the discount amounts might be incorrect.'),
3285
+ percentage: zod
3286
+ .number()
3287
+ .describe('Numeric representation of a percentage\n\n50% is represented as 50')
3288
+ .describe('The percentage of the discount.'),
3907
3289
  })
3908
- .describe('Custom invoicing tax config.')
3290
+ .describe('A percentage discount.')
3909
3291
  .optional()
3910
- .describe('Custom invoicing tax config.'),
3911
- stripe: zod
3292
+ .describe('The percentage discount.'),
3293
+ usage: zod
3912
3294
  .object({
3913
- code: zod
3295
+ correlationId: zod
3914
3296
  .string()
3915
- .regex(updateInvoiceBodyLinesItemTaxConfigStripeCodeRegExp)
3916
- .describe('Product tax code.\n\nSee: https://docs.stripe.com/tax/tax-codes'),
3297
+ .regex(updateInvoiceBodyLinesItemRateCardDiscountsUsageCorrelationIdRegExp)
3298
+ .optional()
3299
+ .describe('Correlation ID for the discount.\n\nThis is used to link discounts across different invoices (progressive billing use case).\n\nIf not provided, the invoicing engine will auto-generate one. When editing an invoice line,\nplease make sure to keep the same correlation ID of the discount or in progressive billing\nsetups the discount amounts might be incorrect.'),
3300
+ quantity: zod
3301
+ .string()
3302
+ .regex(updateInvoiceBodyLinesItemRateCardDiscountsUsageQuantityRegExpOne)
3303
+ .describe('Numeric represents an arbitrary precision number.')
3304
+ .describe('The quantity of the usage discount.\n\nMust be positive.'),
3917
3305
  })
3918
- .describe('The tax config for Stripe.')
3306
+ .describe('A usage discount.')
3919
3307
  .optional()
3920
- .describe('Stripe tax config.'),
3308
+ .describe('The usage discount.'),
3921
3309
  })
3922
- .describe('Set of provider specific tax configs.')
3923
- .optional()
3924
- .describe('Tax config specify the tax configuration for this line.'),
3925
- type: zod.enum(['usage_based']),
3926
- })
3927
- .describe('InvoiceUpdateUsageBasedLineReplaceUpdate represents the update model for an UBP invoice line.\n\nThis type makes ID optional to allow for creating new lines as part of the update.'),
3928
- zod
3929
- .object({
3930
- category: zod
3931
- .enum(['regular', 'commitment'])
3932
- .describe('InvoiceFlatFeeCategory determines if the flat fee is a regular fee due to use due to a\ncommitment.')
3933
- .default(updateInvoiceBodyLinesItemCategoryDefault)
3934
- .describe('Category of the flat fee.'),
3935
- description: zod
3936
- .string()
3937
- .max(updateInvoiceBodyLinesItemDescriptionMaxOne)
3938
- .optional()
3939
- .describe('Optional description of the resource. Maximum 1024 characters.'),
3940
- id: zod
3941
- .string()
3942
- .regex(updateInvoiceBodyLinesItemIdRegExpOne)
3310
+ .describe('A discount by type.')
3943
3311
  .optional()
3944
- .describe('The ID of the line.'),
3945
- invoiceAt: zod
3946
- .date()
3947
- .describe('The time this line item should be invoiced.'),
3948
- metadata: zod
3949
- .record(zod.string(), zod.string())
3950
- .describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
3951
- .nullish()
3952
- .describe('Additional metadata for the resource.'),
3953
- name: zod
3312
+ .describe('The discounts that are applied to the line.'),
3313
+ featureKey: zod
3954
3314
  .string()
3955
3315
  .min(1)
3956
- .max(updateInvoiceBodyLinesItemNameMaxOne)
3957
- .describe('Human-readable name for the resource. Between 1 and 256 characters.'),
3958
- paymentTerm: zod
3959
- .enum(['in_advance', 'in_arrears'])
3960
- .describe('The payment term of a flat price.\nOne of: in_advance or in_arrears.')
3961
- .default(updateInvoiceBodyLinesItemPaymentTermDefault)
3962
- .describe('Payment term of the line.'),
3963
- period: zod
3964
- .object({
3965
- from: zod.date().describe('Period start time.'),
3966
- to: zod.date().describe('Period end time.'),
3967
- })
3968
- .describe('A period with a start and end time.')
3969
- .describe('Period of the line item applies to for revenue recognition pruposes.\n\nBilling always treats periods as start being inclusive and end being exclusive.'),
3970
- perUnitAmount: zod
3971
- .string()
3972
- .regex(updateInvoiceBodyLinesItemPerUnitAmountRegExpOne)
3973
- .describe('Numeric represents an arbitrary precision number.')
3974
- .optional()
3975
- .describe('Price of the item being sold.'),
3976
- quantity: zod
3977
- .string()
3978
- .regex(updateInvoiceBodyLinesItemQuantityRegExpOne)
3979
- .describe('Numeric represents an arbitrary precision number.')
3980
- .optional()
3981
- .describe('Quantity of the item being sold.'),
3982
- rateCard: zod
3983
- .object({
3984
- discounts: zod
3985
- .object({
3986
- percentage: zod
3987
- .object({
3988
- correlationId: zod
3989
- .string()
3990
- .regex(updateInvoiceBodyLinesItemRateCardDiscountsPercentageCorrelationIdRegExpOne)
3991
- .optional()
3992
- .describe('Correlation ID for the discount.\n\nThis is used to link discounts across different invoices (progressive billing use case).\n\nIf not provided, the invoicing engine will auto-generate one. When editing an invoice line,\nplease make sure to keep the same correlation ID of the discount or in progressive billing\nsetups the discount amounts might be incorrect.'),
3993
- percentage: zod
3994
- .number()
3995
- .describe('Numeric representation of a percentage\n\n50% is represented as 50')
3996
- .describe('The percentage of the discount.'),
3997
- })
3998
- .describe('A percentage discount.')
3999
- .optional()
4000
- .describe('The percentage discount.'),
4001
- usage: zod
4002
- .object({
4003
- correlationId: zod
4004
- .string()
4005
- .regex(updateInvoiceBodyLinesItemRateCardDiscountsUsageCorrelationIdRegExpOne)
4006
- .optional()
4007
- .describe('Correlation ID for the discount.\n\nThis is used to link discounts across different invoices (progressive billing use case).\n\nIf not provided, the invoicing engine will auto-generate one. When editing an invoice line,\nplease make sure to keep the same correlation ID of the discount or in progressive billing\nsetups the discount amounts might be incorrect.'),
4008
- quantity: zod
4009
- .string()
4010
- .regex(updateInvoiceBodyLinesItemRateCardDiscountsUsageQuantityRegExpThree)
4011
- .describe('Numeric represents an arbitrary precision number.')
4012
- .describe('The quantity of the usage discount.\n\nMust be positive.'),
4013
- })
4014
- .describe('A usage discount.')
4015
- .optional()
4016
- .describe('The usage discount.'),
4017
- })
4018
- .describe('A discount by type.')
4019
- .optional()
4020
- .describe('The discounts that are applied to the line.'),
4021
- price: zod
3316
+ .max(updateInvoiceBodyLinesItemRateCardFeatureKeyMax)
3317
+ .regex(updateInvoiceBodyLinesItemRateCardFeatureKeyRegExp)
3318
+ .optional()
3319
+ .describe('The feature the customer is entitled to use.'),
3320
+ price: zod
3321
+ .discriminatedUnion('type', [
3322
+ zod
4022
3323
  .object({
4023
3324
  amount: zod
4024
3325
  .string()
4025
- .regex(updateInvoiceBodyLinesItemRateCardPriceAmountRegExpSeven)
3326
+ .regex(updateInvoiceBodyLinesItemRateCardPriceAmountRegExpOne)
4026
3327
  .describe('Numeric represents an arbitrary precision number.')
4027
3328
  .describe('The amount of the flat price.'),
4028
3329
  paymentTerm: zod
4029
3330
  .enum(['in_advance', 'in_arrears'])
4030
3331
  .describe('The payment term of a flat price.\nOne of: in_advance or in_arrears.')
4031
- .default(updateInvoiceBodyLinesItemRateCardPricePaymentTermDefaultTwo)
3332
+ .default(updateInvoiceBodyLinesItemRateCardPricePaymentTermDefault)
4032
3333
  .describe('The payment term of the flat price.\nDefaults to in advance.'),
4033
3334
  type: zod.enum(['flat']),
4034
3335
  })
4035
- .describe('Flat price with payment term.')
4036
- .nullable()
4037
- .describe('The price of the rate card.\nWhen null, the feature or service is free.'),
4038
- quantity: zod
4039
- .string()
4040
- .regex(updateInvoiceBodyLinesItemRateCardQuantityRegExpOne)
4041
- .describe('Numeric represents an arbitrary precision number.')
4042
- .optional()
4043
- .describe('Quantity of the item being sold.\n\nDefault: 1'),
4044
- taxConfig: zod
3336
+ .describe('Flat price with payment term.'),
3337
+ zod
4045
3338
  .object({
4046
- behavior: zod
4047
- .enum(['inclusive', 'exclusive'])
4048
- .describe('Tax behavior.\n\nThis enum is used to specify whether tax is included in the price or excluded from the price.')
3339
+ amount: zod
3340
+ .string()
3341
+ .regex(updateInvoiceBodyLinesItemRateCardPriceAmountRegExpThree)
3342
+ .describe('Numeric represents an arbitrary precision number.')
3343
+ .describe('The amount of the unit price.'),
3344
+ maximumAmount: zod
3345
+ .string()
3346
+ .regex(updateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpOne)
3347
+ .describe('Numeric represents an arbitrary precision number.')
4049
3348
  .optional()
4050
- .describe("Tax behavior.\n\nIf not specified the billing profile is used to determine the tax behavior.\nIf not specified in the billing profile, the provider's default behavior is used."),
4051
- customInvoicing: zod
4052
- .object({
4053
- code: zod
4054
- .string()
4055
- .describe('Tax code.\n\nThe tax code should be interpreted by the custom invoicing provider.'),
4056
- })
4057
- .describe('Custom invoicing tax config.')
3349
+ .describe('The customer is limited to spend at most the amount.'),
3350
+ minimumAmount: zod
3351
+ .string()
3352
+ .regex(updateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpOne)
3353
+ .describe('Numeric represents an arbitrary precision number.')
4058
3354
  .optional()
4059
- .describe('Custom invoicing tax config.'),
4060
- stripe: zod
3355
+ .describe('The customer is committed to spend at least the amount.'),
3356
+ type: zod.enum(['unit']),
3357
+ })
3358
+ .describe('Unit price with spend commitments.'),
3359
+ zod
3360
+ .object({
3361
+ maximumAmount: zod
3362
+ .string()
3363
+ .regex(updateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpThree)
3364
+ .describe('Numeric represents an arbitrary precision number.')
3365
+ .optional()
3366
+ .describe('The customer is limited to spend at most the amount.'),
3367
+ minimumAmount: zod
3368
+ .string()
3369
+ .regex(updateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpThree)
3370
+ .describe('Numeric represents an arbitrary precision number.')
3371
+ .optional()
3372
+ .describe('The customer is committed to spend at least the amount.'),
3373
+ mode: zod
3374
+ .enum(['volume', 'graduated'])
3375
+ .describe('The mode of the tiered price.')
3376
+ .describe('Defines if the tiering mode is volume-based or graduated:\n- In `volume`-based tiering, the maximum quantity within a period determines the per unit price.\n- In `graduated` tiering, pricing can change as the quantity grows.'),
3377
+ tiers: zod
3378
+ .array(zod
4061
3379
  .object({
4062
- code: zod
3380
+ flatPrice: zod
3381
+ .object({
3382
+ amount: zod
3383
+ .string()
3384
+ .regex(updateInvoiceBodyLinesItemRateCardPriceTiersItemFlatPriceAmountRegExpOne)
3385
+ .describe('Numeric represents an arbitrary precision number.')
3386
+ .describe('The amount of the flat price.'),
3387
+ type: zod
3388
+ .enum(['flat'])
3389
+ .describe('The type of the price.'),
3390
+ })
3391
+ .describe('Flat price.')
3392
+ .nullable()
3393
+ .describe('The flat price component of the tier.'),
3394
+ unitPrice: zod
3395
+ .object({
3396
+ amount: zod
3397
+ .string()
3398
+ .regex(updateInvoiceBodyLinesItemRateCardPriceTiersItemUnitPriceAmountRegExpOne)
3399
+ .describe('Numeric represents an arbitrary precision number.')
3400
+ .describe('The amount of the unit price.'),
3401
+ type: zod
3402
+ .enum(['unit'])
3403
+ .describe('The type of the price.'),
3404
+ })
3405
+ .describe('Unit price.')
3406
+ .nullable()
3407
+ .describe('The unit price component of the tier.'),
3408
+ upToAmount: zod
4063
3409
  .string()
4064
- .regex(updateInvoiceBodyLinesItemRateCardTaxConfigStripeCodeRegExpOne)
4065
- .describe('Product tax code.\n\nSee: https://docs.stripe.com/tax/tax-codes'),
3410
+ .regex(updateInvoiceBodyLinesItemRateCardPriceTiersItemUpToAmountRegExpOne)
3411
+ .describe('Numeric represents an arbitrary precision number.')
3412
+ .optional()
3413
+ .describe('Up to and including to this quantity will be contained in the tier.\nIf null, the tier is open-ended.'),
4066
3414
  })
4067
- .describe('The tax config for Stripe.')
3415
+ .describe('A price tier.\nAt least one price component is required in each tier.'))
3416
+ .min(1)
3417
+ .describe('The tiers of the tiered price.\nAt least one price component is required in each tier.'),
3418
+ type: zod.enum(['tiered']),
3419
+ })
3420
+ .describe('Tiered price with spend commitments.'),
3421
+ zod
3422
+ .object({
3423
+ maximumAmount: zod
3424
+ .string()
3425
+ .regex(updateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpFive)
3426
+ .describe('Numeric represents an arbitrary precision number.')
4068
3427
  .optional()
4069
- .describe('Stripe tax config.'),
3428
+ .describe('The customer is limited to spend at most the amount.'),
3429
+ minimumAmount: zod
3430
+ .string()
3431
+ .regex(updateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpFive)
3432
+ .describe('Numeric represents an arbitrary precision number.')
3433
+ .optional()
3434
+ .describe('The customer is committed to spend at least the amount.'),
3435
+ multiplier: zod
3436
+ .string()
3437
+ .regex(updateInvoiceBodyLinesItemRateCardPriceMultiplierRegExpOne)
3438
+ .describe('Numeric represents an arbitrary precision number.')
3439
+ .default(updateInvoiceBodyLinesItemRateCardPriceMultiplierDefault)
3440
+ .describe('The multiplier to apply to the base price to get the dynamic price.\n\nExamples:\n- 0.0: the price is zero\n- 0.5: the price is 50% of the base price\n- 1.0: the price is the same as the base price\n- 1.5: the price is 150% of the base price'),
3441
+ type: zod.enum(['dynamic']),
4070
3442
  })
4071
- .describe('Set of provider specific tax configs.')
4072
- .optional()
4073
- .describe('The tax config of the rate card.\nWhen undefined, the tax config of the feature or the default tax config of the plan is used.'),
4074
- })
4075
- .describe('InvoiceFlatFeeRateCard represents the rate card (intent) for a flat fee line.')
4076
- .optional()
4077
- .describe('The rate card that is used for this line.'),
3443
+ .describe('Dynamic price with spend commitments.'),
3444
+ zod
3445
+ .object({
3446
+ amount: zod
3447
+ .string()
3448
+ .regex(updateInvoiceBodyLinesItemRateCardPriceAmountRegExpFive)
3449
+ .describe('Numeric represents an arbitrary precision number.')
3450
+ .describe('The price of one package.'),
3451
+ maximumAmount: zod
3452
+ .string()
3453
+ .regex(updateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpSeven)
3454
+ .describe('Numeric represents an arbitrary precision number.')
3455
+ .optional()
3456
+ .describe('The customer is limited to spend at most the amount.'),
3457
+ minimumAmount: zod
3458
+ .string()
3459
+ .regex(updateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpSeven)
3460
+ .describe('Numeric represents an arbitrary precision number.')
3461
+ .optional()
3462
+ .describe('The customer is committed to spend at least the amount.'),
3463
+ quantityPerPackage: zod
3464
+ .string()
3465
+ .regex(updateInvoiceBodyLinesItemRateCardPriceQuantityPerPackageRegExpOne)
3466
+ .describe('Numeric represents an arbitrary precision number.')
3467
+ .describe('The quantity per package.'),
3468
+ type: zod.enum(['package']),
3469
+ })
3470
+ .describe('Package price with spend commitments.'),
3471
+ ])
3472
+ .describe('The price of the usage based rate card.')
3473
+ .nullable()
3474
+ .describe('The price of the rate card.\nWhen null, the feature or service is free.'),
4078
3475
  taxConfig: zod
4079
3476
  .object({
4080
3477
  behavior: zod
@@ -4095,7 +3492,7 @@ export const updateInvoiceBody = zod
4095
3492
  .object({
4096
3493
  code: zod
4097
3494
  .string()
4098
- .regex(updateInvoiceBodyLinesItemTaxConfigStripeCodeRegExpOne)
3495
+ .regex(updateInvoiceBodyLinesItemRateCardTaxConfigStripeCodeRegExp)
4099
3496
  .describe('Product tax code.\n\nSee: https://docs.stripe.com/tax/tax-codes'),
4100
3497
  })
4101
3498
  .describe('The tax config for Stripe.')
@@ -4104,12 +3501,43 @@ export const updateInvoiceBody = zod
4104
3501
  })
4105
3502
  .describe('Set of provider specific tax configs.')
4106
3503
  .optional()
4107
- .describe('Tax config specify the tax configuration for this line.'),
4108
- type: zod.enum(['flat_fee']),
3504
+ .describe('The tax config of the rate card.\nWhen undefined, the tax config of the feature or the default tax config of the plan is used.'),
4109
3505
  })
4110
- .describe('InvoiceFlatFeeLineReplaceUpdate represents the update model for a flat fee invoice line.\n\nThis type makes ID optional to allow for creating new lines as part of the update.'),
4111
- ])
4112
- .describe('InvoiceLineReplaceUpdate represents the update model for an invoice line.'))
3506
+ .describe('InvoiceUsageBasedRateCard represents the rate card (intent) for an usage-based line.')
3507
+ .optional()
3508
+ .describe('The rate card that is used for this line.\n\nThe rate card captures the intent of the price and discounts for the usage-based item.'),
3509
+ taxConfig: zod
3510
+ .object({
3511
+ behavior: zod
3512
+ .enum(['inclusive', 'exclusive'])
3513
+ .describe('Tax behavior.\n\nThis enum is used to specify whether tax is included in the price or excluded from the price.')
3514
+ .optional()
3515
+ .describe("Tax behavior.\n\nIf not specified the billing profile is used to determine the tax behavior.\nIf not specified in the billing profile, the provider's default behavior is used."),
3516
+ customInvoicing: zod
3517
+ .object({
3518
+ code: zod
3519
+ .string()
3520
+ .describe('Tax code.\n\nThe tax code should be interpreted by the custom invoicing provider.'),
3521
+ })
3522
+ .describe('Custom invoicing tax config.')
3523
+ .optional()
3524
+ .describe('Custom invoicing tax config.'),
3525
+ stripe: zod
3526
+ .object({
3527
+ code: zod
3528
+ .string()
3529
+ .regex(updateInvoiceBodyLinesItemTaxConfigStripeCodeRegExp)
3530
+ .describe('Product tax code.\n\nSee: https://docs.stripe.com/tax/tax-codes'),
3531
+ })
3532
+ .describe('The tax config for Stripe.')
3533
+ .optional()
3534
+ .describe('Stripe tax config.'),
3535
+ })
3536
+ .describe('Set of provider specific tax configs.')
3537
+ .optional()
3538
+ .describe('Tax config specify the tax configuration for this line.'),
3539
+ })
3540
+ .describe('InvoiceLineReplaceUpdate represents the update model for an UBP invoice line.\n\nThis type makes ID optional to allow for creating new lines as part of the update.'))
4113
3541
  .describe('The lines included in the invoice.'),
4114
3542
  metadata: zod
4115
3543
  .record(zod.string(), zod.string())
@@ -4213,7 +3641,7 @@ export const updateInvoiceBody = zod
4213
3641
  dueAfter: zod
4214
3642
  .string()
4215
3643
  .default(updateInvoiceBodyWorkflowWorkflowInvoicingDueAfterDefault)
4216
- .describe('The period after which the invoice is due.'),
3644
+ .describe("The period after which the invoice is due.\nWith some payment solutions it's only applicable for manual collection method."),
4217
3645
  })
4218
3646
  .describe('InvoiceWorkflowInvoicingSettingsReplaceUpdate represents the update model for the invoicing settings of an invoice workflow.')
4219
3647
  .describe('The invoicing settings for this workflow'),
@@ -4271,6 +3699,21 @@ export const retryInvoiceActionPathInvoiceIdRegExp = new RegExp('^[0-7][0-9A-HJK
4271
3699
  export const retryInvoiceActionParams = zod.object({
4272
3700
  invoiceId: zod.string().regex(retryInvoiceActionPathInvoiceIdRegExp),
4273
3701
  });
3702
+ /**
3703
+ * Snapshot quantities for usage based line items.
3704
+
3705
+ This call will snapshot the quantities for all usage based line items in the invoice.
3706
+
3707
+ This call is only valid in `draft.waiting_for_collection` status, where the collection period
3708
+ can be skipped using this action.
3709
+ * @summary Snapshot quantities for usage based line items
3710
+ */
3711
+ export const snapshotQuantitiesInvoiceActionPathInvoiceIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
3712
+ export const snapshotQuantitiesInvoiceActionParams = zod.object({
3713
+ invoiceId: zod
3714
+ .string()
3715
+ .regex(snapshotQuantitiesInvoiceActionPathInvoiceIdRegExp),
3716
+ });
4274
3717
  /**
4275
3718
  * Recalculate an invoice's tax amounts (using the app set in the customer's billing profile)
4276
3719
 
@@ -4367,7 +3810,11 @@ export const voidInvoiceActionBody = zod
4367
3810
  })
4368
3811
  .describe('Request to void an invoice');
4369
3812
  /**
4370
- * List all billing profiles
3813
+ * List all billing profiles matching the specified filters.
3814
+
3815
+ The expand option can be used to include additional information (besides the billing profile)
3816
+ in the response. For example by adding the expand=apps option the apps used by the billing profile
3817
+ will be included in the response.
4371
3818
  * @summary List billing profiles
4372
3819
  */
4373
3820
  export const listBillingProfilesQueryIncludeArchivedDefault = false;
@@ -4415,37 +3862,33 @@ export const createBillingProfileBodySupplierAddressesMax = 1;
4415
3862
  export const createBillingProfileBodyWorkflowCollectionAlignmentDefault = {
4416
3863
  type: 'subscription',
4417
3864
  };
4418
- export const createBillingProfileBodyWorkflowCollectionIntervalDefault = 'PT2H';
3865
+ export const createBillingProfileBodyWorkflowCollectionIntervalDefault = 'PT1H';
4419
3866
  export const createBillingProfileBodyWorkflowInvoicingAutoAdvanceDefault = true;
4420
3867
  export const createBillingProfileBodyWorkflowInvoicingDraftPeriodDefault = 'P0D';
4421
- export const createBillingProfileBodyWorkflowInvoicingDueAfterDefault = 'P1W';
3868
+ export const createBillingProfileBodyWorkflowInvoicingDueAfterDefault = 'P30D';
4422
3869
  export const createBillingProfileBodyWorkflowInvoicingProgressiveBillingDefault = false;
4423
3870
  export const createBillingProfileBodyWorkflowInvoicingDefaultTaxConfigStripeCodeRegExp = new RegExp('^txcd_\\d{8}$');
4424
3871
  export const createBillingProfileBodyWorkflowPaymentCollectionMethodDefault = 'charge_automatically';
4425
- export const createBillingProfileBodyAppsTaxRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
4426
- export const createBillingProfileBodyAppsInvoicingRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
4427
- export const createBillingProfileBodyAppsPaymentRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
3872
+ export const createBillingProfileBodyWorkflowTaxEnabledDefault = true;
3873
+ export const createBillingProfileBodyWorkflowTaxEnforcedDefault = false;
3874
+ export const createBillingProfileBodyAppsTaxRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
3875
+ export const createBillingProfileBodyAppsInvoicingRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
3876
+ export const createBillingProfileBodyAppsPaymentRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
4428
3877
  export const createBillingProfileBody = zod
4429
3878
  .object({
4430
3879
  apps: zod
4431
3880
  .object({
4432
3881
  invoicing: zod
4433
3882
  .string()
4434
- .regex(createBillingProfileBodyAppsInvoicingRegExpOne)
4435
- .describe('ULID (Universally Unique Lexicographically Sortable Identifier).')
4436
- .or(zod.string())
3883
+ .regex(createBillingProfileBodyAppsInvoicingRegExp)
4437
3884
  .describe('The invoicing app used for this workflow'),
4438
3885
  payment: zod
4439
3886
  .string()
4440
- .regex(createBillingProfileBodyAppsPaymentRegExpOne)
4441
- .describe('ULID (Universally Unique Lexicographically Sortable Identifier).')
4442
- .or(zod.string())
3887
+ .regex(createBillingProfileBodyAppsPaymentRegExp)
4443
3888
  .describe('The payment app used for this workflow'),
4444
3889
  tax: zod
4445
3890
  .string()
4446
- .regex(createBillingProfileBodyAppsTaxRegExpOne)
4447
- .describe('ULID (Universally Unique Lexicographically Sortable Identifier).')
4448
- .or(zod.string())
3891
+ .regex(createBillingProfileBodyAppsTaxRegExp)
4449
3892
  .describe('The tax app used for this workflow'),
4450
3893
  })
4451
3894
  .describe("BillingProfileAppsCreate represents the input for creating a billing profile's apps")
@@ -4585,7 +4028,7 @@ export const createBillingProfileBody = zod
4585
4028
  dueAfter: zod
4586
4029
  .string()
4587
4030
  .default(createBillingProfileBodyWorkflowInvoicingDueAfterDefault)
4588
- .describe('The period after which the invoice is due.'),
4031
+ .describe("The period after which the invoice is due.\nWith some payment solutions it's only applicable for manual collection method."),
4589
4032
  progressiveBilling: zod
4590
4033
  .boolean()
4591
4034
  .optional()
@@ -4605,13 +4048,32 @@ export const createBillingProfileBody = zod
4605
4048
  .describe('BillingWorkflowPaymentSettings represents the payment settings for a billing workflow')
4606
4049
  .optional()
4607
4050
  .describe('The payment settings for this workflow'),
4051
+ tax: zod
4052
+ .object({
4053
+ enabled: zod
4054
+ .boolean()
4055
+ .default(createBillingProfileBodyWorkflowTaxEnabledDefault)
4056
+ .describe('Enable automatic tax calculation when tax is supported by the app.\nFor example, with Stripe Invoicing when enabled, tax is calculated via Stripe Tax.'),
4057
+ enforced: zod
4058
+ .boolean()
4059
+ .optional()
4060
+ .describe('Enforce tax calculation when tax is supported by the app.\nWhen enabled, OpenMeter will not allow to create an invoice without tax calculation.\nEnforcement is different per apps, for example, Stripe app requires customer\nto have a tax location when starting a paid subscription.'),
4061
+ })
4062
+ .describe('BillingWorkflowTaxSettings represents the tax settings for a billing workflow')
4063
+ .optional()
4064
+ .describe('The tax settings for this workflow'),
4608
4065
  })
4609
4066
  .describe('Resource create operation model.')
4610
4067
  .describe('The billing workflow settings for this profile.'),
4611
4068
  })
4612
4069
  .describe('BillingProfileCreate represents the input for creating a billing profile');
4613
4070
  /**
4614
- * Delete a billing profile
4071
+ * Delete a billing profile by id.
4072
+
4073
+ Only such billing profiles can be deleted that are:
4074
+ - not the default one
4075
+ - not pinned to any customer using customer overrides
4076
+ - only have finalized invoices
4615
4077
  * @summary Delete a billing profile
4616
4078
  */
4617
4079
  export const deleteBillingProfilePathIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
@@ -4619,7 +4081,11 @@ export const deleteBillingProfileParams = zod.object({
4619
4081
  id: zod.string().regex(deleteBillingProfilePathIdRegExp),
4620
4082
  });
4621
4083
  /**
4622
- * Get a billing profile by ID
4084
+ * Get a billing profile by id.
4085
+
4086
+ The expand option can be used to include additional information (besides the billing profile)
4087
+ in the response. For example by adding the expand=apps option the apps used by the billing profile
4088
+ will be included in the response.
4623
4089
  * @summary Get a billing profile
4624
4090
  */
4625
4091
  export const getBillingProfilePathIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
@@ -4634,7 +4100,10 @@ export const getBillingProfileQueryParams = zod.object({
4634
4100
  .optional(),
4635
4101
  });
4636
4102
  /**
4637
- * Update a billing profile
4103
+ * Update a billing profile by id.
4104
+
4105
+ The apps field cannot be updated directly, if an app change is desired a new
4106
+ profile should be created.
4638
4107
  * @summary Update a billing profile
4639
4108
  */
4640
4109
  export const updateBillingProfilePathIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
@@ -4651,13 +4120,15 @@ export const updateBillingProfileBodySupplierAddressesMax = 1;
4651
4120
  export const updateBillingProfileBodyWorkflowCollectionAlignmentDefault = {
4652
4121
  type: 'subscription',
4653
4122
  };
4654
- export const updateBillingProfileBodyWorkflowCollectionIntervalDefault = 'PT2H';
4123
+ export const updateBillingProfileBodyWorkflowCollectionIntervalDefault = 'PT1H';
4655
4124
  export const updateBillingProfileBodyWorkflowInvoicingAutoAdvanceDefault = true;
4656
4125
  export const updateBillingProfileBodyWorkflowInvoicingDraftPeriodDefault = 'P0D';
4657
- export const updateBillingProfileBodyWorkflowInvoicingDueAfterDefault = 'P1W';
4126
+ export const updateBillingProfileBodyWorkflowInvoicingDueAfterDefault = 'P30D';
4658
4127
  export const updateBillingProfileBodyWorkflowInvoicingProgressiveBillingDefault = false;
4659
4128
  export const updateBillingProfileBodyWorkflowInvoicingDefaultTaxConfigStripeCodeRegExp = new RegExp('^txcd_\\d{8}$');
4660
4129
  export const updateBillingProfileBodyWorkflowPaymentCollectionMethodDefault = 'charge_automatically';
4130
+ export const updateBillingProfileBodyWorkflowTaxEnabledDefault = true;
4131
+ export const updateBillingProfileBodyWorkflowTaxEnforcedDefault = false;
4661
4132
  export const updateBillingProfileBody = zod
4662
4133
  .object({
4663
4134
  default: zod.boolean().describe('Is this the default profile?'),
@@ -4795,7 +4266,7 @@ export const updateBillingProfileBody = zod
4795
4266
  dueAfter: zod
4796
4267
  .string()
4797
4268
  .default(updateBillingProfileBodyWorkflowInvoicingDueAfterDefault)
4798
- .describe('The period after which the invoice is due.'),
4269
+ .describe("The period after which the invoice is due.\nWith some payment solutions it's only applicable for manual collection method."),
4799
4270
  progressiveBilling: zod
4800
4271
  .boolean()
4801
4272
  .optional()
@@ -4815,6 +4286,20 @@ export const updateBillingProfileBody = zod
4815
4286
  .describe('BillingWorkflowPaymentSettings represents the payment settings for a billing workflow')
4816
4287
  .optional()
4817
4288
  .describe('The payment settings for this workflow'),
4289
+ tax: zod
4290
+ .object({
4291
+ enabled: zod
4292
+ .boolean()
4293
+ .default(updateBillingProfileBodyWorkflowTaxEnabledDefault)
4294
+ .describe('Enable automatic tax calculation when tax is supported by the app.\nFor example, with Stripe Invoicing when enabled, tax is calculated via Stripe Tax.'),
4295
+ enforced: zod
4296
+ .boolean()
4297
+ .optional()
4298
+ .describe('Enforce tax calculation when tax is supported by the app.\nWhen enabled, OpenMeter will not allow to create an invoice without tax calculation.\nEnforcement is different per apps, for example, Stripe app requires customer\nto have a tax location when starting a paid subscription.'),
4299
+ })
4300
+ .describe('BillingWorkflowTaxSettings represents the tax settings for a billing workflow')
4301
+ .optional()
4302
+ .describe('The tax settings for this workflow'),
4818
4303
  })
4819
4304
  .describe('BillingWorkflow represents the settings for a billing workflow.')
4820
4305
  .describe('The billing workflow settings for this profile.'),
@@ -5177,9 +4662,6 @@ export const upsertCustomerAppDataBodyItem = zod
5177
4662
  createdAt: zod
5178
4663
  .date()
5179
4664
  .describe('Timestamp of when the resource was created.'),
5180
- default: zod
5181
- .boolean()
5182
- .describe('Default for the app type\nOnly one app of each type can be default.'),
5183
4665
  deletedAt: zod
5184
4666
  .date()
5185
4667
  .optional()
@@ -5276,9 +4758,6 @@ export const upsertCustomerAppDataBodyItem = zod
5276
4758
  createdAt: zod
5277
4759
  .date()
5278
4760
  .describe('Timestamp of when the resource was created.'),
5279
- default: zod
5280
- .boolean()
5281
- .describe('Default for the app type\nOnly one app of each type can be default.'),
5282
4761
  deletedAt: zod
5283
4762
  .date()
5284
4763
  .optional()
@@ -5399,7 +4878,7 @@ export const deleteCustomerAppDataParams = zod.object({
5399
4878
  });
5400
4879
  /**
5401
4880
  * Checks customer access to a given feature (by key). All entitlement types share the hasAccess property in their value response, but multiple other properties are returned based on the entitlement type.
5402
- * @summary Get entitlement value
4881
+ * @summary Get customer entitlement value
5403
4882
  */
5404
4883
  export const getCustomerEntitlementValuePathCustomerIdOrKeyMax = 64;
5405
4884
  export const getCustomerEntitlementValuePathCustomerIdOrKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
@@ -5850,12 +5329,19 @@ export const marketplaceAppInstallParams = zod.object({
5850
5329
  .enum(['stripe', 'sandbox', 'custom_invoicing'])
5851
5330
  .describe('The type of the app to install.'),
5852
5331
  });
5853
- export const marketplaceAppInstallBody = zod.object({
5332
+ export const marketplaceAppInstallBodyCreateBillingProfileDefault = true;
5333
+ export const marketplaceAppInstallBody = zod
5334
+ .object({
5335
+ createBillingProfile: zod
5336
+ .boolean()
5337
+ .default(marketplaceAppInstallBodyCreateBillingProfileDefault)
5338
+ .describe('If true, a billing profile will be created for the app.\nThe Stripe app will be also set as the default billing profile if the current default is a Sandbox app.'),
5854
5339
  name: zod
5855
5340
  .string()
5856
5341
  .optional()
5857
- .describe("Name of the application to install.\n\nIf not set defaults to the marketplace item's description."),
5858
- });
5342
+ .describe("Name of the application to install.\n\nIf name is not provided defaults to the marketplace listing's name."),
5343
+ })
5344
+ .describe('Marketplace install request payload.');
5859
5345
  /**
5860
5346
  * Install an marketplace app via API Key.
5861
5347
  * @summary Install app via API key
@@ -5865,14 +5351,19 @@ export const marketplaceAppAPIKeyInstallParams = zod.object({
5865
5351
  .enum(['stripe', 'sandbox', 'custom_invoicing'])
5866
5352
  .describe('The type of the app to install.'),
5867
5353
  });
5354
+ export const marketplaceAppAPIKeyInstallBodyCreateBillingProfileDefault = true;
5868
5355
  export const marketplaceAppAPIKeyInstallBody = zod.object({
5869
5356
  apiKey: zod
5870
5357
  .string()
5871
5358
  .describe('The API key for the provider.\nFor example, the Stripe API key.'),
5359
+ createBillingProfile: zod
5360
+ .boolean()
5361
+ .default(marketplaceAppAPIKeyInstallBodyCreateBillingProfileDefault)
5362
+ .describe('If true, a billing profile will be created for the app.\nThe Stripe app will be also set as the default billing profile if the current default is a Sandbox app.'),
5872
5363
  name: zod
5873
5364
  .string()
5874
5365
  .optional()
5875
- .describe("Name of the application to install.\n\nIf not set defaults to the marketplace item's description."),
5366
+ .describe("Name of the application to install.\n\nIf name is not provided defaults to the marketplace listing's name."),
5876
5367
  });
5877
5368
  /**
5878
5369
  * Install an app via OAuth.
@@ -5960,7 +5451,7 @@ export const createMeterBodySlugRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$'
5960
5451
  export const createMeterBody = zod
5961
5452
  .object({
5962
5453
  aggregation: zod
5963
- .enum(['SUM', 'COUNT', 'UNIQUE_COUNT', 'AVG', 'MIN', 'MAX'])
5454
+ .enum(['SUM', 'COUNT', 'UNIQUE_COUNT', 'AVG', 'MIN', 'MAX', 'LATEST'])
5964
5455
  .describe('The aggregation type to use for the meter.')
5965
5456
  .describe('The aggregation type to use for the meter.'),
5966
5457
  description: zod
@@ -6085,38 +5576,95 @@ export const queryMeterQueryParams = zod.object({
6085
5576
  clientId: zod
6086
5577
  .string()
6087
5578
  .min(1)
6088
- .max(queryMeterQueryClientIdMax)
5579
+ .max(queryMeterQueryClientIdMax)
5580
+ .optional()
5581
+ .describe('Client ID\nUseful to track progress of a query.'),
5582
+ filterGroupBy: zod
5583
+ .record(zod.string(), zod.string())
5584
+ .optional()
5585
+ .describe('Simple filter for group bys with exact match.\n\nFor example: ?filterGroupBy[vendor]=openai&filterGroupBy[model]=gpt-4-turbo'),
5586
+ from: zod
5587
+ .date()
5588
+ .optional()
5589
+ .describe('Start date-time in RFC 3339 format.\n\nInclusive.\n\nFor example: ?from=2025-01-01T00%3A00%3A00.000Z'),
5590
+ groupBy: zod
5591
+ .array(zod.string())
5592
+ .optional()
5593
+ .describe('If not specified a single aggregate will be returned for each subject and time window.\n`subject` is a reserved group by value.\n\nFor example: ?groupBy=subject&groupBy=model'),
5594
+ subject: zod
5595
+ .array(zod.string())
5596
+ .optional()
5597
+ .describe('Filtering by multiple subjects.\n\nFor example: ?subject=customer-1&subject=customer-2'),
5598
+ to: zod
5599
+ .date()
5600
+ .optional()
5601
+ .describe('End date-time in RFC 3339 format.\n\nInclusive.\n\nFor example: ?to=2025-02-01T00%3A00%3A00.000Z'),
5602
+ windowSize: zod
5603
+ .enum(['MINUTE', 'HOUR', 'DAY', 'MONTH'])
5604
+ .optional()
5605
+ .describe('If not specified, a single usage aggregate will be returned for the entirety of the specified period for each subject and group.\n\nFor example: ?windowSize=DAY'),
5606
+ windowTimeZone: zod
5607
+ .string()
5608
+ .default(queryMeterQueryWindowTimeZoneDefault)
5609
+ .describe('The value is the name of the time zone as defined in the IANA Time Zone Database (http://www.iana.org/time-zones).\nIf not specified, the UTC timezone will be used.\n\nFor example: ?windowTimeZone=UTC'),
5610
+ });
5611
+ /**
5612
+ * @summary Query meter
5613
+ */
5614
+ export const queryMeterPostPathMeterIdOrSlugMax = 64;
5615
+ export const queryMeterPostPathMeterIdOrSlugRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
5616
+ export const queryMeterPostParams = zod.object({
5617
+ meterIdOrSlug: zod
5618
+ .string()
5619
+ .min(1)
5620
+ .max(queryMeterPostPathMeterIdOrSlugMax)
5621
+ .regex(queryMeterPostPathMeterIdOrSlugRegExp),
5622
+ });
5623
+ export const queryMeterPostBodyClientIdMax = 36;
5624
+ export const queryMeterPostBodyWindowTimeZoneDefault = 'UTC';
5625
+ export const queryMeterPostBodySubjectMax = 100;
5626
+ export const queryMeterPostBodyGroupByMax = 100;
5627
+ export const queryMeterPostBody = zod
5628
+ .object({
5629
+ clientId: zod
5630
+ .string()
5631
+ .min(1)
5632
+ .max(queryMeterPostBodyClientIdMax)
6089
5633
  .optional()
6090
5634
  .describe('Client ID\nUseful to track progress of a query.'),
6091
5635
  filterGroupBy: zod
6092
- .record(zod.string(), zod.string())
5636
+ .record(zod.string(), zod.array(zod.string()))
6093
5637
  .optional()
6094
- .describe('Simple filter for group bys with exact match.\n\nFor example: ?filterGroupBy[vendor]=openai&filterGroupBy[model]=gpt-4-turbo'),
5638
+ .describe('Simple filter for group bys with exact match.'),
6095
5639
  from: zod
6096
5640
  .date()
6097
5641
  .optional()
6098
- .describe('Start date-time in RFC 3339 format.\n\nInclusive.\n\nFor example: ?from=2025-01-01T00%3A00%3A00.000Z'),
5642
+ .describe('Start date-time in RFC 3339 format.\n\nInclusive.'),
6099
5643
  groupBy: zod
6100
5644
  .array(zod.string())
5645
+ .max(queryMeterPostBodyGroupByMax)
6101
5646
  .optional()
6102
- .describe('If not specified a single aggregate will be returned for each subject and time window.\n`subject` is a reserved group by value.\n\nFor example: ?groupBy=subject&groupBy=model'),
5647
+ .describe('If not specified a single aggregate will be returned for each subject and time window.\n`subject` is a reserved group by value.'),
6103
5648
  subject: zod
6104
5649
  .array(zod.string())
5650
+ .max(queryMeterPostBodySubjectMax)
6105
5651
  .optional()
6106
- .describe('Filtering by multiple subjects.\n\nFor example: ?subject=customer-1&subject=customer-2'),
5652
+ .describe('Filtering by multiple subjects.'),
6107
5653
  to: zod
6108
5654
  .date()
6109
5655
  .optional()
6110
- .describe('End date-time in RFC 3339 format.\n\nInclusive.\n\nFor example: ?to=2025-02-01T00%3A00%3A00.000Z'),
5656
+ .describe('End date-time in RFC 3339 format.\n\nInclusive.'),
6111
5657
  windowSize: zod
6112
- .enum(['MINUTE', 'HOUR', 'DAY'])
5658
+ .enum(['MINUTE', 'HOUR', 'DAY', 'MONTH'])
5659
+ .describe('Aggregation window size.')
6113
5660
  .optional()
6114
- .describe('If not specified, a single usage aggregate will be returned for the entirety of the specified period for each subject and group.\n\nFor example: ?windowSize=DAY'),
5661
+ .describe('If not specified, a single usage aggregate will be returned for the entirety of the specified period for each subject and group.'),
6115
5662
  windowTimeZone: zod
6116
5663
  .string()
6117
- .default(queryMeterQueryWindowTimeZoneDefault)
6118
- .describe('The value is the name of the time zone as defined in the IANA Time Zone Database (http://www.iana.org/time-zones).\nIf not specified, the UTC timezone will be used.\n\nFor example: ?windowTimeZone=UTC'),
6119
- });
5664
+ .default(queryMeterPostBodyWindowTimeZoneDefault)
5665
+ .describe('The value is the name of the time zone as defined in the IANA Time Zone Database (http://www.iana.org/time-zones).\nIf not specified, the UTC timezone will be used.'),
5666
+ })
5667
+ .describe('A meter query request.');
6120
5668
  /**
6121
5669
  * List subjects for a meter.
6122
5670
  * @summary List meter subjects
@@ -6364,50 +5912,126 @@ export const createNotificationRuleBodyThresholdsMax = 10;
6364
5912
  export const createNotificationRuleBodyChannelsItemRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
6365
5913
  export const createNotificationRuleBodyFeaturesItemMax = 64;
6366
5914
  export const createNotificationRuleBodyFeaturesItemRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
5915
+ export const createNotificationRuleBodyDisabledDefaultOne = false;
5916
+ export const createNotificationRuleBodyChannelsItemRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
5917
+ export const createNotificationRuleBodyFeaturesItemMaxOne = 64;
5918
+ export const createNotificationRuleBodyFeaturesItemRegExpOne = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
5919
+ export const createNotificationRuleBodyDisabledDefaultTwo = false;
5920
+ export const createNotificationRuleBodyChannelsItemRegExpTwo = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
5921
+ export const createNotificationRuleBodyDisabledDefaultThree = false;
5922
+ export const createNotificationRuleBodyChannelsItemRegExpThree = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
6367
5923
  export const createNotificationRuleBody = zod
6368
- .object({
6369
- channels: zod
6370
- .array(zod
6371
- .string()
6372
- .regex(createNotificationRuleBodyChannelsItemRegExp)
6373
- .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'))
6374
- .min(1)
6375
- .describe('List of notification channels the rule is applied to.'),
6376
- disabled: zod
6377
- .boolean()
6378
- .optional()
6379
- .describe('Whether the rule is disabled or not.'),
6380
- features: zod
6381
- .array(zod
6382
- .string()
6383
- .min(1)
6384
- .max(createNotificationRuleBodyFeaturesItemMax)
6385
- .regex(createNotificationRuleBodyFeaturesItemRegExp)
6386
- .describe('ULID (Universally Unique Lexicographically Sortable Identifier).\nA key is a unique string that is used to identify a resource.\n\nTODO: this is a temporary solution to support both ULID and Key in the same spec for codegen.'))
6387
- .min(1)
6388
- .optional()
6389
- .describe('Optional field for defining the scope of notification by feature. It may contain features by id or key.'),
6390
- name: zod
6391
- .string()
6392
- .describe('The user friendly name of the notification rule.'),
6393
- thresholds: zod
6394
- .array(zod
5924
+ .discriminatedUnion('type', [
5925
+ zod
6395
5926
  .object({
6396
- type: zod
6397
- .enum(['PERCENT', 'NUMBER'])
6398
- .describe('Type of the rule in the balance threshold specification.')
6399
- .describe('Type of the threshold.'),
6400
- value: zod.number().describe('Value of the threshold.'),
5927
+ channels: zod
5928
+ .array(zod
5929
+ .string()
5930
+ .regex(createNotificationRuleBodyChannelsItemRegExp)
5931
+ .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'))
5932
+ .min(1)
5933
+ .describe('List of notification channels the rule is applied to.'),
5934
+ disabled: zod
5935
+ .boolean()
5936
+ .optional()
5937
+ .describe('Whether the rule is disabled or not.'),
5938
+ features: zod
5939
+ .array(zod
5940
+ .string()
5941
+ .min(1)
5942
+ .max(createNotificationRuleBodyFeaturesItemMax)
5943
+ .regex(createNotificationRuleBodyFeaturesItemRegExp)
5944
+ .describe('ULID (Universally Unique Lexicographically Sortable Identifier).\nA key is a unique string that is used to identify a resource.\n\nTODO: this is a temporary solution to support both ULID and Key in the same spec for codegen.'))
5945
+ .min(1)
5946
+ .optional()
5947
+ .describe('Optional field for defining the scope of notification by feature. It may contain features by id or key.'),
5948
+ name: zod
5949
+ .string()
5950
+ .describe('The user friendly name of the notification rule.'),
5951
+ thresholds: zod
5952
+ .array(zod
5953
+ .object({
5954
+ type: zod
5955
+ .enum(['PERCENT', 'NUMBER'])
5956
+ .describe('Type of the rule in the balance threshold specification.')
5957
+ .describe('Type of the threshold.'),
5958
+ value: zod.number().describe('Value of the threshold.'),
5959
+ })
5960
+ .describe('Threshold value with multiple supported types.'))
5961
+ .min(1)
5962
+ .max(createNotificationRuleBodyThresholdsMax)
5963
+ .describe('List of thresholds the rule suppose to be triggered.'),
5964
+ type: zod.enum(['entitlements.balance.threshold']),
6401
5965
  })
6402
- .describe('Threshold value with multiple supported types.'))
6403
- .min(1)
6404
- .max(createNotificationRuleBodyThresholdsMax)
6405
- .describe('List of thresholds the rule suppose to be triggered.'),
6406
- type: zod
6407
- .enum(['entitlements.balance.threshold'])
6408
- .describe('Notification rule type.'),
6409
- })
6410
- .describe('Request with input parameters for creating new notification rule with entitlements.balance.threashold type.')
5966
+ .describe('Request with input parameters for creating new notification rule with entitlements.balance.threshold type.'),
5967
+ zod
5968
+ .object({
5969
+ channels: zod
5970
+ .array(zod
5971
+ .string()
5972
+ .regex(createNotificationRuleBodyChannelsItemRegExpOne)
5973
+ .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'))
5974
+ .min(1)
5975
+ .describe('List of notification channels the rule is applied to.'),
5976
+ disabled: zod
5977
+ .boolean()
5978
+ .optional()
5979
+ .describe('Whether the rule is disabled or not.'),
5980
+ features: zod
5981
+ .array(zod
5982
+ .string()
5983
+ .min(1)
5984
+ .max(createNotificationRuleBodyFeaturesItemMaxOne)
5985
+ .regex(createNotificationRuleBodyFeaturesItemRegExpOne)
5986
+ .describe('ULID (Universally Unique Lexicographically Sortable Identifier).\nA key is a unique string that is used to identify a resource.\n\nTODO: this is a temporary solution to support both ULID and Key in the same spec for codegen.'))
5987
+ .min(1)
5988
+ .optional()
5989
+ .describe('Optional field for defining the scope of notification by feature. It may contain features by id or key.'),
5990
+ name: zod
5991
+ .string()
5992
+ .describe('The user friendly name of the notification rule.'),
5993
+ type: zod.enum(['entitlements.reset']),
5994
+ })
5995
+ .describe('Request with input parameters for creating new notification rule with entitlements.reset type.'),
5996
+ zod
5997
+ .object({
5998
+ channels: zod
5999
+ .array(zod
6000
+ .string()
6001
+ .regex(createNotificationRuleBodyChannelsItemRegExpTwo)
6002
+ .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'))
6003
+ .min(1)
6004
+ .describe('List of notification channels the rule is applied to.'),
6005
+ disabled: zod
6006
+ .boolean()
6007
+ .optional()
6008
+ .describe('Whether the rule is disabled or not.'),
6009
+ name: zod
6010
+ .string()
6011
+ .describe('The user friendly name of the notification rule.'),
6012
+ type: zod.enum(['invoice.created']),
6013
+ })
6014
+ .describe('Request with input parameters for creating new notification rule with invoice.created type.'),
6015
+ zod
6016
+ .object({
6017
+ channels: zod
6018
+ .array(zod
6019
+ .string()
6020
+ .regex(createNotificationRuleBodyChannelsItemRegExpThree)
6021
+ .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'))
6022
+ .min(1)
6023
+ .describe('List of notification channels the rule is applied to.'),
6024
+ disabled: zod
6025
+ .boolean()
6026
+ .optional()
6027
+ .describe('Whether the rule is disabled or not.'),
6028
+ name: zod
6029
+ .string()
6030
+ .describe('The user friendly name of the notification rule.'),
6031
+ type: zod.enum(['invoice.updated']),
6032
+ })
6033
+ .describe('Request with input parameters for creating new notification rule with invoice.updated type.'),
6034
+ ])
6411
6035
  .describe('Union type for requests creating new notification rule with certain type.');
6412
6036
  /**
6413
6037
  * Update notification rule.
@@ -6422,50 +6046,126 @@ export const updateNotificationRuleBodyThresholdsMax = 10;
6422
6046
  export const updateNotificationRuleBodyChannelsItemRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
6423
6047
  export const updateNotificationRuleBodyFeaturesItemMax = 64;
6424
6048
  export const updateNotificationRuleBodyFeaturesItemRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
6049
+ export const updateNotificationRuleBodyDisabledDefaultOne = false;
6050
+ export const updateNotificationRuleBodyChannelsItemRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
6051
+ export const updateNotificationRuleBodyFeaturesItemMaxOne = 64;
6052
+ export const updateNotificationRuleBodyFeaturesItemRegExpOne = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
6053
+ export const updateNotificationRuleBodyDisabledDefaultTwo = false;
6054
+ export const updateNotificationRuleBodyChannelsItemRegExpTwo = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
6055
+ export const updateNotificationRuleBodyDisabledDefaultThree = false;
6056
+ export const updateNotificationRuleBodyChannelsItemRegExpThree = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
6425
6057
  export const updateNotificationRuleBody = zod
6426
- .object({
6427
- channels: zod
6428
- .array(zod
6429
- .string()
6430
- .regex(updateNotificationRuleBodyChannelsItemRegExp)
6431
- .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'))
6432
- .min(1)
6433
- .describe('List of notification channels the rule is applied to.'),
6434
- disabled: zod
6435
- .boolean()
6436
- .optional()
6437
- .describe('Whether the rule is disabled or not.'),
6438
- features: zod
6439
- .array(zod
6440
- .string()
6441
- .min(1)
6442
- .max(updateNotificationRuleBodyFeaturesItemMax)
6443
- .regex(updateNotificationRuleBodyFeaturesItemRegExp)
6444
- .describe('ULID (Universally Unique Lexicographically Sortable Identifier).\nA key is a unique string that is used to identify a resource.\n\nTODO: this is a temporary solution to support both ULID and Key in the same spec for codegen.'))
6445
- .min(1)
6446
- .optional()
6447
- .describe('Optional field for defining the scope of notification by feature. It may contain features by id or key.'),
6448
- name: zod
6449
- .string()
6450
- .describe('The user friendly name of the notification rule.'),
6451
- thresholds: zod
6452
- .array(zod
6058
+ .discriminatedUnion('type', [
6059
+ zod
6060
+ .object({
6061
+ channels: zod
6062
+ .array(zod
6063
+ .string()
6064
+ .regex(updateNotificationRuleBodyChannelsItemRegExp)
6065
+ .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'))
6066
+ .min(1)
6067
+ .describe('List of notification channels the rule is applied to.'),
6068
+ disabled: zod
6069
+ .boolean()
6070
+ .optional()
6071
+ .describe('Whether the rule is disabled or not.'),
6072
+ features: zod
6073
+ .array(zod
6074
+ .string()
6075
+ .min(1)
6076
+ .max(updateNotificationRuleBodyFeaturesItemMax)
6077
+ .regex(updateNotificationRuleBodyFeaturesItemRegExp)
6078
+ .describe('ULID (Universally Unique Lexicographically Sortable Identifier).\nA key is a unique string that is used to identify a resource.\n\nTODO: this is a temporary solution to support both ULID and Key in the same spec for codegen.'))
6079
+ .min(1)
6080
+ .optional()
6081
+ .describe('Optional field for defining the scope of notification by feature. It may contain features by id or key.'),
6082
+ name: zod
6083
+ .string()
6084
+ .describe('The user friendly name of the notification rule.'),
6085
+ thresholds: zod
6086
+ .array(zod
6087
+ .object({
6088
+ type: zod
6089
+ .enum(['PERCENT', 'NUMBER'])
6090
+ .describe('Type of the rule in the balance threshold specification.')
6091
+ .describe('Type of the threshold.'),
6092
+ value: zod.number().describe('Value of the threshold.'),
6093
+ })
6094
+ .describe('Threshold value with multiple supported types.'))
6095
+ .min(1)
6096
+ .max(updateNotificationRuleBodyThresholdsMax)
6097
+ .describe('List of thresholds the rule suppose to be triggered.'),
6098
+ type: zod.enum(['entitlements.balance.threshold']),
6099
+ })
6100
+ .describe('Request with input parameters for creating new notification rule with entitlements.balance.threshold type.'),
6101
+ zod
6453
6102
  .object({
6454
- type: zod
6455
- .enum(['PERCENT', 'NUMBER'])
6456
- .describe('Type of the rule in the balance threshold specification.')
6457
- .describe('Type of the threshold.'),
6458
- value: zod.number().describe('Value of the threshold.'),
6103
+ channels: zod
6104
+ .array(zod
6105
+ .string()
6106
+ .regex(updateNotificationRuleBodyChannelsItemRegExpOne)
6107
+ .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'))
6108
+ .min(1)
6109
+ .describe('List of notification channels the rule is applied to.'),
6110
+ disabled: zod
6111
+ .boolean()
6112
+ .optional()
6113
+ .describe('Whether the rule is disabled or not.'),
6114
+ features: zod
6115
+ .array(zod
6116
+ .string()
6117
+ .min(1)
6118
+ .max(updateNotificationRuleBodyFeaturesItemMaxOne)
6119
+ .regex(updateNotificationRuleBodyFeaturesItemRegExpOne)
6120
+ .describe('ULID (Universally Unique Lexicographically Sortable Identifier).\nA key is a unique string that is used to identify a resource.\n\nTODO: this is a temporary solution to support both ULID and Key in the same spec for codegen.'))
6121
+ .min(1)
6122
+ .optional()
6123
+ .describe('Optional field for defining the scope of notification by feature. It may contain features by id or key.'),
6124
+ name: zod
6125
+ .string()
6126
+ .describe('The user friendly name of the notification rule.'),
6127
+ type: zod.enum(['entitlements.reset']),
6459
6128
  })
6460
- .describe('Threshold value with multiple supported types.'))
6461
- .min(1)
6462
- .max(updateNotificationRuleBodyThresholdsMax)
6463
- .describe('List of thresholds the rule suppose to be triggered.'),
6464
- type: zod
6465
- .enum(['entitlements.balance.threshold'])
6466
- .describe('Notification rule type.'),
6467
- })
6468
- .describe('Request with input parameters for creating new notification rule with entitlements.balance.threashold type.')
6129
+ .describe('Request with input parameters for creating new notification rule with entitlements.reset type.'),
6130
+ zod
6131
+ .object({
6132
+ channels: zod
6133
+ .array(zod
6134
+ .string()
6135
+ .regex(updateNotificationRuleBodyChannelsItemRegExpTwo)
6136
+ .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'))
6137
+ .min(1)
6138
+ .describe('List of notification channels the rule is applied to.'),
6139
+ disabled: zod
6140
+ .boolean()
6141
+ .optional()
6142
+ .describe('Whether the rule is disabled or not.'),
6143
+ name: zod
6144
+ .string()
6145
+ .describe('The user friendly name of the notification rule.'),
6146
+ type: zod.enum(['invoice.created']),
6147
+ })
6148
+ .describe('Request with input parameters for creating new notification rule with invoice.created type.'),
6149
+ zod
6150
+ .object({
6151
+ channels: zod
6152
+ .array(zod
6153
+ .string()
6154
+ .regex(updateNotificationRuleBodyChannelsItemRegExpThree)
6155
+ .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'))
6156
+ .min(1)
6157
+ .describe('List of notification channels the rule is applied to.'),
6158
+ disabled: zod
6159
+ .boolean()
6160
+ .optional()
6161
+ .describe('Whether the rule is disabled or not.'),
6162
+ name: zod
6163
+ .string()
6164
+ .describe('The user friendly name of the notification rule.'),
6165
+ type: zod.enum(['invoice.updated']),
6166
+ })
6167
+ .describe('Request with input parameters for creating new notification rule with invoice.updated type.'),
6168
+ ])
6469
6169
  .describe('Union type for requests creating new notification rule with certain type.');
6470
6170
  /**
6471
6171
  * Get a notification rule by id.
@@ -6493,28 +6193,6 @@ export const testNotificationRulePathRuleIdRegExp = new RegExp('^[0-7][0-9A-HJKM
6493
6193
  export const testNotificationRuleParams = zod.object({
6494
6194
  ruleId: zod.string().regex(testNotificationRulePathRuleIdRegExp),
6495
6195
  });
6496
- /**
6497
- * Callback endpoint used by Svix to notify about operational events.
6498
- * @summary Receive Svix operational events
6499
- */
6500
- export const receiveSvixOperationalEventBody = zod
6501
- .object({
6502
- data: zod
6503
- .record(zod.string(), zod.string())
6504
- .describe('The payload of the Svix operational webhook request.'),
6505
- type: zod
6506
- .enum([
6507
- 'endpoint.created',
6508
- 'endpoint.deleted',
6509
- 'endpoint.disabled',
6510
- 'endpoint.updated',
6511
- 'message.attempt.exhausted',
6512
- 'message.attempt.failing',
6513
- 'message.attempt.recovered',
6514
- ])
6515
- .describe('The type of the Svix operational webhook request.'),
6516
- })
6517
- .describe('Operational webhook reqeuest sent by Svix.');
6518
6196
  /**
6519
6197
  * List all plans.
6520
6198
  * @summary List plans
@@ -6598,6 +6276,12 @@ export const createPlanBodyCurrencyMinOne = 3;
6598
6276
  export const createPlanBodyCurrencyMaxOne = 3;
6599
6277
  export const createPlanBodyCurrencyRegExpOne = new RegExp('^[A-Z]{3}$');
6600
6278
  export const createPlanBodyCurrencyDefault = 'USD';
6279
+ export const createPlanBodyProRatingConfigEnabledDefault = true;
6280
+ export const createPlanBodyProRatingConfigModeDefault = 'prorate_prices';
6281
+ export const createPlanBodyProRatingConfigDefault = {
6282
+ enabled: true,
6283
+ mode: 'prorate_prices',
6284
+ };
6601
6285
  export const createPlanBodyPhasesItemKeyMax = 64;
6602
6286
  export const createPlanBodyPhasesItemKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
6603
6287
  export const createPlanBodyPhasesItemNameMax = 256;
@@ -6660,6 +6344,9 @@ export const createPlanBody = zod
6660
6344
  .describe('Alignment configuration for a plan or subscription.')
6661
6345
  .optional()
6662
6346
  .describe('Alignment configuration for the plan.'),
6347
+ billingCadence: zod
6348
+ .string()
6349
+ .describe('The default billing cadence for subscriptions using this plan.\nDefines how often customers are billed using ISO8601 duration format.\nExamples: \"P1M\" (monthly), \"P3M\" (quarterly), \"P1Y\" (annually).'),
6663
6350
  currency: zod
6664
6351
  .string()
6665
6352
  .min(createPlanBodyCurrencyMinOne)
@@ -7209,6 +6896,19 @@ export const createPlanBody = zod
7209
6896
  .describe("The plan phase or pricing ramp allows changing a plan's rate cards over time as a subscription progresses."))
7210
6897
  .min(1)
7211
6898
  .describe("The plan phase or pricing ramp allows changing a plan's rate cards over time as a subscription progresses.\nA phase switch occurs only at the end of a billing period, ensuring that a single subscription invoice will not include charges from different phase prices."),
6899
+ proRatingConfig: zod
6900
+ .object({
6901
+ enabled: zod
6902
+ .boolean()
6903
+ .describe('Whether pro-rating is enabled for this plan.'),
6904
+ mode: zod
6905
+ .enum(['prorate_prices'])
6906
+ .describe('Pro-rating mode options for handling billing period changes.')
6907
+ .describe('How to handle pro-rating for billing period changes.'),
6908
+ })
6909
+ .describe('Configuration for pro-rating behavior.')
6910
+ .default(createPlanBodyProRatingConfigDefault)
6911
+ .describe('Default pro-rating configuration for subscriptions using this plan.'),
7212
6912
  })
7213
6913
  .describe('Resource create operation model.');
7214
6914
  /**
@@ -7236,6 +6936,12 @@ export const updatePlanParams = zod.object({
7236
6936
  });
7237
6937
  export const updatePlanBodyNameMax = 256;
7238
6938
  export const updatePlanBodyDescriptionMax = 1024;
6939
+ export const updatePlanBodyProRatingConfigEnabledDefault = true;
6940
+ export const updatePlanBodyProRatingConfigModeDefault = 'prorate_prices';
6941
+ export const updatePlanBodyProRatingConfigDefault = {
6942
+ enabled: true,
6943
+ mode: 'prorate_prices',
6944
+ };
7239
6945
  export const updatePlanBodyPhasesItemKeyMax = 64;
7240
6946
  export const updatePlanBodyPhasesItemKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
7241
6947
  export const updatePlanBodyPhasesItemNameMax = 256;
@@ -7298,6 +7004,9 @@ export const updatePlanBody = zod
7298
7004
  .describe('Alignment configuration for a plan or subscription.')
7299
7005
  .optional()
7300
7006
  .describe('Alignment configuration for the plan.'),
7007
+ billingCadence: zod
7008
+ .string()
7009
+ .describe('The default billing cadence for subscriptions using this plan.\nDefines how often customers are billed using ISO8601 duration format.\nExamples: \"P1M\" (monthly), \"P3M\" (quarterly), \"P1Y\" (annually).'),
7301
7010
  description: zod
7302
7011
  .string()
7303
7012
  .max(updatePlanBodyDescriptionMax)
@@ -7834,6 +7543,19 @@ export const updatePlanBody = zod
7834
7543
  .describe("The plan phase or pricing ramp allows changing a plan's rate cards over time as a subscription progresses."))
7835
7544
  .min(1)
7836
7545
  .describe("The plan phase or pricing ramp allows changing a plan's rate cards over time as a subscription progresses.\nA phase switch occurs only at the end of a billing period, ensuring that a single subscription invoice will not include charges from different phase prices."),
7546
+ proRatingConfig: zod
7547
+ .object({
7548
+ enabled: zod
7549
+ .boolean()
7550
+ .describe('Whether pro-rating is enabled for this plan.'),
7551
+ mode: zod
7552
+ .enum(['prorate_prices'])
7553
+ .describe('Pro-rating mode options for handling billing period changes.')
7554
+ .describe('How to handle pro-rating for billing period changes.'),
7555
+ })
7556
+ .describe('Configuration for pro-rating behavior.')
7557
+ .default(updatePlanBodyProRatingConfigDefault)
7558
+ .describe('Default pro-rating configuration for subscriptions using this plan.'),
7837
7559
  })
7838
7560
  .describe('Resource update operation model.');
7839
7561
  /**
@@ -7939,14 +7661,10 @@ export const createPlanAddonParams = zod.object({
7939
7661
  export const createPlanAddonBodyAddonIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
7940
7662
  export const createPlanAddonBody = zod
7941
7663
  .object({
7942
- addon: zod
7943
- .object({
7944
- id: zod
7945
- .string()
7946
- .regex(createPlanAddonBodyAddonIdRegExp)
7947
- .describe('The ID of the add-on.'),
7948
- })
7949
- .describe('The add-on to create.'),
7664
+ addonId: zod
7665
+ .string()
7666
+ .regex(createPlanAddonBodyAddonIdRegExp)
7667
+ .describe('The add-on unique identifier in ULID format.'),
7950
7668
  fromPlanPhase: zod
7951
7669
  .string()
7952
7670
  .describe('The key of the plan phase from the add-on becomes available for purchase.'),
@@ -8074,7 +7792,7 @@ export const queryPortalMeterQueryParams = zod.object({
8074
7792
  .optional()
8075
7793
  .describe('End date-time in RFC 3339 format.\n\nInclusive.\n\nFor example: ?to=2025-02-01T00%3A00%3A00.000Z'),
8076
7794
  windowSize: zod
8077
- .enum(['MINUTE', 'HOUR', 'DAY'])
7795
+ .enum(['MINUTE', 'HOUR', 'DAY', 'MONTH'])
8078
7796
  .optional()
8079
7797
  .describe('If not specified, a single usage aggregate will be returned for the entirety of the specified period for each subject and group.\n\nFor example: ?windowSize=DAY'),
8080
7798
  windowTimeZone: zod
@@ -8414,20 +8132,26 @@ export const upsertSubjectBodyItem = zod
8414
8132
  currentPeriodEnd: zod
8415
8133
  .date()
8416
8134
  .optional()
8417
- .describe('[RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC.'),
8135
+ .describe('The end of the current period for the subject.'),
8418
8136
  currentPeriodStart: zod
8419
8137
  .date()
8420
8138
  .optional()
8421
- .describe('[RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC.'),
8139
+ .describe('The start of the current period for the subject.'),
8422
8140
  displayName: zod
8423
8141
  .string()
8424
8142
  .nullish()
8425
8143
  .describe('A human-readable display name for the subject.'),
8426
8144
  key: zod
8427
8145
  .string()
8428
- .describe('A unique, human-readable identifier for the subject.'),
8429
- metadata: zod.record(zod.string(), zod.any()).nullish(),
8430
- stripeCustomerId: zod.string().nullish(),
8146
+ .describe('A unique, human-readable identifier for the subject.\nThis is typically a database ID or a customer key.'),
8147
+ metadata: zod
8148
+ .record(zod.string(), zod.any())
8149
+ .nullish()
8150
+ .describe('Metadata for the subject.'),
8151
+ stripeCustomerId: zod
8152
+ .string()
8153
+ .nullish()
8154
+ .describe('The Stripe customer ID for the subject.'),
8431
8155
  })
8432
8156
  .describe('A subject is a unique identifier for a user or entity.');
8433
8157
  export const upsertSubjectBody = zod.array(upsertSubjectBodyItem);
@@ -8455,7 +8179,7 @@ export const deleteSubjectParams = zod.object({
8455
8179
  A given subject can only have one active (non-deleted) entitlement per featureKey. If you try to create a new entitlement for a featureKey that already has an active entitlement, the request will fail with a 409 error.
8456
8180
 
8457
8181
  Once an entitlement is created you cannot modify it, only delete it.
8458
- * @summary Create an entitlement
8182
+ * @summary Create a subject entitlement
8459
8183
  */
8460
8184
  export const createEntitlementParams = zod.object({
8461
8185
  subjectIdOrKey: zod.string(),
@@ -8632,7 +8356,7 @@ export const createEntitlementBody = zod
8632
8356
  .describe('Create inputs for entitlement');
8633
8357
  /**
8634
8358
  * List all entitlements for a subject. For checking entitlement access, use the /value endpoint instead.
8635
- * @summary List entitlements
8359
+ * @summary List subject entitlements
8636
8360
  */
8637
8361
  export const listSubjectEntitlementsParams = zod.object({
8638
8362
  subjectIdOrKey: zod.string(),
@@ -8643,7 +8367,7 @@ export const listSubjectEntitlementsQueryParams = zod.object({
8643
8367
  });
8644
8368
  /**
8645
8369
  * List all grants issued for an entitlement. The entitlement can be defined either by its id or featureKey.
8646
- * @summary List entitlement grants
8370
+ * @summary List subject entitlement grants
8647
8371
  */
8648
8372
  export const listEntitlementGrantsParams = zod.object({
8649
8373
  entitlementIdOrFeatureKey: zod.string(),
@@ -8666,7 +8390,7 @@ Grants can have a recurrence setting intended to automate the manual reissuing o
8666
8390
  Rollover settings define what happens to the remaining balance of a grant at a reset. Balance_After_Reset = MIN(MaxRolloverAmount, MAX(Balance_Before_Reset, MinRolloverAmount))
8667
8391
 
8668
8392
  Grants cannot be changed once created, only deleted. This is to ensure that balance is deterministic regardless of when it is queried.
8669
- * @summary Create grant
8393
+ * @summary Create subject entitlement grant
8670
8394
  */
8671
8395
  export const createGrantParams = zod.object({
8672
8396
  entitlementIdOrFeatureKey: zod.string(),
@@ -8739,7 +8463,7 @@ export const createGrantBody = zod
8739
8463
  * Overriding an entitlement creates a new entitlement from the provided inputs and soft deletes the previous entitlement for the provided subject-feature pair. If the previous entitlement is already deleted or otherwise doesnt exist, the override will fail.
8740
8464
 
8741
8465
  This endpoint is useful for upgrades, downgrades, or other changes to entitlements that require a new entitlement to be created with zero downtime.
8742
- * @summary Override entitlement
8466
+ * @summary Override subject entitlement
8743
8467
  */
8744
8468
  export const overrideEntitlementParams = zod.object({
8745
8469
  entitlementIdOrFeatureKey: zod.string(),
@@ -8919,7 +8643,7 @@ export const overrideEntitlementBody = zod
8919
8643
  * This endpoint should be used for access checks and enforcement. All entitlement types share the hasAccess property in their value response, but multiple other properties are returned based on the entitlement type.
8920
8644
 
8921
8645
  For convenience reasons, /value works with both entitlementId and featureKey.
8922
- * @summary Get entitlement value
8646
+ * @summary Get subject entitlement value
8923
8647
  */
8924
8648
  export const getEntitlementValueParams = zod.object({
8925
8649
  entitlementIdOrFeatureKey: zod.string(),
@@ -8930,7 +8654,7 @@ export const getEntitlementValueQueryParams = zod.object({
8930
8654
  });
8931
8655
  /**
8932
8656
  * Get entitlement by id. For checking entitlement access, use the /value endpoint instead.
8933
- * @summary Get entitlement
8657
+ * @summary Get subject entitlement
8934
8658
  */
8935
8659
  export const getEntitlementParams = zod.object({
8936
8660
  entitlementId: zod.string(),
@@ -8939,7 +8663,7 @@ export const getEntitlementParams = zod.object({
8939
8663
  /**
8940
8664
  * Deleting an entitlement revokes access to the associated feature. As a single subject can only have one entitlement per featureKey, when "migrating" features you have to delete the old entitlements as well.
8941
8665
  As access and status checks can be historical queries, deleting an entitlement populates the deletedAt timestamp. When queried for a time before that, the entitlement is still considered active, you cannot have retroactive changes to access, which is important for, among other things, auditing.
8942
- * @summary Delete entitlement
8666
+ * @summary Delete subject entitlement
8943
8667
  */
8944
8668
  export const deleteEntitlementParams = zod.object({
8945
8669
  entitlementId: zod.string(),
@@ -8951,7 +8675,7 @@ export const deleteEntitlementParams = zod.object({
8951
8675
  BurndownHistory returns a continous history of segments, where the segments are seperated by events that changed either the grant burndown priority or the usage period.
8952
8676
 
8953
8677
  WindowedHistory returns windowed usage data for the period enriched with balance information and the list of grants that were being burnt down in that window.
8954
- * @summary Get entitlement history
8678
+ * @summary Get subject entitlement history
8955
8679
  */
8956
8680
  export const getEntitlementHistoryParams = zod.object({
8957
8681
  entitlementId: zod.string(),
@@ -8967,7 +8691,9 @@ export const getEntitlementHistoryQueryParams = zod.object({
8967
8691
  .date()
8968
8692
  .optional()
8969
8693
  .describe('End of time range to query entitlement: date-time in RFC 3339 format. Defaults to now.\nIf not now then gets truncated to the granularity of the underlying meter.'),
8970
- windowSize: zod.enum(['MINUTE', 'HOUR', 'DAY']).describe('Windowsize'),
8694
+ windowSize: zod
8695
+ .enum(['MINUTE', 'HOUR', 'DAY', 'MONTH'])
8696
+ .describe('Windowsize'),
8971
8697
  windowTimeZone: zod
8972
8698
  .string()
8973
8699
  .default(getEntitlementHistoryQueryWindowTimeZoneDefault)
@@ -8977,7 +8703,7 @@ export const getEntitlementHistoryQueryParams = zod.object({
8977
8703
  * Reset marks the start of a new usage period for the entitlement and initiates grant rollover. At the start of a period usage is zerod out and grants are rolled over based on their rollover settings. It would typically be synced with the subjects billing period to enforce usage based on their subscription.
8978
8704
 
8979
8705
  Usage is automatically reset for metered entitlements based on their usage period, but this endpoint allows to manually reset it at any time. When doing so the period anchor of the entitlement can be changed if needed.
8980
- * @summary Reset entitlement
8706
+ * @summary Reset subject entitlement
8981
8707
  */
8982
8708
  export const resetEntitlementUsageParams = zod.object({
8983
8709
  entitlementId: zod.string(),
@@ -9013,6 +8739,12 @@ export const createSubscriptionBodyCustomPlanCurrencyMinOne = 3;
9013
8739
  export const createSubscriptionBodyCustomPlanCurrencyMaxOne = 3;
9014
8740
  export const createSubscriptionBodyCustomPlanCurrencyRegExpOne = new RegExp('^[A-Z]{3}$');
9015
8741
  export const createSubscriptionBodyCustomPlanCurrencyDefault = 'USD';
8742
+ export const createSubscriptionBodyCustomPlanProRatingConfigEnabledDefault = true;
8743
+ export const createSubscriptionBodyCustomPlanProRatingConfigModeDefault = 'prorate_prices';
8744
+ export const createSubscriptionBodyCustomPlanProRatingConfigDefault = {
8745
+ enabled: true,
8746
+ mode: 'prorate_prices',
8747
+ };
9016
8748
  export const createSubscriptionBodyCustomPlanPhasesItemKeyMax = 64;
9017
8749
  export const createSubscriptionBodyCustomPlanPhasesItemKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
9018
8750
  export const createSubscriptionBodyCustomPlanPhasesItemNameMax = 256;
@@ -9078,6 +8810,10 @@ export const createSubscriptionBody = zod
9078
8810
  .describe('Alignment configuration for a plan or subscription.')
9079
8811
  .optional()
9080
8812
  .describe('What alignment settings the subscription should have.'),
8813
+ billingAnchor: zod
8814
+ .date()
8815
+ .optional()
8816
+ .describe('The billing anchor of the subscription. The provided date will be normalized according to the billing cadence to the nearest recurrence before start time. If not provided, the subscription start time will be used.'),
9081
8817
  customerId: zod
9082
8818
  .string()
9083
8819
  .regex(createSubscriptionBodyCustomerIdRegExp)
@@ -9114,6 +8850,11 @@ export const createSubscriptionBody = zod
9114
8850
  })
9115
8851
  .describe('References an exact plan defaulting to the current active version.')
9116
8852
  .describe('The plan reference to change to.'),
8853
+ startingPhase: zod
8854
+ .string()
8855
+ .min(1)
8856
+ .optional()
8857
+ .describe('The key of the phase to start the subscription in.\nIf not provided, the subscription will start in the first phase of the plan.'),
9117
8858
  timing: zod
9118
8859
  .enum(['immediate', 'next_billing_cycle'])
9119
8860
  .describe('Subscription edit timing.\nWhen immediate, the requested changes take effect immediately.\nWhen nextBillingCycle, the requested changes take effect at the next billing cycle.')
@@ -9127,6 +8868,10 @@ export const createSubscriptionBody = zod
9127
8868
  .describe('Create subscription based on plan.')
9128
8869
  .or(zod
9129
8870
  .object({
8871
+ billingAnchor: zod
8872
+ .date()
8873
+ .optional()
8874
+ .describe('The billing anchor of the subscription. The provided date will be normalized according to the billing cadence to the nearest recurrence before start time. If not provided, the subscription start time will be used.'),
9130
8875
  customerId: zod
9131
8876
  .string()
9132
8877
  .regex(createSubscriptionBodyCustomerIdRegExpOne)
@@ -9150,6 +8895,9 @@ export const createSubscriptionBody = zod
9150
8895
  .describe('Alignment configuration for a plan or subscription.')
9151
8896
  .optional()
9152
8897
  .describe('Alignment configuration for the plan.'),
8898
+ billingCadence: zod
8899
+ .string()
8900
+ .describe('The default billing cadence for subscriptions using this plan.\nDefines how often customers are billed using ISO8601 duration format.\nExamples: \"P1M\" (monthly), \"P3M\" (quarterly), \"P1Y\" (annually).'),
9153
8901
  currency: zod
9154
8902
  .string()
9155
8903
  .min(createSubscriptionBodyCustomPlanCurrencyMinOne)
@@ -9693,6 +9441,19 @@ export const createSubscriptionBody = zod
9693
9441
  .describe("The plan phase or pricing ramp allows changing a plan's rate cards over time as a subscription progresses."))
9694
9442
  .min(1)
9695
9443
  .describe("The plan phase or pricing ramp allows changing a plan's rate cards over time as a subscription progresses.\nA phase switch occurs only at the end of a billing period, ensuring that a single subscription invoice will not include charges from different phase prices."),
9444
+ proRatingConfig: zod
9445
+ .object({
9446
+ enabled: zod
9447
+ .boolean()
9448
+ .describe('Whether pro-rating is enabled for this plan.'),
9449
+ mode: zod
9450
+ .enum(['prorate_prices'])
9451
+ .describe('Pro-rating mode options for handling billing period changes.')
9452
+ .describe('How to handle pro-rating for billing period changes.'),
9453
+ })
9454
+ .describe('Configuration for pro-rating behavior.')
9455
+ .default(createSubscriptionBodyCustomPlanProRatingConfigDefault)
9456
+ .describe('Default pro-rating configuration for subscriptions using this plan.'),
9696
9457
  })
9697
9458
  .describe('The template for omitting properties.')
9698
9459
  .describe('Plan input for custom subscription creation (without key and version).')
@@ -10403,11 +10164,6 @@ export const createSubscriptionAddonBodyQuantityMin = 0;
10403
10164
  export const createSubscriptionAddonBodyAddonIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
10404
10165
  export const createSubscriptionAddonBody = zod
10405
10166
  .object({
10406
- activeFrom: zod.date().describe('The cadence start of the resource.'),
10407
- activeTo: zod
10408
- .date()
10409
- .optional()
10410
- .describe('The cadence end of the resource.'),
10411
10167
  addon: zod
10412
10168
  .object({
10413
10169
  id: zod
@@ -10488,14 +10244,6 @@ export const updateSubscriptionAddonBodyDescriptionMax = 1024;
10488
10244
  export const updateSubscriptionAddonBodyQuantityMin = 0;
10489
10245
  export const updateSubscriptionAddonBody = zod
10490
10246
  .object({
10491
- activeFrom: zod
10492
- .date()
10493
- .optional()
10494
- .describe('The cadence start of the resource.'),
10495
- activeTo: zod
10496
- .date()
10497
- .optional()
10498
- .describe('The cadence end of the resource.'),
10499
10247
  description: zod
10500
10248
  .string()
10501
10249
  .max(updateSubscriptionAddonBodyDescriptionMax)
@@ -10569,6 +10317,12 @@ export const changeSubscriptionBodyCustomPlanCurrencyMinOne = 3;
10569
10317
  export const changeSubscriptionBodyCustomPlanCurrencyMaxOne = 3;
10570
10318
  export const changeSubscriptionBodyCustomPlanCurrencyRegExpOne = new RegExp('^[A-Z]{3}$');
10571
10319
  export const changeSubscriptionBodyCustomPlanCurrencyDefault = 'USD';
10320
+ export const changeSubscriptionBodyCustomPlanProRatingConfigEnabledDefault = true;
10321
+ export const changeSubscriptionBodyCustomPlanProRatingConfigModeDefault = 'prorate_prices';
10322
+ export const changeSubscriptionBodyCustomPlanProRatingConfigDefault = {
10323
+ enabled: true,
10324
+ mode: 'prorate_prices',
10325
+ };
10572
10326
  export const changeSubscriptionBodyCustomPlanPhasesItemKeyMax = 64;
10573
10327
  export const changeSubscriptionBodyCustomPlanPhasesItemKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
10574
10328
  export const changeSubscriptionBodyCustomPlanPhasesItemNameMax = 256;
@@ -10631,6 +10385,10 @@ export const changeSubscriptionBody = zod
10631
10385
  .describe('Alignment configuration for a plan or subscription.')
10632
10386
  .optional()
10633
10387
  .describe('What alignment settings the subscription should have.'),
10388
+ billingAnchor: zod
10389
+ .date()
10390
+ .optional()
10391
+ .describe('The billing anchor of the subscription. The provided date will be normalized according to the billing cadence to the nearest recurrence before start time. If not provided, the previous subscription billing anchor will be used.'),
10634
10392
  description: zod
10635
10393
  .string()
10636
10394
  .optional()
@@ -10656,6 +10414,11 @@ export const changeSubscriptionBody = zod
10656
10414
  })
10657
10415
  .describe('References an exact plan defaulting to the current active version.')
10658
10416
  .describe('The plan reference to change to.'),
10417
+ startingPhase: zod
10418
+ .string()
10419
+ .min(1)
10420
+ .optional()
10421
+ .describe('The key of the phase to start the subscription in.\nIf not provided, the subscription will start in the first phase of the plan.'),
10659
10422
  timing: zod
10660
10423
  .enum(['immediate', 'next_billing_cycle'])
10661
10424
  .describe('Subscription edit timing.\nWhen immediate, the requested changes take effect immediately.\nWhen nextBillingCycle, the requested changes take effect at the next billing cycle.')
@@ -10668,6 +10431,10 @@ export const changeSubscriptionBody = zod
10668
10431
  .describe('Change subscription based on plan.')
10669
10432
  .or(zod
10670
10433
  .object({
10434
+ billingAnchor: zod
10435
+ .date()
10436
+ .optional()
10437
+ .describe('The billing anchor of the subscription. The provided date will be normalized according to the billing cadence to the nearest recurrence before start time. If not provided, the previous subscription billing anchor will be used.'),
10671
10438
  customPlan: zod
10672
10439
  .object({
10673
10440
  alignment: zod
@@ -10680,6 +10447,9 @@ export const changeSubscriptionBody = zod
10680
10447
  .describe('Alignment configuration for a plan or subscription.')
10681
10448
  .optional()
10682
10449
  .describe('Alignment configuration for the plan.'),
10450
+ billingCadence: zod
10451
+ .string()
10452
+ .describe('The default billing cadence for subscriptions using this plan.\nDefines how often customers are billed using ISO8601 duration format.\nExamples: \"P1M\" (monthly), \"P3M\" (quarterly), \"P1Y\" (annually).'),
10683
10453
  currency: zod
10684
10454
  .string()
10685
10455
  .min(changeSubscriptionBodyCustomPlanCurrencyMinOne)
@@ -11223,6 +10993,19 @@ export const changeSubscriptionBody = zod
11223
10993
  .describe("The plan phase or pricing ramp allows changing a plan's rate cards over time as a subscription progresses."))
11224
10994
  .min(1)
11225
10995
  .describe("The plan phase or pricing ramp allows changing a plan's rate cards over time as a subscription progresses.\nA phase switch occurs only at the end of a billing period, ensuring that a single subscription invoice will not include charges from different phase prices."),
10996
+ proRatingConfig: zod
10997
+ .object({
10998
+ enabled: zod
10999
+ .boolean()
11000
+ .describe('Whether pro-rating is enabled for this plan.'),
11001
+ mode: zod
11002
+ .enum(['prorate_prices'])
11003
+ .describe('Pro-rating mode options for handling billing period changes.')
11004
+ .describe('How to handle pro-rating for billing period changes.'),
11005
+ })
11006
+ .describe('Configuration for pro-rating behavior.')
11007
+ .default(changeSubscriptionBodyCustomPlanProRatingConfigDefault)
11008
+ .describe('Default pro-rating configuration for subscriptions using this plan.'),
11226
11009
  })
11227
11010
  .describe('The template for omitting properties.')
11228
11011
  .describe('Plan input for custom subscription creation (without key and version).')
@@ -11250,8 +11033,31 @@ export const migrateSubscriptionParams = zod.object({
11250
11033
  .string()
11251
11034
  .regex(migrateSubscriptionPathSubscriptionIdRegExp),
11252
11035
  });
11036
+ export const migrateSubscriptionBodyTimingDefault = 'immediate';
11253
11037
  export const migrateSubscriptionBody = zod.object({
11254
- targetVersion: zod.number().min(1).optional(),
11038
+ billingAnchor: zod
11039
+ .date()
11040
+ .optional()
11041
+ .describe('The billing anchor of the subscription. The provided date will be normalized according to the billing cadence to the nearest recurrence before start time. If not provided, the previous subscription billing anchor will be used.'),
11042
+ startingPhase: zod
11043
+ .string()
11044
+ .min(1)
11045
+ .optional()
11046
+ .describe('The key of the phase to start the subscription in.\nIf not provided, the subscription will start in the first phase of the plan.'),
11047
+ targetVersion: zod
11048
+ .number()
11049
+ .min(1)
11050
+ .optional()
11051
+ .describe('The version of the plan to migrate to.\nIf not provided, the subscription will migrate to the latest version of the current plan.'),
11052
+ timing: zod
11053
+ .enum(['immediate', 'next_billing_cycle'])
11054
+ .describe('Subscription edit timing.\nWhen immediate, the requested changes take effect immediately.\nWhen nextBillingCycle, the requested changes take effect at the next billing cycle.')
11055
+ .or(zod
11056
+ .date()
11057
+ .describe('[RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC.'))
11058
+ .describe('Subscription edit timing defined when the changes should take effect.\nIf the provided configuration is not supported by the subscription, an error will be returned.')
11059
+ .default(migrateSubscriptionBodyTimingDefault)
11060
+ .describe('Timing configuration for the migration, when the migration should take effect.\nIf not supported by the subscription, 400 will be returned.'),
11255
11061
  });
11256
11062
  /**
11257
11063
  * Restores a canceled subscription.