@openmeter/sdk 1.0.0-beta-e49464db8b22 → 1.0.0-beta-5e4e38ebc196

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.
@@ -1673,95 +1673,93 @@ export const deleteBillingProfileCustomerOverrideParams = zod.object({
1673
1673
  .regex(deleteBillingProfileCustomerOverridePathCustomerIdRegExp),
1674
1674
  });
1675
1675
  /**
1676
- * Simulate an invoice for a customer.
1676
+ * Create a new pending line item (charge).
1677
1677
 
1678
- This call will simulate an invoice for a customer based on the pending line items.
1678
+ This call is used to create a new pending line item for the customer if required a new
1679
+ gathering invoice will be created.
1679
1680
 
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
1681
+ A new invoice will be created if:
1682
+ - there is no invoice in gathering state
1683
+ - the currency of the line item doesn't match the currency of any invoices in gathering state
1684
+ * @summary Create pending line items
1682
1685
  */
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),
1686
+ export const createPendingInvoiceLinePathCustomerIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
1687
+ export const createPendingInvoiceLineParams = zod.object({
1688
+ customerId: zod.string().regex(createPendingInvoiceLinePathCustomerIdRegExp),
1686
1689
  });
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
1690
+ export const createPendingInvoiceLineBodyCurrencyMinOne = 3;
1691
+ export const createPendingInvoiceLineBodyCurrencyMaxOne = 3;
1692
+ export const createPendingInvoiceLineBodyCurrencyRegExpOne = new RegExp('^[A-Z]{3}$');
1693
+ export const createPendingInvoiceLineBodyLinesItemNameMax = 256;
1694
+ export const createPendingInvoiceLineBodyLinesItemDescriptionMax = 1024;
1695
+ export const createPendingInvoiceLineBodyLinesItemTaxConfigStripeCodeRegExp = new RegExp('^txcd_\\d{8}$');
1696
+ export const createPendingInvoiceLineBodyLinesItemPriceAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1697
+ export const createPendingInvoiceLineBodyLinesItemPricePaymentTermDefault = 'in_advance';
1698
+ export const createPendingInvoiceLineBodyLinesItemPriceAmountRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1699
+ export const createPendingInvoiceLineBodyLinesItemPriceMinimumAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1700
+ export const createPendingInvoiceLineBodyLinesItemPriceMaximumAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1701
+ export const createPendingInvoiceLineBodyLinesItemPriceTiersItemUpToAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1702
+ export const createPendingInvoiceLineBodyLinesItemPriceTiersItemFlatPriceAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1703
+ export const createPendingInvoiceLineBodyLinesItemPriceTiersItemUnitPriceAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1704
+ export const createPendingInvoiceLineBodyLinesItemPriceMinimumAmountRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1705
+ export const createPendingInvoiceLineBodyLinesItemPriceMaximumAmountRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1706
+ export const createPendingInvoiceLineBodyLinesItemPriceMultiplierRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1707
+ export const createPendingInvoiceLineBodyLinesItemPriceMultiplierDefault = '1';
1708
+ export const createPendingInvoiceLineBodyLinesItemPriceMinimumAmountRegExpFive = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1709
+ export const createPendingInvoiceLineBodyLinesItemPriceMaximumAmountRegExpFive = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1710
+ export const createPendingInvoiceLineBodyLinesItemPriceAmountRegExpFive = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1711
+ export const createPendingInvoiceLineBodyLinesItemPriceQuantityPerPackageRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1712
+ export const createPendingInvoiceLineBodyLinesItemPriceMinimumAmountRegExpSeven = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1713
+ export const createPendingInvoiceLineBodyLinesItemPriceMaximumAmountRegExpSeven = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1714
+ export const createPendingInvoiceLineBodyLinesItemFeatureKeyMax = 64;
1715
+ export const createPendingInvoiceLineBodyLinesItemFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
1716
+ export const createPendingInvoiceLineBodyLinesItemRateCardFeatureKeyMax = 64;
1717
+ export const createPendingInvoiceLineBodyLinesItemRateCardFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
1718
+ export const createPendingInvoiceLineBodyLinesItemRateCardTaxConfigStripeCodeRegExp = new RegExp('^txcd_\\d{8}$');
1719
+ export const createPendingInvoiceLineBodyLinesItemRateCardPriceAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1720
+ export const createPendingInvoiceLineBodyLinesItemRateCardPricePaymentTermDefault = 'in_advance';
1721
+ export const createPendingInvoiceLineBodyLinesItemRateCardPriceAmountRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1722
+ export const createPendingInvoiceLineBodyLinesItemRateCardPriceMinimumAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1723
+ export const createPendingInvoiceLineBodyLinesItemRateCardPriceMaximumAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1724
+ export const createPendingInvoiceLineBodyLinesItemRateCardPriceTiersItemUpToAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1725
+ export const createPendingInvoiceLineBodyLinesItemRateCardPriceTiersItemFlatPriceAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1726
+ export const createPendingInvoiceLineBodyLinesItemRateCardPriceTiersItemUnitPriceAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1727
+ export const createPendingInvoiceLineBodyLinesItemRateCardPriceMinimumAmountRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1728
+ export const createPendingInvoiceLineBodyLinesItemRateCardPriceMaximumAmountRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1729
+ export const createPendingInvoiceLineBodyLinesItemRateCardPriceMultiplierRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1730
+ export const createPendingInvoiceLineBodyLinesItemRateCardPriceMultiplierDefault = '1';
1731
+ export const createPendingInvoiceLineBodyLinesItemRateCardPriceMinimumAmountRegExpFive = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1732
+ export const createPendingInvoiceLineBodyLinesItemRateCardPriceMaximumAmountRegExpFive = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1733
+ export const createPendingInvoiceLineBodyLinesItemRateCardPriceAmountRegExpFive = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1734
+ export const createPendingInvoiceLineBodyLinesItemRateCardPriceQuantityPerPackageRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1735
+ export const createPendingInvoiceLineBodyLinesItemRateCardPriceMinimumAmountRegExpSeven = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1736
+ export const createPendingInvoiceLineBodyLinesItemRateCardPriceMaximumAmountRegExpSeven = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1737
+ export const createPendingInvoiceLineBodyLinesItemRateCardDiscountsPercentageCorrelationIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
1738
+ export const createPendingInvoiceLineBodyLinesItemRateCardDiscountsUsageQuantityRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1739
+ export const createPendingInvoiceLineBodyLinesItemRateCardDiscountsUsageCorrelationIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
1740
+ export const createPendingInvoiceLineBodyLinesItemNameMaxOne = 256;
1741
+ export const createPendingInvoiceLineBodyLinesItemDescriptionMaxOne = 1024;
1742
+ export const createPendingInvoiceLineBodyLinesItemTaxConfigStripeCodeRegExpOne = new RegExp('^txcd_\\d{8}$');
1743
+ export const createPendingInvoiceLineBodyLinesItemPerUnitAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1744
+ export const createPendingInvoiceLineBodyLinesItemPaymentTermDefault = 'in_advance';
1745
+ export const createPendingInvoiceLineBodyLinesItemQuantityRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1746
+ export const createPendingInvoiceLineBodyLinesItemRateCardTaxConfigStripeCodeRegExpOne = new RegExp('^txcd_\\d{8}$');
1747
+ export const createPendingInvoiceLineBodyLinesItemRateCardPriceAmountRegExpSeven = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1748
+ export const createPendingInvoiceLineBodyLinesItemRateCardPricePaymentTermDefaultTwo = 'in_advance';
1749
+ export const createPendingInvoiceLineBodyLinesItemRateCardQuantityRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1750
+ export const createPendingInvoiceLineBodyLinesItemRateCardDiscountsPercentageCorrelationIdRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
1751
+ export const createPendingInvoiceLineBodyLinesItemRateCardDiscountsUsageQuantityRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1752
+ export const createPendingInvoiceLineBodyLinesItemRateCardDiscountsUsageCorrelationIdRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
1753
+ export const createPendingInvoiceLineBodyLinesItemCategoryDefault = 'regular';
1754
+ export const createPendingInvoiceLineBody = zod
1757
1755
  .object({
1758
1756
  currency: zod
1759
1757
  .string()
1760
- .min(simulateInvoiceBodyCurrencyMinOne)
1761
- .max(simulateInvoiceBodyCurrencyMaxOne)
1762
- .regex(simulateInvoiceBodyCurrencyRegExpOne)
1758
+ .min(createPendingInvoiceLineBodyCurrencyMinOne)
1759
+ .max(createPendingInvoiceLineBodyCurrencyMaxOne)
1760
+ .regex(createPendingInvoiceLineBodyCurrencyRegExpOne)
1763
1761
  .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.'),
1762
+ .describe('The currency of the lines to be created.'),
1765
1763
  lines: zod
1766
1764
  .array(zod
1767
1765
  .discriminatedUnion('type', [
@@ -1769,21 +1767,16 @@ export const simulateInvoiceBody = zod
1769
1767
  .object({
1770
1768
  description: zod
1771
1769
  .string()
1772
- .max(simulateInvoiceBodyLinesItemDescriptionMax)
1770
+ .max(createPendingInvoiceLineBodyLinesItemDescriptionMax)
1773
1771
  .optional()
1774
1772
  .describe('Optional description of the resource. Maximum 1024 characters.'),
1775
1773
  featureKey: zod
1776
1774
  .string()
1777
1775
  .min(1)
1778
- .max(simulateInvoiceBodyLinesItemFeatureKeyMax)
1779
- .regex(simulateInvoiceBodyLinesItemFeatureKeyRegExp)
1776
+ .max(createPendingInvoiceLineBodyLinesItemFeatureKeyMax)
1777
+ .regex(createPendingInvoiceLineBodyLinesItemFeatureKeyRegExp)
1780
1778
  .optional()
1781
1779
  .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
1780
  invoiceAt: zod
1788
1781
  .date()
1789
1782
  .describe('The time this line item should be invoiced.'),
@@ -1795,7 +1788,7 @@ export const simulateInvoiceBody = zod
1795
1788
  name: zod
1796
1789
  .string()
1797
1790
  .min(1)
1798
- .max(simulateInvoiceBodyLinesItemNameMax)
1791
+ .max(createPendingInvoiceLineBodyLinesItemNameMax)
1799
1792
  .describe('Human-readable name for the resource. Between 1 and 256 characters.'),
1800
1793
  period: zod
1801
1794
  .object({
@@ -1804,25 +1797,19 @@ export const simulateInvoiceBody = zod
1804
1797
  })
1805
1798
  .describe('A period with a start and end time.')
1806
1799
  .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
1800
  price: zod
1814
1801
  .discriminatedUnion('type', [
1815
1802
  zod
1816
1803
  .object({
1817
1804
  amount: zod
1818
1805
  .string()
1819
- .regex(simulateInvoiceBodyLinesItemPriceAmountRegExpOne)
1806
+ .regex(createPendingInvoiceLineBodyLinesItemPriceAmountRegExpOne)
1820
1807
  .describe('Numeric represents an arbitrary precision number.')
1821
1808
  .describe('The amount of the flat price.'),
1822
1809
  paymentTerm: zod
1823
1810
  .enum(['in_advance', 'in_arrears'])
1824
1811
  .describe('The payment term of a flat price.\nOne of: in_advance or in_arrears.')
1825
- .default(simulateInvoiceBodyLinesItemPricePaymentTermDefault)
1812
+ .default(createPendingInvoiceLineBodyLinesItemPricePaymentTermDefault)
1826
1813
  .describe('The payment term of the flat price.\nDefaults to in advance.'),
1827
1814
  type: zod.enum(['flat']),
1828
1815
  })
@@ -1831,18 +1818,18 @@ export const simulateInvoiceBody = zod
1831
1818
  .object({
1832
1819
  amount: zod
1833
1820
  .string()
1834
- .regex(simulateInvoiceBodyLinesItemPriceAmountRegExpThree)
1821
+ .regex(createPendingInvoiceLineBodyLinesItemPriceAmountRegExpThree)
1835
1822
  .describe('Numeric represents an arbitrary precision number.')
1836
1823
  .describe('The amount of the unit price.'),
1837
1824
  maximumAmount: zod
1838
1825
  .string()
1839
- .regex(simulateInvoiceBodyLinesItemPriceMaximumAmountRegExpOne)
1826
+ .regex(createPendingInvoiceLineBodyLinesItemPriceMaximumAmountRegExpOne)
1840
1827
  .describe('Numeric represents an arbitrary precision number.')
1841
1828
  .optional()
1842
1829
  .describe('The customer is limited to spend at most the amount.'),
1843
1830
  minimumAmount: zod
1844
1831
  .string()
1845
- .regex(simulateInvoiceBodyLinesItemPriceMinimumAmountRegExpOne)
1832
+ .regex(createPendingInvoiceLineBodyLinesItemPriceMinimumAmountRegExpOne)
1846
1833
  .describe('Numeric represents an arbitrary precision number.')
1847
1834
  .optional()
1848
1835
  .describe('The customer is committed to spend at least the amount.'),
@@ -1853,13 +1840,13 @@ export const simulateInvoiceBody = zod
1853
1840
  .object({
1854
1841
  maximumAmount: zod
1855
1842
  .string()
1856
- .regex(simulateInvoiceBodyLinesItemPriceMaximumAmountRegExpThree)
1843
+ .regex(createPendingInvoiceLineBodyLinesItemPriceMaximumAmountRegExpThree)
1857
1844
  .describe('Numeric represents an arbitrary precision number.')
1858
1845
  .optional()
1859
1846
  .describe('The customer is limited to spend at most the amount.'),
1860
1847
  minimumAmount: zod
1861
1848
  .string()
1862
- .regex(simulateInvoiceBodyLinesItemPriceMinimumAmountRegExpThree)
1849
+ .regex(createPendingInvoiceLineBodyLinesItemPriceMinimumAmountRegExpThree)
1863
1850
  .describe('Numeric represents an arbitrary precision number.')
1864
1851
  .optional()
1865
1852
  .describe('The customer is committed to spend at least the amount.'),
@@ -1874,7 +1861,7 @@ export const simulateInvoiceBody = zod
1874
1861
  .object({
1875
1862
  amount: zod
1876
1863
  .string()
1877
- .regex(simulateInvoiceBodyLinesItemPriceTiersItemFlatPriceAmountRegExpOne)
1864
+ .regex(createPendingInvoiceLineBodyLinesItemPriceTiersItemFlatPriceAmountRegExpOne)
1878
1865
  .describe('Numeric represents an arbitrary precision number.')
1879
1866
  .describe('The amount of the flat price.'),
1880
1867
  type: zod
@@ -1888,7 +1875,7 @@ export const simulateInvoiceBody = zod
1888
1875
  .object({
1889
1876
  amount: zod
1890
1877
  .string()
1891
- .regex(simulateInvoiceBodyLinesItemPriceTiersItemUnitPriceAmountRegExpOne)
1878
+ .regex(createPendingInvoiceLineBodyLinesItemPriceTiersItemUnitPriceAmountRegExpOne)
1892
1879
  .describe('Numeric represents an arbitrary precision number.')
1893
1880
  .describe('The amount of the unit price.'),
1894
1881
  type: zod
@@ -1900,7 +1887,7 @@ export const simulateInvoiceBody = zod
1900
1887
  .describe('The unit price component of the tier.'),
1901
1888
  upToAmount: zod
1902
1889
  .string()
1903
- .regex(simulateInvoiceBodyLinesItemPriceTiersItemUpToAmountRegExpOne)
1890
+ .regex(createPendingInvoiceLineBodyLinesItemPriceTiersItemUpToAmountRegExpOne)
1904
1891
  .describe('Numeric represents an arbitrary precision number.')
1905
1892
  .optional()
1906
1893
  .describe('Up to and including to this quantity will be contained in the tier.\nIf null, the tier is open-ended.'),
@@ -1915,21 +1902,21 @@ export const simulateInvoiceBody = zod
1915
1902
  .object({
1916
1903
  maximumAmount: zod
1917
1904
  .string()
1918
- .regex(simulateInvoiceBodyLinesItemPriceMaximumAmountRegExpFive)
1905
+ .regex(createPendingInvoiceLineBodyLinesItemPriceMaximumAmountRegExpFive)
1919
1906
  .describe('Numeric represents an arbitrary precision number.')
1920
1907
  .optional()
1921
1908
  .describe('The customer is limited to spend at most the amount.'),
1922
1909
  minimumAmount: zod
1923
1910
  .string()
1924
- .regex(simulateInvoiceBodyLinesItemPriceMinimumAmountRegExpFive)
1911
+ .regex(createPendingInvoiceLineBodyLinesItemPriceMinimumAmountRegExpFive)
1925
1912
  .describe('Numeric represents an arbitrary precision number.')
1926
1913
  .optional()
1927
1914
  .describe('The customer is committed to spend at least the amount.'),
1928
1915
  multiplier: zod
1929
1916
  .string()
1930
- .regex(simulateInvoiceBodyLinesItemPriceMultiplierRegExpOne)
1917
+ .regex(createPendingInvoiceLineBodyLinesItemPriceMultiplierRegExpOne)
1931
1918
  .describe('Numeric represents an arbitrary precision number.')
1932
- .default(simulateInvoiceBodyLinesItemPriceMultiplierDefault)
1919
+ .default(createPendingInvoiceLineBodyLinesItemPriceMultiplierDefault)
1933
1920
  .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
1921
  type: zod.enum(['dynamic']),
1935
1922
  })
@@ -1938,24 +1925,24 @@ export const simulateInvoiceBody = zod
1938
1925
  .object({
1939
1926
  amount: zod
1940
1927
  .string()
1941
- .regex(simulateInvoiceBodyLinesItemPriceAmountRegExpFive)
1928
+ .regex(createPendingInvoiceLineBodyLinesItemPriceAmountRegExpFive)
1942
1929
  .describe('Numeric represents an arbitrary precision number.')
1943
1930
  .describe('The price of one package.'),
1944
1931
  maximumAmount: zod
1945
1932
  .string()
1946
- .regex(simulateInvoiceBodyLinesItemPriceMaximumAmountRegExpSeven)
1933
+ .regex(createPendingInvoiceLineBodyLinesItemPriceMaximumAmountRegExpSeven)
1947
1934
  .describe('Numeric represents an arbitrary precision number.')
1948
1935
  .optional()
1949
1936
  .describe('The customer is limited to spend at most the amount.'),
1950
1937
  minimumAmount: zod
1951
1938
  .string()
1952
- .regex(simulateInvoiceBodyLinesItemPriceMinimumAmountRegExpSeven)
1939
+ .regex(createPendingInvoiceLineBodyLinesItemPriceMinimumAmountRegExpSeven)
1953
1940
  .describe('Numeric represents an arbitrary precision number.')
1954
1941
  .optional()
1955
1942
  .describe('The customer is committed to spend at least the amount.'),
1956
1943
  quantityPerPackage: zod
1957
1944
  .string()
1958
- .regex(simulateInvoiceBodyLinesItemPriceQuantityPerPackageRegExpOne)
1945
+ .regex(createPendingInvoiceLineBodyLinesItemPriceQuantityPerPackageRegExpOne)
1959
1946
  .describe('Numeric represents an arbitrary precision number.')
1960
1947
  .describe('The quantity per package.'),
1961
1948
  type: zod.enum(['package']),
@@ -1965,11 +1952,6 @@ export const simulateInvoiceBody = zod
1965
1952
  .describe('The price of the usage based rate card.')
1966
1953
  .optional()
1967
1954
  .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
1955
  rateCard: zod
1974
1956
  .object({
1975
1957
  discounts: zod
@@ -1978,7 +1960,7 @@ export const simulateInvoiceBody = zod
1978
1960
  .object({
1979
1961
  correlationId: zod
1980
1962
  .string()
1981
- .regex(simulateInvoiceBodyLinesItemRateCardDiscountsPercentageCorrelationIdRegExp)
1963
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardDiscountsPercentageCorrelationIdRegExp)
1982
1964
  .optional()
1983
1965
  .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
1966
  percentage: zod
@@ -1993,12 +1975,12 @@ export const simulateInvoiceBody = zod
1993
1975
  .object({
1994
1976
  correlationId: zod
1995
1977
  .string()
1996
- .regex(simulateInvoiceBodyLinesItemRateCardDiscountsUsageCorrelationIdRegExp)
1978
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardDiscountsUsageCorrelationIdRegExp)
1997
1979
  .optional()
1998
1980
  .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
1981
  quantity: zod
2000
1982
  .string()
2001
- .regex(simulateInvoiceBodyLinesItemRateCardDiscountsUsageQuantityRegExpOne)
1983
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardDiscountsUsageQuantityRegExpOne)
2002
1984
  .describe('Numeric represents an arbitrary precision number.')
2003
1985
  .describe('The quantity of the usage discount.\n\nMust be positive.'),
2004
1986
  })
@@ -2012,8 +1994,8 @@ export const simulateInvoiceBody = zod
2012
1994
  featureKey: zod
2013
1995
  .string()
2014
1996
  .min(1)
2015
- .max(simulateInvoiceBodyLinesItemRateCardFeatureKeyMax)
2016
- .regex(simulateInvoiceBodyLinesItemRateCardFeatureKeyRegExp)
1997
+ .max(createPendingInvoiceLineBodyLinesItemRateCardFeatureKeyMax)
1998
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardFeatureKeyRegExp)
2017
1999
  .optional()
2018
2000
  .describe('The feature the customer is entitled to use.'),
2019
2001
  price: zod
@@ -2022,13 +2004,13 @@ export const simulateInvoiceBody = zod
2022
2004
  .object({
2023
2005
  amount: zod
2024
2006
  .string()
2025
- .regex(simulateInvoiceBodyLinesItemRateCardPriceAmountRegExpOne)
2007
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceAmountRegExpOne)
2026
2008
  .describe('Numeric represents an arbitrary precision number.')
2027
2009
  .describe('The amount of the flat price.'),
2028
2010
  paymentTerm: zod
2029
2011
  .enum(['in_advance', 'in_arrears'])
2030
2012
  .describe('The payment term of a flat price.\nOne of: in_advance or in_arrears.')
2031
- .default(simulateInvoiceBodyLinesItemRateCardPricePaymentTermDefault)
2013
+ .default(createPendingInvoiceLineBodyLinesItemRateCardPricePaymentTermDefault)
2032
2014
  .describe('The payment term of the flat price.\nDefaults to in advance.'),
2033
2015
  type: zod.enum(['flat']),
2034
2016
  })
@@ -2037,18 +2019,18 @@ export const simulateInvoiceBody = zod
2037
2019
  .object({
2038
2020
  amount: zod
2039
2021
  .string()
2040
- .regex(simulateInvoiceBodyLinesItemRateCardPriceAmountRegExpThree)
2022
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceAmountRegExpThree)
2041
2023
  .describe('Numeric represents an arbitrary precision number.')
2042
2024
  .describe('The amount of the unit price.'),
2043
2025
  maximumAmount: zod
2044
2026
  .string()
2045
- .regex(simulateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpOne)
2027
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceMaximumAmountRegExpOne)
2046
2028
  .describe('Numeric represents an arbitrary precision number.')
2047
2029
  .optional()
2048
2030
  .describe('The customer is limited to spend at most the amount.'),
2049
2031
  minimumAmount: zod
2050
2032
  .string()
2051
- .regex(simulateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpOne)
2033
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceMinimumAmountRegExpOne)
2052
2034
  .describe('Numeric represents an arbitrary precision number.')
2053
2035
  .optional()
2054
2036
  .describe('The customer is committed to spend at least the amount.'),
@@ -2059,13 +2041,13 @@ export const simulateInvoiceBody = zod
2059
2041
  .object({
2060
2042
  maximumAmount: zod
2061
2043
  .string()
2062
- .regex(simulateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpThree)
2044
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceMaximumAmountRegExpThree)
2063
2045
  .describe('Numeric represents an arbitrary precision number.')
2064
2046
  .optional()
2065
2047
  .describe('The customer is limited to spend at most the amount.'),
2066
2048
  minimumAmount: zod
2067
2049
  .string()
2068
- .regex(simulateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpThree)
2050
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceMinimumAmountRegExpThree)
2069
2051
  .describe('Numeric represents an arbitrary precision number.')
2070
2052
  .optional()
2071
2053
  .describe('The customer is committed to spend at least the amount.'),
@@ -2080,7 +2062,7 @@ export const simulateInvoiceBody = zod
2080
2062
  .object({
2081
2063
  amount: zod
2082
2064
  .string()
2083
- .regex(simulateInvoiceBodyLinesItemRateCardPriceTiersItemFlatPriceAmountRegExpOne)
2065
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceTiersItemFlatPriceAmountRegExpOne)
2084
2066
  .describe('Numeric represents an arbitrary precision number.')
2085
2067
  .describe('The amount of the flat price.'),
2086
2068
  type: zod
@@ -2094,7 +2076,7 @@ export const simulateInvoiceBody = zod
2094
2076
  .object({
2095
2077
  amount: zod
2096
2078
  .string()
2097
- .regex(simulateInvoiceBodyLinesItemRateCardPriceTiersItemUnitPriceAmountRegExpOne)
2079
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceTiersItemUnitPriceAmountRegExpOne)
2098
2080
  .describe('Numeric represents an arbitrary precision number.')
2099
2081
  .describe('The amount of the unit price.'),
2100
2082
  type: zod
@@ -2106,7 +2088,7 @@ export const simulateInvoiceBody = zod
2106
2088
  .describe('The unit price component of the tier.'),
2107
2089
  upToAmount: zod
2108
2090
  .string()
2109
- .regex(simulateInvoiceBodyLinesItemRateCardPriceTiersItemUpToAmountRegExpOne)
2091
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceTiersItemUpToAmountRegExpOne)
2110
2092
  .describe('Numeric represents an arbitrary precision number.')
2111
2093
  .optional()
2112
2094
  .describe('Up to and including to this quantity will be contained in the tier.\nIf null, the tier is open-ended.'),
@@ -2121,21 +2103,21 @@ export const simulateInvoiceBody = zod
2121
2103
  .object({
2122
2104
  maximumAmount: zod
2123
2105
  .string()
2124
- .regex(simulateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpFive)
2106
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceMaximumAmountRegExpFive)
2125
2107
  .describe('Numeric represents an arbitrary precision number.')
2126
2108
  .optional()
2127
2109
  .describe('The customer is limited to spend at most the amount.'),
2128
2110
  minimumAmount: zod
2129
2111
  .string()
2130
- .regex(simulateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpFive)
2112
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceMinimumAmountRegExpFive)
2131
2113
  .describe('Numeric represents an arbitrary precision number.')
2132
2114
  .optional()
2133
2115
  .describe('The customer is committed to spend at least the amount.'),
2134
2116
  multiplier: zod
2135
2117
  .string()
2136
- .regex(simulateInvoiceBodyLinesItemRateCardPriceMultiplierRegExpOne)
2118
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceMultiplierRegExpOne)
2137
2119
  .describe('Numeric represents an arbitrary precision number.')
2138
- .default(simulateInvoiceBodyLinesItemRateCardPriceMultiplierDefault)
2120
+ .default(createPendingInvoiceLineBodyLinesItemRateCardPriceMultiplierDefault)
2139
2121
  .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
2122
  type: zod.enum(['dynamic']),
2141
2123
  })
@@ -2144,24 +2126,24 @@ export const simulateInvoiceBody = zod
2144
2126
  .object({
2145
2127
  amount: zod
2146
2128
  .string()
2147
- .regex(simulateInvoiceBodyLinesItemRateCardPriceAmountRegExpFive)
2129
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceAmountRegExpFive)
2148
2130
  .describe('Numeric represents an arbitrary precision number.')
2149
2131
  .describe('The price of one package.'),
2150
2132
  maximumAmount: zod
2151
2133
  .string()
2152
- .regex(simulateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpSeven)
2134
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceMaximumAmountRegExpSeven)
2153
2135
  .describe('Numeric represents an arbitrary precision number.')
2154
2136
  .optional()
2155
2137
  .describe('The customer is limited to spend at most the amount.'),
2156
2138
  minimumAmount: zod
2157
2139
  .string()
2158
- .regex(simulateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpSeven)
2140
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceMinimumAmountRegExpSeven)
2159
2141
  .describe('Numeric represents an arbitrary precision number.')
2160
2142
  .optional()
2161
2143
  .describe('The customer is committed to spend at least the amount.'),
2162
2144
  quantityPerPackage: zod
2163
2145
  .string()
2164
- .regex(simulateInvoiceBodyLinesItemRateCardPriceQuantityPerPackageRegExpOne)
2146
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceQuantityPerPackageRegExpOne)
2165
2147
  .describe('Numeric represents an arbitrary precision number.')
2166
2148
  .describe('The quantity per package.'),
2167
2149
  type: zod.enum(['package']),
@@ -2191,7 +2173,7 @@ export const simulateInvoiceBody = zod
2191
2173
  .object({
2192
2174
  code: zod
2193
2175
  .string()
2194
- .regex(simulateInvoiceBodyLinesItemRateCardTaxConfigStripeCodeRegExp)
2176
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardTaxConfigStripeCodeRegExp)
2195
2177
  .describe('Product tax code.\n\nSee: https://docs.stripe.com/tax/tax-codes'),
2196
2178
  })
2197
2179
  .describe('The tax config for Stripe.')
@@ -2225,7 +2207,7 @@ export const simulateInvoiceBody = zod
2225
2207
  .object({
2226
2208
  code: zod
2227
2209
  .string()
2228
- .regex(simulateInvoiceBodyLinesItemTaxConfigStripeCodeRegExp)
2210
+ .regex(createPendingInvoiceLineBodyLinesItemTaxConfigStripeCodeRegExp)
2229
2211
  .describe('Product tax code.\n\nSee: https://docs.stripe.com/tax/tax-codes'),
2230
2212
  })
2231
2213
  .describe('The tax config for Stripe.')
@@ -2237,24 +2219,19 @@ export const simulateInvoiceBody = zod
2237
2219
  .describe('Tax config specify the tax configuration for this line.'),
2238
2220
  type: zod.enum(['usage_based']),
2239
2221
  })
2240
- .describe('InvoiceSimulationUsageBasedLine represents a usage-based line item that can be input to the simulation endpoint.'),
2222
+ .describe('InvoiceUsageBasedLineCreateWithCustomer represents the create model for an invoice line that is sold to the customer based on usage.'),
2241
2223
  zod
2242
2224
  .object({
2243
2225
  category: zod
2244
2226
  .enum(['regular', 'commitment'])
2245
2227
  .describe('InvoiceFlatFeeCategory determines if the flat fee is a regular fee due to use due to a\ncommitment.')
2246
- .default(simulateInvoiceBodyLinesItemCategoryDefault)
2228
+ .default(createPendingInvoiceLineBodyLinesItemCategoryDefault)
2247
2229
  .describe('Category of the flat fee.'),
2248
2230
  description: zod
2249
2231
  .string()
2250
- .max(simulateInvoiceBodyLinesItemDescriptionMaxOne)
2232
+ .max(createPendingInvoiceLineBodyLinesItemDescriptionMaxOne)
2251
2233
  .optional()
2252
2234
  .describe('Optional description of the resource. Maximum 1024 characters.'),
2253
- id: zod
2254
- .string()
2255
- .regex(simulateInvoiceBodyLinesItemIdRegExpOne)
2256
- .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
2235
  invoiceAt: zod
2259
2236
  .date()
2260
2237
  .describe('The time this line item should be invoiced.'),
@@ -2266,12 +2243,12 @@ export const simulateInvoiceBody = zod
2266
2243
  name: zod
2267
2244
  .string()
2268
2245
  .min(1)
2269
- .max(simulateInvoiceBodyLinesItemNameMaxOne)
2246
+ .max(createPendingInvoiceLineBodyLinesItemNameMaxOne)
2270
2247
  .describe('Human-readable name for the resource. Between 1 and 256 characters.'),
2271
2248
  paymentTerm: zod
2272
2249
  .enum(['in_advance', 'in_arrears'])
2273
2250
  .describe('The payment term of a flat price.\nOne of: in_advance or in_arrears.')
2274
- .default(simulateInvoiceBodyLinesItemPaymentTermDefault)
2251
+ .default(createPendingInvoiceLineBodyLinesItemPaymentTermDefault)
2275
2252
  .describe('Payment term of the line.'),
2276
2253
  period: zod
2277
2254
  .object({
@@ -2282,13 +2259,13 @@ export const simulateInvoiceBody = zod
2282
2259
  .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
2260
  perUnitAmount: zod
2284
2261
  .string()
2285
- .regex(simulateInvoiceBodyLinesItemPerUnitAmountRegExpOne)
2262
+ .regex(createPendingInvoiceLineBodyLinesItemPerUnitAmountRegExpOne)
2286
2263
  .describe('Numeric represents an arbitrary precision number.')
2287
2264
  .optional()
2288
2265
  .describe('Price of the item being sold.'),
2289
2266
  quantity: zod
2290
2267
  .string()
2291
- .regex(simulateInvoiceBodyLinesItemQuantityRegExpThree)
2268
+ .regex(createPendingInvoiceLineBodyLinesItemQuantityRegExpOne)
2292
2269
  .describe('Numeric represents an arbitrary precision number.')
2293
2270
  .optional()
2294
2271
  .describe('Quantity of the item being sold.'),
@@ -2300,7 +2277,7 @@ export const simulateInvoiceBody = zod
2300
2277
  .object({
2301
2278
  correlationId: zod
2302
2279
  .string()
2303
- .regex(simulateInvoiceBodyLinesItemRateCardDiscountsPercentageCorrelationIdRegExpOne)
2280
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardDiscountsPercentageCorrelationIdRegExpOne)
2304
2281
  .optional()
2305
2282
  .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
2283
  percentage: zod
@@ -2315,12 +2292,12 @@ export const simulateInvoiceBody = zod
2315
2292
  .object({
2316
2293
  correlationId: zod
2317
2294
  .string()
2318
- .regex(simulateInvoiceBodyLinesItemRateCardDiscountsUsageCorrelationIdRegExpOne)
2295
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardDiscountsUsageCorrelationIdRegExpOne)
2319
2296
  .optional()
2320
2297
  .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
2298
  quantity: zod
2322
2299
  .string()
2323
- .regex(simulateInvoiceBodyLinesItemRateCardDiscountsUsageQuantityRegExpThree)
2300
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardDiscountsUsageQuantityRegExpThree)
2324
2301
  .describe('Numeric represents an arbitrary precision number.')
2325
2302
  .describe('The quantity of the usage discount.\n\nMust be positive.'),
2326
2303
  })
@@ -2335,13 +2312,13 @@ export const simulateInvoiceBody = zod
2335
2312
  .object({
2336
2313
  amount: zod
2337
2314
  .string()
2338
- .regex(simulateInvoiceBodyLinesItemRateCardPriceAmountRegExpSeven)
2315
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceAmountRegExpSeven)
2339
2316
  .describe('Numeric represents an arbitrary precision number.')
2340
2317
  .describe('The amount of the flat price.'),
2341
2318
  paymentTerm: zod
2342
2319
  .enum(['in_advance', 'in_arrears'])
2343
2320
  .describe('The payment term of a flat price.\nOne of: in_advance or in_arrears.')
2344
- .default(simulateInvoiceBodyLinesItemRateCardPricePaymentTermDefaultTwo)
2321
+ .default(createPendingInvoiceLineBodyLinesItemRateCardPricePaymentTermDefaultTwo)
2345
2322
  .describe('The payment term of the flat price.\nDefaults to in advance.'),
2346
2323
  type: zod.enum(['flat']),
2347
2324
  })
@@ -2350,7 +2327,7 @@ export const simulateInvoiceBody = zod
2350
2327
  .describe('The price of the rate card.\nWhen null, the feature or service is free.'),
2351
2328
  quantity: zod
2352
2329
  .string()
2353
- .regex(simulateInvoiceBodyLinesItemRateCardQuantityRegExpOne)
2330
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardQuantityRegExpOne)
2354
2331
  .describe('Numeric represents an arbitrary precision number.')
2355
2332
  .optional()
2356
2333
  .describe('Quantity of the item being sold.\n\nDefault: 1'),
@@ -2374,7 +2351,7 @@ export const simulateInvoiceBody = zod
2374
2351
  .object({
2375
2352
  code: zod
2376
2353
  .string()
2377
- .regex(simulateInvoiceBodyLinesItemRateCardTaxConfigStripeCodeRegExpOne)
2354
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardTaxConfigStripeCodeRegExpOne)
2378
2355
  .describe('Product tax code.\n\nSee: https://docs.stripe.com/tax/tax-codes'),
2379
2356
  })
2380
2357
  .describe('The tax config for Stripe.')
@@ -2408,7 +2385,7 @@ export const simulateInvoiceBody = zod
2408
2385
  .object({
2409
2386
  code: zod
2410
2387
  .string()
2411
- .regex(simulateInvoiceBodyLinesItemTaxConfigStripeCodeRegExpOne)
2388
+ .regex(createPendingInvoiceLineBodyLinesItemTaxConfigStripeCodeRegExpOne)
2412
2389
  .describe('Product tax code.\n\nSee: https://docs.stripe.com/tax/tax-codes'),
2413
2390
  })
2414
2391
  .describe('The tax config for Stripe.')
@@ -2420,475 +2397,164 @@ export const simulateInvoiceBody = zod
2420
2397
  .describe('Tax config specify the tax configuration for this line.'),
2421
2398
  type: zod.enum(['flat_fee']),
2422
2399
  })
2423
- .describe('InvoiceSimulationFlatFeeLine represents a flat fee line item that can be input to the simulation endpoint.'),
2400
+ .describe('InvoiceFlatFeePendingLineCreate represents the create model for an invoice line that is sold to the customer as a manually added fee.'),
2424
2401
  ])
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()
2402
+ .describe('InvoiceLineCreate represents the create model for an invoice line.'))
2429
2403
  .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.'),
2404
+ .describe('The lines to be created.'),
2434
2405
  })
2435
- .describe('InvoiceSimulationInput is the input for simulating an invoice.');
2406
+ .describe('InvoicePendingLineCreate represents the create model for a pending invoice line.');
2436
2407
  /**
2437
- * List invoices for a specific customer
2438
- * @summary List invoices
2408
+ * Simulate an invoice for a customer.
2409
+
2410
+ This call will simulate an invoice for a customer based on the pending line items.
2411
+
2412
+ The call will return the total amount of the invoice and the line items that will be included in the invoice.
2413
+ * @summary Simulate an invoice for a customer
2439
2414
  */
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
- createdAfter: zod
2446
- .date()
2447
- .optional()
2448
- .describe('Filter by invoice created time.\nInclusive.'),
2449
- createdBefore: zod
2450
- .date()
2451
- .optional()
2452
- .describe('Filter by invoice created time.\nInclusive.'),
2453
- customers: zod
2454
- .array(zod
2455
- .string()
2456
- .regex(listInvoicesQueryCustomersItemRegExp)
2457
- .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'))
2458
- .optional()
2459
- .describe('Filter by customer ID'),
2460
- expand: zod
2461
- .array(zod
2462
- .enum(['lines', 'preceding', 'workflow.apps'])
2463
- .describe('InvoiceExpand specifies the parts of the invoice to expand in the list output.'))
2464
- .optional()
2465
- .describe('What parts of the list output to expand in listings'),
2466
- extendedStatuses: zod
2467
- .array(zod.string())
2468
- .optional()
2469
- .describe('Filter by invoice extended statuses'),
2470
- includeDeleted: zod.boolean().optional().describe('Include deleted invoices'),
2471
- issuedAfter: zod
2472
- .date()
2473
- .optional()
2474
- .describe('Filter by invoice issued time.\nInclusive.'),
2475
- issuedBefore: zod
2476
- .date()
2477
- .optional()
2478
- .describe('Filter by invoice issued time.\nInclusive.'),
2479
- order: zod.enum(['ASC', 'DESC']).optional().describe('The order direction.'),
2480
- orderBy: zod
2481
- .enum(['customer.name', 'issuedAt', 'status', 'createdAt', 'updatedAt'])
2482
- .optional()
2483
- .describe('The order by field.'),
2484
- page: zod
2485
- .number()
2486
- .min(1)
2487
- .default(listInvoicesQueryPageDefault)
2488
- .describe('Page index.\n\nDefault is 1.'),
2489
- pageSize: zod
2490
- .number()
2491
- .min(1)
2492
- .max(listInvoicesQueryPageSizeMax)
2493
- .default(listInvoicesQueryPageSizeDefault)
2494
- .describe('The maximum number of items per page.\n\nDefault is 100.'),
2495
- statuses: zod
2496
- .array(zod
2497
- .enum([
2498
- 'gathering',
2499
- 'draft',
2500
- 'issuing',
2501
- 'issued',
2502
- 'payment_processing',
2503
- 'overdue',
2504
- 'paid',
2505
- 'uncollectible',
2506
- 'voided',
2507
- ])
2508
- .describe('InvoiceStatus describes the status of an invoice.'))
2509
- .optional()
2510
- .describe('Filter by the invoice status.'),
2415
+ export const simulateInvoicePathCustomerIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
2416
+ export const simulateInvoiceParams = zod.object({
2417
+ customerId: zod.string().regex(simulateInvoicePathCustomerIdRegExp),
2511
2418
  });
2512
- /**
2513
- * Create a new invoice from the pending line items.
2514
-
2515
- This should be only called if for some reason we need to invoice a customer outside of the normal billing cycle.
2516
-
2517
- 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.
2518
-
2519
- New pending line items will be created for the period between now() and the next billing cycle's begining date for any metered item.
2520
-
2521
- The call can return multiple invoices if the pending line items are in different currencies.
2522
- * @summary Invoice a customer based on the pending line items
2523
- */
2524
- export const invoicePendingLinesActionBodyFiltersLineIdsItemRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
2525
- export const invoicePendingLinesActionBodyCustomerIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
2526
- export const invoicePendingLinesActionBody = zod
2527
- .object({
2528
- asOf: zod
2529
- .date()
2530
- .optional()
2531
- .describe('The time as of which the invoice is created.\n\nIf not provided, the current time is used.'),
2532
- customerId: zod
2533
- .string()
2534
- .regex(invoicePendingLinesActionBodyCustomerIdRegExp)
2535
- .describe('The customer ID for which to create the invoice.'),
2536
- filters: zod
2537
- .object({
2538
- lineIds: zod
2539
- .array(zod
2540
- .string()
2541
- .regex(invoicePendingLinesActionBodyFiltersLineIdsItemRegExp)
2542
- .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'))
2543
- .optional()
2544
- .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.'),
2545
- })
2546
- .describe('InvoicePendingLinesActionFiltersInput specifies which lines to include in the invoice.')
2547
- .optional()
2548
- .describe('Filters to apply when creating the invoice.'),
2549
- })
2550
- .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.');
2551
- /**
2552
- * Create a new pending line item (charge).
2553
-
2554
- This call is used to create a new pending line item for the customer if required a new
2555
- gathering invoice will be created.
2556
-
2557
- A new invoice will be created if:
2558
- - there is no invoice in gathering state
2559
- - the currency of the line item doesn't match the currency of any invoices in gathering state
2560
- * @summary Create pending line items
2561
- */
2562
- export const createPendingInvoiceLineBodyNameMax = 256;
2563
- export const createPendingInvoiceLineBodyDescriptionMax = 1024;
2564
- export const createPendingInvoiceLineBodyCurrencyMinOne = 3;
2565
- export const createPendingInvoiceLineBodyCurrencyMaxOne = 3;
2566
- export const createPendingInvoiceLineBodyCurrencyRegExpOne = new RegExp('^[A-Z]{3}$');
2567
- export const createPendingInvoiceLineBodyTaxConfigStripeCodeRegExp = new RegExp('^txcd_\\d{8}$');
2568
- export const createPendingInvoiceLineBodyPriceAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2569
- export const createPendingInvoiceLineBodyPricePaymentTermDefault = 'in_advance';
2570
- export const createPendingInvoiceLineBodyPriceAmountRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2571
- export const createPendingInvoiceLineBodyPriceMinimumAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2572
- export const createPendingInvoiceLineBodyPriceMaximumAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2573
- export const createPendingInvoiceLineBodyPriceTiersItemUpToAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2574
- export const createPendingInvoiceLineBodyPriceTiersItemFlatPriceAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2575
- export const createPendingInvoiceLineBodyPriceTiersItemUnitPriceAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2576
- export const createPendingInvoiceLineBodyPriceMinimumAmountRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2577
- export const createPendingInvoiceLineBodyPriceMaximumAmountRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2578
- export const createPendingInvoiceLineBodyPriceMultiplierRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2579
- export const createPendingInvoiceLineBodyPriceMultiplierDefault = '1';
2580
- export const createPendingInvoiceLineBodyPriceMinimumAmountRegExpFive = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2581
- export const createPendingInvoiceLineBodyPriceMaximumAmountRegExpFive = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2582
- export const createPendingInvoiceLineBodyPriceAmountRegExpFive = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2583
- export const createPendingInvoiceLineBodyPriceQuantityPerPackageRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2584
- export const createPendingInvoiceLineBodyPriceMinimumAmountRegExpSeven = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2585
- export const createPendingInvoiceLineBodyPriceMaximumAmountRegExpSeven = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2586
- export const createPendingInvoiceLineBodyFeatureKeyMax = 64;
2587
- export const createPendingInvoiceLineBodyFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
2588
- export const createPendingInvoiceLineBodyRateCardFeatureKeyMax = 64;
2589
- export const createPendingInvoiceLineBodyRateCardFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
2590
- export const createPendingInvoiceLineBodyRateCardTaxConfigStripeCodeRegExp = new RegExp('^txcd_\\d{8}$');
2591
- export const createPendingInvoiceLineBodyRateCardPriceAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2592
- export const createPendingInvoiceLineBodyRateCardPricePaymentTermDefault = 'in_advance';
2593
- export const createPendingInvoiceLineBodyRateCardPriceAmountRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2594
- export const createPendingInvoiceLineBodyRateCardPriceMinimumAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2595
- export const createPendingInvoiceLineBodyRateCardPriceMaximumAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2596
- export const createPendingInvoiceLineBodyRateCardPriceTiersItemUpToAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2597
- export const createPendingInvoiceLineBodyRateCardPriceTiersItemFlatPriceAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2598
- export const createPendingInvoiceLineBodyRateCardPriceTiersItemUnitPriceAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2599
- export const createPendingInvoiceLineBodyRateCardPriceMinimumAmountRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2600
- export const createPendingInvoiceLineBodyRateCardPriceMaximumAmountRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2601
- export const createPendingInvoiceLineBodyRateCardPriceMultiplierRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2602
- export const createPendingInvoiceLineBodyRateCardPriceMultiplierDefault = '1';
2603
- export const createPendingInvoiceLineBodyRateCardPriceMinimumAmountRegExpFive = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2604
- export const createPendingInvoiceLineBodyRateCardPriceMaximumAmountRegExpFive = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2605
- export const createPendingInvoiceLineBodyRateCardPriceAmountRegExpFive = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2606
- export const createPendingInvoiceLineBodyRateCardPriceQuantityPerPackageRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2607
- export const createPendingInvoiceLineBodyRateCardPriceMinimumAmountRegExpSeven = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2608
- export const createPendingInvoiceLineBodyRateCardPriceMaximumAmountRegExpSeven = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2609
- export const createPendingInvoiceLineBodyRateCardDiscountsPercentageCorrelationIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
2610
- export const createPendingInvoiceLineBodyRateCardDiscountsUsageQuantityRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2611
- export const createPendingInvoiceLineBodyRateCardDiscountsUsageCorrelationIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
2612
- export const createPendingInvoiceLineBodyCustomerIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
2613
- export const createPendingInvoiceLineBodyNameMaxOne = 256;
2614
- export const createPendingInvoiceLineBodyDescriptionMaxOne = 1024;
2615
- export const createPendingInvoiceLineBodyCurrencyMinThree = 3;
2616
- export const createPendingInvoiceLineBodyCurrencyMaxThree = 3;
2617
- export const createPendingInvoiceLineBodyCurrencyRegExpThree = new RegExp('^[A-Z]{3}$');
2618
- export const createPendingInvoiceLineBodyTaxConfigStripeCodeRegExpOne = new RegExp('^txcd_\\d{8}$');
2619
- export const createPendingInvoiceLineBodyPerUnitAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2620
- export const createPendingInvoiceLineBodyPaymentTermDefault = 'in_advance';
2621
- export const createPendingInvoiceLineBodyQuantityRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2622
- export const createPendingInvoiceLineBodyRateCardTaxConfigStripeCodeRegExpOne = new RegExp('^txcd_\\d{8}$');
2623
- export const createPendingInvoiceLineBodyRateCardPriceAmountRegExpSeven = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2624
- export const createPendingInvoiceLineBodyRateCardPricePaymentTermDefaultTwo = 'in_advance';
2625
- export const createPendingInvoiceLineBodyRateCardQuantityRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2626
- export const createPendingInvoiceLineBodyRateCardDiscountsPercentageCorrelationIdRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
2627
- export const createPendingInvoiceLineBodyRateCardDiscountsUsageQuantityRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2628
- export const createPendingInvoiceLineBodyRateCardDiscountsUsageCorrelationIdRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
2629
- export const createPendingInvoiceLineBodyCategoryDefault = 'regular';
2630
- export const createPendingInvoiceLineBodyCustomerIdRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
2631
- export const createPendingInvoiceLineBodyItem = zod
2632
- .discriminatedUnion('type', [
2633
- zod
2634
- .object({
2635
- currency: zod
2636
- .string()
2637
- .min(createPendingInvoiceLineBodyCurrencyMinOne)
2638
- .max(createPendingInvoiceLineBodyCurrencyMaxOne)
2639
- .regex(createPendingInvoiceLineBodyCurrencyRegExpOne)
2640
- .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.')
2641
- .describe('The currency of this line.'),
2642
- customerId: zod
2643
- .string()
2644
- .regex(createPendingInvoiceLineBodyCustomerIdRegExp)
2645
- .describe('The customer this line item belongs to.'),
2646
- description: zod
2647
- .string()
2648
- .max(createPendingInvoiceLineBodyDescriptionMax)
2649
- .optional()
2650
- .describe('Optional description of the resource. Maximum 1024 characters.'),
2651
- featureKey: zod
2652
- .string()
2653
- .min(1)
2654
- .max(createPendingInvoiceLineBodyFeatureKeyMax)
2655
- .regex(createPendingInvoiceLineBodyFeatureKeyRegExp)
2656
- .optional()
2657
- .describe('The feature that the usage is based on.'),
2658
- invoiceAt: zod
2659
- .date()
2660
- .describe('The time this line item should be invoiced.'),
2661
- metadata: zod
2662
- .record(zod.string(), zod.string())
2663
- .describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
2664
- .nullish()
2665
- .describe('Additional metadata for the resource.'),
2666
- name: zod
2667
- .string()
2668
- .min(1)
2669
- .max(createPendingInvoiceLineBodyNameMax)
2670
- .describe('Human-readable name for the resource. Between 1 and 256 characters.'),
2671
- period: zod
2672
- .object({
2673
- from: zod.date().describe('Period start time.'),
2674
- to: zod.date().describe('Period end time.'),
2675
- })
2676
- .describe('A period with a start and end time.')
2677
- .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.'),
2678
- price: zod
2679
- .discriminatedUnion('type', [
2680
- zod
2681
- .object({
2682
- amount: zod
2683
- .string()
2684
- .regex(createPendingInvoiceLineBodyPriceAmountRegExpOne)
2685
- .describe('Numeric represents an arbitrary precision number.')
2686
- .describe('The amount of the flat price.'),
2687
- paymentTerm: zod
2688
- .enum(['in_advance', 'in_arrears'])
2689
- .describe('The payment term of a flat price.\nOne of: in_advance or in_arrears.')
2690
- .default(createPendingInvoiceLineBodyPricePaymentTermDefault)
2691
- .describe('The payment term of the flat price.\nDefaults to in advance.'),
2692
- type: zod.enum(['flat']),
2693
- })
2694
- .describe('Flat price with payment term.'),
2695
- zod
2696
- .object({
2697
- amount: zod
2698
- .string()
2699
- .regex(createPendingInvoiceLineBodyPriceAmountRegExpThree)
2700
- .describe('Numeric represents an arbitrary precision number.')
2701
- .describe('The amount of the unit price.'),
2702
- maximumAmount: zod
2703
- .string()
2704
- .regex(createPendingInvoiceLineBodyPriceMaximumAmountRegExpOne)
2705
- .describe('Numeric represents an arbitrary precision number.')
2706
- .optional()
2707
- .describe('The customer is limited to spend at most the amount.'),
2708
- minimumAmount: zod
2709
- .string()
2710
- .regex(createPendingInvoiceLineBodyPriceMinimumAmountRegExpOne)
2711
- .describe('Numeric represents an arbitrary precision number.')
2712
- .optional()
2713
- .describe('The customer is committed to spend at least the amount.'),
2714
- type: zod.enum(['unit']),
2715
- })
2716
- .describe('Unit price with spend commitments.'),
2717
- zod
2718
- .object({
2719
- maximumAmount: zod
2720
- .string()
2721
- .regex(createPendingInvoiceLineBodyPriceMaximumAmountRegExpThree)
2722
- .describe('Numeric represents an arbitrary precision number.')
2723
- .optional()
2724
- .describe('The customer is limited to spend at most the amount.'),
2725
- minimumAmount: zod
2726
- .string()
2727
- .regex(createPendingInvoiceLineBodyPriceMinimumAmountRegExpThree)
2728
- .describe('Numeric represents an arbitrary precision number.')
2729
- .optional()
2730
- .describe('The customer is committed to spend at least the amount.'),
2731
- mode: zod
2732
- .enum(['volume', 'graduated'])
2733
- .describe('The mode of the tiered price.')
2734
- .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.'),
2735
- tiers: zod
2736
- .array(zod
2737
- .object({
2738
- flatPrice: zod
2739
- .object({
2740
- amount: zod
2741
- .string()
2742
- .regex(createPendingInvoiceLineBodyPriceTiersItemFlatPriceAmountRegExpOne)
2743
- .describe('Numeric represents an arbitrary precision number.')
2744
- .describe('The amount of the flat price.'),
2745
- type: zod
2746
- .enum(['flat'])
2747
- .describe('The type of the price.'),
2748
- })
2749
- .describe('Flat price.')
2750
- .nullable()
2751
- .describe('The flat price component of the tier.'),
2752
- unitPrice: zod
2753
- .object({
2754
- amount: zod
2755
- .string()
2756
- .regex(createPendingInvoiceLineBodyPriceTiersItemUnitPriceAmountRegExpOne)
2757
- .describe('Numeric represents an arbitrary precision number.')
2758
- .describe('The amount of the unit price.'),
2759
- type: zod
2760
- .enum(['unit'])
2761
- .describe('The type of the price.'),
2762
- })
2763
- .describe('Unit price.')
2764
- .nullable()
2765
- .describe('The unit price component of the tier.'),
2766
- upToAmount: zod
2767
- .string()
2768
- .regex(createPendingInvoiceLineBodyPriceTiersItemUpToAmountRegExpOne)
2769
- .describe('Numeric represents an arbitrary precision number.')
2770
- .optional()
2771
- .describe('Up to and including to this quantity will be contained in the tier.\nIf null, the tier is open-ended.'),
2772
- })
2773
- .describe('A price tier.\nAt least one price component is required in each tier.'))
2774
- .min(1)
2775
- .describe('The tiers of the tiered price.\nAt least one price component is required in each tier.'),
2776
- type: zod.enum(['tiered']),
2777
- })
2778
- .describe('Tiered price with spend commitments.'),
2779
- zod
2780
- .object({
2781
- maximumAmount: zod
2782
- .string()
2783
- .regex(createPendingInvoiceLineBodyPriceMaximumAmountRegExpFive)
2784
- .describe('Numeric represents an arbitrary precision number.')
2785
- .optional()
2786
- .describe('The customer is limited to spend at most the amount.'),
2787
- minimumAmount: zod
2788
- .string()
2789
- .regex(createPendingInvoiceLineBodyPriceMinimumAmountRegExpFive)
2790
- .describe('Numeric represents an arbitrary precision number.')
2791
- .optional()
2792
- .describe('The customer is committed to spend at least the amount.'),
2793
- multiplier: zod
2794
- .string()
2795
- .regex(createPendingInvoiceLineBodyPriceMultiplierRegExpOne)
2796
- .describe('Numeric represents an arbitrary precision number.')
2797
- .default(createPendingInvoiceLineBodyPriceMultiplierDefault)
2798
- .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'),
2799
- type: zod.enum(['dynamic']),
2800
- })
2801
- .describe('Dynamic price with spend commitments.'),
2802
- zod
2803
- .object({
2804
- amount: zod
2805
- .string()
2806
- .regex(createPendingInvoiceLineBodyPriceAmountRegExpFive)
2807
- .describe('Numeric represents an arbitrary precision number.')
2808
- .describe('The price of one package.'),
2809
- maximumAmount: zod
2810
- .string()
2811
- .regex(createPendingInvoiceLineBodyPriceMaximumAmountRegExpSeven)
2812
- .describe('Numeric represents an arbitrary precision number.')
2813
- .optional()
2814
- .describe('The customer is limited to spend at most the amount.'),
2815
- minimumAmount: zod
2816
- .string()
2817
- .regex(createPendingInvoiceLineBodyPriceMinimumAmountRegExpSeven)
2818
- .describe('Numeric represents an arbitrary precision number.')
2819
- .optional()
2820
- .describe('The customer is committed to spend at least the amount.'),
2821
- quantityPerPackage: zod
2822
- .string()
2823
- .regex(createPendingInvoiceLineBodyPriceQuantityPerPackageRegExpOne)
2824
- .describe('Numeric represents an arbitrary precision number.')
2825
- .describe('The quantity per package.'),
2826
- type: zod.enum(['package']),
2827
- })
2828
- .describe('Package price with spend commitments.'),
2829
- ])
2830
- .describe('The price of the usage based rate card.')
2831
- .optional()
2832
- .describe('Price of the usage-based item being sold.'),
2833
- rateCard: zod
2834
- .object({
2835
- discounts: zod
2836
- .object({
2837
- percentage: zod
2838
- .object({
2839
- correlationId: zod
2840
- .string()
2841
- .regex(createPendingInvoiceLineBodyRateCardDiscountsPercentageCorrelationIdRegExp)
2842
- .optional()
2843
- .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.'),
2844
- percentage: zod
2845
- .number()
2846
- .describe('Numeric representation of a percentage\n\n50% is represented as 50')
2847
- .describe('The percentage of the discount.'),
2848
- })
2849
- .describe('A percentage discount.')
2850
- .optional()
2851
- .describe('The percentage discount.'),
2852
- usage: zod
2853
- .object({
2854
- correlationId: zod
2855
- .string()
2856
- .regex(createPendingInvoiceLineBodyRateCardDiscountsUsageCorrelationIdRegExp)
2857
- .optional()
2858
- .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.'),
2859
- quantity: zod
2860
- .string()
2861
- .regex(createPendingInvoiceLineBodyRateCardDiscountsUsageQuantityRegExpOne)
2862
- .describe('Numeric represents an arbitrary precision number.')
2863
- .describe('The quantity of the usage discount.\n\nMust be positive.'),
2864
- })
2865
- .describe('A usage discount.')
2866
- .optional()
2867
- .describe('The usage discount.'),
2868
- })
2869
- .describe('A discount by type.')
2419
+ export const simulateInvoiceBodyNumberMaxOne = 256;
2420
+ export const simulateInvoiceBodyCurrencyMinOne = 3;
2421
+ export const simulateInvoiceBodyCurrencyMaxOne = 3;
2422
+ export const simulateInvoiceBodyCurrencyRegExpOne = new RegExp('^[A-Z]{3}$');
2423
+ export const simulateInvoiceBodyLinesItemNameMax = 256;
2424
+ export const simulateInvoiceBodyLinesItemDescriptionMax = 1024;
2425
+ export const simulateInvoiceBodyLinesItemTaxConfigStripeCodeRegExp = new RegExp('^txcd_\\d{8}$');
2426
+ export const simulateInvoiceBodyLinesItemPriceAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2427
+ export const simulateInvoiceBodyLinesItemPricePaymentTermDefault = 'in_advance';
2428
+ export const simulateInvoiceBodyLinesItemPriceAmountRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2429
+ export const simulateInvoiceBodyLinesItemPriceMinimumAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2430
+ export const simulateInvoiceBodyLinesItemPriceMaximumAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2431
+ export const simulateInvoiceBodyLinesItemPriceTiersItemUpToAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2432
+ export const simulateInvoiceBodyLinesItemPriceTiersItemFlatPriceAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2433
+ export const simulateInvoiceBodyLinesItemPriceTiersItemUnitPriceAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2434
+ export const simulateInvoiceBodyLinesItemPriceMinimumAmountRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2435
+ export const simulateInvoiceBodyLinesItemPriceMaximumAmountRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2436
+ export const simulateInvoiceBodyLinesItemPriceMultiplierRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2437
+ export const simulateInvoiceBodyLinesItemPriceMultiplierDefault = '1';
2438
+ export const simulateInvoiceBodyLinesItemPriceMinimumAmountRegExpFive = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2439
+ export const simulateInvoiceBodyLinesItemPriceMaximumAmountRegExpFive = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2440
+ export const simulateInvoiceBodyLinesItemPriceAmountRegExpFive = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2441
+ export const simulateInvoiceBodyLinesItemPriceQuantityPerPackageRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2442
+ export const simulateInvoiceBodyLinesItemPriceMinimumAmountRegExpSeven = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2443
+ export const simulateInvoiceBodyLinesItemPriceMaximumAmountRegExpSeven = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2444
+ export const simulateInvoiceBodyLinesItemFeatureKeyMax = 64;
2445
+ export const simulateInvoiceBodyLinesItemFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
2446
+ export const simulateInvoiceBodyLinesItemRateCardFeatureKeyMax = 64;
2447
+ export const simulateInvoiceBodyLinesItemRateCardFeatureKeyRegExp = new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$');
2448
+ export const simulateInvoiceBodyLinesItemRateCardTaxConfigStripeCodeRegExp = new RegExp('^txcd_\\d{8}$');
2449
+ export const simulateInvoiceBodyLinesItemRateCardPriceAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2450
+ export const simulateInvoiceBodyLinesItemRateCardPricePaymentTermDefault = 'in_advance';
2451
+ export const simulateInvoiceBodyLinesItemRateCardPriceAmountRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2452
+ export const simulateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2453
+ export const simulateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2454
+ export const simulateInvoiceBodyLinesItemRateCardPriceTiersItemUpToAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2455
+ export const simulateInvoiceBodyLinesItemRateCardPriceTiersItemFlatPriceAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2456
+ export const simulateInvoiceBodyLinesItemRateCardPriceTiersItemUnitPriceAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2457
+ export const simulateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2458
+ export const simulateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2459
+ export const simulateInvoiceBodyLinesItemRateCardPriceMultiplierRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2460
+ export const simulateInvoiceBodyLinesItemRateCardPriceMultiplierDefault = '1';
2461
+ export const simulateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpFive = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2462
+ export const simulateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpFive = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2463
+ export const simulateInvoiceBodyLinesItemRateCardPriceAmountRegExpFive = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2464
+ export const simulateInvoiceBodyLinesItemRateCardPriceQuantityPerPackageRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2465
+ export const simulateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpSeven = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2466
+ export const simulateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpSeven = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2467
+ export const simulateInvoiceBodyLinesItemRateCardDiscountsPercentageCorrelationIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
2468
+ export const simulateInvoiceBodyLinesItemRateCardDiscountsUsageQuantityRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2469
+ export const simulateInvoiceBodyLinesItemRateCardDiscountsUsageCorrelationIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
2470
+ export const simulateInvoiceBodyLinesItemQuantityRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2471
+ export const simulateInvoiceBodyLinesItemPreLinePeriodQuantityRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2472
+ export const simulateInvoiceBodyLinesItemIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
2473
+ export const simulateInvoiceBodyLinesItemNameMaxOne = 256;
2474
+ export const simulateInvoiceBodyLinesItemDescriptionMaxOne = 1024;
2475
+ export const simulateInvoiceBodyLinesItemTaxConfigStripeCodeRegExpOne = new RegExp('^txcd_\\d{8}$');
2476
+ export const simulateInvoiceBodyLinesItemPerUnitAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2477
+ export const simulateInvoiceBodyLinesItemPaymentTermDefault = 'in_advance';
2478
+ export const simulateInvoiceBodyLinesItemQuantityRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2479
+ export const simulateInvoiceBodyLinesItemRateCardTaxConfigStripeCodeRegExpOne = new RegExp('^txcd_\\d{8}$');
2480
+ export const simulateInvoiceBodyLinesItemRateCardPriceAmountRegExpSeven = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2481
+ export const simulateInvoiceBodyLinesItemRateCardPricePaymentTermDefaultTwo = 'in_advance';
2482
+ export const simulateInvoiceBodyLinesItemRateCardQuantityRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2483
+ export const simulateInvoiceBodyLinesItemRateCardDiscountsPercentageCorrelationIdRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
2484
+ export const simulateInvoiceBodyLinesItemRateCardDiscountsUsageQuantityRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2485
+ export const simulateInvoiceBodyLinesItemRateCardDiscountsUsageCorrelationIdRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
2486
+ export const simulateInvoiceBodyLinesItemCategoryDefault = 'regular';
2487
+ export const simulateInvoiceBodyLinesItemIdRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
2488
+ export const simulateInvoiceBody = zod
2489
+ .object({
2490
+ currency: zod
2491
+ .string()
2492
+ .min(simulateInvoiceBodyCurrencyMinOne)
2493
+ .max(simulateInvoiceBodyCurrencyMaxOne)
2494
+ .regex(simulateInvoiceBodyCurrencyRegExpOne)
2495
+ .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.')
2496
+ .describe('Currency for all invoice line items.\n\nMulti currency invoices are not supported yet.'),
2497
+ lines: zod
2498
+ .array(zod
2499
+ .discriminatedUnion('type', [
2500
+ zod
2501
+ .object({
2502
+ description: zod
2503
+ .string()
2504
+ .max(simulateInvoiceBodyLinesItemDescriptionMax)
2870
2505
  .optional()
2871
- .describe('The discounts that are applied to the line.'),
2506
+ .describe('Optional description of the resource. Maximum 1024 characters.'),
2872
2507
  featureKey: zod
2873
2508
  .string()
2874
2509
  .min(1)
2875
- .max(createPendingInvoiceLineBodyRateCardFeatureKeyMax)
2876
- .regex(createPendingInvoiceLineBodyRateCardFeatureKeyRegExp)
2510
+ .max(simulateInvoiceBodyLinesItemFeatureKeyMax)
2511
+ .regex(simulateInvoiceBodyLinesItemFeatureKeyRegExp)
2877
2512
  .optional()
2878
- .describe('The feature the customer is entitled to use.'),
2513
+ .describe('The feature that the usage is based on.'),
2514
+ id: zod
2515
+ .string()
2516
+ .regex(simulateInvoiceBodyLinesItemIdRegExp)
2517
+ .optional()
2518
+ .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.'),
2519
+ invoiceAt: zod
2520
+ .date()
2521
+ .describe('The time this line item should be invoiced.'),
2522
+ metadata: zod
2523
+ .record(zod.string(), zod.string())
2524
+ .describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
2525
+ .nullish()
2526
+ .describe('Additional metadata for the resource.'),
2527
+ name: zod
2528
+ .string()
2529
+ .min(1)
2530
+ .max(simulateInvoiceBodyLinesItemNameMax)
2531
+ .describe('Human-readable name for the resource. Between 1 and 256 characters.'),
2532
+ period: zod
2533
+ .object({
2534
+ from: zod.date().describe('Period start time.'),
2535
+ to: zod.date().describe('Period end time.'),
2536
+ })
2537
+ .describe('A period with a start and end time.')
2538
+ .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.'),
2539
+ preLinePeriodQuantity: zod
2540
+ .string()
2541
+ .regex(simulateInvoiceBodyLinesItemPreLinePeriodQuantityRegExpOne)
2542
+ .describe('Numeric represents an arbitrary precision number.')
2543
+ .optional()
2544
+ .describe("The quantity of the item used before this line's period, if the line is billed progressively."),
2879
2545
  price: zod
2880
2546
  .discriminatedUnion('type', [
2881
2547
  zod
2882
2548
  .object({
2883
2549
  amount: zod
2884
2550
  .string()
2885
- .regex(createPendingInvoiceLineBodyRateCardPriceAmountRegExpOne)
2551
+ .regex(simulateInvoiceBodyLinesItemPriceAmountRegExpOne)
2886
2552
  .describe('Numeric represents an arbitrary precision number.')
2887
2553
  .describe('The amount of the flat price.'),
2888
2554
  paymentTerm: zod
2889
2555
  .enum(['in_advance', 'in_arrears'])
2890
2556
  .describe('The payment term of a flat price.\nOne of: in_advance or in_arrears.')
2891
- .default(createPendingInvoiceLineBodyRateCardPricePaymentTermDefault)
2557
+ .default(simulateInvoiceBodyLinesItemPricePaymentTermDefault)
2892
2558
  .describe('The payment term of the flat price.\nDefaults to in advance.'),
2893
2559
  type: zod.enum(['flat']),
2894
2560
  })
@@ -2897,18 +2563,18 @@ export const createPendingInvoiceLineBodyItem = zod
2897
2563
  .object({
2898
2564
  amount: zod
2899
2565
  .string()
2900
- .regex(createPendingInvoiceLineBodyRateCardPriceAmountRegExpThree)
2566
+ .regex(simulateInvoiceBodyLinesItemPriceAmountRegExpThree)
2901
2567
  .describe('Numeric represents an arbitrary precision number.')
2902
2568
  .describe('The amount of the unit price.'),
2903
2569
  maximumAmount: zod
2904
2570
  .string()
2905
- .regex(createPendingInvoiceLineBodyRateCardPriceMaximumAmountRegExpOne)
2571
+ .regex(simulateInvoiceBodyLinesItemPriceMaximumAmountRegExpOne)
2906
2572
  .describe('Numeric represents an arbitrary precision number.')
2907
2573
  .optional()
2908
2574
  .describe('The customer is limited to spend at most the amount.'),
2909
2575
  minimumAmount: zod
2910
2576
  .string()
2911
- .regex(createPendingInvoiceLineBodyRateCardPriceMinimumAmountRegExpOne)
2577
+ .regex(simulateInvoiceBodyLinesItemPriceMinimumAmountRegExpOne)
2912
2578
  .describe('Numeric represents an arbitrary precision number.')
2913
2579
  .optional()
2914
2580
  .describe('The customer is committed to spend at least the amount.'),
@@ -2919,13 +2585,13 @@ export const createPendingInvoiceLineBodyItem = zod
2919
2585
  .object({
2920
2586
  maximumAmount: zod
2921
2587
  .string()
2922
- .regex(createPendingInvoiceLineBodyRateCardPriceMaximumAmountRegExpThree)
2588
+ .regex(simulateInvoiceBodyLinesItemPriceMaximumAmountRegExpThree)
2923
2589
  .describe('Numeric represents an arbitrary precision number.')
2924
2590
  .optional()
2925
2591
  .describe('The customer is limited to spend at most the amount.'),
2926
2592
  minimumAmount: zod
2927
2593
  .string()
2928
- .regex(createPendingInvoiceLineBodyRateCardPriceMinimumAmountRegExpThree)
2594
+ .regex(simulateInvoiceBodyLinesItemPriceMinimumAmountRegExpThree)
2929
2595
  .describe('Numeric represents an arbitrary precision number.')
2930
2596
  .optional()
2931
2597
  .describe('The customer is committed to spend at least the amount.'),
@@ -2940,7 +2606,7 @@ export const createPendingInvoiceLineBodyItem = zod
2940
2606
  .object({
2941
2607
  amount: zod
2942
2608
  .string()
2943
- .regex(createPendingInvoiceLineBodyRateCardPriceTiersItemFlatPriceAmountRegExpOne)
2609
+ .regex(simulateInvoiceBodyLinesItemPriceTiersItemFlatPriceAmountRegExpOne)
2944
2610
  .describe('Numeric represents an arbitrary precision number.')
2945
2611
  .describe('The amount of the flat price.'),
2946
2612
  type: zod
@@ -2954,83 +2620,323 @@ export const createPendingInvoiceLineBodyItem = zod
2954
2620
  .object({
2955
2621
  amount: zod
2956
2622
  .string()
2957
- .regex(createPendingInvoiceLineBodyRateCardPriceTiersItemUnitPriceAmountRegExpOne)
2623
+ .regex(simulateInvoiceBodyLinesItemPriceTiersItemUnitPriceAmountRegExpOne)
2624
+ .describe('Numeric represents an arbitrary precision number.')
2625
+ .describe('The amount of the unit price.'),
2626
+ type: zod
2627
+ .enum(['unit'])
2628
+ .describe('The type of the price.'),
2629
+ })
2630
+ .describe('Unit price.')
2631
+ .nullable()
2632
+ .describe('The unit price component of the tier.'),
2633
+ upToAmount: zod
2634
+ .string()
2635
+ .regex(simulateInvoiceBodyLinesItemPriceTiersItemUpToAmountRegExpOne)
2636
+ .describe('Numeric represents an arbitrary precision number.')
2637
+ .optional()
2638
+ .describe('Up to and including to this quantity will be contained in the tier.\nIf null, the tier is open-ended.'),
2639
+ })
2640
+ .describe('A price tier.\nAt least one price component is required in each tier.'))
2641
+ .min(1)
2642
+ .describe('The tiers of the tiered price.\nAt least one price component is required in each tier.'),
2643
+ type: zod.enum(['tiered']),
2644
+ })
2645
+ .describe('Tiered price with spend commitments.'),
2646
+ zod
2647
+ .object({
2648
+ maximumAmount: zod
2649
+ .string()
2650
+ .regex(simulateInvoiceBodyLinesItemPriceMaximumAmountRegExpFive)
2651
+ .describe('Numeric represents an arbitrary precision number.')
2652
+ .optional()
2653
+ .describe('The customer is limited to spend at most the amount.'),
2654
+ minimumAmount: zod
2655
+ .string()
2656
+ .regex(simulateInvoiceBodyLinesItemPriceMinimumAmountRegExpFive)
2657
+ .describe('Numeric represents an arbitrary precision number.')
2658
+ .optional()
2659
+ .describe('The customer is committed to spend at least the amount.'),
2660
+ multiplier: zod
2661
+ .string()
2662
+ .regex(simulateInvoiceBodyLinesItemPriceMultiplierRegExpOne)
2663
+ .describe('Numeric represents an arbitrary precision number.')
2664
+ .default(simulateInvoiceBodyLinesItemPriceMultiplierDefault)
2665
+ .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'),
2666
+ type: zod.enum(['dynamic']),
2667
+ })
2668
+ .describe('Dynamic price with spend commitments.'),
2669
+ zod
2670
+ .object({
2671
+ amount: zod
2672
+ .string()
2673
+ .regex(simulateInvoiceBodyLinesItemPriceAmountRegExpFive)
2674
+ .describe('Numeric represents an arbitrary precision number.')
2675
+ .describe('The price of one package.'),
2676
+ maximumAmount: zod
2677
+ .string()
2678
+ .regex(simulateInvoiceBodyLinesItemPriceMaximumAmountRegExpSeven)
2679
+ .describe('Numeric represents an arbitrary precision number.')
2680
+ .optional()
2681
+ .describe('The customer is limited to spend at most the amount.'),
2682
+ minimumAmount: zod
2683
+ .string()
2684
+ .regex(simulateInvoiceBodyLinesItemPriceMinimumAmountRegExpSeven)
2685
+ .describe('Numeric represents an arbitrary precision number.')
2686
+ .optional()
2687
+ .describe('The customer is committed to spend at least the amount.'),
2688
+ quantityPerPackage: zod
2689
+ .string()
2690
+ .regex(simulateInvoiceBodyLinesItemPriceQuantityPerPackageRegExpOne)
2691
+ .describe('Numeric represents an arbitrary precision number.')
2692
+ .describe('The quantity per package.'),
2693
+ type: zod.enum(['package']),
2694
+ })
2695
+ .describe('Package price with spend commitments.'),
2696
+ ])
2697
+ .describe('The price of the usage based rate card.')
2698
+ .optional()
2699
+ .describe('Price of the usage-based item being sold.'),
2700
+ quantity: zod
2701
+ .string()
2702
+ .regex(simulateInvoiceBodyLinesItemQuantityRegExpOne)
2703
+ .describe('Numeric represents an arbitrary precision number.')
2704
+ .describe('The quantity of the item being sold.'),
2705
+ rateCard: zod
2706
+ .object({
2707
+ discounts: zod
2708
+ .object({
2709
+ percentage: zod
2710
+ .object({
2711
+ correlationId: zod
2712
+ .string()
2713
+ .regex(simulateInvoiceBodyLinesItemRateCardDiscountsPercentageCorrelationIdRegExp)
2714
+ .optional()
2715
+ .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.'),
2716
+ percentage: zod
2717
+ .number()
2718
+ .describe('Numeric representation of a percentage\n\n50% is represented as 50')
2719
+ .describe('The percentage of the discount.'),
2720
+ })
2721
+ .describe('A percentage discount.')
2722
+ .optional()
2723
+ .describe('The percentage discount.'),
2724
+ usage: zod
2725
+ .object({
2726
+ correlationId: zod
2727
+ .string()
2728
+ .regex(simulateInvoiceBodyLinesItemRateCardDiscountsUsageCorrelationIdRegExp)
2729
+ .optional()
2730
+ .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.'),
2731
+ quantity: zod
2732
+ .string()
2733
+ .regex(simulateInvoiceBodyLinesItemRateCardDiscountsUsageQuantityRegExpOne)
2734
+ .describe('Numeric represents an arbitrary precision number.')
2735
+ .describe('The quantity of the usage discount.\n\nMust be positive.'),
2736
+ })
2737
+ .describe('A usage discount.')
2738
+ .optional()
2739
+ .describe('The usage discount.'),
2740
+ })
2741
+ .describe('A discount by type.')
2742
+ .optional()
2743
+ .describe('The discounts that are applied to the line.'),
2744
+ featureKey: zod
2745
+ .string()
2746
+ .min(1)
2747
+ .max(simulateInvoiceBodyLinesItemRateCardFeatureKeyMax)
2748
+ .regex(simulateInvoiceBodyLinesItemRateCardFeatureKeyRegExp)
2749
+ .optional()
2750
+ .describe('The feature the customer is entitled to use.'),
2751
+ price: zod
2752
+ .discriminatedUnion('type', [
2753
+ zod
2754
+ .object({
2755
+ amount: zod
2756
+ .string()
2757
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceAmountRegExpOne)
2758
+ .describe('Numeric represents an arbitrary precision number.')
2759
+ .describe('The amount of the flat price.'),
2760
+ paymentTerm: zod
2761
+ .enum(['in_advance', 'in_arrears'])
2762
+ .describe('The payment term of a flat price.\nOne of: in_advance or in_arrears.')
2763
+ .default(simulateInvoiceBodyLinesItemRateCardPricePaymentTermDefault)
2764
+ .describe('The payment term of the flat price.\nDefaults to in advance.'),
2765
+ type: zod.enum(['flat']),
2766
+ })
2767
+ .describe('Flat price with payment term.'),
2768
+ zod
2769
+ .object({
2770
+ amount: zod
2771
+ .string()
2772
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceAmountRegExpThree)
2773
+ .describe('Numeric represents an arbitrary precision number.')
2774
+ .describe('The amount of the unit price.'),
2775
+ maximumAmount: zod
2776
+ .string()
2777
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpOne)
2778
+ .describe('Numeric represents an arbitrary precision number.')
2779
+ .optional()
2780
+ .describe('The customer is limited to spend at most the amount.'),
2781
+ minimumAmount: zod
2782
+ .string()
2783
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpOne)
2784
+ .describe('Numeric represents an arbitrary precision number.')
2785
+ .optional()
2786
+ .describe('The customer is committed to spend at least the amount.'),
2787
+ type: zod.enum(['unit']),
2788
+ })
2789
+ .describe('Unit price with spend commitments.'),
2790
+ zod
2791
+ .object({
2792
+ maximumAmount: zod
2793
+ .string()
2794
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpThree)
2795
+ .describe('Numeric represents an arbitrary precision number.')
2796
+ .optional()
2797
+ .describe('The customer is limited to spend at most the amount.'),
2798
+ minimumAmount: zod
2799
+ .string()
2800
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpThree)
2801
+ .describe('Numeric represents an arbitrary precision number.')
2802
+ .optional()
2803
+ .describe('The customer is committed to spend at least the amount.'),
2804
+ mode: zod
2805
+ .enum(['volume', 'graduated'])
2806
+ .describe('The mode of the tiered price.')
2807
+ .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.'),
2808
+ tiers: zod
2809
+ .array(zod
2810
+ .object({
2811
+ flatPrice: zod
2812
+ .object({
2813
+ amount: zod
2814
+ .string()
2815
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceTiersItemFlatPriceAmountRegExpOne)
2816
+ .describe('Numeric represents an arbitrary precision number.')
2817
+ .describe('The amount of the flat price.'),
2818
+ type: zod
2819
+ .enum(['flat'])
2820
+ .describe('The type of the price.'),
2821
+ })
2822
+ .describe('Flat price.')
2823
+ .nullable()
2824
+ .describe('The flat price component of the tier.'),
2825
+ unitPrice: zod
2826
+ .object({
2827
+ amount: zod
2828
+ .string()
2829
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceTiersItemUnitPriceAmountRegExpOne)
2830
+ .describe('Numeric represents an arbitrary precision number.')
2831
+ .describe('The amount of the unit price.'),
2832
+ type: zod
2833
+ .enum(['unit'])
2834
+ .describe('The type of the price.'),
2835
+ })
2836
+ .describe('Unit price.')
2837
+ .nullable()
2838
+ .describe('The unit price component of the tier.'),
2839
+ upToAmount: zod
2840
+ .string()
2841
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceTiersItemUpToAmountRegExpOne)
2958
2842
  .describe('Numeric represents an arbitrary precision number.')
2959
- .describe('The amount of the unit price.'),
2960
- type: zod
2961
- .enum(['unit'])
2962
- .describe('The type of the price.'),
2843
+ .optional()
2844
+ .describe('Up to and including to this quantity will be contained in the tier.\nIf null, the tier is open-ended.'),
2963
2845
  })
2964
- .describe('Unit price.')
2965
- .nullable()
2966
- .describe('The unit price component of the tier.'),
2967
- upToAmount: zod
2846
+ .describe('A price tier.\nAt least one price component is required in each tier.'))
2847
+ .min(1)
2848
+ .describe('The tiers of the tiered price.\nAt least one price component is required in each tier.'),
2849
+ type: zod.enum(['tiered']),
2850
+ })
2851
+ .describe('Tiered price with spend commitments.'),
2852
+ zod
2853
+ .object({
2854
+ maximumAmount: zod
2968
2855
  .string()
2969
- .regex(createPendingInvoiceLineBodyRateCardPriceTiersItemUpToAmountRegExpOne)
2856
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpFive)
2970
2857
  .describe('Numeric represents an arbitrary precision number.')
2971
2858
  .optional()
2972
- .describe('Up to and including to this quantity will be contained in the tier.\nIf null, the tier is open-ended.'),
2859
+ .describe('The customer is limited to spend at most the amount.'),
2860
+ minimumAmount: zod
2861
+ .string()
2862
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpFive)
2863
+ .describe('Numeric represents an arbitrary precision number.')
2864
+ .optional()
2865
+ .describe('The customer is committed to spend at least the amount.'),
2866
+ multiplier: zod
2867
+ .string()
2868
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceMultiplierRegExpOne)
2869
+ .describe('Numeric represents an arbitrary precision number.')
2870
+ .default(simulateInvoiceBodyLinesItemRateCardPriceMultiplierDefault)
2871
+ .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'),
2872
+ type: zod.enum(['dynamic']),
2973
2873
  })
2974
- .describe('A price tier.\nAt least one price component is required in each tier.'))
2975
- .min(1)
2976
- .describe('The tiers of the tiered price.\nAt least one price component is required in each tier.'),
2977
- type: zod.enum(['tiered']),
2978
- })
2979
- .describe('Tiered price with spend commitments.'),
2980
- zod
2874
+ .describe('Dynamic price with spend commitments.'),
2875
+ zod
2876
+ .object({
2877
+ amount: zod
2878
+ .string()
2879
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceAmountRegExpFive)
2880
+ .describe('Numeric represents an arbitrary precision number.')
2881
+ .describe('The price of one package.'),
2882
+ maximumAmount: zod
2883
+ .string()
2884
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpSeven)
2885
+ .describe('Numeric represents an arbitrary precision number.')
2886
+ .optional()
2887
+ .describe('The customer is limited to spend at most the amount.'),
2888
+ minimumAmount: zod
2889
+ .string()
2890
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpSeven)
2891
+ .describe('Numeric represents an arbitrary precision number.')
2892
+ .optional()
2893
+ .describe('The customer is committed to spend at least the amount.'),
2894
+ quantityPerPackage: zod
2895
+ .string()
2896
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceQuantityPerPackageRegExpOne)
2897
+ .describe('Numeric represents an arbitrary precision number.')
2898
+ .describe('The quantity per package.'),
2899
+ type: zod.enum(['package']),
2900
+ })
2901
+ .describe('Package price with spend commitments.'),
2902
+ ])
2903
+ .describe('The price of the usage based rate card.')
2904
+ .nullable()
2905
+ .describe('The price of the rate card.\nWhen null, the feature or service is free.'),
2906
+ taxConfig: zod
2981
2907
  .object({
2982
- maximumAmount: zod
2983
- .string()
2984
- .regex(createPendingInvoiceLineBodyRateCardPriceMaximumAmountRegExpFive)
2985
- .describe('Numeric represents an arbitrary precision number.')
2986
- .optional()
2987
- .describe('The customer is limited to spend at most the amount.'),
2988
- minimumAmount: zod
2989
- .string()
2990
- .regex(createPendingInvoiceLineBodyRateCardPriceMinimumAmountRegExpFive)
2991
- .describe('Numeric represents an arbitrary precision number.')
2908
+ behavior: zod
2909
+ .enum(['inclusive', 'exclusive'])
2910
+ .describe('Tax behavior.\n\nThis enum is used to specify whether tax is included in the price or excluded from the price.')
2992
2911
  .optional()
2993
- .describe('The customer is committed to spend at least the amount.'),
2994
- multiplier: zod
2995
- .string()
2996
- .regex(createPendingInvoiceLineBodyRateCardPriceMultiplierRegExpOne)
2997
- .describe('Numeric represents an arbitrary precision number.')
2998
- .default(createPendingInvoiceLineBodyRateCardPriceMultiplierDefault)
2999
- .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'),
3000
- type: zod.enum(['dynamic']),
3001
- })
3002
- .describe('Dynamic price with spend commitments.'),
3003
- zod
3004
- .object({
3005
- amount: zod
3006
- .string()
3007
- .regex(createPendingInvoiceLineBodyRateCardPriceAmountRegExpFive)
3008
- .describe('Numeric represents an arbitrary precision number.')
3009
- .describe('The price of one package.'),
3010
- maximumAmount: zod
3011
- .string()
3012
- .regex(createPendingInvoiceLineBodyRateCardPriceMaximumAmountRegExpSeven)
3013
- .describe('Numeric represents an arbitrary precision number.')
2912
+ .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."),
2913
+ customInvoicing: zod
2914
+ .object({
2915
+ code: zod
2916
+ .string()
2917
+ .describe('Tax code.\n\nThe tax code should be interpreted by the custom invoicing provider.'),
2918
+ })
2919
+ .describe('Custom invoicing tax config.')
3014
2920
  .optional()
3015
- .describe('The customer is limited to spend at most the amount.'),
3016
- minimumAmount: zod
3017
- .string()
3018
- .regex(createPendingInvoiceLineBodyRateCardPriceMinimumAmountRegExpSeven)
3019
- .describe('Numeric represents an arbitrary precision number.')
2921
+ .describe('Custom invoicing tax config.'),
2922
+ stripe: zod
2923
+ .object({
2924
+ code: zod
2925
+ .string()
2926
+ .regex(simulateInvoiceBodyLinesItemRateCardTaxConfigStripeCodeRegExp)
2927
+ .describe('Product tax code.\n\nSee: https://docs.stripe.com/tax/tax-codes'),
2928
+ })
2929
+ .describe('The tax config for Stripe.')
3020
2930
  .optional()
3021
- .describe('The customer is committed to spend at least the amount.'),
3022
- quantityPerPackage: zod
3023
- .string()
3024
- .regex(createPendingInvoiceLineBodyRateCardPriceQuantityPerPackageRegExpOne)
3025
- .describe('Numeric represents an arbitrary precision number.')
3026
- .describe('The quantity per package.'),
3027
- type: zod.enum(['package']),
2931
+ .describe('Stripe tax config.'),
3028
2932
  })
3029
- .describe('Package price with spend commitments.'),
3030
- ])
3031
- .describe('The price of the usage based rate card.')
3032
- .nullable()
3033
- .describe('The price of the rate card.\nWhen null, the feature or service is free.'),
2933
+ .describe('Set of provider specific tax configs.')
2934
+ .optional()
2935
+ .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.'),
2936
+ })
2937
+ .describe('InvoiceUsageBasedRateCard represents the rate card (intent) for an usage-based line.')
2938
+ .optional()
2939
+ .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.'),
3034
2940
  taxConfig: zod
3035
2941
  .object({
3036
2942
  behavior: zod
@@ -3051,7 +2957,7 @@ export const createPendingInvoiceLineBodyItem = zod
3051
2957
  .object({
3052
2958
  code: zod
3053
2959
  .string()
3054
- .regex(createPendingInvoiceLineBodyRateCardTaxConfigStripeCodeRegExp)
2960
+ .regex(simulateInvoiceBodyLinesItemTaxConfigStripeCodeRegExp)
3055
2961
  .describe('Product tax code.\n\nSee: https://docs.stripe.com/tax/tax-codes'),
3056
2962
  })
3057
2963
  .describe('The tax config for Stripe.')
@@ -3060,166 +2966,160 @@ export const createPendingInvoiceLineBodyItem = zod
3060
2966
  })
3061
2967
  .describe('Set of provider specific tax configs.')
3062
2968
  .optional()
3063
- .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.'),
2969
+ .describe('Tax config specify the tax configuration for this line.'),
2970
+ type: zod.enum(['usage_based']),
3064
2971
  })
3065
- .describe('InvoiceUsageBasedRateCard represents the rate card (intent) for an usage-based line.')
3066
- .optional()
3067
- .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.'),
3068
- taxConfig: zod
2972
+ .describe('InvoiceSimulationUsageBasedLine represents a usage-based line item that can be input to the simulation endpoint.'),
2973
+ zod
3069
2974
  .object({
3070
- behavior: zod
3071
- .enum(['inclusive', 'exclusive'])
3072
- .describe('Tax behavior.\n\nThis enum is used to specify whether tax is included in the price or excluded from the price.')
2975
+ category: zod
2976
+ .enum(['regular', 'commitment'])
2977
+ .describe('InvoiceFlatFeeCategory determines if the flat fee is a regular fee due to use due to a\ncommitment.')
2978
+ .default(simulateInvoiceBodyLinesItemCategoryDefault)
2979
+ .describe('Category of the flat fee.'),
2980
+ description: zod
2981
+ .string()
2982
+ .max(simulateInvoiceBodyLinesItemDescriptionMaxOne)
3073
2983
  .optional()
3074
- .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."),
3075
- customInvoicing: zod
3076
- .object({
3077
- code: zod
3078
- .string()
3079
- .describe('Tax code.\n\nThe tax code should be interpreted by the custom invoicing provider.'),
3080
- })
3081
- .describe('Custom invoicing tax config.')
2984
+ .describe('Optional description of the resource. Maximum 1024 characters.'),
2985
+ id: zod
2986
+ .string()
2987
+ .regex(simulateInvoiceBodyLinesItemIdRegExpOne)
3082
2988
  .optional()
3083
- .describe('Custom invoicing tax config.'),
3084
- stripe: zod
2989
+ .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.'),
2990
+ invoiceAt: zod
2991
+ .date()
2992
+ .describe('The time this line item should be invoiced.'),
2993
+ metadata: zod
2994
+ .record(zod.string(), zod.string())
2995
+ .describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
2996
+ .nullish()
2997
+ .describe('Additional metadata for the resource.'),
2998
+ name: zod
2999
+ .string()
3000
+ .min(1)
3001
+ .max(simulateInvoiceBodyLinesItemNameMaxOne)
3002
+ .describe('Human-readable name for the resource. Between 1 and 256 characters.'),
3003
+ paymentTerm: zod
3004
+ .enum(['in_advance', 'in_arrears'])
3005
+ .describe('The payment term of a flat price.\nOne of: in_advance or in_arrears.')
3006
+ .default(simulateInvoiceBodyLinesItemPaymentTermDefault)
3007
+ .describe('Payment term of the line.'),
3008
+ period: zod
3085
3009
  .object({
3086
- code: zod
3087
- .string()
3088
- .regex(createPendingInvoiceLineBodyTaxConfigStripeCodeRegExp)
3089
- .describe('Product tax code.\n\nSee: https://docs.stripe.com/tax/tax-codes'),
3010
+ from: zod.date().describe('Period start time.'),
3011
+ to: zod.date().describe('Period end time.'),
3090
3012
  })
3091
- .describe('The tax config for Stripe.')
3013
+ .describe('A period with a start and end time.')
3014
+ .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.'),
3015
+ perUnitAmount: zod
3016
+ .string()
3017
+ .regex(simulateInvoiceBodyLinesItemPerUnitAmountRegExpOne)
3018
+ .describe('Numeric represents an arbitrary precision number.')
3092
3019
  .optional()
3093
- .describe('Stripe tax config.'),
3094
- })
3095
- .describe('Set of provider specific tax configs.')
3096
- .optional()
3097
- .describe('Tax config specify the tax configuration for this line.'),
3098
- type: zod.enum(['usage_based']),
3099
- })
3100
- .describe('InvoiceUsageBasedLineCreateWithCustomer represents the create model for an invoice line that is sold to the customer based on usage.'),
3101
- zod
3102
- .object({
3103
- category: zod
3104
- .enum(['regular', 'commitment'])
3105
- .describe('InvoiceFlatFeeCategory determines if the flat fee is a regular fee due to use due to a\ncommitment.')
3106
- .default(createPendingInvoiceLineBodyCategoryDefault)
3107
- .describe('Category of the flat fee.'),
3108
- currency: zod
3109
- .string()
3110
- .min(createPendingInvoiceLineBodyCurrencyMinThree)
3111
- .max(createPendingInvoiceLineBodyCurrencyMaxThree)
3112
- .regex(createPendingInvoiceLineBodyCurrencyRegExpThree)
3113
- .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.')
3114
- .describe('The currency of this line.'),
3115
- customerId: zod
3116
- .string()
3117
- .regex(createPendingInvoiceLineBodyCustomerIdRegExpOne)
3118
- .describe('The customer this line item belongs to.'),
3119
- description: zod
3120
- .string()
3121
- .max(createPendingInvoiceLineBodyDescriptionMaxOne)
3122
- .optional()
3123
- .describe('Optional description of the resource. Maximum 1024 characters.'),
3124
- invoiceAt: zod
3125
- .date()
3126
- .describe('The time this line item should be invoiced.'),
3127
- metadata: zod
3128
- .record(zod.string(), zod.string())
3129
- .describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
3130
- .nullish()
3131
- .describe('Additional metadata for the resource.'),
3132
- name: zod
3133
- .string()
3134
- .min(1)
3135
- .max(createPendingInvoiceLineBodyNameMaxOne)
3136
- .describe('Human-readable name for the resource. Between 1 and 256 characters.'),
3137
- paymentTerm: zod
3138
- .enum(['in_advance', 'in_arrears'])
3139
- .describe('The payment term of a flat price.\nOne of: in_advance or in_arrears.')
3140
- .default(createPendingInvoiceLineBodyPaymentTermDefault)
3141
- .describe('Payment term of the line.'),
3142
- period: zod
3143
- .object({
3144
- from: zod.date().describe('Period start time.'),
3145
- to: zod.date().describe('Period end time.'),
3146
- })
3147
- .describe('A period with a start and end time.')
3148
- .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.'),
3149
- perUnitAmount: zod
3150
- .string()
3151
- .regex(createPendingInvoiceLineBodyPerUnitAmountRegExpOne)
3152
- .describe('Numeric represents an arbitrary precision number.')
3153
- .optional()
3154
- .describe('Price of the item being sold.'),
3155
- quantity: zod
3156
- .string()
3157
- .regex(createPendingInvoiceLineBodyQuantityRegExpOne)
3158
- .describe('Numeric represents an arbitrary precision number.')
3159
- .optional()
3160
- .describe('Quantity of the item being sold.'),
3161
- rateCard: zod
3162
- .object({
3163
- discounts: zod
3020
+ .describe('Price of the item being sold.'),
3021
+ quantity: zod
3022
+ .string()
3023
+ .regex(simulateInvoiceBodyLinesItemQuantityRegExpThree)
3024
+ .describe('Numeric represents an arbitrary precision number.')
3025
+ .optional()
3026
+ .describe('Quantity of the item being sold.'),
3027
+ rateCard: zod
3164
3028
  .object({
3165
- percentage: zod
3029
+ discounts: zod
3166
3030
  .object({
3167
- correlationId: zod
3168
- .string()
3169
- .regex(createPendingInvoiceLineBodyRateCardDiscountsPercentageCorrelationIdRegExpOne)
3170
- .optional()
3171
- .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.'),
3172
3031
  percentage: zod
3173
- .number()
3174
- .describe('Numeric representation of a percentage\n\n50% is represented as 50')
3175
- .describe('The percentage of the discount.'),
3032
+ .object({
3033
+ correlationId: zod
3034
+ .string()
3035
+ .regex(simulateInvoiceBodyLinesItemRateCardDiscountsPercentageCorrelationIdRegExpOne)
3036
+ .optional()
3037
+ .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.'),
3038
+ percentage: zod
3039
+ .number()
3040
+ .describe('Numeric representation of a percentage\n\n50% is represented as 50')
3041
+ .describe('The percentage of the discount.'),
3042
+ })
3043
+ .describe('A percentage discount.')
3044
+ .optional()
3045
+ .describe('The percentage discount.'),
3046
+ usage: zod
3047
+ .object({
3048
+ correlationId: zod
3049
+ .string()
3050
+ .regex(simulateInvoiceBodyLinesItemRateCardDiscountsUsageCorrelationIdRegExpOne)
3051
+ .optional()
3052
+ .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.'),
3053
+ quantity: zod
3054
+ .string()
3055
+ .regex(simulateInvoiceBodyLinesItemRateCardDiscountsUsageQuantityRegExpThree)
3056
+ .describe('Numeric represents an arbitrary precision number.')
3057
+ .describe('The quantity of the usage discount.\n\nMust be positive.'),
3058
+ })
3059
+ .describe('A usage discount.')
3060
+ .optional()
3061
+ .describe('The usage discount.'),
3176
3062
  })
3177
- .describe('A percentage discount.')
3063
+ .describe('A discount by type.')
3178
3064
  .optional()
3179
- .describe('The percentage discount.'),
3180
- usage: zod
3065
+ .describe('The discounts that are applied to the line.'),
3066
+ price: zod
3181
3067
  .object({
3182
- correlationId: zod
3183
- .string()
3184
- .regex(createPendingInvoiceLineBodyRateCardDiscountsUsageCorrelationIdRegExpOne)
3185
- .optional()
3186
- .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.'),
3187
- quantity: zod
3068
+ amount: zod
3188
3069
  .string()
3189
- .regex(createPendingInvoiceLineBodyRateCardDiscountsUsageQuantityRegExpThree)
3070
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceAmountRegExpSeven)
3190
3071
  .describe('Numeric represents an arbitrary precision number.')
3191
- .describe('The quantity of the usage discount.\n\nMust be positive.'),
3072
+ .describe('The amount of the flat price.'),
3073
+ paymentTerm: zod
3074
+ .enum(['in_advance', 'in_arrears'])
3075
+ .describe('The payment term of a flat price.\nOne of: in_advance or in_arrears.')
3076
+ .default(simulateInvoiceBodyLinesItemRateCardPricePaymentTermDefaultTwo)
3077
+ .describe('The payment term of the flat price.\nDefaults to in advance.'),
3078
+ type: zod.enum(['flat']),
3192
3079
  })
3193
- .describe('A usage discount.')
3194
- .optional()
3195
- .describe('The usage discount.'),
3196
- })
3197
- .describe('A discount by type.')
3198
- .optional()
3199
- .describe('The discounts that are applied to the line.'),
3200
- price: zod
3201
- .object({
3202
- amount: zod
3080
+ .describe('Flat price with payment term.')
3081
+ .nullable()
3082
+ .describe('The price of the rate card.\nWhen null, the feature or service is free.'),
3083
+ quantity: zod
3203
3084
  .string()
3204
- .regex(createPendingInvoiceLineBodyRateCardPriceAmountRegExpSeven)
3085
+ .regex(simulateInvoiceBodyLinesItemRateCardQuantityRegExpOne)
3205
3086
  .describe('Numeric represents an arbitrary precision number.')
3206
- .describe('The amount of the flat price.'),
3207
- paymentTerm: zod
3208
- .enum(['in_advance', 'in_arrears'])
3209
- .describe('The payment term of a flat price.\nOne of: in_advance or in_arrears.')
3210
- .default(createPendingInvoiceLineBodyRateCardPricePaymentTermDefaultTwo)
3211
- .describe('The payment term of the flat price.\nDefaults to in advance.'),
3212
- type: zod.enum(['flat']),
3087
+ .optional()
3088
+ .describe('Quantity of the item being sold.\n\nDefault: 1'),
3089
+ taxConfig: zod
3090
+ .object({
3091
+ behavior: zod
3092
+ .enum(['inclusive', 'exclusive'])
3093
+ .describe('Tax behavior.\n\nThis enum is used to specify whether tax is included in the price or excluded from the price.')
3094
+ .optional()
3095
+ .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."),
3096
+ customInvoicing: zod
3097
+ .object({
3098
+ code: zod
3099
+ .string()
3100
+ .describe('Tax code.\n\nThe tax code should be interpreted by the custom invoicing provider.'),
3101
+ })
3102
+ .describe('Custom invoicing tax config.')
3103
+ .optional()
3104
+ .describe('Custom invoicing tax config.'),
3105
+ stripe: zod
3106
+ .object({
3107
+ code: zod
3108
+ .string()
3109
+ .regex(simulateInvoiceBodyLinesItemRateCardTaxConfigStripeCodeRegExpOne)
3110
+ .describe('Product tax code.\n\nSee: https://docs.stripe.com/tax/tax-codes'),
3111
+ })
3112
+ .describe('The tax config for Stripe.')
3113
+ .optional()
3114
+ .describe('Stripe tax config.'),
3115
+ })
3116
+ .describe('Set of provider specific tax configs.')
3117
+ .optional()
3118
+ .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.'),
3213
3119
  })
3214
- .describe('Flat price with payment term.')
3215
- .nullable()
3216
- .describe('The price of the rate card.\nWhen null, the feature or service is free.'),
3217
- quantity: zod
3218
- .string()
3219
- .regex(createPendingInvoiceLineBodyRateCardQuantityRegExpOne)
3220
- .describe('Numeric represents an arbitrary precision number.')
3120
+ .describe('InvoiceFlatFeeRateCard represents the rate card (intent) for a flat fee line.')
3221
3121
  .optional()
3222
- .describe('Quantity of the item being sold.\n\nDefault: 1'),
3122
+ .describe('The rate card that is used for this line.'),
3223
3123
  taxConfig: zod
3224
3124
  .object({
3225
3125
  behavior: zod
@@ -3240,7 +3140,7 @@ export const createPendingInvoiceLineBodyItem = zod
3240
3140
  .object({
3241
3141
  code: zod
3242
3142
  .string()
3243
- .regex(createPendingInvoiceLineBodyRateCardTaxConfigStripeCodeRegExpOne)
3143
+ .regex(simulateInvoiceBodyLinesItemTaxConfigStripeCodeRegExpOne)
3244
3144
  .describe('Product tax code.\n\nSee: https://docs.stripe.com/tax/tax-codes'),
3245
3145
  })
3246
3146
  .describe('The tax config for Stripe.')
@@ -3249,47 +3149,137 @@ export const createPendingInvoiceLineBodyItem = zod
3249
3149
  })
3250
3150
  .describe('Set of provider specific tax configs.')
3251
3151
  .optional()
3252
- .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.'),
3253
- })
3254
- .describe('InvoiceFlatFeeRateCard represents the rate card (intent) for a flat fee line.')
3255
- .optional()
3256
- .describe('The rate card that is used for this line.'),
3257
- taxConfig: zod
3258
- .object({
3259
- behavior: zod
3260
- .enum(['inclusive', 'exclusive'])
3261
- .describe('Tax behavior.\n\nThis enum is used to specify whether tax is included in the price or excluded from the price.')
3262
- .optional()
3263
- .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."),
3264
- customInvoicing: zod
3265
- .object({
3266
- code: zod
3267
- .string()
3268
- .describe('Tax code.\n\nThe tax code should be interpreted by the custom invoicing provider.'),
3269
- })
3270
- .describe('Custom invoicing tax config.')
3271
- .optional()
3272
- .describe('Custom invoicing tax config.'),
3273
- stripe: zod
3274
- .object({
3275
- code: zod
3276
- .string()
3277
- .regex(createPendingInvoiceLineBodyTaxConfigStripeCodeRegExpOne)
3278
- .describe('Product tax code.\n\nSee: https://docs.stripe.com/tax/tax-codes'),
3279
- })
3280
- .describe('The tax config for Stripe.')
3281
- .optional()
3282
- .describe('Stripe tax config.'),
3152
+ .describe('Tax config specify the tax configuration for this line.'),
3153
+ type: zod.enum(['flat_fee']),
3283
3154
  })
3284
- .describe('Set of provider specific tax configs.')
3155
+ .describe('InvoiceSimulationFlatFeeLine represents a flat fee line item that can be input to the simulation endpoint.'),
3156
+ ])
3157
+ .describe('InvoiceSimulationInput represents a line item that can be input to the simulation endpoint.'))
3158
+ .describe('Lines to be included in the generated invoice.'),
3159
+ number: zod
3160
+ .string()
3161
+ .min(1)
3162
+ .max(simulateInvoiceBodyNumberMaxOne)
3163
+ .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)')
3164
+ .optional()
3165
+ .describe('The number of the invoice.'),
3166
+ })
3167
+ .describe('InvoiceSimulationInput is the input for simulating an invoice.');
3168
+ /**
3169
+ * List invoices for a specific customer
3170
+ * @summary List invoices
3171
+ */
3172
+ export const listInvoicesQueryCustomersItemRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
3173
+ export const listInvoicesQueryPageDefault = 1;
3174
+ export const listInvoicesQueryPageSizeDefault = 100;
3175
+ export const listInvoicesQueryPageSizeMax = 1000;
3176
+ export const listInvoicesQueryParams = zod.object({
3177
+ createdAfter: zod
3178
+ .date()
3179
+ .optional()
3180
+ .describe('Filter by invoice created time.\nInclusive.'),
3181
+ createdBefore: zod
3182
+ .date()
3183
+ .optional()
3184
+ .describe('Filter by invoice created time.\nInclusive.'),
3185
+ customers: zod
3186
+ .array(zod
3187
+ .string()
3188
+ .regex(listInvoicesQueryCustomersItemRegExp)
3189
+ .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'))
3190
+ .optional()
3191
+ .describe('Filter by customer ID'),
3192
+ expand: zod
3193
+ .array(zod
3194
+ .enum(['lines', 'preceding', 'workflow.apps'])
3195
+ .describe('InvoiceExpand specifies the parts of the invoice to expand in the list output.'))
3196
+ .optional()
3197
+ .describe('What parts of the list output to expand in listings'),
3198
+ extendedStatuses: zod
3199
+ .array(zod.string())
3200
+ .optional()
3201
+ .describe('Filter by invoice extended statuses'),
3202
+ includeDeleted: zod.boolean().optional().describe('Include deleted invoices'),
3203
+ issuedAfter: zod
3204
+ .date()
3205
+ .optional()
3206
+ .describe('Filter by invoice issued time.\nInclusive.'),
3207
+ issuedBefore: zod
3208
+ .date()
3209
+ .optional()
3210
+ .describe('Filter by invoice issued time.\nInclusive.'),
3211
+ order: zod.enum(['ASC', 'DESC']).optional().describe('The order direction.'),
3212
+ orderBy: zod
3213
+ .enum(['customer.name', 'issuedAt', 'status', 'createdAt', 'updatedAt'])
3214
+ .optional()
3215
+ .describe('The order by field.'),
3216
+ page: zod
3217
+ .number()
3218
+ .min(1)
3219
+ .default(listInvoicesQueryPageDefault)
3220
+ .describe('Page index.\n\nDefault is 1.'),
3221
+ pageSize: zod
3222
+ .number()
3223
+ .min(1)
3224
+ .max(listInvoicesQueryPageSizeMax)
3225
+ .default(listInvoicesQueryPageSizeDefault)
3226
+ .describe('The maximum number of items per page.\n\nDefault is 100.'),
3227
+ statuses: zod
3228
+ .array(zod
3229
+ .enum([
3230
+ 'gathering',
3231
+ 'draft',
3232
+ 'issuing',
3233
+ 'issued',
3234
+ 'payment_processing',
3235
+ 'overdue',
3236
+ 'paid',
3237
+ 'uncollectible',
3238
+ 'voided',
3239
+ ])
3240
+ .describe('InvoiceStatus describes the status of an invoice.'))
3241
+ .optional()
3242
+ .describe('Filter by the invoice status.'),
3243
+ });
3244
+ /**
3245
+ * Create a new invoice from the pending line items.
3246
+
3247
+ This should be only called if for some reason we need to invoice a customer outside of the normal billing cycle.
3248
+
3249
+ 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.
3250
+
3251
+ New pending line items will be created for the period between now() and the next billing cycle's begining date for any metered item.
3252
+
3253
+ The call can return multiple invoices if the pending line items are in different currencies.
3254
+ * @summary Invoice a customer based on the pending line items
3255
+ */
3256
+ export const invoicePendingLinesActionBodyFiltersLineIdsItemRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
3257
+ export const invoicePendingLinesActionBodyCustomerIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
3258
+ export const invoicePendingLinesActionBody = zod
3259
+ .object({
3260
+ asOf: zod
3261
+ .date()
3262
+ .optional()
3263
+ .describe('The time as of which the invoice is created.\n\nIf not provided, the current time is used.'),
3264
+ customerId: zod
3265
+ .string()
3266
+ .regex(invoicePendingLinesActionBodyCustomerIdRegExp)
3267
+ .describe('The customer ID for which to create the invoice.'),
3268
+ filters: zod
3269
+ .object({
3270
+ lineIds: zod
3271
+ .array(zod
3272
+ .string()
3273
+ .regex(invoicePendingLinesActionBodyFiltersLineIdsItemRegExp)
3274
+ .describe('ULID (Universally Unique Lexicographically Sortable Identifier).'))
3285
3275
  .optional()
3286
- .describe('Tax config specify the tax configuration for this line.'),
3287
- type: zod.enum(['flat_fee']),
3276
+ .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.'),
3288
3277
  })
3289
- .describe('InvoiceFlatFeePendingLineCreate represents the create model for an invoice line that is sold to the customer as a manually added fee.'),
3290
- ])
3291
- .describe('InvoiceLineCreate represents the create model for an invoice line.');
3292
- export const createPendingInvoiceLineBody = zod.array(createPendingInvoiceLineBodyItem);
3278
+ .describe('InvoicePendingLinesActionFiltersInput specifies which lines to include in the invoice.')
3279
+ .optional()
3280
+ .describe('Filters to apply when creating the invoice.'),
3281
+ })
3282
+ .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.');
3293
3283
  /**
3294
3284
  * Get an invoice by ID.
3295
3285
  * @summary Get an invoice