Skip to content

Commit d6b8deb

Browse files
committed
feat(customcurrency): support custom currency subscriptions
1 parent 1230145 commit d6b8deb

155 files changed

Lines changed: 14416 additions & 3923 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

api/api.gen.go

Lines changed: 1343 additions & 1273 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/client/go/client.gen.go

Lines changed: 1112 additions & 1042 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/client/javascript/src/client/schemas.ts

Lines changed: 78 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3825,6 +3825,8 @@ export interface components {
38253825
* @example USD
38263826
*/
38273827
CurrencyCode: string
3828+
/** @description Fiat or managed custom currency code. */
3829+
CurrencyCodeOrCustom: string
38283830
/**
38293831
* @description Custom Invoicing app can be used for interface with any invoicing or payment system.
38303832
*
@@ -4130,6 +4132,11 @@ export interface components {
41304132
* @example 2023-01-01T01:01:01.001Z
41314133
*/
41324134
billingAnchor?: Date
4135+
/**
4136+
* @description Controls how custom-currency cost bases are selected for the new subscription.
4137+
* @default dynamic
4138+
*/
4139+
costBasisMode?: components['schemas']['SubscriptionCostBasisMode']
41334140
/** @description The custom plan description which defines the Subscription. */
41344141
customPlan: components['schemas']['CustomPlanInput']
41354142
}
@@ -4138,6 +4145,11 @@ export interface components {
41384145
* @description Create a custom subscription.
41394146
*/
41404147
CustomSubscriptionCreate: {
4148+
/**
4149+
* @description Controls how custom-currency cost bases are selected for the new subscription.
4150+
* @default dynamic
4151+
*/
4152+
costBasisMode?: components['schemas']['SubscriptionCostBasisMode']
41414153
/** @description The custom plan description which defines the Subscription. */
41424154
customPlan: components['schemas']['CustomPlanInput']
41434155
/**
@@ -9927,6 +9939,11 @@ export interface components {
99279939
billingAnchor?: Date
99289940
/** @description The settlement mode of the subscription. */
99299941
settlementMode?: components['schemas']['BillingSettlementMode']
9942+
/**
9943+
* @description Controls how custom-currency cost bases are selected for the new subscription.
9944+
* @default dynamic
9945+
*/
9946+
costBasisMode?: components['schemas']['SubscriptionCostBasisMode']
99309947
}
99319948
/**
99329949
* Create from plan
@@ -9950,6 +9967,11 @@ export interface components {
99509967
description?: string
99519968
/** @description The settlement mode of the subscription. */
99529969
settlementMode?: components['schemas']['BillingSettlementMode']
9970+
/**
9971+
* @description Controls how custom-currency cost bases are selected for the new subscription.
9972+
* @default dynamic
9973+
*/
9974+
costBasisMode?: components['schemas']['SubscriptionCostBasisMode']
99539975
/**
99549976
* @description Timing configuration for the change, when the change should take effect.
99559977
* The default is immediate.
@@ -11037,11 +11059,22 @@ export interface components {
1103711059
plan?: components['schemas']['PlanReference']
1103811060
/**
1103911061
* Currency
11040-
* @description The currency code of the subscription.
11041-
* Will be revised once we add multi currency support.
11062+
* @description The fiat currency in which the subscription is invoiced.
1104211063
* @default USD
1104311064
*/
1104411065
currency: components['schemas']['CurrencyCode']
11066+
/**
11067+
* Cost basis mode
11068+
* @description Controls whether custom-currency cost bases are resolved dynamically or pinned
11069+
* when their currency pair is introduced to the subscription.
11070+
* @default dynamic
11071+
*/
11072+
readonly costBasisMode: components['schemas']['SubscriptionCostBasisMode']
11073+
/**
11074+
* Pinned cost bases
11075+
* @description Cost bases pinned to custom-currency pairs for this subscription.
11076+
*/
11077+
readonly costBasisPins: components['schemas']['SubscriptionCostBasisPin'][]
1104511078
/**
1104611079
* Billing cadence
1104711080
* Format: duration
@@ -11409,6 +11442,26 @@ export interface components {
1140911442
/** @description Additional properties specific to the problem type may be present. */
1141011443
extensions?: components['schemas']['SubscriptionErrorExtensions']
1141111444
}
11445+
/**
11446+
* @description Controls how custom-currency cost bases are selected for the subscription.
11447+
* @enum {string}
11448+
*/
11449+
SubscriptionCostBasisMode: 'dynamic' | 'pinned'
11450+
/** @description A cost basis pinned to a custom-currency pair for the subscription. */
11451+
SubscriptionCostBasisPin: {
11452+
/**
11453+
* @description The managed custom currency ID.
11454+
* @example 01G65Z755AFWAKHE12NY0CQ9FH
11455+
*/
11456+
readonly customCurrencyId: string
11457+
/** @description The fiat currency in which the subscription is invoiced. */
11458+
readonly invoiceCurrency: components['schemas']['CurrencyCode']
11459+
/**
11460+
* @description The pinned cost basis resource ID.
11461+
* @example 01G65Z755AFWAKHE12NY0CQ9FH
11462+
*/
11463+
readonly costBasisId: string
11464+
}
1141211465
/** @description Create a subscription. */
1141311466
SubscriptionCreate:
1141411467
| components['schemas']['PlanSubscriptionCreate']
@@ -11507,11 +11560,22 @@ export interface components {
1150711560
plan?: components['schemas']['PlanReference']
1150811561
/**
1150911562
* Currency
11510-
* @description The currency code of the subscription.
11511-
* Will be revised once we add multi currency support.
11563+
* @description The fiat currency in which the subscription is invoiced.
1151211564
* @default USD
1151311565
*/
1151411566
currency: components['schemas']['CurrencyCode']
11567+
/**
11568+
* Cost basis mode
11569+
* @description Controls whether custom-currency cost bases are resolved dynamically or pinned
11570+
* when their currency pair is introduced to the subscription.
11571+
* @default dynamic
11572+
*/
11573+
readonly costBasisMode: components['schemas']['SubscriptionCostBasisMode']
11574+
/**
11575+
* Pinned cost bases
11576+
* @description Cost bases pinned to custom-currency pairs for this subscription.
11577+
*/
11578+
readonly costBasisPins: components['schemas']['SubscriptionCostBasisPin'][]
1151511579
/**
1151611580
* Billing cadence
1151711581
* Format: duration
@@ -11620,6 +11684,11 @@ export interface components {
1162011684
* We say "referenced by the Price" regardless of how a price itself is referenced, it colloquially makes sense to say "paying the same price for the same thing". In practice this should be derived from what's printed on the invoice line-item.
1162111685
*/
1162211686
key: string
11687+
/**
11688+
* Currency
11689+
* @description The materialized currency of the item's rate card. Present for priced items.
11690+
*/
11691+
readonly currency?: components['schemas']['CurrencyCodeOrCustom']
1162311692
/** @description The feature's key (if present). */
1162411693
featureKey?: string
1162511694
/**
@@ -12569,6 +12638,7 @@ export type CreditNoteOriginalInvoiceRef =
1256912638
components['schemas']['CreditNoteOriginalInvoiceRef']
1257012639
export type Currency = components['schemas']['Currency']
1257112640
export type CurrencyCode = components['schemas']['CurrencyCode']
12641+
export type CurrencyCodeOrCustom = components['schemas']['CurrencyCodeOrCustom']
1257212642
export type CustomInvoicingApp = components['schemas']['CustomInvoicingApp']
1257312643
export type CustomInvoicingAppReplaceUpdate =
1257412644
components['schemas']['CustomInvoicingAppReplaceUpdate']
@@ -13003,6 +13073,10 @@ export type SubscriptionChangeResponseBody =
1300313073
components['schemas']['SubscriptionChangeResponseBody']
1300413074
export type SubscriptionConflictErrorResponse =
1300513075
components['schemas']['SubscriptionConflictErrorResponse']
13076+
export type SubscriptionCostBasisMode =
13077+
components['schemas']['SubscriptionCostBasisMode']
13078+
export type SubscriptionCostBasisPin =
13079+
components['schemas']['SubscriptionCostBasisPin']
1300613080
export type SubscriptionCreate = components['schemas']['SubscriptionCreate']
1300713081
export type SubscriptionEdit = components['schemas']['SubscriptionEdit']
1300813082
export type SubscriptionEditOperation =

api/client/javascript/src/zod/index.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14323,11 +14323,13 @@ export const createSubscriptionBodyOnePlanOneKeyMax = 64
1432314323
export const createSubscriptionBodyOnePlanOneKeyRegExp =
1432414324
/^[a-z0-9]+(?:_[a-z0-9]+)*$/
1432514325

14326+
export const createSubscriptionBodyOneCostBasisModeDefault = 'dynamic'
1432614327
export const createSubscriptionBodyOneTimingDefault = 'immediate'
1432714328
export const createSubscriptionBodyOneCustomerIdRegExp =
1432814329
/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/
1432914330
export const createSubscriptionBodyOneCustomerKeyMax = 256
1433014331

14332+
export const createSubscriptionBodyTwoCostBasisModeDefault = 'dynamic'
1433114333
export const createSubscriptionBodyTwoCustomPlanOneOneNameMax = 256
1433214334

1433314335
export const createSubscriptionBodyTwoCustomPlanOneOneDescriptionMax = 1024
@@ -14474,6 +14476,15 @@ export const CreateSubscriptionBody = zod
1447414476
.describe(
1447514477
'The billing anchor of the subscription. The provided date will be normalized according to the billing cadence to the nearest recurrence before start time. If not provided, the subscription start time will be used.',
1447614478
),
14479+
costBasisMode: zod
14480+
.enum(['dynamic', 'pinned'])
14481+
.describe(
14482+
'Controls how custom-currency cost bases are selected for the subscription.',
14483+
)
14484+
.default(createSubscriptionBodyOneCostBasisModeDefault)
14485+
.describe(
14486+
'Controls how custom-currency cost bases are selected for the new subscription.',
14487+
),
1447714488
customerId: zod.coerce
1447814489
.string()
1447914490
.regex(createSubscriptionBodyOneCustomerIdRegExp)
@@ -14565,6 +14576,15 @@ export const CreateSubscriptionBody = zod
1456514576
.describe(
1456614577
'The billing anchor of the subscription. The provided date will be normalized according to the billing cadence to the nearest recurrence before start time. If not provided, the subscription start time will be used.',
1456714578
),
14579+
costBasisMode: zod
14580+
.enum(['dynamic', 'pinned'])
14581+
.describe(
14582+
'Controls how custom-currency cost bases are selected for the subscription.',
14583+
)
14584+
.default(createSubscriptionBodyTwoCostBasisModeDefault)
14585+
.describe(
14586+
'Controls how custom-currency cost bases are selected for the new subscription.',
14587+
),
1456814588
customerId: zod.coerce
1456914589
.string()
1457014590
.regex(createSubscriptionBodyTwoCustomerIdRegExp)
@@ -17027,6 +17047,8 @@ export const changeSubscriptionBodyOnePlanOneKeyMax = 64
1702717047
export const changeSubscriptionBodyOnePlanOneKeyRegExp =
1702817048
/^[a-z0-9]+(?:_[a-z0-9]+)*$/
1702917049

17050+
export const changeSubscriptionBodyOneCostBasisModeDefault = 'dynamic'
17051+
export const changeSubscriptionBodyTwoCostBasisModeDefault = 'dynamic'
1703017052
export const changeSubscriptionBodyTwoCustomPlanOneOneNameMax = 256
1703117053

1703217054
export const changeSubscriptionBodyTwoCustomPlanOneOneDescriptionMax = 1024
@@ -17168,6 +17190,15 @@ export const ChangeSubscriptionBody = zod
1716817190
.describe(
1716917191
'The billing anchor of the subscription. The provided date will be normalized according to the billing cadence to the nearest recurrence before start time. If not provided, the previous subscription billing anchor will be used.',
1717017192
),
17193+
costBasisMode: zod
17194+
.enum(['dynamic', 'pinned'])
17195+
.describe(
17196+
'Controls how custom-currency cost bases are selected for the subscription.',
17197+
)
17198+
.default(changeSubscriptionBodyOneCostBasisModeDefault)
17199+
.describe(
17200+
'Controls how custom-currency cost bases are selected for the new subscription.',
17201+
),
1717117202
description: zod.coerce
1717217203
.string()
1717317204
.optional()
@@ -17245,6 +17276,15 @@ export const ChangeSubscriptionBody = zod
1724517276
.describe(
1724617277
'The billing anchor of the subscription. The provided date will be normalized according to the billing cadence to the nearest recurrence before start time. If not provided, the previous subscription billing anchor will be used.',
1724717278
),
17279+
costBasisMode: zod
17280+
.enum(['dynamic', 'pinned'])
17281+
.describe(
17282+
'Controls how custom-currency cost bases are selected for the subscription.',
17283+
)
17284+
.default(changeSubscriptionBodyTwoCostBasisModeDefault)
17285+
.describe(
17286+
'Controls how custom-currency cost bases are selected for the new subscription.',
17287+
),
1724817288
customPlan: zod
1724917289
.object({
1725017290
alignment: zod

api/client/python/openmeter/_generated/models/__init__.py

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/client/python/openmeter/_generated/models/_enums.py

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)