@openmeter/sdk 1.0.0-beta-491b73a4e260 → 1.0.0-beta-dc555220d9fa

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.
@@ -1755,20 +1755,6 @@ export const createPendingInvoiceLineBodyLinesItemRateCardPriceMaximumAmountRegE
1755
1755
  export const createPendingInvoiceLineBodyLinesItemRateCardDiscountsPercentageCorrelationIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
1756
1756
  export const createPendingInvoiceLineBodyLinesItemRateCardDiscountsUsageQuantityRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1757
1757
  export const createPendingInvoiceLineBodyLinesItemRateCardDiscountsUsageCorrelationIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
1758
- export const createPendingInvoiceLineBodyLinesItemNameMaxOne = 256;
1759
- export const createPendingInvoiceLineBodyLinesItemDescriptionMaxOne = 1024;
1760
- export const createPendingInvoiceLineBodyLinesItemTaxConfigStripeCodeRegExpOne = new RegExp('^txcd_\\d{8}$');
1761
- export const createPendingInvoiceLineBodyLinesItemPerUnitAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1762
- export const createPendingInvoiceLineBodyLinesItemPaymentTermDefault = 'in_advance';
1763
- export const createPendingInvoiceLineBodyLinesItemQuantityRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1764
- export const createPendingInvoiceLineBodyLinesItemRateCardTaxConfigStripeCodeRegExpOne = new RegExp('^txcd_\\d{8}$');
1765
- export const createPendingInvoiceLineBodyLinesItemRateCardPriceAmountRegExpSeven = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1766
- export const createPendingInvoiceLineBodyLinesItemRateCardPricePaymentTermDefaultTwo = 'in_advance';
1767
- export const createPendingInvoiceLineBodyLinesItemRateCardQuantityRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1768
- export const createPendingInvoiceLineBodyLinesItemRateCardDiscountsPercentageCorrelationIdRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
1769
- export const createPendingInvoiceLineBodyLinesItemRateCardDiscountsUsageQuantityRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
1770
- export const createPendingInvoiceLineBodyLinesItemRateCardDiscountsUsageCorrelationIdRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
1771
- export const createPendingInvoiceLineBodyLinesItemCategoryDefault = 'regular';
1772
1758
  export const createPendingInvoiceLineBody = zod
1773
1759
  .object({
1774
1760
  currency: zod
@@ -1780,54 +1766,253 @@ export const createPendingInvoiceLineBody = zod
1780
1766
  .describe('The currency of the lines to be created.'),
1781
1767
  lines: zod
1782
1768
  .array(zod
1783
- .discriminatedUnion('type', [
1784
- zod
1769
+ .object({
1770
+ description: zod
1771
+ .string()
1772
+ .max(createPendingInvoiceLineBodyLinesItemDescriptionMax)
1773
+ .optional()
1774
+ .describe('Optional description of the resource. Maximum 1024 characters.'),
1775
+ featureKey: zod
1776
+ .string()
1777
+ .min(1)
1778
+ .max(createPendingInvoiceLineBodyLinesItemFeatureKeyMax)
1779
+ .regex(createPendingInvoiceLineBodyLinesItemFeatureKeyRegExp)
1780
+ .optional()
1781
+ .describe('The feature that the usage is based on.'),
1782
+ invoiceAt: zod
1783
+ .date()
1784
+ .describe('The time this line item should be invoiced.'),
1785
+ metadata: zod
1786
+ .record(zod.string(), zod.string())
1787
+ .describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
1788
+ .nullish()
1789
+ .describe('Additional metadata for the resource.'),
1790
+ name: zod
1791
+ .string()
1792
+ .min(1)
1793
+ .max(createPendingInvoiceLineBodyLinesItemNameMax)
1794
+ .describe('Human-readable name for the resource. Between 1 and 256 characters.'),
1795
+ period: zod
1785
1796
  .object({
1786
- description: zod
1787
- .string()
1788
- .max(createPendingInvoiceLineBodyLinesItemDescriptionMax)
1797
+ from: zod.date().describe('Period start time.'),
1798
+ to: zod.date().describe('Period end time.'),
1799
+ })
1800
+ .describe('A period with a start and end time.')
1801
+ .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.'),
1802
+ price: zod
1803
+ .discriminatedUnion('type', [
1804
+ zod
1805
+ .object({
1806
+ amount: zod
1807
+ .string()
1808
+ .regex(createPendingInvoiceLineBodyLinesItemPriceAmountRegExpOne)
1809
+ .describe('Numeric represents an arbitrary precision number.')
1810
+ .describe('The amount of the flat price.'),
1811
+ paymentTerm: zod
1812
+ .enum(['in_advance', 'in_arrears'])
1813
+ .describe('The payment term of a flat price.\nOne of: in_advance or in_arrears.')
1814
+ .default(createPendingInvoiceLineBodyLinesItemPricePaymentTermDefault)
1815
+ .describe('The payment term of the flat price.\nDefaults to in advance.'),
1816
+ type: zod.enum(['flat']),
1817
+ })
1818
+ .describe('Flat price with payment term.'),
1819
+ zod
1820
+ .object({
1821
+ amount: zod
1822
+ .string()
1823
+ .regex(createPendingInvoiceLineBodyLinesItemPriceAmountRegExpThree)
1824
+ .describe('Numeric represents an arbitrary precision number.')
1825
+ .describe('The amount of the unit price.'),
1826
+ maximumAmount: zod
1827
+ .string()
1828
+ .regex(createPendingInvoiceLineBodyLinesItemPriceMaximumAmountRegExpOne)
1829
+ .describe('Numeric represents an arbitrary precision number.')
1830
+ .optional()
1831
+ .describe('The customer is limited to spend at most the amount.'),
1832
+ minimumAmount: zod
1833
+ .string()
1834
+ .regex(createPendingInvoiceLineBodyLinesItemPriceMinimumAmountRegExpOne)
1835
+ .describe('Numeric represents an arbitrary precision number.')
1836
+ .optional()
1837
+ .describe('The customer is committed to spend at least the amount.'),
1838
+ type: zod.enum(['unit']),
1839
+ })
1840
+ .describe('Unit price with spend commitments.'),
1841
+ zod
1842
+ .object({
1843
+ maximumAmount: zod
1844
+ .string()
1845
+ .regex(createPendingInvoiceLineBodyLinesItemPriceMaximumAmountRegExpThree)
1846
+ .describe('Numeric represents an arbitrary precision number.')
1847
+ .optional()
1848
+ .describe('The customer is limited to spend at most the amount.'),
1849
+ minimumAmount: zod
1850
+ .string()
1851
+ .regex(createPendingInvoiceLineBodyLinesItemPriceMinimumAmountRegExpThree)
1852
+ .describe('Numeric represents an arbitrary precision number.')
1853
+ .optional()
1854
+ .describe('The customer is committed to spend at least the amount.'),
1855
+ mode: zod
1856
+ .enum(['volume', 'graduated'])
1857
+ .describe('The mode of the tiered price.')
1858
+ .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.'),
1859
+ tiers: zod
1860
+ .array(zod
1861
+ .object({
1862
+ flatPrice: zod
1863
+ .object({
1864
+ amount: zod
1865
+ .string()
1866
+ .regex(createPendingInvoiceLineBodyLinesItemPriceTiersItemFlatPriceAmountRegExpOne)
1867
+ .describe('Numeric represents an arbitrary precision number.')
1868
+ .describe('The amount of the flat price.'),
1869
+ type: zod
1870
+ .enum(['flat'])
1871
+ .describe('The type of the price.'),
1872
+ })
1873
+ .describe('Flat price.')
1874
+ .nullable()
1875
+ .describe('The flat price component of the tier.'),
1876
+ unitPrice: zod
1877
+ .object({
1878
+ amount: zod
1879
+ .string()
1880
+ .regex(createPendingInvoiceLineBodyLinesItemPriceTiersItemUnitPriceAmountRegExpOne)
1881
+ .describe('Numeric represents an arbitrary precision number.')
1882
+ .describe('The amount of the unit price.'),
1883
+ type: zod
1884
+ .enum(['unit'])
1885
+ .describe('The type of the price.'),
1886
+ })
1887
+ .describe('Unit price.')
1888
+ .nullable()
1889
+ .describe('The unit price component of the tier.'),
1890
+ upToAmount: zod
1891
+ .string()
1892
+ .regex(createPendingInvoiceLineBodyLinesItemPriceTiersItemUpToAmountRegExpOne)
1893
+ .describe('Numeric represents an arbitrary precision number.')
1894
+ .optional()
1895
+ .describe('Up to and including to this quantity will be contained in the tier.\nIf null, the tier is open-ended.'),
1896
+ })
1897
+ .describe('A price tier.\nAt least one price component is required in each tier.'))
1898
+ .min(1)
1899
+ .describe('The tiers of the tiered price.\nAt least one price component is required in each tier.'),
1900
+ type: zod.enum(['tiered']),
1901
+ })
1902
+ .describe('Tiered price with spend commitments.'),
1903
+ zod
1904
+ .object({
1905
+ maximumAmount: zod
1906
+ .string()
1907
+ .regex(createPendingInvoiceLineBodyLinesItemPriceMaximumAmountRegExpFive)
1908
+ .describe('Numeric represents an arbitrary precision number.')
1909
+ .optional()
1910
+ .describe('The customer is limited to spend at most the amount.'),
1911
+ minimumAmount: zod
1912
+ .string()
1913
+ .regex(createPendingInvoiceLineBodyLinesItemPriceMinimumAmountRegExpFive)
1914
+ .describe('Numeric represents an arbitrary precision number.')
1915
+ .optional()
1916
+ .describe('The customer is committed to spend at least the amount.'),
1917
+ multiplier: zod
1918
+ .string()
1919
+ .regex(createPendingInvoiceLineBodyLinesItemPriceMultiplierRegExpOne)
1920
+ .describe('Numeric represents an arbitrary precision number.')
1921
+ .default(createPendingInvoiceLineBodyLinesItemPriceMultiplierDefault)
1922
+ .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'),
1923
+ type: zod.enum(['dynamic']),
1924
+ })
1925
+ .describe('Dynamic price with spend commitments.'),
1926
+ zod
1927
+ .object({
1928
+ amount: zod
1929
+ .string()
1930
+ .regex(createPendingInvoiceLineBodyLinesItemPriceAmountRegExpFive)
1931
+ .describe('Numeric represents an arbitrary precision number.')
1932
+ .describe('The price of one package.'),
1933
+ maximumAmount: zod
1934
+ .string()
1935
+ .regex(createPendingInvoiceLineBodyLinesItemPriceMaximumAmountRegExpSeven)
1936
+ .describe('Numeric represents an arbitrary precision number.')
1937
+ .optional()
1938
+ .describe('The customer is limited to spend at most the amount.'),
1939
+ minimumAmount: zod
1940
+ .string()
1941
+ .regex(createPendingInvoiceLineBodyLinesItemPriceMinimumAmountRegExpSeven)
1942
+ .describe('Numeric represents an arbitrary precision number.')
1943
+ .optional()
1944
+ .describe('The customer is committed to spend at least the amount.'),
1945
+ quantityPerPackage: zod
1946
+ .string()
1947
+ .regex(createPendingInvoiceLineBodyLinesItemPriceQuantityPerPackageRegExpOne)
1948
+ .describe('Numeric represents an arbitrary precision number.')
1949
+ .describe('The quantity per package.'),
1950
+ type: zod.enum(['package']),
1951
+ })
1952
+ .describe('Package price with spend commitments.'),
1953
+ ])
1954
+ .describe('The price of the usage based rate card.')
1955
+ .optional()
1956
+ .describe('Price of the usage-based item being sold.'),
1957
+ rateCard: zod
1958
+ .object({
1959
+ discounts: zod
1960
+ .object({
1961
+ percentage: zod
1962
+ .object({
1963
+ correlationId: zod
1964
+ .string()
1965
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardDiscountsPercentageCorrelationIdRegExp)
1966
+ .optional()
1967
+ .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.'),
1968
+ percentage: zod
1969
+ .number()
1970
+ .describe('Numeric representation of a percentage\n\n50% is represented as 50')
1971
+ .describe('The percentage of the discount.'),
1972
+ })
1973
+ .describe('A percentage discount.')
1974
+ .optional()
1975
+ .describe('The percentage discount.'),
1976
+ usage: zod
1977
+ .object({
1978
+ correlationId: zod
1979
+ .string()
1980
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardDiscountsUsageCorrelationIdRegExp)
1981
+ .optional()
1982
+ .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.'),
1983
+ quantity: zod
1984
+ .string()
1985
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardDiscountsUsageQuantityRegExpOne)
1986
+ .describe('Numeric represents an arbitrary precision number.')
1987
+ .describe('The quantity of the usage discount.\n\nMust be positive.'),
1988
+ })
1989
+ .describe('A usage discount.')
1990
+ .optional()
1991
+ .describe('The usage discount.'),
1992
+ })
1993
+ .describe('A discount by type.')
1789
1994
  .optional()
1790
- .describe('Optional description of the resource. Maximum 1024 characters.'),
1995
+ .describe('The discounts that are applied to the line.'),
1791
1996
  featureKey: zod
1792
1997
  .string()
1793
1998
  .min(1)
1794
- .max(createPendingInvoiceLineBodyLinesItemFeatureKeyMax)
1795
- .regex(createPendingInvoiceLineBodyLinesItemFeatureKeyRegExp)
1999
+ .max(createPendingInvoiceLineBodyLinesItemRateCardFeatureKeyMax)
2000
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardFeatureKeyRegExp)
1796
2001
  .optional()
1797
- .describe('The feature that the usage is based on.'),
1798
- invoiceAt: zod
1799
- .date()
1800
- .describe('The time this line item should be invoiced.'),
1801
- metadata: zod
1802
- .record(zod.string(), zod.string())
1803
- .describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
1804
- .nullish()
1805
- .describe('Additional metadata for the resource.'),
1806
- name: zod
1807
- .string()
1808
- .min(1)
1809
- .max(createPendingInvoiceLineBodyLinesItemNameMax)
1810
- .describe('Human-readable name for the resource. Between 1 and 256 characters.'),
1811
- period: zod
1812
- .object({
1813
- from: zod.date().describe('Period start time.'),
1814
- to: zod.date().describe('Period end time.'),
1815
- })
1816
- .describe('A period with a start and end time.')
1817
- .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.'),
2002
+ .describe('The feature the customer is entitled to use.'),
1818
2003
  price: zod
1819
2004
  .discriminatedUnion('type', [
1820
2005
  zod
1821
2006
  .object({
1822
2007
  amount: zod
1823
2008
  .string()
1824
- .regex(createPendingInvoiceLineBodyLinesItemPriceAmountRegExpOne)
2009
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceAmountRegExpOne)
1825
2010
  .describe('Numeric represents an arbitrary precision number.')
1826
2011
  .describe('The amount of the flat price.'),
1827
2012
  paymentTerm: zod
1828
2013
  .enum(['in_advance', 'in_arrears'])
1829
2014
  .describe('The payment term of a flat price.\nOne of: in_advance or in_arrears.')
1830
- .default(createPendingInvoiceLineBodyLinesItemPricePaymentTermDefault)
2015
+ .default(createPendingInvoiceLineBodyLinesItemRateCardPricePaymentTermDefault)
1831
2016
  .describe('The payment term of the flat price.\nDefaults to in advance.'),
1832
2017
  type: zod.enum(['flat']),
1833
2018
  })
@@ -1836,18 +2021,18 @@ export const createPendingInvoiceLineBody = zod
1836
2021
  .object({
1837
2022
  amount: zod
1838
2023
  .string()
1839
- .regex(createPendingInvoiceLineBodyLinesItemPriceAmountRegExpThree)
2024
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceAmountRegExpThree)
1840
2025
  .describe('Numeric represents an arbitrary precision number.')
1841
2026
  .describe('The amount of the unit price.'),
1842
2027
  maximumAmount: zod
1843
2028
  .string()
1844
- .regex(createPendingInvoiceLineBodyLinesItemPriceMaximumAmountRegExpOne)
2029
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceMaximumAmountRegExpOne)
1845
2030
  .describe('Numeric represents an arbitrary precision number.')
1846
2031
  .optional()
1847
2032
  .describe('The customer is limited to spend at most the amount.'),
1848
2033
  minimumAmount: zod
1849
2034
  .string()
1850
- .regex(createPendingInvoiceLineBodyLinesItemPriceMinimumAmountRegExpOne)
2035
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceMinimumAmountRegExpOne)
1851
2036
  .describe('Numeric represents an arbitrary precision number.')
1852
2037
  .optional()
1853
2038
  .describe('The customer is committed to spend at least the amount.'),
@@ -1858,13 +2043,13 @@ export const createPendingInvoiceLineBody = zod
1858
2043
  .object({
1859
2044
  maximumAmount: zod
1860
2045
  .string()
1861
- .regex(createPendingInvoiceLineBodyLinesItemPriceMaximumAmountRegExpThree)
2046
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceMaximumAmountRegExpThree)
1862
2047
  .describe('Numeric represents an arbitrary precision number.')
1863
2048
  .optional()
1864
2049
  .describe('The customer is limited to spend at most the amount.'),
1865
2050
  minimumAmount: zod
1866
2051
  .string()
1867
- .regex(createPendingInvoiceLineBodyLinesItemPriceMinimumAmountRegExpThree)
2052
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceMinimumAmountRegExpThree)
1868
2053
  .describe('Numeric represents an arbitrary precision number.')
1869
2054
  .optional()
1870
2055
  .describe('The customer is committed to spend at least the amount.'),
@@ -1879,7 +2064,7 @@ export const createPendingInvoiceLineBody = zod
1879
2064
  .object({
1880
2065
  amount: zod
1881
2066
  .string()
1882
- .regex(createPendingInvoiceLineBodyLinesItemPriceTiersItemFlatPriceAmountRegExpOne)
2067
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceTiersItemFlatPriceAmountRegExpOne)
1883
2068
  .describe('Numeric represents an arbitrary precision number.')
1884
2069
  .describe('The amount of the flat price.'),
1885
2070
  type: zod
@@ -1893,7 +2078,7 @@ export const createPendingInvoiceLineBody = zod
1893
2078
  .object({
1894
2079
  amount: zod
1895
2080
  .string()
1896
- .regex(createPendingInvoiceLineBodyLinesItemPriceTiersItemUnitPriceAmountRegExpOne)
2081
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceTiersItemUnitPriceAmountRegExpOne)
1897
2082
  .describe('Numeric represents an arbitrary precision number.')
1898
2083
  .describe('The amount of the unit price.'),
1899
2084
  type: zod
@@ -1905,7 +2090,7 @@ export const createPendingInvoiceLineBody = zod
1905
2090
  .describe('The unit price component of the tier.'),
1906
2091
  upToAmount: zod
1907
2092
  .string()
1908
- .regex(createPendingInvoiceLineBodyLinesItemPriceTiersItemUpToAmountRegExpOne)
2093
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceTiersItemUpToAmountRegExpOne)
1909
2094
  .describe('Numeric represents an arbitrary precision number.')
1910
2095
  .optional()
1911
2096
  .describe('Up to and including to this quantity will be contained in the tier.\nIf null, the tier is open-ended.'),
@@ -1920,21 +2105,21 @@ export const createPendingInvoiceLineBody = zod
1920
2105
  .object({
1921
2106
  maximumAmount: zod
1922
2107
  .string()
1923
- .regex(createPendingInvoiceLineBodyLinesItemPriceMaximumAmountRegExpFive)
2108
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceMaximumAmountRegExpFive)
1924
2109
  .describe('Numeric represents an arbitrary precision number.')
1925
2110
  .optional()
1926
2111
  .describe('The customer is limited to spend at most the amount.'),
1927
2112
  minimumAmount: zod
1928
2113
  .string()
1929
- .regex(createPendingInvoiceLineBodyLinesItemPriceMinimumAmountRegExpFive)
2114
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceMinimumAmountRegExpFive)
1930
2115
  .describe('Numeric represents an arbitrary precision number.')
1931
2116
  .optional()
1932
2117
  .describe('The customer is committed to spend at least the amount.'),
1933
2118
  multiplier: zod
1934
2119
  .string()
1935
- .regex(createPendingInvoiceLineBodyLinesItemPriceMultiplierRegExpOne)
2120
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceMultiplierRegExpOne)
1936
2121
  .describe('Numeric represents an arbitrary precision number.')
1937
- .default(createPendingInvoiceLineBodyLinesItemPriceMultiplierDefault)
2122
+ .default(createPendingInvoiceLineBodyLinesItemRateCardPriceMultiplierDefault)
1938
2123
  .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'),
1939
2124
  type: zod.enum(['dynamic']),
1940
2125
  })
@@ -1943,24 +2128,24 @@ export const createPendingInvoiceLineBody = zod
1943
2128
  .object({
1944
2129
  amount: zod
1945
2130
  .string()
1946
- .regex(createPendingInvoiceLineBodyLinesItemPriceAmountRegExpFive)
2131
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceAmountRegExpFive)
1947
2132
  .describe('Numeric represents an arbitrary precision number.')
1948
2133
  .describe('The price of one package.'),
1949
2134
  maximumAmount: zod
1950
2135
  .string()
1951
- .regex(createPendingInvoiceLineBodyLinesItemPriceMaximumAmountRegExpSeven)
2136
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceMaximumAmountRegExpSeven)
1952
2137
  .describe('Numeric represents an arbitrary precision number.')
1953
2138
  .optional()
1954
2139
  .describe('The customer is limited to spend at most the amount.'),
1955
2140
  minimumAmount: zod
1956
2141
  .string()
1957
- .regex(createPendingInvoiceLineBodyLinesItemPriceMinimumAmountRegExpSeven)
2142
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceMinimumAmountRegExpSeven)
1958
2143
  .describe('Numeric represents an arbitrary precision number.')
1959
2144
  .optional()
1960
2145
  .describe('The customer is committed to spend at least the amount.'),
1961
2146
  quantityPerPackage: zod
1962
2147
  .string()
1963
- .regex(createPendingInvoiceLineBodyLinesItemPriceQuantityPerPackageRegExpOne)
2148
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceQuantityPerPackageRegExpOne)
1964
2149
  .describe('Numeric represents an arbitrary precision number.')
1965
2150
  .describe('The quantity per package.'),
1966
2151
  type: zod.enum(['package']),
@@ -1968,456 +2153,74 @@ export const createPendingInvoiceLineBody = zod
1968
2153
  .describe('Package price with spend commitments.'),
1969
2154
  ])
1970
2155
  .describe('The price of the usage based rate card.')
1971
- .optional()
1972
- .describe('Price of the usage-based item being sold.'),
1973
- rateCard: zod
2156
+ .nullable()
2157
+ .describe('The price of the rate card.\nWhen null, the feature or service is free.'),
2158
+ taxConfig: zod
1974
2159
  .object({
1975
- discounts: zod
2160
+ behavior: zod
2161
+ .enum(['inclusive', 'exclusive'])
2162
+ .describe('Tax behavior.\n\nThis enum is used to specify whether tax is included in the price or excluded from the price.')
2163
+ .optional()
2164
+ .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."),
2165
+ customInvoicing: zod
1976
2166
  .object({
1977
- percentage: zod
1978
- .object({
1979
- correlationId: zod
1980
- .string()
1981
- .regex(createPendingInvoiceLineBodyLinesItemRateCardDiscountsPercentageCorrelationIdRegExp)
1982
- .optional()
1983
- .describe('Correlation ID for the discount.\n\nThis is used to link discounts across different invoices (progressive billing use case).\n\nIf not provided, the invoicing engine will auto-generate one. When editing an invoice line,\nplease make sure to keep the same correlation ID of the discount or in progressive billing\nsetups the discount amounts might be incorrect.'),
1984
- percentage: zod
1985
- .number()
1986
- .describe('Numeric representation of a percentage\n\n50% is represented as 50')
1987
- .describe('The percentage of the discount.'),
1988
- })
1989
- .describe('A percentage discount.')
1990
- .optional()
1991
- .describe('The percentage discount.'),
1992
- usage: zod
1993
- .object({
1994
- correlationId: zod
1995
- .string()
1996
- .regex(createPendingInvoiceLineBodyLinesItemRateCardDiscountsUsageCorrelationIdRegExp)
1997
- .optional()
1998
- .describe('Correlation ID for the discount.\n\nThis is used to link discounts across different invoices (progressive billing use case).\n\nIf not provided, the invoicing engine will auto-generate one. When editing an invoice line,\nplease make sure to keep the same correlation ID of the discount or in progressive billing\nsetups the discount amounts might be incorrect.'),
1999
- quantity: zod
2000
- .string()
2001
- .regex(createPendingInvoiceLineBodyLinesItemRateCardDiscountsUsageQuantityRegExpOne)
2002
- .describe('Numeric represents an arbitrary precision number.')
2003
- .describe('The quantity of the usage discount.\n\nMust be positive.'),
2004
- })
2005
- .describe('A usage discount.')
2006
- .optional()
2007
- .describe('The usage discount.'),
2167
+ code: zod
2168
+ .string()
2169
+ .describe('Tax code.\n\nThe tax code should be interpreted by the custom invoicing provider.'),
2008
2170
  })
2009
- .describe('A discount by type.')
2171
+ .describe('Custom invoicing tax config.')
2010
2172
  .optional()
2011
- .describe('The discounts that are applied to the line.'),
2012
- featureKey: zod
2013
- .string()
2014
- .min(1)
2015
- .max(createPendingInvoiceLineBodyLinesItemRateCardFeatureKeyMax)
2016
- .regex(createPendingInvoiceLineBodyLinesItemRateCardFeatureKeyRegExp)
2017
- .optional()
2018
- .describe('The feature the customer is entitled to use.'),
2019
- price: zod
2020
- .discriminatedUnion('type', [
2021
- zod
2022
- .object({
2023
- amount: zod
2024
- .string()
2025
- .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceAmountRegExpOne)
2026
- .describe('Numeric represents an arbitrary precision number.')
2027
- .describe('The amount of the flat price.'),
2028
- paymentTerm: zod
2029
- .enum(['in_advance', 'in_arrears'])
2030
- .describe('The payment term of a flat price.\nOne of: in_advance or in_arrears.')
2031
- .default(createPendingInvoiceLineBodyLinesItemRateCardPricePaymentTermDefault)
2032
- .describe('The payment term of the flat price.\nDefaults to in advance.'),
2033
- type: zod.enum(['flat']),
2034
- })
2035
- .describe('Flat price with payment term.'),
2036
- zod
2037
- .object({
2038
- amount: zod
2039
- .string()
2040
- .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceAmountRegExpThree)
2041
- .describe('Numeric represents an arbitrary precision number.')
2042
- .describe('The amount of the unit price.'),
2043
- maximumAmount: zod
2044
- .string()
2045
- .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceMaximumAmountRegExpOne)
2046
- .describe('Numeric represents an arbitrary precision number.')
2047
- .optional()
2048
- .describe('The customer is limited to spend at most the amount.'),
2049
- minimumAmount: zod
2050
- .string()
2051
- .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceMinimumAmountRegExpOne)
2052
- .describe('Numeric represents an arbitrary precision number.')
2053
- .optional()
2054
- .describe('The customer is committed to spend at least the amount.'),
2055
- type: zod.enum(['unit']),
2056
- })
2057
- .describe('Unit price with spend commitments.'),
2058
- zod
2059
- .object({
2060
- maximumAmount: zod
2061
- .string()
2062
- .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceMaximumAmountRegExpThree)
2063
- .describe('Numeric represents an arbitrary precision number.')
2064
- .optional()
2065
- .describe('The customer is limited to spend at most the amount.'),
2066
- minimumAmount: zod
2067
- .string()
2068
- .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceMinimumAmountRegExpThree)
2069
- .describe('Numeric represents an arbitrary precision number.')
2070
- .optional()
2071
- .describe('The customer is committed to spend at least the amount.'),
2072
- mode: zod
2073
- .enum(['volume', 'graduated'])
2074
- .describe('The mode of the tiered price.')
2075
- .describe('Defines if the tiering mode is volume-based or graduated:\n- In `volume`-based tiering, the maximum quantity within a period determines the per unit price.\n- In `graduated` tiering, pricing can change as the quantity grows.'),
2076
- tiers: zod
2077
- .array(zod
2078
- .object({
2079
- flatPrice: zod
2080
- .object({
2081
- amount: zod
2082
- .string()
2083
- .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceTiersItemFlatPriceAmountRegExpOne)
2084
- .describe('Numeric represents an arbitrary precision number.')
2085
- .describe('The amount of the flat price.'),
2086
- type: zod
2087
- .enum(['flat'])
2088
- .describe('The type of the price.'),
2089
- })
2090
- .describe('Flat price.')
2091
- .nullable()
2092
- .describe('The flat price component of the tier.'),
2093
- unitPrice: zod
2094
- .object({
2095
- amount: zod
2096
- .string()
2097
- .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceTiersItemUnitPriceAmountRegExpOne)
2098
- .describe('Numeric represents an arbitrary precision number.')
2099
- .describe('The amount of the unit price.'),
2100
- type: zod
2101
- .enum(['unit'])
2102
- .describe('The type of the price.'),
2103
- })
2104
- .describe('Unit price.')
2105
- .nullable()
2106
- .describe('The unit price component of the tier.'),
2107
- upToAmount: zod
2108
- .string()
2109
- .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceTiersItemUpToAmountRegExpOne)
2110
- .describe('Numeric represents an arbitrary precision number.')
2111
- .optional()
2112
- .describe('Up to and including to this quantity will be contained in the tier.\nIf null, the tier is open-ended.'),
2113
- })
2114
- .describe('A price tier.\nAt least one price component is required in each tier.'))
2115
- .min(1)
2116
- .describe('The tiers of the tiered price.\nAt least one price component is required in each tier.'),
2117
- type: zod.enum(['tiered']),
2118
- })
2119
- .describe('Tiered price with spend commitments.'),
2120
- zod
2121
- .object({
2122
- maximumAmount: zod
2123
- .string()
2124
- .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceMaximumAmountRegExpFive)
2125
- .describe('Numeric represents an arbitrary precision number.')
2126
- .optional()
2127
- .describe('The customer is limited to spend at most the amount.'),
2128
- minimumAmount: zod
2129
- .string()
2130
- .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceMinimumAmountRegExpFive)
2131
- .describe('Numeric represents an arbitrary precision number.')
2132
- .optional()
2133
- .describe('The customer is committed to spend at least the amount.'),
2134
- multiplier: zod
2135
- .string()
2136
- .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceMultiplierRegExpOne)
2137
- .describe('Numeric represents an arbitrary precision number.')
2138
- .default(createPendingInvoiceLineBodyLinesItemRateCardPriceMultiplierDefault)
2139
- .describe('The multiplier to apply to the base price to get the dynamic price.\n\nExamples:\n- 0.0: the price is zero\n- 0.5: the price is 50% of the base price\n- 1.0: the price is the same as the base price\n- 1.5: the price is 150% of the base price'),
2140
- type: zod.enum(['dynamic']),
2141
- })
2142
- .describe('Dynamic price with spend commitments.'),
2143
- zod
2144
- .object({
2145
- amount: zod
2146
- .string()
2147
- .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceAmountRegExpFive)
2148
- .describe('Numeric represents an arbitrary precision number.')
2149
- .describe('The price of one package.'),
2150
- maximumAmount: zod
2151
- .string()
2152
- .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceMaximumAmountRegExpSeven)
2153
- .describe('Numeric represents an arbitrary precision number.')
2154
- .optional()
2155
- .describe('The customer is limited to spend at most the amount.'),
2156
- minimumAmount: zod
2157
- .string()
2158
- .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceMinimumAmountRegExpSeven)
2159
- .describe('Numeric represents an arbitrary precision number.')
2160
- .optional()
2161
- .describe('The customer is committed to spend at least the amount.'),
2162
- quantityPerPackage: zod
2163
- .string()
2164
- .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceQuantityPerPackageRegExpOne)
2165
- .describe('Numeric represents an arbitrary precision number.')
2166
- .describe('The quantity per package.'),
2167
- type: zod.enum(['package']),
2168
- })
2169
- .describe('Package price with spend commitments.'),
2170
- ])
2171
- .describe('The price of the usage based rate card.')
2172
- .nullable()
2173
- .describe('The price of the rate card.\nWhen null, the feature or service is free.'),
2174
- taxConfig: zod
2175
- .object({
2176
- behavior: zod
2177
- .enum(['inclusive', 'exclusive'])
2178
- .describe('Tax behavior.\n\nThis enum is used to specify whether tax is included in the price or excluded from the price.')
2179
- .optional()
2180
- .describe("Tax behavior.\n\nIf not specified the billing profile is used to determine the tax behavior.\nIf not specified in the billing profile, the provider's default behavior is used."),
2181
- customInvoicing: zod
2182
- .object({
2183
- code: zod
2184
- .string()
2185
- .describe('Tax code.\n\nThe tax code should be interpreted by the custom invoicing provider.'),
2186
- })
2187
- .describe('Custom invoicing tax config.')
2188
- .optional()
2189
- .describe('Custom invoicing tax config.'),
2190
- stripe: zod
2191
- .object({
2192
- code: zod
2193
- .string()
2194
- .regex(createPendingInvoiceLineBodyLinesItemRateCardTaxConfigStripeCodeRegExp)
2195
- .describe('Product tax code.\n\nSee: https://docs.stripe.com/tax/tax-codes'),
2196
- })
2197
- .describe('The tax config for Stripe.')
2198
- .optional()
2199
- .describe('Stripe tax config.'),
2200
- })
2201
- .describe('Set of provider specific tax configs.')
2202
- .optional()
2203
- .describe('The tax config of the rate card.\nWhen undefined, the tax config of the feature or the default tax config of the plan is used.'),
2204
- })
2205
- .describe('InvoiceUsageBasedRateCard represents the rate card (intent) for an usage-based line.')
2206
- .optional()
2207
- .describe('The rate card that is used for this line.\n\nThe rate card captures the intent of the price and discounts for the usage-based item.'),
2208
- taxConfig: zod
2209
- .object({
2210
- behavior: zod
2211
- .enum(['inclusive', 'exclusive'])
2212
- .describe('Tax behavior.\n\nThis enum is used to specify whether tax is included in the price or excluded from the price.')
2213
- .optional()
2214
- .describe("Tax behavior.\n\nIf not specified the billing profile is used to determine the tax behavior.\nIf not specified in the billing profile, the provider's default behavior is used."),
2215
- customInvoicing: zod
2216
- .object({
2217
- code: zod
2218
- .string()
2219
- .describe('Tax code.\n\nThe tax code should be interpreted by the custom invoicing provider.'),
2220
- })
2221
- .describe('Custom invoicing tax config.')
2222
- .optional()
2223
- .describe('Custom invoicing tax config.'),
2224
- stripe: zod
2225
- .object({
2226
- code: zod
2227
- .string()
2228
- .regex(createPendingInvoiceLineBodyLinesItemTaxConfigStripeCodeRegExp)
2229
- .describe('Product tax code.\n\nSee: https://docs.stripe.com/tax/tax-codes'),
2230
- })
2231
- .describe('The tax config for Stripe.')
2173
+ .describe('Custom invoicing tax config.'),
2174
+ stripe: zod
2175
+ .object({
2176
+ code: zod
2177
+ .string()
2178
+ .regex(createPendingInvoiceLineBodyLinesItemRateCardTaxConfigStripeCodeRegExp)
2179
+ .describe('Product tax code.\n\nSee: https://docs.stripe.com/tax/tax-codes'),
2180
+ })
2181
+ .describe('The tax config for Stripe.')
2232
2182
  .optional()
2233
2183
  .describe('Stripe tax config.'),
2234
2184
  })
2235
2185
  .describe('Set of provider specific tax configs.')
2236
2186
  .optional()
2237
- .describe('Tax config specify the tax configuration for this line.'),
2238
- type: zod.enum(['usage_based']),
2187
+ .describe('The tax config of the rate card.\nWhen undefined, the tax config of the feature or the default tax config of the plan is used.'),
2239
2188
  })
2240
- .describe('InvoiceUsageBasedLineCreateWithCustomer represents the create model for an invoice line that is sold to the customer based on usage.'),
2241
- zod
2189
+ .describe('InvoiceUsageBasedRateCard represents the rate card (intent) for an usage-based line.')
2190
+ .optional()
2191
+ .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.'),
2192
+ taxConfig: zod
2242
2193
  .object({
2243
- category: zod
2244
- .enum(['regular', 'commitment'])
2245
- .describe('InvoiceFlatFeeCategory determines if the flat fee is a regular fee due to use due to a\ncommitment.')
2246
- .default(createPendingInvoiceLineBodyLinesItemCategoryDefault)
2247
- .describe('Category of the flat fee.'),
2248
- description: zod
2249
- .string()
2250
- .max(createPendingInvoiceLineBodyLinesItemDescriptionMaxOne)
2251
- .optional()
2252
- .describe('Optional description of the resource. Maximum 1024 characters.'),
2253
- invoiceAt: zod
2254
- .date()
2255
- .describe('The time this line item should be invoiced.'),
2256
- metadata: zod
2257
- .record(zod.string(), zod.string())
2258
- .describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
2259
- .nullish()
2260
- .describe('Additional metadata for the resource.'),
2261
- name: zod
2262
- .string()
2263
- .min(1)
2264
- .max(createPendingInvoiceLineBodyLinesItemNameMaxOne)
2265
- .describe('Human-readable name for the resource. Between 1 and 256 characters.'),
2266
- paymentTerm: zod
2267
- .enum(['in_advance', 'in_arrears'])
2268
- .describe('The payment term of a flat price.\nOne of: in_advance or in_arrears.')
2269
- .default(createPendingInvoiceLineBodyLinesItemPaymentTermDefault)
2270
- .describe('Payment term of the line.'),
2271
- period: zod
2272
- .object({
2273
- from: zod.date().describe('Period start time.'),
2274
- to: zod.date().describe('Period end time.'),
2275
- })
2276
- .describe('A period with a start and end time.')
2277
- .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.'),
2278
- perUnitAmount: zod
2279
- .string()
2280
- .regex(createPendingInvoiceLineBodyLinesItemPerUnitAmountRegExpOne)
2281
- .describe('Numeric represents an arbitrary precision number.')
2282
- .optional()
2283
- .describe('Price of the item being sold.'),
2284
- quantity: zod
2285
- .string()
2286
- .regex(createPendingInvoiceLineBodyLinesItemQuantityRegExpOne)
2287
- .describe('Numeric represents an arbitrary precision number.')
2194
+ behavior: zod
2195
+ .enum(['inclusive', 'exclusive'])
2196
+ .describe('Tax behavior.\n\nThis enum is used to specify whether tax is included in the price or excluded from the price.')
2288
2197
  .optional()
2289
- .describe('Quantity of the item being sold.'),
2290
- rateCard: zod
2198
+ .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."),
2199
+ customInvoicing: zod
2291
2200
  .object({
2292
- discounts: zod
2293
- .object({
2294
- percentage: zod
2295
- .object({
2296
- correlationId: zod
2297
- .string()
2298
- .regex(createPendingInvoiceLineBodyLinesItemRateCardDiscountsPercentageCorrelationIdRegExpOne)
2299
- .optional()
2300
- .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.'),
2301
- percentage: zod
2302
- .number()
2303
- .describe('Numeric representation of a percentage\n\n50% is represented as 50')
2304
- .describe('The percentage of the discount.'),
2305
- })
2306
- .describe('A percentage discount.')
2307
- .optional()
2308
- .describe('The percentage discount.'),
2309
- usage: zod
2310
- .object({
2311
- correlationId: zod
2312
- .string()
2313
- .regex(createPendingInvoiceLineBodyLinesItemRateCardDiscountsUsageCorrelationIdRegExpOne)
2314
- .optional()
2315
- .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.'),
2316
- quantity: zod
2317
- .string()
2318
- .regex(createPendingInvoiceLineBodyLinesItemRateCardDiscountsUsageQuantityRegExpThree)
2319
- .describe('Numeric represents an arbitrary precision number.')
2320
- .describe('The quantity of the usage discount.\n\nMust be positive.'),
2321
- })
2322
- .describe('A usage discount.')
2323
- .optional()
2324
- .describe('The usage discount.'),
2325
- })
2326
- .describe('A discount by type.')
2327
- .optional()
2328
- .describe('The discounts that are applied to the line.'),
2329
- price: zod
2330
- .object({
2331
- amount: zod
2332
- .string()
2333
- .regex(createPendingInvoiceLineBodyLinesItemRateCardPriceAmountRegExpSeven)
2334
- .describe('Numeric represents an arbitrary precision number.')
2335
- .describe('The amount of the flat price.'),
2336
- paymentTerm: zod
2337
- .enum(['in_advance', 'in_arrears'])
2338
- .describe('The payment term of a flat price.\nOne of: in_advance or in_arrears.')
2339
- .default(createPendingInvoiceLineBodyLinesItemRateCardPricePaymentTermDefaultTwo)
2340
- .describe('The payment term of the flat price.\nDefaults to in advance.'),
2341
- type: zod.enum(['flat']),
2342
- })
2343
- .describe('Flat price with payment term.')
2344
- .nullable()
2345
- .describe('The price of the rate card.\nWhen null, the feature or service is free.'),
2346
- quantity: zod
2201
+ code: zod
2347
2202
  .string()
2348
- .regex(createPendingInvoiceLineBodyLinesItemRateCardQuantityRegExpOne)
2349
- .describe('Numeric represents an arbitrary precision number.')
2350
- .optional()
2351
- .describe('Quantity of the item being sold.\n\nDefault: 1'),
2352
- taxConfig: zod
2353
- .object({
2354
- behavior: zod
2355
- .enum(['inclusive', 'exclusive'])
2356
- .describe('Tax behavior.\n\nThis enum is used to specify whether tax is included in the price or excluded from the price.')
2357
- .optional()
2358
- .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."),
2359
- customInvoicing: zod
2360
- .object({
2361
- code: zod
2362
- .string()
2363
- .describe('Tax code.\n\nThe tax code should be interpreted by the custom invoicing provider.'),
2364
- })
2365
- .describe('Custom invoicing tax config.')
2366
- .optional()
2367
- .describe('Custom invoicing tax config.'),
2368
- stripe: zod
2369
- .object({
2370
- code: zod
2371
- .string()
2372
- .regex(createPendingInvoiceLineBodyLinesItemRateCardTaxConfigStripeCodeRegExpOne)
2373
- .describe('Product tax code.\n\nSee: https://docs.stripe.com/tax/tax-codes'),
2374
- })
2375
- .describe('The tax config for Stripe.')
2376
- .optional()
2377
- .describe('Stripe tax config.'),
2378
- })
2379
- .describe('Set of provider specific tax configs.')
2380
- .optional()
2381
- .describe('The tax config of the rate card.\nWhen undefined, the tax config of the feature or the default tax config of the plan is used.'),
2203
+ .describe('Tax code.\n\nThe tax code should be interpreted by the custom invoicing provider.'),
2382
2204
  })
2383
- .describe('InvoiceFlatFeeRateCard represents the rate card (intent) for a flat fee line.')
2205
+ .describe('Custom invoicing tax config.')
2384
2206
  .optional()
2385
- .describe('The rate card that is used for this line.'),
2386
- taxConfig: zod
2207
+ .describe('Custom invoicing tax config.'),
2208
+ stripe: zod
2387
2209
  .object({
2388
- behavior: zod
2389
- .enum(['inclusive', 'exclusive'])
2390
- .describe('Tax behavior.\n\nThis enum is used to specify whether tax is included in the price or excluded from the price.')
2391
- .optional()
2392
- .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."),
2393
- customInvoicing: zod
2394
- .object({
2395
- code: zod
2396
- .string()
2397
- .describe('Tax code.\n\nThe tax code should be interpreted by the custom invoicing provider.'),
2398
- })
2399
- .describe('Custom invoicing tax config.')
2400
- .optional()
2401
- .describe('Custom invoicing tax config.'),
2402
- stripe: zod
2403
- .object({
2404
- code: zod
2405
- .string()
2406
- .regex(createPendingInvoiceLineBodyLinesItemTaxConfigStripeCodeRegExpOne)
2407
- .describe('Product tax code.\n\nSee: https://docs.stripe.com/tax/tax-codes'),
2408
- })
2409
- .describe('The tax config for Stripe.')
2410
- .optional()
2411
- .describe('Stripe tax config.'),
2210
+ code: zod
2211
+ .string()
2212
+ .regex(createPendingInvoiceLineBodyLinesItemTaxConfigStripeCodeRegExp)
2213
+ .describe('Product tax code.\n\nSee: https://docs.stripe.com/tax/tax-codes'),
2412
2214
  })
2413
- .describe('Set of provider specific tax configs.')
2215
+ .describe('The tax config for Stripe.')
2414
2216
  .optional()
2415
- .describe('Tax config specify the tax configuration for this line.'),
2416
- type: zod.enum(['flat_fee']),
2217
+ .describe('Stripe tax config.'),
2417
2218
  })
2418
- .describe('InvoiceFlatFeePendingLineCreate represents the create model for an invoice line that is sold to the customer as a manually added fee.'),
2419
- ])
2420
- .describe('InvoiceLineCreate represents the create model for an invoice line.'))
2219
+ .describe('Set of provider specific tax configs.')
2220
+ .optional()
2221
+ .describe('Tax config specify the tax configuration for this line.'),
2222
+ })
2223
+ .describe('InvoicePendingLineCreate represents the create model for an invoice line that is sold to the customer based on usage.'))
2421
2224
  .min(1)
2422
2225
  .describe('The lines to be created.'),
2423
2226
  })
@@ -2488,21 +2291,6 @@ export const simulateInvoiceBodyLinesItemRateCardDiscountsUsageCorrelationIdRegE
2488
2291
  export const simulateInvoiceBodyLinesItemQuantityRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2489
2292
  export const simulateInvoiceBodyLinesItemPreLinePeriodQuantityRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2490
2293
  export const simulateInvoiceBodyLinesItemIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
2491
- export const simulateInvoiceBodyLinesItemNameMaxOne = 256;
2492
- export const simulateInvoiceBodyLinesItemDescriptionMaxOne = 1024;
2493
- export const simulateInvoiceBodyLinesItemTaxConfigStripeCodeRegExpOne = new RegExp('^txcd_\\d{8}$');
2494
- export const simulateInvoiceBodyLinesItemPerUnitAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2495
- export const simulateInvoiceBodyLinesItemPaymentTermDefault = 'in_advance';
2496
- export const simulateInvoiceBodyLinesItemQuantityRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2497
- export const simulateInvoiceBodyLinesItemRateCardTaxConfigStripeCodeRegExpOne = new RegExp('^txcd_\\d{8}$');
2498
- export const simulateInvoiceBodyLinesItemRateCardPriceAmountRegExpSeven = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2499
- export const simulateInvoiceBodyLinesItemRateCardPricePaymentTermDefaultTwo = 'in_advance';
2500
- export const simulateInvoiceBodyLinesItemRateCardQuantityRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2501
- export const simulateInvoiceBodyLinesItemRateCardDiscountsPercentageCorrelationIdRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
2502
- export const simulateInvoiceBodyLinesItemRateCardDiscountsUsageQuantityRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
2503
- export const simulateInvoiceBodyLinesItemRateCardDiscountsUsageCorrelationIdRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
2504
- export const simulateInvoiceBodyLinesItemCategoryDefault = 'regular';
2505
- export const simulateInvoiceBodyLinesItemIdRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
2506
2294
  export const simulateInvoiceBody = zod
2507
2295
  .object({
2508
2296
  currency: zod
@@ -2514,630 +2302,411 @@ export const simulateInvoiceBody = zod
2514
2302
  .describe('Currency for all invoice line items.\n\nMulti currency invoices are not supported yet.'),
2515
2303
  lines: zod
2516
2304
  .array(zod
2517
- .discriminatedUnion('type', [
2518
- zod
2305
+ .object({
2306
+ description: zod
2307
+ .string()
2308
+ .max(simulateInvoiceBodyLinesItemDescriptionMax)
2309
+ .optional()
2310
+ .describe('Optional description of the resource. Maximum 1024 characters.'),
2311
+ featureKey: zod
2312
+ .string()
2313
+ .min(1)
2314
+ .max(simulateInvoiceBodyLinesItemFeatureKeyMax)
2315
+ .regex(simulateInvoiceBodyLinesItemFeatureKeyRegExp)
2316
+ .optional()
2317
+ .describe('The feature that the usage is based on.'),
2318
+ id: zod
2319
+ .string()
2320
+ .regex(simulateInvoiceBodyLinesItemIdRegExp)
2321
+ .optional()
2322
+ .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.'),
2323
+ invoiceAt: zod
2324
+ .date()
2325
+ .describe('The time this line item should be invoiced.'),
2326
+ metadata: zod
2327
+ .record(zod.string(), zod.string())
2328
+ .describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
2329
+ .nullish()
2330
+ .describe('Additional metadata for the resource.'),
2331
+ name: zod
2332
+ .string()
2333
+ .min(1)
2334
+ .max(simulateInvoiceBodyLinesItemNameMax)
2335
+ .describe('Human-readable name for the resource. Between 1 and 256 characters.'),
2336
+ period: zod
2519
2337
  .object({
2520
- description: zod
2521
- .string()
2522
- .max(simulateInvoiceBodyLinesItemDescriptionMax)
2523
- .optional()
2524
- .describe('Optional description of the resource. Maximum 1024 characters.'),
2525
- featureKey: zod
2526
- .string()
2527
- .min(1)
2528
- .max(simulateInvoiceBodyLinesItemFeatureKeyMax)
2529
- .regex(simulateInvoiceBodyLinesItemFeatureKeyRegExp)
2530
- .optional()
2531
- .describe('The feature that the usage is based on.'),
2532
- id: zod
2533
- .string()
2534
- .regex(simulateInvoiceBodyLinesItemIdRegExp)
2535
- .optional()
2536
- .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.'),
2537
- invoiceAt: zod
2538
- .date()
2539
- .describe('The time this line item should be invoiced.'),
2540
- metadata: zod
2541
- .record(zod.string(), zod.string())
2542
- .describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
2543
- .nullish()
2544
- .describe('Additional metadata for the resource.'),
2545
- name: zod
2546
- .string()
2547
- .min(1)
2548
- .max(simulateInvoiceBodyLinesItemNameMax)
2549
- .describe('Human-readable name for the resource. Between 1 and 256 characters.'),
2550
- period: zod
2338
+ from: zod.date().describe('Period start time.'),
2339
+ to: zod.date().describe('Period end time.'),
2340
+ })
2341
+ .describe('A period with a start and end time.')
2342
+ .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.'),
2343
+ preLinePeriodQuantity: zod
2344
+ .string()
2345
+ .regex(simulateInvoiceBodyLinesItemPreLinePeriodQuantityRegExpOne)
2346
+ .describe('Numeric represents an arbitrary precision number.')
2347
+ .optional()
2348
+ .describe("The quantity of the item used before this line's period, if the line is billed progressively."),
2349
+ price: zod
2350
+ .discriminatedUnion('type', [
2351
+ zod
2551
2352
  .object({
2552
- from: zod.date().describe('Period start time.'),
2553
- to: zod.date().describe('Period end time.'),
2353
+ amount: zod
2354
+ .string()
2355
+ .regex(simulateInvoiceBodyLinesItemPriceAmountRegExpOne)
2356
+ .describe('Numeric represents an arbitrary precision number.')
2357
+ .describe('The amount of the flat price.'),
2358
+ paymentTerm: zod
2359
+ .enum(['in_advance', 'in_arrears'])
2360
+ .describe('The payment term of a flat price.\nOne of: in_advance or in_arrears.')
2361
+ .default(simulateInvoiceBodyLinesItemPricePaymentTermDefault)
2362
+ .describe('The payment term of the flat price.\nDefaults to in advance.'),
2363
+ type: zod.enum(['flat']),
2554
2364
  })
2555
- .describe('A period with a start and end time.')
2556
- .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.'),
2557
- preLinePeriodQuantity: zod
2558
- .string()
2559
- .regex(simulateInvoiceBodyLinesItemPreLinePeriodQuantityRegExpOne)
2560
- .describe('Numeric represents an arbitrary precision number.')
2561
- .optional()
2562
- .describe("The quantity of the item used before this line's period, if the line is billed progressively."),
2563
- price: zod
2564
- .discriminatedUnion('type', [
2565
- zod
2566
- .object({
2567
- amount: zod
2568
- .string()
2569
- .regex(simulateInvoiceBodyLinesItemPriceAmountRegExpOne)
2570
- .describe('Numeric represents an arbitrary precision number.')
2571
- .describe('The amount of the flat price.'),
2572
- paymentTerm: zod
2573
- .enum(['in_advance', 'in_arrears'])
2574
- .describe('The payment term of a flat price.\nOne of: in_advance or in_arrears.')
2575
- .default(simulateInvoiceBodyLinesItemPricePaymentTermDefault)
2576
- .describe('The payment term of the flat price.\nDefaults to in advance.'),
2577
- type: zod.enum(['flat']),
2578
- })
2579
- .describe('Flat price with payment term.'),
2580
- zod
2581
- .object({
2582
- amount: zod
2583
- .string()
2584
- .regex(simulateInvoiceBodyLinesItemPriceAmountRegExpThree)
2585
- .describe('Numeric represents an arbitrary precision number.')
2586
- .describe('The amount of the unit price.'),
2587
- maximumAmount: zod
2588
- .string()
2589
- .regex(simulateInvoiceBodyLinesItemPriceMaximumAmountRegExpOne)
2590
- .describe('Numeric represents an arbitrary precision number.')
2591
- .optional()
2592
- .describe('The customer is limited to spend at most the amount.'),
2593
- minimumAmount: zod
2594
- .string()
2595
- .regex(simulateInvoiceBodyLinesItemPriceMinimumAmountRegExpOne)
2596
- .describe('Numeric represents an arbitrary precision number.')
2597
- .optional()
2598
- .describe('The customer is committed to spend at least the amount.'),
2599
- type: zod.enum(['unit']),
2600
- })
2601
- .describe('Unit price with spend commitments.'),
2602
- zod
2603
- .object({
2604
- maximumAmount: zod
2605
- .string()
2606
- .regex(simulateInvoiceBodyLinesItemPriceMaximumAmountRegExpThree)
2607
- .describe('Numeric represents an arbitrary precision number.')
2608
- .optional()
2609
- .describe('The customer is limited to spend at most the amount.'),
2610
- minimumAmount: zod
2611
- .string()
2612
- .regex(simulateInvoiceBodyLinesItemPriceMinimumAmountRegExpThree)
2613
- .describe('Numeric represents an arbitrary precision number.')
2614
- .optional()
2615
- .describe('The customer is committed to spend at least the amount.'),
2616
- mode: zod
2617
- .enum(['volume', 'graduated'])
2618
- .describe('The mode of the tiered price.')
2619
- .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.'),
2620
- tiers: zod
2621
- .array(zod
2622
- .object({
2623
- flatPrice: zod
2624
- .object({
2625
- amount: zod
2626
- .string()
2627
- .regex(simulateInvoiceBodyLinesItemPriceTiersItemFlatPriceAmountRegExpOne)
2628
- .describe('Numeric represents an arbitrary precision number.')
2629
- .describe('The amount of the flat price.'),
2630
- type: zod
2631
- .enum(['flat'])
2632
- .describe('The type of the price.'),
2633
- })
2634
- .describe('Flat price.')
2635
- .nullable()
2636
- .describe('The flat price component of the tier.'),
2637
- unitPrice: zod
2638
- .object({
2639
- amount: zod
2640
- .string()
2641
- .regex(simulateInvoiceBodyLinesItemPriceTiersItemUnitPriceAmountRegExpOne)
2642
- .describe('Numeric represents an arbitrary precision number.')
2643
- .describe('The amount of the unit price.'),
2644
- type: zod
2645
- .enum(['unit'])
2646
- .describe('The type of the price.'),
2647
- })
2648
- .describe('Unit price.')
2649
- .nullable()
2650
- .describe('The unit price component of the tier.'),
2651
- upToAmount: zod
2652
- .string()
2653
- .regex(simulateInvoiceBodyLinesItemPriceTiersItemUpToAmountRegExpOne)
2654
- .describe('Numeric represents an arbitrary precision number.')
2655
- .optional()
2656
- .describe('Up to and including to this quantity will be contained in the tier.\nIf null, the tier is open-ended.'),
2657
- })
2658
- .describe('A price tier.\nAt least one price component is required in each tier.'))
2659
- .min(1)
2660
- .describe('The tiers of the tiered price.\nAt least one price component is required in each tier.'),
2661
- type: zod.enum(['tiered']),
2662
- })
2663
- .describe('Tiered price with spend commitments.'),
2664
- zod
2665
- .object({
2666
- maximumAmount: zod
2667
- .string()
2668
- .regex(simulateInvoiceBodyLinesItemPriceMaximumAmountRegExpFive)
2669
- .describe('Numeric represents an arbitrary precision number.')
2670
- .optional()
2671
- .describe('The customer is limited to spend at most the amount.'),
2672
- minimumAmount: zod
2673
- .string()
2674
- .regex(simulateInvoiceBodyLinesItemPriceMinimumAmountRegExpFive)
2675
- .describe('Numeric represents an arbitrary precision number.')
2676
- .optional()
2677
- .describe('The customer is committed to spend at least the amount.'),
2678
- multiplier: zod
2679
- .string()
2680
- .regex(simulateInvoiceBodyLinesItemPriceMultiplierRegExpOne)
2681
- .describe('Numeric represents an arbitrary precision number.')
2682
- .default(simulateInvoiceBodyLinesItemPriceMultiplierDefault)
2683
- .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'),
2684
- type: zod.enum(['dynamic']),
2685
- })
2686
- .describe('Dynamic price with spend commitments.'),
2687
- zod
2688
- .object({
2689
- amount: zod
2690
- .string()
2691
- .regex(simulateInvoiceBodyLinesItemPriceAmountRegExpFive)
2692
- .describe('Numeric represents an arbitrary precision number.')
2693
- .describe('The price of one package.'),
2694
- maximumAmount: zod
2695
- .string()
2696
- .regex(simulateInvoiceBodyLinesItemPriceMaximumAmountRegExpSeven)
2697
- .describe('Numeric represents an arbitrary precision number.')
2698
- .optional()
2699
- .describe('The customer is limited to spend at most the amount.'),
2700
- minimumAmount: zod
2701
- .string()
2702
- .regex(simulateInvoiceBodyLinesItemPriceMinimumAmountRegExpSeven)
2703
- .describe('Numeric represents an arbitrary precision number.')
2704
- .optional()
2705
- .describe('The customer is committed to spend at least the amount.'),
2706
- quantityPerPackage: zod
2707
- .string()
2708
- .regex(simulateInvoiceBodyLinesItemPriceQuantityPerPackageRegExpOne)
2709
- .describe('Numeric represents an arbitrary precision number.')
2710
- .describe('The quantity per package.'),
2711
- type: zod.enum(['package']),
2712
- })
2713
- .describe('Package price with spend commitments.'),
2714
- ])
2715
- .describe('The price of the usage based rate card.')
2716
- .optional()
2717
- .describe('Price of the usage-based item being sold.'),
2718
- quantity: zod
2719
- .string()
2720
- .regex(simulateInvoiceBodyLinesItemQuantityRegExpOne)
2721
- .describe('Numeric represents an arbitrary precision number.')
2722
- .describe('The quantity of the item being sold.'),
2723
- rateCard: zod
2365
+ .describe('Flat price with payment term.'),
2366
+ zod
2724
2367
  .object({
2725
- discounts: zod
2726
- .object({
2727
- percentage: zod
2728
- .object({
2729
- correlationId: zod
2730
- .string()
2731
- .regex(simulateInvoiceBodyLinesItemRateCardDiscountsPercentageCorrelationIdRegExp)
2732
- .optional()
2733
- .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.'),
2734
- percentage: zod
2735
- .number()
2736
- .describe('Numeric representation of a percentage\n\n50% is represented as 50')
2737
- .describe('The percentage of the discount.'),
2738
- })
2739
- .describe('A percentage discount.')
2740
- .optional()
2741
- .describe('The percentage discount.'),
2742
- usage: zod
2743
- .object({
2744
- correlationId: zod
2745
- .string()
2746
- .regex(simulateInvoiceBodyLinesItemRateCardDiscountsUsageCorrelationIdRegExp)
2747
- .optional()
2748
- .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.'),
2749
- quantity: zod
2750
- .string()
2751
- .regex(simulateInvoiceBodyLinesItemRateCardDiscountsUsageQuantityRegExpOne)
2752
- .describe('Numeric represents an arbitrary precision number.')
2753
- .describe('The quantity of the usage discount.\n\nMust be positive.'),
2754
- })
2755
- .describe('A usage discount.')
2756
- .optional()
2757
- .describe('The usage discount.'),
2758
- })
2759
- .describe('A discount by type.')
2368
+ amount: zod
2369
+ .string()
2370
+ .regex(simulateInvoiceBodyLinesItemPriceAmountRegExpThree)
2371
+ .describe('Numeric represents an arbitrary precision number.')
2372
+ .describe('The amount of the unit price.'),
2373
+ maximumAmount: zod
2374
+ .string()
2375
+ .regex(simulateInvoiceBodyLinesItemPriceMaximumAmountRegExpOne)
2376
+ .describe('Numeric represents an arbitrary precision number.')
2760
2377
  .optional()
2761
- .describe('The discounts that are applied to the line.'),
2762
- featureKey: zod
2378
+ .describe('The customer is limited to spend at most the amount.'),
2379
+ minimumAmount: zod
2763
2380
  .string()
2764
- .min(1)
2765
- .max(simulateInvoiceBodyLinesItemRateCardFeatureKeyMax)
2766
- .regex(simulateInvoiceBodyLinesItemRateCardFeatureKeyRegExp)
2381
+ .regex(simulateInvoiceBodyLinesItemPriceMinimumAmountRegExpOne)
2382
+ .describe('Numeric represents an arbitrary precision number.')
2767
2383
  .optional()
2768
- .describe('The feature the customer is entitled to use.'),
2769
- price: zod
2770
- .discriminatedUnion('type', [
2771
- zod
2772
- .object({
2773
- amount: zod
2774
- .string()
2775
- .regex(simulateInvoiceBodyLinesItemRateCardPriceAmountRegExpOne)
2776
- .describe('Numeric represents an arbitrary precision number.')
2777
- .describe('The amount of the flat price.'),
2778
- paymentTerm: zod
2779
- .enum(['in_advance', 'in_arrears'])
2780
- .describe('The payment term of a flat price.\nOne of: in_advance or in_arrears.')
2781
- .default(simulateInvoiceBodyLinesItemRateCardPricePaymentTermDefault)
2782
- .describe('The payment term of the flat price.\nDefaults to in advance.'),
2783
- type: zod.enum(['flat']),
2784
- })
2785
- .describe('Flat price with payment term.'),
2786
- zod
2787
- .object({
2788
- amount: zod
2789
- .string()
2790
- .regex(simulateInvoiceBodyLinesItemRateCardPriceAmountRegExpThree)
2791
- .describe('Numeric represents an arbitrary precision number.')
2792
- .describe('The amount of the unit price.'),
2793
- maximumAmount: zod
2794
- .string()
2795
- .regex(simulateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpOne)
2796
- .describe('Numeric represents an arbitrary precision number.')
2797
- .optional()
2798
- .describe('The customer is limited to spend at most the amount.'),
2799
- minimumAmount: zod
2800
- .string()
2801
- .regex(simulateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpOne)
2802
- .describe('Numeric represents an arbitrary precision number.')
2803
- .optional()
2804
- .describe('The customer is committed to spend at least the amount.'),
2805
- type: zod.enum(['unit']),
2806
- })
2807
- .describe('Unit price with spend commitments.'),
2808
- zod
2809
- .object({
2810
- maximumAmount: zod
2811
- .string()
2812
- .regex(simulateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpThree)
2813
- .describe('Numeric represents an arbitrary precision number.')
2814
- .optional()
2815
- .describe('The customer is limited to spend at most the amount.'),
2816
- minimumAmount: zod
2817
- .string()
2818
- .regex(simulateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpThree)
2819
- .describe('Numeric represents an arbitrary precision number.')
2820
- .optional()
2821
- .describe('The customer is committed to spend at least the amount.'),
2822
- mode: zod
2823
- .enum(['volume', 'graduated'])
2824
- .describe('The mode of the tiered price.')
2825
- .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.'),
2826
- tiers: zod
2827
- .array(zod
2828
- .object({
2829
- flatPrice: zod
2830
- .object({
2831
- amount: zod
2832
- .string()
2833
- .regex(simulateInvoiceBodyLinesItemRateCardPriceTiersItemFlatPriceAmountRegExpOne)
2834
- .describe('Numeric represents an arbitrary precision number.')
2835
- .describe('The amount of the flat price.'),
2836
- type: zod
2837
- .enum(['flat'])
2838
- .describe('The type of the price.'),
2839
- })
2840
- .describe('Flat price.')
2841
- .nullable()
2842
- .describe('The flat price component of the tier.'),
2843
- unitPrice: zod
2844
- .object({
2845
- amount: zod
2846
- .string()
2847
- .regex(simulateInvoiceBodyLinesItemRateCardPriceTiersItemUnitPriceAmountRegExpOne)
2848
- .describe('Numeric represents an arbitrary precision number.')
2849
- .describe('The amount of the unit price.'),
2850
- type: zod
2851
- .enum(['unit'])
2852
- .describe('The type of the price.'),
2853
- })
2854
- .describe('Unit price.')
2855
- .nullable()
2856
- .describe('The unit price component of the tier.'),
2857
- upToAmount: zod
2858
- .string()
2859
- .regex(simulateInvoiceBodyLinesItemRateCardPriceTiersItemUpToAmountRegExpOne)
2860
- .describe('Numeric represents an arbitrary precision number.')
2861
- .optional()
2862
- .describe('Up to and including to this quantity will be contained in the tier.\nIf null, the tier is open-ended.'),
2863
- })
2864
- .describe('A price tier.\nAt least one price component is required in each tier.'))
2865
- .min(1)
2866
- .describe('The tiers of the tiered price.\nAt least one price component is required in each tier.'),
2867
- type: zod.enum(['tiered']),
2868
- })
2869
- .describe('Tiered price with spend commitments.'),
2870
- zod
2871
- .object({
2872
- maximumAmount: zod
2873
- .string()
2874
- .regex(simulateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpFive)
2875
- .describe('Numeric represents an arbitrary precision number.')
2876
- .optional()
2877
- .describe('The customer is limited to spend at most the amount.'),
2878
- minimumAmount: zod
2879
- .string()
2880
- .regex(simulateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpFive)
2881
- .describe('Numeric represents an arbitrary precision number.')
2882
- .optional()
2883
- .describe('The customer is committed to spend at least the amount.'),
2884
- multiplier: zod
2885
- .string()
2886
- .regex(simulateInvoiceBodyLinesItemRateCardPriceMultiplierRegExpOne)
2887
- .describe('Numeric represents an arbitrary precision number.')
2888
- .default(simulateInvoiceBodyLinesItemRateCardPriceMultiplierDefault)
2889
- .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'),
2890
- type: zod.enum(['dynamic']),
2891
- })
2892
- .describe('Dynamic price with spend commitments.'),
2893
- zod
2384
+ .describe('The customer is committed to spend at least the amount.'),
2385
+ type: zod.enum(['unit']),
2386
+ })
2387
+ .describe('Unit price with spend commitments.'),
2388
+ zod
2389
+ .object({
2390
+ maximumAmount: zod
2391
+ .string()
2392
+ .regex(simulateInvoiceBodyLinesItemPriceMaximumAmountRegExpThree)
2393
+ .describe('Numeric represents an arbitrary precision number.')
2394
+ .optional()
2395
+ .describe('The customer is limited to spend at most the amount.'),
2396
+ minimumAmount: zod
2397
+ .string()
2398
+ .regex(simulateInvoiceBodyLinesItemPriceMinimumAmountRegExpThree)
2399
+ .describe('Numeric represents an arbitrary precision number.')
2400
+ .optional()
2401
+ .describe('The customer is committed to spend at least the amount.'),
2402
+ mode: zod
2403
+ .enum(['volume', 'graduated'])
2404
+ .describe('The mode of the tiered price.')
2405
+ .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.'),
2406
+ tiers: zod
2407
+ .array(zod
2408
+ .object({
2409
+ flatPrice: zod
2894
2410
  .object({
2895
2411
  amount: zod
2896
2412
  .string()
2897
- .regex(simulateInvoiceBodyLinesItemRateCardPriceAmountRegExpFive)
2898
- .describe('Numeric represents an arbitrary precision number.')
2899
- .describe('The price of one package.'),
2900
- maximumAmount: zod
2901
- .string()
2902
- .regex(simulateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpSeven)
2903
- .describe('Numeric represents an arbitrary precision number.')
2904
- .optional()
2905
- .describe('The customer is limited to spend at most the amount.'),
2906
- minimumAmount: zod
2907
- .string()
2908
- .regex(simulateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpSeven)
2909
- .describe('Numeric represents an arbitrary precision number.')
2910
- .optional()
2911
- .describe('The customer is committed to spend at least the amount.'),
2912
- quantityPerPackage: zod
2913
- .string()
2914
- .regex(simulateInvoiceBodyLinesItemRateCardPriceQuantityPerPackageRegExpOne)
2413
+ .regex(simulateInvoiceBodyLinesItemPriceTiersItemFlatPriceAmountRegExpOne)
2915
2414
  .describe('Numeric represents an arbitrary precision number.')
2916
- .describe('The quantity per package.'),
2917
- type: zod.enum(['package']),
2918
- })
2919
- .describe('Package price with spend commitments.'),
2920
- ])
2921
- .describe('The price of the usage based rate card.')
2922
- .nullable()
2923
- .describe('The price of the rate card.\nWhen null, the feature or service is free.'),
2924
- taxConfig: zod
2925
- .object({
2926
- behavior: zod
2927
- .enum(['inclusive', 'exclusive'])
2928
- .describe('Tax behavior.\n\nThis enum is used to specify whether tax is included in the price or excluded from the price.')
2929
- .optional()
2930
- .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."),
2931
- customInvoicing: zod
2932
- .object({
2933
- code: zod
2934
- .string()
2935
- .describe('Tax code.\n\nThe tax code should be interpreted by the custom invoicing provider.'),
2415
+ .describe('The amount of the flat price.'),
2416
+ type: zod
2417
+ .enum(['flat'])
2418
+ .describe('The type of the price.'),
2936
2419
  })
2937
- .describe('Custom invoicing tax config.')
2938
- .optional()
2939
- .describe('Custom invoicing tax config.'),
2940
- stripe: zod
2420
+ .describe('Flat price.')
2421
+ .nullable()
2422
+ .describe('The flat price component of the tier.'),
2423
+ unitPrice: zod
2941
2424
  .object({
2942
- code: zod
2425
+ amount: zod
2943
2426
  .string()
2944
- .regex(simulateInvoiceBodyLinesItemRateCardTaxConfigStripeCodeRegExp)
2945
- .describe('Product tax code.\n\nSee: https://docs.stripe.com/tax/tax-codes'),
2427
+ .regex(simulateInvoiceBodyLinesItemPriceTiersItemUnitPriceAmountRegExpOne)
2428
+ .describe('Numeric represents an arbitrary precision number.')
2429
+ .describe('The amount of the unit price.'),
2430
+ type: zod
2431
+ .enum(['unit'])
2432
+ .describe('The type of the price.'),
2946
2433
  })
2947
- .describe('The tax config for Stripe.')
2434
+ .describe('Unit price.')
2435
+ .nullable()
2436
+ .describe('The unit price component of the tier.'),
2437
+ upToAmount: zod
2438
+ .string()
2439
+ .regex(simulateInvoiceBodyLinesItemPriceTiersItemUpToAmountRegExpOne)
2440
+ .describe('Numeric represents an arbitrary precision number.')
2948
2441
  .optional()
2949
- .describe('Stripe tax config.'),
2442
+ .describe('Up to and including to this quantity will be contained in the tier.\nIf null, the tier is open-ended.'),
2950
2443
  })
2951
- .describe('Set of provider specific tax configs.')
2444
+ .describe('A price tier.\nAt least one price component is required in each tier.'))
2445
+ .min(1)
2446
+ .describe('The tiers of the tiered price.\nAt least one price component is required in each tier.'),
2447
+ type: zod.enum(['tiered']),
2448
+ })
2449
+ .describe('Tiered price with spend commitments.'),
2450
+ zod
2451
+ .object({
2452
+ maximumAmount: zod
2453
+ .string()
2454
+ .regex(simulateInvoiceBodyLinesItemPriceMaximumAmountRegExpFive)
2455
+ .describe('Numeric represents an arbitrary precision number.')
2952
2456
  .optional()
2953
- .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.'),
2457
+ .describe('The customer is limited to spend at most the amount.'),
2458
+ minimumAmount: zod
2459
+ .string()
2460
+ .regex(simulateInvoiceBodyLinesItemPriceMinimumAmountRegExpFive)
2461
+ .describe('Numeric represents an arbitrary precision number.')
2462
+ .optional()
2463
+ .describe('The customer is committed to spend at least the amount.'),
2464
+ multiplier: zod
2465
+ .string()
2466
+ .regex(simulateInvoiceBodyLinesItemPriceMultiplierRegExpOne)
2467
+ .describe('Numeric represents an arbitrary precision number.')
2468
+ .default(simulateInvoiceBodyLinesItemPriceMultiplierDefault)
2469
+ .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'),
2470
+ type: zod.enum(['dynamic']),
2954
2471
  })
2955
- .describe('InvoiceUsageBasedRateCard represents the rate card (intent) for an usage-based line.')
2956
- .optional()
2957
- .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.'),
2958
- taxConfig: zod
2472
+ .describe('Dynamic price with spend commitments.'),
2473
+ zod
2959
2474
  .object({
2960
- behavior: zod
2961
- .enum(['inclusive', 'exclusive'])
2962
- .describe('Tax behavior.\n\nThis enum is used to specify whether tax is included in the price or excluded from the price.')
2475
+ amount: zod
2476
+ .string()
2477
+ .regex(simulateInvoiceBodyLinesItemPriceAmountRegExpFive)
2478
+ .describe('Numeric represents an arbitrary precision number.')
2479
+ .describe('The price of one package.'),
2480
+ maximumAmount: zod
2481
+ .string()
2482
+ .regex(simulateInvoiceBodyLinesItemPriceMaximumAmountRegExpSeven)
2483
+ .describe('Numeric represents an arbitrary precision number.')
2963
2484
  .optional()
2964
- .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."),
2965
- customInvoicing: zod
2485
+ .describe('The customer is limited to spend at most the amount.'),
2486
+ minimumAmount: zod
2487
+ .string()
2488
+ .regex(simulateInvoiceBodyLinesItemPriceMinimumAmountRegExpSeven)
2489
+ .describe('Numeric represents an arbitrary precision number.')
2490
+ .optional()
2491
+ .describe('The customer is committed to spend at least the amount.'),
2492
+ quantityPerPackage: zod
2493
+ .string()
2494
+ .regex(simulateInvoiceBodyLinesItemPriceQuantityPerPackageRegExpOne)
2495
+ .describe('Numeric represents an arbitrary precision number.')
2496
+ .describe('The quantity per package.'),
2497
+ type: zod.enum(['package']),
2498
+ })
2499
+ .describe('Package price with spend commitments.'),
2500
+ ])
2501
+ .describe('The price of the usage based rate card.')
2502
+ .optional()
2503
+ .describe('Price of the usage-based item being sold.'),
2504
+ quantity: zod
2505
+ .string()
2506
+ .regex(simulateInvoiceBodyLinesItemQuantityRegExpOne)
2507
+ .describe('Numeric represents an arbitrary precision number.')
2508
+ .describe('The quantity of the item being sold.'),
2509
+ rateCard: zod
2510
+ .object({
2511
+ discounts: zod
2512
+ .object({
2513
+ percentage: zod
2966
2514
  .object({
2967
- code: zod
2515
+ correlationId: zod
2968
2516
  .string()
2969
- .describe('Tax code.\n\nThe tax code should be interpreted by the custom invoicing provider.'),
2517
+ .regex(simulateInvoiceBodyLinesItemRateCardDiscountsPercentageCorrelationIdRegExp)
2518
+ .optional()
2519
+ .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.'),
2520
+ percentage: zod
2521
+ .number()
2522
+ .describe('Numeric representation of a percentage\n\n50% is represented as 50')
2523
+ .describe('The percentage of the discount.'),
2970
2524
  })
2971
- .describe('Custom invoicing tax config.')
2525
+ .describe('A percentage discount.')
2972
2526
  .optional()
2973
- .describe('Custom invoicing tax config.'),
2974
- stripe: zod
2527
+ .describe('The percentage discount.'),
2528
+ usage: zod
2975
2529
  .object({
2976
- code: zod
2530
+ correlationId: zod
2977
2531
  .string()
2978
- .regex(simulateInvoiceBodyLinesItemTaxConfigStripeCodeRegExp)
2979
- .describe('Product tax code.\n\nSee: https://docs.stripe.com/tax/tax-codes'),
2532
+ .regex(simulateInvoiceBodyLinesItemRateCardDiscountsUsageCorrelationIdRegExp)
2533
+ .optional()
2534
+ .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.'),
2535
+ quantity: zod
2536
+ .string()
2537
+ .regex(simulateInvoiceBodyLinesItemRateCardDiscountsUsageQuantityRegExpOne)
2538
+ .describe('Numeric represents an arbitrary precision number.')
2539
+ .describe('The quantity of the usage discount.\n\nMust be positive.'),
2980
2540
  })
2981
- .describe('The tax config for Stripe.')
2541
+ .describe('A usage discount.')
2982
2542
  .optional()
2983
- .describe('Stripe tax config.'),
2543
+ .describe('The usage discount.'),
2984
2544
  })
2985
- .describe('Set of provider specific tax configs.')
2986
- .optional()
2987
- .describe('Tax config specify the tax configuration for this line.'),
2988
- type: zod.enum(['usage_based']),
2989
- })
2990
- .describe('InvoiceSimulationUsageBasedLine represents a usage-based line item that can be input to the simulation endpoint.'),
2991
- zod
2992
- .object({
2993
- category: zod
2994
- .enum(['regular', 'commitment'])
2995
- .describe('InvoiceFlatFeeCategory determines if the flat fee is a regular fee due to use due to a\ncommitment.')
2996
- .default(simulateInvoiceBodyLinesItemCategoryDefault)
2997
- .describe('Category of the flat fee.'),
2998
- description: zod
2999
- .string()
3000
- .max(simulateInvoiceBodyLinesItemDescriptionMaxOne)
3001
- .optional()
3002
- .describe('Optional description of the resource. Maximum 1024 characters.'),
3003
- id: zod
3004
- .string()
3005
- .regex(simulateInvoiceBodyLinesItemIdRegExpOne)
2545
+ .describe('A discount by type.')
3006
2546
  .optional()
3007
- .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.'),
3008
- invoiceAt: zod
3009
- .date()
3010
- .describe('The time this line item should be invoiced.'),
3011
- metadata: zod
3012
- .record(zod.string(), zod.string())
3013
- .describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
3014
- .nullish()
3015
- .describe('Additional metadata for the resource.'),
3016
- name: zod
2547
+ .describe('The discounts that are applied to the line.'),
2548
+ featureKey: zod
3017
2549
  .string()
3018
2550
  .min(1)
3019
- .max(simulateInvoiceBodyLinesItemNameMaxOne)
3020
- .describe('Human-readable name for the resource. Between 1 and 256 characters.'),
3021
- paymentTerm: zod
3022
- .enum(['in_advance', 'in_arrears'])
3023
- .describe('The payment term of a flat price.\nOne of: in_advance or in_arrears.')
3024
- .default(simulateInvoiceBodyLinesItemPaymentTermDefault)
3025
- .describe('Payment term of the line.'),
3026
- period: zod
3027
- .object({
3028
- from: zod.date().describe('Period start time.'),
3029
- to: zod.date().describe('Period end time.'),
3030
- })
3031
- .describe('A period with a start and end time.')
3032
- .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.'),
3033
- perUnitAmount: zod
3034
- .string()
3035
- .regex(simulateInvoiceBodyLinesItemPerUnitAmountRegExpOne)
3036
- .describe('Numeric represents an arbitrary precision number.')
3037
- .optional()
3038
- .describe('Price of the item being sold.'),
3039
- quantity: zod
3040
- .string()
3041
- .regex(simulateInvoiceBodyLinesItemQuantityRegExpThree)
3042
- .describe('Numeric represents an arbitrary precision number.')
2551
+ .max(simulateInvoiceBodyLinesItemRateCardFeatureKeyMax)
2552
+ .regex(simulateInvoiceBodyLinesItemRateCardFeatureKeyRegExp)
3043
2553
  .optional()
3044
- .describe('Quantity of the item being sold.'),
3045
- rateCard: zod
3046
- .object({
3047
- discounts: zod
2554
+ .describe('The feature the customer is entitled to use.'),
2555
+ price: zod
2556
+ .discriminatedUnion('type', [
2557
+ zod
3048
2558
  .object({
3049
- percentage: zod
3050
- .object({
3051
- correlationId: zod
3052
- .string()
3053
- .regex(simulateInvoiceBodyLinesItemRateCardDiscountsPercentageCorrelationIdRegExpOne)
3054
- .optional()
3055
- .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.'),
3056
- percentage: zod
3057
- .number()
3058
- .describe('Numeric representation of a percentage\n\n50% is represented as 50')
3059
- .describe('The percentage of the discount.'),
3060
- })
3061
- .describe('A percentage discount.')
2559
+ amount: zod
2560
+ .string()
2561
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceAmountRegExpOne)
2562
+ .describe('Numeric represents an arbitrary precision number.')
2563
+ .describe('The amount of the flat price.'),
2564
+ paymentTerm: zod
2565
+ .enum(['in_advance', 'in_arrears'])
2566
+ .describe('The payment term of a flat price.\nOne of: in_advance or in_arrears.')
2567
+ .default(simulateInvoiceBodyLinesItemRateCardPricePaymentTermDefault)
2568
+ .describe('The payment term of the flat price.\nDefaults to in advance.'),
2569
+ type: zod.enum(['flat']),
2570
+ })
2571
+ .describe('Flat price with payment term.'),
2572
+ zod
2573
+ .object({
2574
+ amount: zod
2575
+ .string()
2576
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceAmountRegExpThree)
2577
+ .describe('Numeric represents an arbitrary precision number.')
2578
+ .describe('The amount of the unit price.'),
2579
+ maximumAmount: zod
2580
+ .string()
2581
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpOne)
2582
+ .describe('Numeric represents an arbitrary precision number.')
3062
2583
  .optional()
3063
- .describe('The percentage discount.'),
3064
- usage: zod
2584
+ .describe('The customer is limited to spend at most the amount.'),
2585
+ minimumAmount: zod
2586
+ .string()
2587
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpOne)
2588
+ .describe('Numeric represents an arbitrary precision number.')
2589
+ .optional()
2590
+ .describe('The customer is committed to spend at least the amount.'),
2591
+ type: zod.enum(['unit']),
2592
+ })
2593
+ .describe('Unit price with spend commitments.'),
2594
+ zod
2595
+ .object({
2596
+ maximumAmount: zod
2597
+ .string()
2598
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpThree)
2599
+ .describe('Numeric represents an arbitrary precision number.')
2600
+ .optional()
2601
+ .describe('The customer is limited to spend at most the amount.'),
2602
+ minimumAmount: zod
2603
+ .string()
2604
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpThree)
2605
+ .describe('Numeric represents an arbitrary precision number.')
2606
+ .optional()
2607
+ .describe('The customer is committed to spend at least the amount.'),
2608
+ mode: zod
2609
+ .enum(['volume', 'graduated'])
2610
+ .describe('The mode of the tiered price.')
2611
+ .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.'),
2612
+ tiers: zod
2613
+ .array(zod
3065
2614
  .object({
3066
- correlationId: zod
3067
- .string()
3068
- .regex(simulateInvoiceBodyLinesItemRateCardDiscountsUsageCorrelationIdRegExpOne)
3069
- .optional()
3070
- .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.'),
3071
- quantity: zod
2615
+ flatPrice: zod
2616
+ .object({
2617
+ amount: zod
2618
+ .string()
2619
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceTiersItemFlatPriceAmountRegExpOne)
2620
+ .describe('Numeric represents an arbitrary precision number.')
2621
+ .describe('The amount of the flat price.'),
2622
+ type: zod
2623
+ .enum(['flat'])
2624
+ .describe('The type of the price.'),
2625
+ })
2626
+ .describe('Flat price.')
2627
+ .nullable()
2628
+ .describe('The flat price component of the tier.'),
2629
+ unitPrice: zod
2630
+ .object({
2631
+ amount: zod
2632
+ .string()
2633
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceTiersItemUnitPriceAmountRegExpOne)
2634
+ .describe('Numeric represents an arbitrary precision number.')
2635
+ .describe('The amount of the unit price.'),
2636
+ type: zod
2637
+ .enum(['unit'])
2638
+ .describe('The type of the price.'),
2639
+ })
2640
+ .describe('Unit price.')
2641
+ .nullable()
2642
+ .describe('The unit price component of the tier.'),
2643
+ upToAmount: zod
3072
2644
  .string()
3073
- .regex(simulateInvoiceBodyLinesItemRateCardDiscountsUsageQuantityRegExpThree)
2645
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceTiersItemUpToAmountRegExpOne)
3074
2646
  .describe('Numeric represents an arbitrary precision number.')
3075
- .describe('The quantity of the usage discount.\n\nMust be positive.'),
2647
+ .optional()
2648
+ .describe('Up to and including to this quantity will be contained in the tier.\nIf null, the tier is open-ended.'),
3076
2649
  })
3077
- .describe('A usage discount.')
2650
+ .describe('A price tier.\nAt least one price component is required in each tier.'))
2651
+ .min(1)
2652
+ .describe('The tiers of the tiered price.\nAt least one price component is required in each tier.'),
2653
+ type: zod.enum(['tiered']),
2654
+ })
2655
+ .describe('Tiered price with spend commitments.'),
2656
+ zod
2657
+ .object({
2658
+ maximumAmount: zod
2659
+ .string()
2660
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpFive)
2661
+ .describe('Numeric represents an arbitrary precision number.')
3078
2662
  .optional()
3079
- .describe('The usage discount.'),
2663
+ .describe('The customer is limited to spend at most the amount.'),
2664
+ minimumAmount: zod
2665
+ .string()
2666
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpFive)
2667
+ .describe('Numeric represents an arbitrary precision number.')
2668
+ .optional()
2669
+ .describe('The customer is committed to spend at least the amount.'),
2670
+ multiplier: zod
2671
+ .string()
2672
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceMultiplierRegExpOne)
2673
+ .describe('Numeric represents an arbitrary precision number.')
2674
+ .default(simulateInvoiceBodyLinesItemRateCardPriceMultiplierDefault)
2675
+ .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'),
2676
+ type: zod.enum(['dynamic']),
3080
2677
  })
3081
- .describe('A discount by type.')
3082
- .optional()
3083
- .describe('The discounts that are applied to the line.'),
3084
- price: zod
2678
+ .describe('Dynamic price with spend commitments.'),
2679
+ zod
3085
2680
  .object({
3086
2681
  amount: zod
3087
2682
  .string()
3088
- .regex(simulateInvoiceBodyLinesItemRateCardPriceAmountRegExpSeven)
2683
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceAmountRegExpFive)
2684
+ .describe('Numeric represents an arbitrary precision number.')
2685
+ .describe('The price of one package.'),
2686
+ maximumAmount: zod
2687
+ .string()
2688
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpSeven)
3089
2689
  .describe('Numeric represents an arbitrary precision number.')
3090
- .describe('The amount of the flat price.'),
3091
- paymentTerm: zod
3092
- .enum(['in_advance', 'in_arrears'])
3093
- .describe('The payment term of a flat price.\nOne of: in_advance or in_arrears.')
3094
- .default(simulateInvoiceBodyLinesItemRateCardPricePaymentTermDefaultTwo)
3095
- .describe('The payment term of the flat price.\nDefaults to in advance.'),
3096
- type: zod.enum(['flat']),
3097
- })
3098
- .describe('Flat price with payment term.')
3099
- .nullable()
3100
- .describe('The price of the rate card.\nWhen null, the feature or service is free.'),
3101
- quantity: zod
3102
- .string()
3103
- .regex(simulateInvoiceBodyLinesItemRateCardQuantityRegExpOne)
3104
- .describe('Numeric represents an arbitrary precision number.')
3105
- .optional()
3106
- .describe('Quantity of the item being sold.\n\nDefault: 1'),
3107
- taxConfig: zod
3108
- .object({
3109
- behavior: zod
3110
- .enum(['inclusive', 'exclusive'])
3111
- .describe('Tax behavior.\n\nThis enum is used to specify whether tax is included in the price or excluded from the price.')
3112
- .optional()
3113
- .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."),
3114
- customInvoicing: zod
3115
- .object({
3116
- code: zod
3117
- .string()
3118
- .describe('Tax code.\n\nThe tax code should be interpreted by the custom invoicing provider.'),
3119
- })
3120
- .describe('Custom invoicing tax config.')
3121
2690
  .optional()
3122
- .describe('Custom invoicing tax config.'),
3123
- stripe: zod
3124
- .object({
3125
- code: zod
3126
- .string()
3127
- .regex(simulateInvoiceBodyLinesItemRateCardTaxConfigStripeCodeRegExpOne)
3128
- .describe('Product tax code.\n\nSee: https://docs.stripe.com/tax/tax-codes'),
3129
- })
3130
- .describe('The tax config for Stripe.')
2691
+ .describe('The customer is limited to spend at most the amount.'),
2692
+ minimumAmount: zod
2693
+ .string()
2694
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpSeven)
2695
+ .describe('Numeric represents an arbitrary precision number.')
3131
2696
  .optional()
3132
- .describe('Stripe tax config.'),
2697
+ .describe('The customer is committed to spend at least the amount.'),
2698
+ quantityPerPackage: zod
2699
+ .string()
2700
+ .regex(simulateInvoiceBodyLinesItemRateCardPriceQuantityPerPackageRegExpOne)
2701
+ .describe('Numeric represents an arbitrary precision number.')
2702
+ .describe('The quantity per package.'),
2703
+ type: zod.enum(['package']),
3133
2704
  })
3134
- .describe('Set of provider specific tax configs.')
3135
- .optional()
3136
- .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.'),
3137
- })
3138
- .describe('InvoiceFlatFeeRateCard represents the rate card (intent) for a flat fee line.')
3139
- .optional()
3140
- .describe('The rate card that is used for this line.'),
2705
+ .describe('Package price with spend commitments.'),
2706
+ ])
2707
+ .describe('The price of the usage based rate card.')
2708
+ .nullable()
2709
+ .describe('The price of the rate card.\nWhen null, the feature or service is free.'),
3141
2710
  taxConfig: zod
3142
2711
  .object({
3143
2712
  behavior: zod
@@ -3158,7 +2727,7 @@ export const simulateInvoiceBody = zod
3158
2727
  .object({
3159
2728
  code: zod
3160
2729
  .string()
3161
- .regex(simulateInvoiceBodyLinesItemTaxConfigStripeCodeRegExpOne)
2730
+ .regex(simulateInvoiceBodyLinesItemRateCardTaxConfigStripeCodeRegExp)
3162
2731
  .describe('Product tax code.\n\nSee: https://docs.stripe.com/tax/tax-codes'),
3163
2732
  })
3164
2733
  .describe('The tax config for Stripe.')
@@ -3167,12 +2736,43 @@ export const simulateInvoiceBody = zod
3167
2736
  })
3168
2737
  .describe('Set of provider specific tax configs.')
3169
2738
  .optional()
3170
- .describe('Tax config specify the tax configuration for this line.'),
3171
- type: zod.enum(['flat_fee']),
2739
+ .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.'),
3172
2740
  })
3173
- .describe('InvoiceSimulationFlatFeeLine represents a flat fee line item that can be input to the simulation endpoint.'),
3174
- ])
3175
- .describe('InvoiceSimulationInput represents a line item that can be input to the simulation endpoint.'))
2741
+ .describe('InvoiceUsageBasedRateCard represents the rate card (intent) for an usage-based line.')
2742
+ .optional()
2743
+ .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.'),
2744
+ taxConfig: zod
2745
+ .object({
2746
+ behavior: zod
2747
+ .enum(['inclusive', 'exclusive'])
2748
+ .describe('Tax behavior.\n\nThis enum is used to specify whether tax is included in the price or excluded from the price.')
2749
+ .optional()
2750
+ .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."),
2751
+ customInvoicing: zod
2752
+ .object({
2753
+ code: zod
2754
+ .string()
2755
+ .describe('Tax code.\n\nThe tax code should be interpreted by the custom invoicing provider.'),
2756
+ })
2757
+ .describe('Custom invoicing tax config.')
2758
+ .optional()
2759
+ .describe('Custom invoicing tax config.'),
2760
+ stripe: zod
2761
+ .object({
2762
+ code: zod
2763
+ .string()
2764
+ .regex(simulateInvoiceBodyLinesItemTaxConfigStripeCodeRegExp)
2765
+ .describe('Product tax code.\n\nSee: https://docs.stripe.com/tax/tax-codes'),
2766
+ })
2767
+ .describe('The tax config for Stripe.')
2768
+ .optional()
2769
+ .describe('Stripe tax config.'),
2770
+ })
2771
+ .describe('Set of provider specific tax configs.')
2772
+ .optional()
2773
+ .describe('Tax config specify the tax configuration for this line.'),
2774
+ })
2775
+ .describe('InvoiceSimulationLine represents a usage-based line item that can be input to the simulation endpoint.'))
3176
2776
  .describe('Lines to be included in the generated invoice.'),
3177
2777
  number: zod
3178
2778
  .string()
@@ -3423,21 +3023,6 @@ export const updateInvoiceBodyLinesItemRateCardDiscountsPercentageCorrelationIdR
3423
3023
  export const updateInvoiceBodyLinesItemRateCardDiscountsUsageQuantityRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
3424
3024
  export const updateInvoiceBodyLinesItemRateCardDiscountsUsageCorrelationIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
3425
3025
  export const updateInvoiceBodyLinesItemIdRegExp = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
3426
- export const updateInvoiceBodyLinesItemNameMaxOne = 256;
3427
- export const updateInvoiceBodyLinesItemDescriptionMaxOne = 1024;
3428
- export const updateInvoiceBodyLinesItemTaxConfigStripeCodeRegExpOne = new RegExp('^txcd_\\d{8}$');
3429
- export const updateInvoiceBodyLinesItemPerUnitAmountRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
3430
- export const updateInvoiceBodyLinesItemPaymentTermDefault = 'in_advance';
3431
- export const updateInvoiceBodyLinesItemQuantityRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
3432
- export const updateInvoiceBodyLinesItemRateCardTaxConfigStripeCodeRegExpOne = new RegExp('^txcd_\\d{8}$');
3433
- export const updateInvoiceBodyLinesItemRateCardPriceAmountRegExpSeven = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
3434
- export const updateInvoiceBodyLinesItemRateCardPricePaymentTermDefaultTwo = 'in_advance';
3435
- export const updateInvoiceBodyLinesItemRateCardQuantityRegExpOne = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
3436
- export const updateInvoiceBodyLinesItemRateCardDiscountsPercentageCorrelationIdRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
3437
- export const updateInvoiceBodyLinesItemRateCardDiscountsUsageQuantityRegExpThree = new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$');
3438
- export const updateInvoiceBodyLinesItemRateCardDiscountsUsageCorrelationIdRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
3439
- export const updateInvoiceBodyLinesItemCategoryDefault = 'regular';
3440
- export const updateInvoiceBodyLinesItemIdRegExpOne = new RegExp('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$');
3441
3026
  export const updateInvoiceBodyWorkflowWorkflowInvoicingAutoAdvanceDefault = true;
3442
3027
  export const updateInvoiceBodyWorkflowWorkflowInvoicingDraftPeriodDefault = 'P0D';
3443
3028
  export const updateInvoiceBodyWorkflowWorkflowInvoicingDueAfterDefault = 'P30D';
@@ -3502,619 +3087,400 @@ export const updateInvoiceBody = zod
3502
3087
  .describe('Optional description of the resource. Maximum 1024 characters.'),
3503
3088
  lines: zod
3504
3089
  .array(zod
3505
- .discriminatedUnion('type', [
3506
- zod
3507
- .object({
3508
- description: zod
3509
- .string()
3510
- .max(updateInvoiceBodyLinesItemDescriptionMax)
3511
- .optional()
3512
- .describe('Optional description of the resource. Maximum 1024 characters.'),
3513
- featureKey: zod
3514
- .string()
3515
- .min(1)
3516
- .max(updateInvoiceBodyLinesItemFeatureKeyMax)
3517
- .regex(updateInvoiceBodyLinesItemFeatureKeyRegExp)
3518
- .optional()
3519
- .describe('The feature that the usage is based on.'),
3520
- id: zod
3521
- .string()
3522
- .regex(updateInvoiceBodyLinesItemIdRegExp)
3523
- .optional()
3524
- .describe('The ID of the line.'),
3525
- invoiceAt: zod
3526
- .date()
3527
- .describe('The time this line item should be invoiced.'),
3528
- metadata: zod
3529
- .record(zod.string(), zod.string())
3530
- .describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
3531
- .nullish()
3532
- .describe('Additional metadata for the resource.'),
3533
- name: zod
3534
- .string()
3535
- .min(1)
3536
- .max(updateInvoiceBodyLinesItemNameMax)
3537
- .describe('Human-readable name for the resource. Between 1 and 256 characters.'),
3538
- period: zod
3539
- .object({
3540
- from: zod.date().describe('Period start time.'),
3541
- to: zod.date().describe('Period end time.'),
3542
- })
3543
- .describe('A period with a start and end time.')
3544
- .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.'),
3545
- price: zod
3546
- .discriminatedUnion('type', [
3547
- zod
3548
- .object({
3549
- amount: zod
3550
- .string()
3551
- .regex(updateInvoiceBodyLinesItemPriceAmountRegExpOne)
3552
- .describe('Numeric represents an arbitrary precision number.')
3553
- .describe('The amount of the flat price.'),
3554
- paymentTerm: zod
3555
- .enum(['in_advance', 'in_arrears'])
3556
- .describe('The payment term of a flat price.\nOne of: in_advance or in_arrears.')
3557
- .default(updateInvoiceBodyLinesItemPricePaymentTermDefault)
3558
- .describe('The payment term of the flat price.\nDefaults to in advance.'),
3559
- type: zod.enum(['flat']),
3560
- })
3561
- .describe('Flat price with payment term.'),
3562
- zod
3563
- .object({
3564
- amount: zod
3565
- .string()
3566
- .regex(updateInvoiceBodyLinesItemPriceAmountRegExpThree)
3567
- .describe('Numeric represents an arbitrary precision number.')
3568
- .describe('The amount of the unit price.'),
3569
- maximumAmount: zod
3570
- .string()
3571
- .regex(updateInvoiceBodyLinesItemPriceMaximumAmountRegExpOne)
3572
- .describe('Numeric represents an arbitrary precision number.')
3573
- .optional()
3574
- .describe('The customer is limited to spend at most the amount.'),
3575
- minimumAmount: zod
3576
- .string()
3577
- .regex(updateInvoiceBodyLinesItemPriceMinimumAmountRegExpOne)
3578
- .describe('Numeric represents an arbitrary precision number.')
3579
- .optional()
3580
- .describe('The customer is committed to spend at least the amount.'),
3581
- type: zod.enum(['unit']),
3582
- })
3583
- .describe('Unit price with spend commitments.'),
3584
- zod
3585
- .object({
3586
- maximumAmount: zod
3587
- .string()
3588
- .regex(updateInvoiceBodyLinesItemPriceMaximumAmountRegExpThree)
3589
- .describe('Numeric represents an arbitrary precision number.')
3590
- .optional()
3591
- .describe('The customer is limited to spend at most the amount.'),
3592
- minimumAmount: zod
3593
- .string()
3594
- .regex(updateInvoiceBodyLinesItemPriceMinimumAmountRegExpThree)
3595
- .describe('Numeric represents an arbitrary precision number.')
3596
- .optional()
3597
- .describe('The customer is committed to spend at least the amount.'),
3598
- mode: zod
3599
- .enum(['volume', 'graduated'])
3600
- .describe('The mode of the tiered price.')
3601
- .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.'),
3602
- tiers: zod
3603
- .array(zod
3604
- .object({
3605
- flatPrice: zod
3606
- .object({
3607
- amount: zod
3608
- .string()
3609
- .regex(updateInvoiceBodyLinesItemPriceTiersItemFlatPriceAmountRegExpOne)
3610
- .describe('Numeric represents an arbitrary precision number.')
3611
- .describe('The amount of the flat price.'),
3612
- type: zod
3613
- .enum(['flat'])
3614
- .describe('The type of the price.'),
3615
- })
3616
- .describe('Flat price.')
3617
- .nullable()
3618
- .describe('The flat price component of the tier.'),
3619
- unitPrice: zod
3620
- .object({
3621
- amount: zod
3622
- .string()
3623
- .regex(updateInvoiceBodyLinesItemPriceTiersItemUnitPriceAmountRegExpOne)
3624
- .describe('Numeric represents an arbitrary precision number.')
3625
- .describe('The amount of the unit price.'),
3626
- type: zod
3627
- .enum(['unit'])
3628
- .describe('The type of the price.'),
3629
- })
3630
- .describe('Unit price.')
3631
- .nullable()
3632
- .describe('The unit price component of the tier.'),
3633
- upToAmount: zod
3634
- .string()
3635
- .regex(updateInvoiceBodyLinesItemPriceTiersItemUpToAmountRegExpOne)
3636
- .describe('Numeric represents an arbitrary precision number.')
3637
- .optional()
3638
- .describe('Up to and including to this quantity will be contained in the tier.\nIf null, the tier is open-ended.'),
3639
- })
3640
- .describe('A price tier.\nAt least one price component is required in each tier.'))
3641
- .min(1)
3642
- .describe('The tiers of the tiered price.\nAt least one price component is required in each tier.'),
3643
- type: zod.enum(['tiered']),
3644
- })
3645
- .describe('Tiered price with spend commitments.'),
3646
- zod
3647
- .object({
3648
- maximumAmount: zod
3649
- .string()
3650
- .regex(updateInvoiceBodyLinesItemPriceMaximumAmountRegExpFive)
3651
- .describe('Numeric represents an arbitrary precision number.')
3652
- .optional()
3653
- .describe('The customer is limited to spend at most the amount.'),
3654
- minimumAmount: zod
3655
- .string()
3656
- .regex(updateInvoiceBodyLinesItemPriceMinimumAmountRegExpFive)
3657
- .describe('Numeric represents an arbitrary precision number.')
3658
- .optional()
3659
- .describe('The customer is committed to spend at least the amount.'),
3660
- multiplier: zod
3661
- .string()
3662
- .regex(updateInvoiceBodyLinesItemPriceMultiplierRegExpOne)
3663
- .describe('Numeric represents an arbitrary precision number.')
3664
- .default(updateInvoiceBodyLinesItemPriceMultiplierDefault)
3665
- .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'),
3666
- type: zod.enum(['dynamic']),
3667
- })
3668
- .describe('Dynamic price with spend commitments.'),
3669
- zod
3670
- .object({
3671
- amount: zod
3672
- .string()
3673
- .regex(updateInvoiceBodyLinesItemPriceAmountRegExpFive)
3674
- .describe('Numeric represents an arbitrary precision number.')
3675
- .describe('The price of one package.'),
3676
- maximumAmount: zod
3677
- .string()
3678
- .regex(updateInvoiceBodyLinesItemPriceMaximumAmountRegExpSeven)
3679
- .describe('Numeric represents an arbitrary precision number.')
3680
- .optional()
3681
- .describe('The customer is limited to spend at most the amount.'),
3682
- minimumAmount: zod
3683
- .string()
3684
- .regex(updateInvoiceBodyLinesItemPriceMinimumAmountRegExpSeven)
3685
- .describe('Numeric represents an arbitrary precision number.')
3686
- .optional()
3687
- .describe('The customer is committed to spend at least the amount.'),
3688
- quantityPerPackage: zod
3689
- .string()
3690
- .regex(updateInvoiceBodyLinesItemPriceQuantityPerPackageRegExpOne)
3691
- .describe('Numeric represents an arbitrary precision number.')
3692
- .describe('The quantity per package.'),
3693
- type: zod.enum(['package']),
3694
- })
3695
- .describe('Package price with spend commitments.'),
3696
- ])
3697
- .describe('The price of the usage based rate card.')
3698
- .optional()
3699
- .describe('Price of the usage-based item being sold.'),
3700
- rateCard: zod
3090
+ .object({
3091
+ description: zod
3092
+ .string()
3093
+ .max(updateInvoiceBodyLinesItemDescriptionMax)
3094
+ .optional()
3095
+ .describe('Optional description of the resource. Maximum 1024 characters.'),
3096
+ featureKey: zod
3097
+ .string()
3098
+ .min(1)
3099
+ .max(updateInvoiceBodyLinesItemFeatureKeyMax)
3100
+ .regex(updateInvoiceBodyLinesItemFeatureKeyRegExp)
3101
+ .optional()
3102
+ .describe('The feature that the usage is based on.'),
3103
+ id: zod
3104
+ .string()
3105
+ .regex(updateInvoiceBodyLinesItemIdRegExp)
3106
+ .optional()
3107
+ .describe('The ID of the line.'),
3108
+ invoiceAt: zod
3109
+ .date()
3110
+ .describe('The time this line item should be invoiced.'),
3111
+ metadata: zod
3112
+ .record(zod.string(), zod.string())
3113
+ .describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
3114
+ .nullish()
3115
+ .describe('Additional metadata for the resource.'),
3116
+ name: zod
3117
+ .string()
3118
+ .min(1)
3119
+ .max(updateInvoiceBodyLinesItemNameMax)
3120
+ .describe('Human-readable name for the resource. Between 1 and 256 characters.'),
3121
+ period: zod
3122
+ .object({
3123
+ from: zod.date().describe('Period start time.'),
3124
+ to: zod.date().describe('Period end time.'),
3125
+ })
3126
+ .describe('A period with a start and end time.')
3127
+ .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.'),
3128
+ price: zod
3129
+ .discriminatedUnion('type', [
3130
+ zod
3701
3131
  .object({
3702
- discounts: zod
3703
- .object({
3704
- percentage: zod
3705
- .object({
3706
- correlationId: zod
3707
- .string()
3708
- .regex(updateInvoiceBodyLinesItemRateCardDiscountsPercentageCorrelationIdRegExp)
3709
- .optional()
3710
- .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.'),
3711
- percentage: zod
3712
- .number()
3713
- .describe('Numeric representation of a percentage\n\n50% is represented as 50')
3714
- .describe('The percentage of the discount.'),
3715
- })
3716
- .describe('A percentage discount.')
3717
- .optional()
3718
- .describe('The percentage discount.'),
3719
- usage: zod
3720
- .object({
3721
- correlationId: zod
3722
- .string()
3723
- .regex(updateInvoiceBodyLinesItemRateCardDiscountsUsageCorrelationIdRegExp)
3724
- .optional()
3725
- .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.'),
3726
- quantity: zod
3727
- .string()
3728
- .regex(updateInvoiceBodyLinesItemRateCardDiscountsUsageQuantityRegExpOne)
3729
- .describe('Numeric represents an arbitrary precision number.')
3730
- .describe('The quantity of the usage discount.\n\nMust be positive.'),
3731
- })
3732
- .describe('A usage discount.')
3733
- .optional()
3734
- .describe('The usage discount.'),
3735
- })
3736
- .describe('A discount by type.')
3132
+ amount: zod
3133
+ .string()
3134
+ .regex(updateInvoiceBodyLinesItemPriceAmountRegExpOne)
3135
+ .describe('Numeric represents an arbitrary precision number.')
3136
+ .describe('The amount of the flat price.'),
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(updateInvoiceBodyLinesItemPricePaymentTermDefault)
3141
+ .describe('The payment term of the flat price.\nDefaults to in advance.'),
3142
+ type: zod.enum(['flat']),
3143
+ })
3144
+ .describe('Flat price with payment term.'),
3145
+ zod
3146
+ .object({
3147
+ amount: zod
3148
+ .string()
3149
+ .regex(updateInvoiceBodyLinesItemPriceAmountRegExpThree)
3150
+ .describe('Numeric represents an arbitrary precision number.')
3151
+ .describe('The amount of the unit price.'),
3152
+ maximumAmount: zod
3153
+ .string()
3154
+ .regex(updateInvoiceBodyLinesItemPriceMaximumAmountRegExpOne)
3155
+ .describe('Numeric represents an arbitrary precision number.')
3737
3156
  .optional()
3738
- .describe('The discounts that are applied to the line.'),
3739
- featureKey: zod
3157
+ .describe('The customer is limited to spend at most the amount.'),
3158
+ minimumAmount: zod
3740
3159
  .string()
3741
- .min(1)
3742
- .max(updateInvoiceBodyLinesItemRateCardFeatureKeyMax)
3743
- .regex(updateInvoiceBodyLinesItemRateCardFeatureKeyRegExp)
3160
+ .regex(updateInvoiceBodyLinesItemPriceMinimumAmountRegExpOne)
3161
+ .describe('Numeric represents an arbitrary precision number.')
3744
3162
  .optional()
3745
- .describe('The feature the customer is entitled to use.'),
3746
- price: zod
3747
- .discriminatedUnion('type', [
3748
- zod
3163
+ .describe('The customer is committed to spend at least the amount.'),
3164
+ type: zod.enum(['unit']),
3165
+ })
3166
+ .describe('Unit price with spend commitments.'),
3167
+ zod
3168
+ .object({
3169
+ maximumAmount: zod
3170
+ .string()
3171
+ .regex(updateInvoiceBodyLinesItemPriceMaximumAmountRegExpThree)
3172
+ .describe('Numeric represents an arbitrary precision number.')
3173
+ .optional()
3174
+ .describe('The customer is limited to spend at most the amount.'),
3175
+ minimumAmount: zod
3176
+ .string()
3177
+ .regex(updateInvoiceBodyLinesItemPriceMinimumAmountRegExpThree)
3178
+ .describe('Numeric represents an arbitrary precision number.')
3179
+ .optional()
3180
+ .describe('The customer is committed to spend at least the amount.'),
3181
+ mode: zod
3182
+ .enum(['volume', 'graduated'])
3183
+ .describe('The mode of the tiered price.')
3184
+ .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.'),
3185
+ tiers: zod
3186
+ .array(zod
3187
+ .object({
3188
+ flatPrice: zod
3749
3189
  .object({
3750
3190
  amount: zod
3751
3191
  .string()
3752
- .regex(updateInvoiceBodyLinesItemRateCardPriceAmountRegExpOne)
3192
+ .regex(updateInvoiceBodyLinesItemPriceTiersItemFlatPriceAmountRegExpOne)
3753
3193
  .describe('Numeric represents an arbitrary precision number.')
3754
3194
  .describe('The amount of the flat price.'),
3755
- paymentTerm: zod
3756
- .enum(['in_advance', 'in_arrears'])
3757
- .describe('The payment term of a flat price.\nOne of: in_advance or in_arrears.')
3758
- .default(updateInvoiceBodyLinesItemRateCardPricePaymentTermDefault)
3759
- .describe('The payment term of the flat price.\nDefaults to in advance.'),
3760
- type: zod.enum(['flat']),
3195
+ type: zod
3196
+ .enum(['flat'])
3197
+ .describe('The type of the price.'),
3761
3198
  })
3762
- .describe('Flat price with payment term.'),
3763
- zod
3199
+ .describe('Flat price.')
3200
+ .nullable()
3201
+ .describe('The flat price component of the tier.'),
3202
+ unitPrice: zod
3764
3203
  .object({
3765
3204
  amount: zod
3766
3205
  .string()
3767
- .regex(updateInvoiceBodyLinesItemRateCardPriceAmountRegExpThree)
3206
+ .regex(updateInvoiceBodyLinesItemPriceTiersItemUnitPriceAmountRegExpOne)
3768
3207
  .describe('Numeric represents an arbitrary precision number.')
3769
3208
  .describe('The amount of the unit price.'),
3770
- maximumAmount: zod
3771
- .string()
3772
- .regex(updateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpOne)
3773
- .describe('Numeric represents an arbitrary precision number.')
3774
- .optional()
3775
- .describe('The customer is limited to spend at most the amount.'),
3776
- minimumAmount: zod
3777
- .string()
3778
- .regex(updateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpOne)
3779
- .describe('Numeric represents an arbitrary precision number.')
3780
- .optional()
3781
- .describe('The customer is committed to spend at least the amount.'),
3782
- type: zod.enum(['unit']),
3783
- })
3784
- .describe('Unit price with spend commitments.'),
3785
- zod
3786
- .object({
3787
- maximumAmount: zod
3788
- .string()
3789
- .regex(updateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpThree)
3790
- .describe('Numeric represents an arbitrary precision number.')
3791
- .optional()
3792
- .describe('The customer is limited to spend at most the amount.'),
3793
- minimumAmount: zod
3794
- .string()
3795
- .regex(updateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpThree)
3796
- .describe('Numeric represents an arbitrary precision number.')
3797
- .optional()
3798
- .describe('The customer is committed to spend at least the amount.'),
3799
- mode: zod
3800
- .enum(['volume', 'graduated'])
3801
- .describe('The mode of the tiered price.')
3802
- .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.'),
3803
- tiers: zod
3804
- .array(zod
3805
- .object({
3806
- flatPrice: zod
3807
- .object({
3808
- amount: zod
3809
- .string()
3810
- .regex(updateInvoiceBodyLinesItemRateCardPriceTiersItemFlatPriceAmountRegExpOne)
3811
- .describe('Numeric represents an arbitrary precision number.')
3812
- .describe('The amount of the flat price.'),
3813
- type: zod
3814
- .enum(['flat'])
3815
- .describe('The type of the price.'),
3816
- })
3817
- .describe('Flat price.')
3818
- .nullable()
3819
- .describe('The flat price component of the tier.'),
3820
- unitPrice: zod
3821
- .object({
3822
- amount: zod
3823
- .string()
3824
- .regex(updateInvoiceBodyLinesItemRateCardPriceTiersItemUnitPriceAmountRegExpOne)
3825
- .describe('Numeric represents an arbitrary precision number.')
3826
- .describe('The amount of the unit price.'),
3827
- type: zod
3828
- .enum(['unit'])
3829
- .describe('The type of the price.'),
3830
- })
3831
- .describe('Unit price.')
3832
- .nullable()
3833
- .describe('The unit price component of the tier.'),
3834
- upToAmount: zod
3835
- .string()
3836
- .regex(updateInvoiceBodyLinesItemRateCardPriceTiersItemUpToAmountRegExpOne)
3837
- .describe('Numeric represents an arbitrary precision number.')
3838
- .optional()
3839
- .describe('Up to and including to this quantity will be contained in the tier.\nIf null, the tier is open-ended.'),
3840
- })
3841
- .describe('A price tier.\nAt least one price component is required in each tier.'))
3842
- .min(1)
3843
- .describe('The tiers of the tiered price.\nAt least one price component is required in each tier.'),
3844
- type: zod.enum(['tiered']),
3845
- })
3846
- .describe('Tiered price with spend commitments.'),
3847
- zod
3848
- .object({
3849
- maximumAmount: zod
3850
- .string()
3851
- .regex(updateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpFive)
3852
- .describe('Numeric represents an arbitrary precision number.')
3853
- .optional()
3854
- .describe('The customer is limited to spend at most the amount.'),
3855
- minimumAmount: zod
3856
- .string()
3857
- .regex(updateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpFive)
3858
- .describe('Numeric represents an arbitrary precision number.')
3859
- .optional()
3860
- .describe('The customer is committed to spend at least the amount.'),
3861
- multiplier: zod
3862
- .string()
3863
- .regex(updateInvoiceBodyLinesItemRateCardPriceMultiplierRegExpOne)
3864
- .describe('Numeric represents an arbitrary precision number.')
3865
- .default(updateInvoiceBodyLinesItemRateCardPriceMultiplierDefault)
3866
- .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'),
3867
- type: zod.enum(['dynamic']),
3868
- })
3869
- .describe('Dynamic price with spend commitments.'),
3870
- zod
3871
- .object({
3872
- amount: zod
3873
- .string()
3874
- .regex(updateInvoiceBodyLinesItemRateCardPriceAmountRegExpFive)
3875
- .describe('Numeric represents an arbitrary precision number.')
3876
- .describe('The price of one package.'),
3877
- maximumAmount: zod
3878
- .string()
3879
- .regex(updateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpSeven)
3880
- .describe('Numeric represents an arbitrary precision number.')
3881
- .optional()
3882
- .describe('The customer is limited to spend at most the amount.'),
3883
- minimumAmount: zod
3884
- .string()
3885
- .regex(updateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpSeven)
3886
- .describe('Numeric represents an arbitrary precision number.')
3887
- .optional()
3888
- .describe('The customer is committed to spend at least the amount.'),
3889
- quantityPerPackage: zod
3890
- .string()
3891
- .regex(updateInvoiceBodyLinesItemRateCardPriceQuantityPerPackageRegExpOne)
3892
- .describe('Numeric represents an arbitrary precision number.')
3893
- .describe('The quantity per package.'),
3894
- type: zod.enum(['package']),
3895
- })
3896
- .describe('Package price with spend commitments.'),
3897
- ])
3898
- .describe('The price of the usage based rate card.')
3899
- .nullable()
3900
- .describe('The price of the rate card.\nWhen null, the feature or service is free.'),
3901
- taxConfig: zod
3902
- .object({
3903
- behavior: zod
3904
- .enum(['inclusive', 'exclusive'])
3905
- .describe('Tax behavior.\n\nThis enum is used to specify whether tax is included in the price or excluded from the price.')
3906
- .optional()
3907
- .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."),
3908
- customInvoicing: zod
3909
- .object({
3910
- code: zod
3911
- .string()
3912
- .describe('Tax code.\n\nThe tax code should be interpreted by the custom invoicing provider.'),
3913
- })
3914
- .describe('Custom invoicing tax config.')
3915
- .optional()
3916
- .describe('Custom invoicing tax config.'),
3917
- stripe: zod
3918
- .object({
3919
- code: zod
3920
- .string()
3921
- .regex(updateInvoiceBodyLinesItemRateCardTaxConfigStripeCodeRegExp)
3922
- .describe('Product tax code.\n\nSee: https://docs.stripe.com/tax/tax-codes'),
3209
+ type: zod
3210
+ .enum(['unit'])
3211
+ .describe('The type of the price.'),
3923
3212
  })
3924
- .describe('The tax config for Stripe.')
3213
+ .describe('Unit price.')
3214
+ .nullable()
3215
+ .describe('The unit price component of the tier.'),
3216
+ upToAmount: zod
3217
+ .string()
3218
+ .regex(updateInvoiceBodyLinesItemPriceTiersItemUpToAmountRegExpOne)
3219
+ .describe('Numeric represents an arbitrary precision number.')
3925
3220
  .optional()
3926
- .describe('Stripe tax config.'),
3221
+ .describe('Up to and including to this quantity will be contained in the tier.\nIf null, the tier is open-ended.'),
3927
3222
  })
3928
- .describe('Set of provider specific tax configs.')
3223
+ .describe('A price tier.\nAt least one price component is required in each tier.'))
3224
+ .min(1)
3225
+ .describe('The tiers of the tiered price.\nAt least one price component is required in each tier.'),
3226
+ type: zod.enum(['tiered']),
3227
+ })
3228
+ .describe('Tiered price with spend commitments.'),
3229
+ zod
3230
+ .object({
3231
+ maximumAmount: zod
3232
+ .string()
3233
+ .regex(updateInvoiceBodyLinesItemPriceMaximumAmountRegExpFive)
3234
+ .describe('Numeric represents an arbitrary precision number.')
3929
3235
  .optional()
3930
- .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.'),
3236
+ .describe('The customer is limited to spend at most the amount.'),
3237
+ minimumAmount: zod
3238
+ .string()
3239
+ .regex(updateInvoiceBodyLinesItemPriceMinimumAmountRegExpFive)
3240
+ .describe('Numeric represents an arbitrary precision number.')
3241
+ .optional()
3242
+ .describe('The customer is committed to spend at least the amount.'),
3243
+ multiplier: zod
3244
+ .string()
3245
+ .regex(updateInvoiceBodyLinesItemPriceMultiplierRegExpOne)
3246
+ .describe('Numeric represents an arbitrary precision number.')
3247
+ .default(updateInvoiceBodyLinesItemPriceMultiplierDefault)
3248
+ .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'),
3249
+ type: zod.enum(['dynamic']),
3250
+ })
3251
+ .describe('Dynamic price with spend commitments.'),
3252
+ zod
3253
+ .object({
3254
+ amount: zod
3255
+ .string()
3256
+ .regex(updateInvoiceBodyLinesItemPriceAmountRegExpFive)
3257
+ .describe('Numeric represents an arbitrary precision number.')
3258
+ .describe('The price of one package.'),
3259
+ maximumAmount: zod
3260
+ .string()
3261
+ .regex(updateInvoiceBodyLinesItemPriceMaximumAmountRegExpSeven)
3262
+ .describe('Numeric represents an arbitrary precision number.')
3263
+ .optional()
3264
+ .describe('The customer is limited to spend at most the amount.'),
3265
+ minimumAmount: zod
3266
+ .string()
3267
+ .regex(updateInvoiceBodyLinesItemPriceMinimumAmountRegExpSeven)
3268
+ .describe('Numeric represents an arbitrary precision number.')
3269
+ .optional()
3270
+ .describe('The customer is committed to spend at least the amount.'),
3271
+ quantityPerPackage: zod
3272
+ .string()
3273
+ .regex(updateInvoiceBodyLinesItemPriceQuantityPerPackageRegExpOne)
3274
+ .describe('Numeric represents an arbitrary precision number.')
3275
+ .describe('The quantity per package.'),
3276
+ type: zod.enum(['package']),
3931
3277
  })
3932
- .describe('InvoiceUsageBasedRateCard represents the rate card (intent) for an usage-based line.')
3933
- .optional()
3934
- .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.'),
3935
- taxConfig: zod
3278
+ .describe('Package price with spend commitments.'),
3279
+ ])
3280
+ .describe('The price of the usage based rate card.')
3281
+ .optional()
3282
+ .describe('Price of the usage-based item being sold.'),
3283
+ rateCard: zod
3284
+ .object({
3285
+ discounts: zod
3936
3286
  .object({
3937
- behavior: zod
3938
- .enum(['inclusive', 'exclusive'])
3939
- .describe('Tax behavior.\n\nThis enum is used to specify whether tax is included in the price or excluded from the price.')
3940
- .optional()
3941
- .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."),
3942
- customInvoicing: zod
3287
+ percentage: zod
3943
3288
  .object({
3944
- code: zod
3289
+ correlationId: zod
3945
3290
  .string()
3946
- .describe('Tax code.\n\nThe tax code should be interpreted by the custom invoicing provider.'),
3291
+ .regex(updateInvoiceBodyLinesItemRateCardDiscountsPercentageCorrelationIdRegExp)
3292
+ .optional()
3293
+ .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.'),
3294
+ percentage: zod
3295
+ .number()
3296
+ .describe('Numeric representation of a percentage\n\n50% is represented as 50')
3297
+ .describe('The percentage of the discount.'),
3947
3298
  })
3948
- .describe('Custom invoicing tax config.')
3299
+ .describe('A percentage discount.')
3949
3300
  .optional()
3950
- .describe('Custom invoicing tax config.'),
3951
- stripe: zod
3301
+ .describe('The percentage discount.'),
3302
+ usage: zod
3952
3303
  .object({
3953
- code: zod
3304
+ correlationId: zod
3954
3305
  .string()
3955
- .regex(updateInvoiceBodyLinesItemTaxConfigStripeCodeRegExp)
3956
- .describe('Product tax code.\n\nSee: https://docs.stripe.com/tax/tax-codes'),
3306
+ .regex(updateInvoiceBodyLinesItemRateCardDiscountsUsageCorrelationIdRegExp)
3307
+ .optional()
3308
+ .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.'),
3309
+ quantity: zod
3310
+ .string()
3311
+ .regex(updateInvoiceBodyLinesItemRateCardDiscountsUsageQuantityRegExpOne)
3312
+ .describe('Numeric represents an arbitrary precision number.')
3313
+ .describe('The quantity of the usage discount.\n\nMust be positive.'),
3957
3314
  })
3958
- .describe('The tax config for Stripe.')
3315
+ .describe('A usage discount.')
3959
3316
  .optional()
3960
- .describe('Stripe tax config.'),
3317
+ .describe('The usage discount.'),
3961
3318
  })
3962
- .describe('Set of provider specific tax configs.')
3963
- .optional()
3964
- .describe('Tax config specify the tax configuration for this line.'),
3965
- type: zod.enum(['usage_based']),
3966
- })
3967
- .describe('InvoiceUpdateUsageBasedLineReplaceUpdate represents the update model for an UBP invoice line.\n\nThis type makes ID optional to allow for creating new lines as part of the update.'),
3968
- zod
3969
- .object({
3970
- category: zod
3971
- .enum(['regular', 'commitment'])
3972
- .describe('InvoiceFlatFeeCategory determines if the flat fee is a regular fee due to use due to a\ncommitment.')
3973
- .default(updateInvoiceBodyLinesItemCategoryDefault)
3974
- .describe('Category of the flat fee.'),
3975
- description: zod
3976
- .string()
3977
- .max(updateInvoiceBodyLinesItemDescriptionMaxOne)
3978
- .optional()
3979
- .describe('Optional description of the resource. Maximum 1024 characters.'),
3980
- id: zod
3981
- .string()
3982
- .regex(updateInvoiceBodyLinesItemIdRegExpOne)
3319
+ .describe('A discount by type.')
3983
3320
  .optional()
3984
- .describe('The ID of the line.'),
3985
- invoiceAt: zod
3986
- .date()
3987
- .describe('The time this line item should be invoiced.'),
3988
- metadata: zod
3989
- .record(zod.string(), zod.string())
3990
- .describe('Set of key-value pairs.\nMetadata can be used to store additional information about a resource.')
3991
- .nullish()
3992
- .describe('Additional metadata for the resource.'),
3993
- name: zod
3321
+ .describe('The discounts that are applied to the line.'),
3322
+ featureKey: zod
3994
3323
  .string()
3995
3324
  .min(1)
3996
- .max(updateInvoiceBodyLinesItemNameMaxOne)
3997
- .describe('Human-readable name for the resource. Between 1 and 256 characters.'),
3998
- paymentTerm: zod
3999
- .enum(['in_advance', 'in_arrears'])
4000
- .describe('The payment term of a flat price.\nOne of: in_advance or in_arrears.')
4001
- .default(updateInvoiceBodyLinesItemPaymentTermDefault)
4002
- .describe('Payment term of the line.'),
4003
- period: zod
4004
- .object({
4005
- from: zod.date().describe('Period start time.'),
4006
- to: zod.date().describe('Period end time.'),
4007
- })
4008
- .describe('A period with a start and end time.')
4009
- .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.'),
4010
- perUnitAmount: zod
4011
- .string()
4012
- .regex(updateInvoiceBodyLinesItemPerUnitAmountRegExpOne)
4013
- .describe('Numeric represents an arbitrary precision number.')
3325
+ .max(updateInvoiceBodyLinesItemRateCardFeatureKeyMax)
3326
+ .regex(updateInvoiceBodyLinesItemRateCardFeatureKeyRegExp)
4014
3327
  .optional()
4015
- .describe('Price of the item being sold.'),
4016
- quantity: zod
4017
- .string()
4018
- .regex(updateInvoiceBodyLinesItemQuantityRegExpOne)
4019
- .describe('Numeric represents an arbitrary precision number.')
4020
- .optional()
4021
- .describe('Quantity of the item being sold.'),
4022
- rateCard: zod
4023
- .object({
4024
- discounts: zod
4025
- .object({
4026
- percentage: zod
4027
- .object({
4028
- correlationId: zod
4029
- .string()
4030
- .regex(updateInvoiceBodyLinesItemRateCardDiscountsPercentageCorrelationIdRegExpOne)
4031
- .optional()
4032
- .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.'),
4033
- percentage: zod
4034
- .number()
4035
- .describe('Numeric representation of a percentage\n\n50% is represented as 50')
4036
- .describe('The percentage of the discount.'),
4037
- })
4038
- .describe('A percentage discount.')
4039
- .optional()
4040
- .describe('The percentage discount.'),
4041
- usage: zod
4042
- .object({
4043
- correlationId: zod
4044
- .string()
4045
- .regex(updateInvoiceBodyLinesItemRateCardDiscountsUsageCorrelationIdRegExpOne)
4046
- .optional()
4047
- .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.'),
4048
- quantity: zod
4049
- .string()
4050
- .regex(updateInvoiceBodyLinesItemRateCardDiscountsUsageQuantityRegExpThree)
4051
- .describe('Numeric represents an arbitrary precision number.')
4052
- .describe('The quantity of the usage discount.\n\nMust be positive.'),
4053
- })
4054
- .describe('A usage discount.')
4055
- .optional()
4056
- .describe('The usage discount.'),
4057
- })
4058
- .describe('A discount by type.')
4059
- .optional()
4060
- .describe('The discounts that are applied to the line.'),
4061
- price: zod
3328
+ .describe('The feature the customer is entitled to use.'),
3329
+ price: zod
3330
+ .discriminatedUnion('type', [
3331
+ zod
4062
3332
  .object({
4063
3333
  amount: zod
4064
3334
  .string()
4065
- .regex(updateInvoiceBodyLinesItemRateCardPriceAmountRegExpSeven)
3335
+ .regex(updateInvoiceBodyLinesItemRateCardPriceAmountRegExpOne)
4066
3336
  .describe('Numeric represents an arbitrary precision number.')
4067
3337
  .describe('The amount of the flat price.'),
4068
3338
  paymentTerm: zod
4069
3339
  .enum(['in_advance', 'in_arrears'])
4070
3340
  .describe('The payment term of a flat price.\nOne of: in_advance or in_arrears.')
4071
- .default(updateInvoiceBodyLinesItemRateCardPricePaymentTermDefaultTwo)
3341
+ .default(updateInvoiceBodyLinesItemRateCardPricePaymentTermDefault)
4072
3342
  .describe('The payment term of the flat price.\nDefaults to in advance.'),
4073
3343
  type: zod.enum(['flat']),
4074
3344
  })
4075
- .describe('Flat price with payment term.')
4076
- .nullable()
4077
- .describe('The price of the rate card.\nWhen null, the feature or service is free.'),
4078
- quantity: zod
4079
- .string()
4080
- .regex(updateInvoiceBodyLinesItemRateCardQuantityRegExpOne)
4081
- .describe('Numeric represents an arbitrary precision number.')
4082
- .optional()
4083
- .describe('Quantity of the item being sold.\n\nDefault: 1'),
4084
- taxConfig: zod
3345
+ .describe('Flat price with payment term.'),
3346
+ zod
4085
3347
  .object({
4086
- behavior: zod
4087
- .enum(['inclusive', 'exclusive'])
4088
- .describe('Tax behavior.\n\nThis enum is used to specify whether tax is included in the price or excluded from the price.')
3348
+ amount: zod
3349
+ .string()
3350
+ .regex(updateInvoiceBodyLinesItemRateCardPriceAmountRegExpThree)
3351
+ .describe('Numeric represents an arbitrary precision number.')
3352
+ .describe('The amount of the unit price.'),
3353
+ maximumAmount: zod
3354
+ .string()
3355
+ .regex(updateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpOne)
3356
+ .describe('Numeric represents an arbitrary precision number.')
4089
3357
  .optional()
4090
- .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."),
4091
- customInvoicing: zod
4092
- .object({
4093
- code: zod
4094
- .string()
4095
- .describe('Tax code.\n\nThe tax code should be interpreted by the custom invoicing provider.'),
4096
- })
4097
- .describe('Custom invoicing tax config.')
3358
+ .describe('The customer is limited to spend at most the amount.'),
3359
+ minimumAmount: zod
3360
+ .string()
3361
+ .regex(updateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpOne)
3362
+ .describe('Numeric represents an arbitrary precision number.')
4098
3363
  .optional()
4099
- .describe('Custom invoicing tax config.'),
4100
- stripe: zod
3364
+ .describe('The customer is committed to spend at least the amount.'),
3365
+ type: zod.enum(['unit']),
3366
+ })
3367
+ .describe('Unit price with spend commitments.'),
3368
+ zod
3369
+ .object({
3370
+ maximumAmount: zod
3371
+ .string()
3372
+ .regex(updateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpThree)
3373
+ .describe('Numeric represents an arbitrary precision number.')
3374
+ .optional()
3375
+ .describe('The customer is limited to spend at most the amount.'),
3376
+ minimumAmount: zod
3377
+ .string()
3378
+ .regex(updateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpThree)
3379
+ .describe('Numeric represents an arbitrary precision number.')
3380
+ .optional()
3381
+ .describe('The customer is committed to spend at least the amount.'),
3382
+ mode: zod
3383
+ .enum(['volume', 'graduated'])
3384
+ .describe('The mode of the tiered price.')
3385
+ .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.'),
3386
+ tiers: zod
3387
+ .array(zod
4101
3388
  .object({
4102
- code: zod
3389
+ flatPrice: zod
3390
+ .object({
3391
+ amount: zod
3392
+ .string()
3393
+ .regex(updateInvoiceBodyLinesItemRateCardPriceTiersItemFlatPriceAmountRegExpOne)
3394
+ .describe('Numeric represents an arbitrary precision number.')
3395
+ .describe('The amount of the flat price.'),
3396
+ type: zod
3397
+ .enum(['flat'])
3398
+ .describe('The type of the price.'),
3399
+ })
3400
+ .describe('Flat price.')
3401
+ .nullable()
3402
+ .describe('The flat price component of the tier.'),
3403
+ unitPrice: zod
3404
+ .object({
3405
+ amount: zod
3406
+ .string()
3407
+ .regex(updateInvoiceBodyLinesItemRateCardPriceTiersItemUnitPriceAmountRegExpOne)
3408
+ .describe('Numeric represents an arbitrary precision number.')
3409
+ .describe('The amount of the unit price.'),
3410
+ type: zod
3411
+ .enum(['unit'])
3412
+ .describe('The type of the price.'),
3413
+ })
3414
+ .describe('Unit price.')
3415
+ .nullable()
3416
+ .describe('The unit price component of the tier.'),
3417
+ upToAmount: zod
4103
3418
  .string()
4104
- .regex(updateInvoiceBodyLinesItemRateCardTaxConfigStripeCodeRegExpOne)
4105
- .describe('Product tax code.\n\nSee: https://docs.stripe.com/tax/tax-codes'),
3419
+ .regex(updateInvoiceBodyLinesItemRateCardPriceTiersItemUpToAmountRegExpOne)
3420
+ .describe('Numeric represents an arbitrary precision number.')
3421
+ .optional()
3422
+ .describe('Up to and including to this quantity will be contained in the tier.\nIf null, the tier is open-ended.'),
4106
3423
  })
4107
- .describe('The tax config for Stripe.')
3424
+ .describe('A price tier.\nAt least one price component is required in each tier.'))
3425
+ .min(1)
3426
+ .describe('The tiers of the tiered price.\nAt least one price component is required in each tier.'),
3427
+ type: zod.enum(['tiered']),
3428
+ })
3429
+ .describe('Tiered price with spend commitments.'),
3430
+ zod
3431
+ .object({
3432
+ maximumAmount: zod
3433
+ .string()
3434
+ .regex(updateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpFive)
3435
+ .describe('Numeric represents an arbitrary precision number.')
4108
3436
  .optional()
4109
- .describe('Stripe tax config.'),
3437
+ .describe('The customer is limited to spend at most the amount.'),
3438
+ minimumAmount: zod
3439
+ .string()
3440
+ .regex(updateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpFive)
3441
+ .describe('Numeric represents an arbitrary precision number.')
3442
+ .optional()
3443
+ .describe('The customer is committed to spend at least the amount.'),
3444
+ multiplier: zod
3445
+ .string()
3446
+ .regex(updateInvoiceBodyLinesItemRateCardPriceMultiplierRegExpOne)
3447
+ .describe('Numeric represents an arbitrary precision number.')
3448
+ .default(updateInvoiceBodyLinesItemRateCardPriceMultiplierDefault)
3449
+ .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'),
3450
+ type: zod.enum(['dynamic']),
4110
3451
  })
4111
- .describe('Set of provider specific tax configs.')
4112
- .optional()
4113
- .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.'),
4114
- })
4115
- .describe('InvoiceFlatFeeRateCard represents the rate card (intent) for a flat fee line.')
4116
- .optional()
4117
- .describe('The rate card that is used for this line.'),
3452
+ .describe('Dynamic price with spend commitments.'),
3453
+ zod
3454
+ .object({
3455
+ amount: zod
3456
+ .string()
3457
+ .regex(updateInvoiceBodyLinesItemRateCardPriceAmountRegExpFive)
3458
+ .describe('Numeric represents an arbitrary precision number.')
3459
+ .describe('The price of one package.'),
3460
+ maximumAmount: zod
3461
+ .string()
3462
+ .regex(updateInvoiceBodyLinesItemRateCardPriceMaximumAmountRegExpSeven)
3463
+ .describe('Numeric represents an arbitrary precision number.')
3464
+ .optional()
3465
+ .describe('The customer is limited to spend at most the amount.'),
3466
+ minimumAmount: zod
3467
+ .string()
3468
+ .regex(updateInvoiceBodyLinesItemRateCardPriceMinimumAmountRegExpSeven)
3469
+ .describe('Numeric represents an arbitrary precision number.')
3470
+ .optional()
3471
+ .describe('The customer is committed to spend at least the amount.'),
3472
+ quantityPerPackage: zod
3473
+ .string()
3474
+ .regex(updateInvoiceBodyLinesItemRateCardPriceQuantityPerPackageRegExpOne)
3475
+ .describe('Numeric represents an arbitrary precision number.')
3476
+ .describe('The quantity per package.'),
3477
+ type: zod.enum(['package']),
3478
+ })
3479
+ .describe('Package price with spend commitments.'),
3480
+ ])
3481
+ .describe('The price of the usage based rate card.')
3482
+ .nullable()
3483
+ .describe('The price of the rate card.\nWhen null, the feature or service is free.'),
4118
3484
  taxConfig: zod
4119
3485
  .object({
4120
3486
  behavior: zod
@@ -4135,7 +3501,7 @@ export const updateInvoiceBody = zod
4135
3501
  .object({
4136
3502
  code: zod
4137
3503
  .string()
4138
- .regex(updateInvoiceBodyLinesItemTaxConfigStripeCodeRegExpOne)
3504
+ .regex(updateInvoiceBodyLinesItemRateCardTaxConfigStripeCodeRegExp)
4139
3505
  .describe('Product tax code.\n\nSee: https://docs.stripe.com/tax/tax-codes'),
4140
3506
  })
4141
3507
  .describe('The tax config for Stripe.')
@@ -4144,12 +3510,43 @@ export const updateInvoiceBody = zod
4144
3510
  })
4145
3511
  .describe('Set of provider specific tax configs.')
4146
3512
  .optional()
4147
- .describe('Tax config specify the tax configuration for this line.'),
4148
- type: zod.enum(['flat_fee']),
3513
+ .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.'),
4149
3514
  })
4150
- .describe('InvoiceFlatFeeLineReplaceUpdate represents the update model for a flat fee invoice line.\n\nThis type makes ID optional to allow for creating new lines as part of the update.'),
4151
- ])
4152
- .describe('InvoiceLineReplaceUpdate represents the update model for an invoice line.'))
3515
+ .describe('InvoiceUsageBasedRateCard represents the rate card (intent) for an usage-based line.')
3516
+ .optional()
3517
+ .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.'),
3518
+ taxConfig: zod
3519
+ .object({
3520
+ behavior: zod
3521
+ .enum(['inclusive', 'exclusive'])
3522
+ .describe('Tax behavior.\n\nThis enum is used to specify whether tax is included in the price or excluded from the price.')
3523
+ .optional()
3524
+ .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."),
3525
+ customInvoicing: zod
3526
+ .object({
3527
+ code: zod
3528
+ .string()
3529
+ .describe('Tax code.\n\nThe tax code should be interpreted by the custom invoicing provider.'),
3530
+ })
3531
+ .describe('Custom invoicing tax config.')
3532
+ .optional()
3533
+ .describe('Custom invoicing tax config.'),
3534
+ stripe: zod
3535
+ .object({
3536
+ code: zod
3537
+ .string()
3538
+ .regex(updateInvoiceBodyLinesItemTaxConfigStripeCodeRegExp)
3539
+ .describe('Product tax code.\n\nSee: https://docs.stripe.com/tax/tax-codes'),
3540
+ })
3541
+ .describe('The tax config for Stripe.')
3542
+ .optional()
3543
+ .describe('Stripe tax config.'),
3544
+ })
3545
+ .describe('Set of provider specific tax configs.')
3546
+ .optional()
3547
+ .describe('Tax config specify the tax configuration for this line.'),
3548
+ })
3549
+ .describe('InvoiceLineReplaceUpdate represents the update model for an UBP invoice line.\n\nThis type makes ID optional to allow for creating new lines as part of the update.'))
4153
3550
  .describe('The lines included in the invoice.'),
4154
3551
  metadata: zod
4155
3552
  .record(zod.string(), zod.string())