Skip to content

Commit ad30221

Browse files
committed
feat(backend): add billing cadence and pro-rating config to plan & subscription
1 parent 5859aa8 commit ad30221

Some content is hidden

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

69 files changed

+6809
-3147
lines changed

api/api.gen.go

Lines changed: 1145 additions & 1070 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: 1119 additions & 1043 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: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3504,6 +3504,24 @@ export interface components {
35043504
* @default USD
35053505
*/
35063506
currency: components['schemas']['CurrencyCode']
3507+
/**
3508+
* Billing cadence
3509+
* Format: duration
3510+
* @description The default billing cadence for subscriptions using this plan.
3511+
* Defines how often customers are billed using ISO8601 duration format.
3512+
* Examples: "P1M" (monthly), "P3M" (quarterly), "P1Y" (annually).
3513+
* @example P1M
3514+
*/
3515+
billingCadence: string
3516+
/**
3517+
* Pro-rating configuration
3518+
* @description Default pro-rating configuration for subscriptions using this plan.
3519+
* @default {
3520+
* "enabled": true,
3521+
* "mode": "prorate_prices"
3522+
* }
3523+
*/
3524+
proRatingConfig?: components['schemas']['ProRatingConfig']
35073525
/**
35083526
* Plan phases
35093527
* @description The plan phase or pricing ramp allows changing a plan's rate cards over time as a subscription progresses.
@@ -7933,6 +7951,24 @@ export interface components {
79337951
* @default USD
79347952
*/
79357953
currency: components['schemas']['CurrencyCode']
7954+
/**
7955+
* Billing cadence
7956+
* Format: duration
7957+
* @description The default billing cadence for subscriptions using this plan.
7958+
* Defines how often customers are billed using ISO8601 duration format.
7959+
* Examples: "P1M" (monthly), "P3M" (quarterly), "P1Y" (annually).
7960+
* @example P1M
7961+
*/
7962+
billingCadence: string
7963+
/**
7964+
* Pro-rating configuration
7965+
* @description Default pro-rating configuration for subscriptions using this plan.
7966+
* @default {
7967+
* "enabled": true,
7968+
* "mode": "prorate_prices"
7969+
* }
7970+
*/
7971+
proRatingConfig?: components['schemas']['ProRatingConfig']
79367972
/**
79377973
* Effective start date
79387974
* Format: date-time
@@ -8127,6 +8163,24 @@ export interface components {
81278163
* @default USD
81288164
*/
81298165
currency: components['schemas']['CurrencyCode']
8166+
/**
8167+
* Billing cadence
8168+
* Format: duration
8169+
* @description The default billing cadence for subscriptions using this plan.
8170+
* Defines how often customers are billed using ISO8601 duration format.
8171+
* Examples: "P1M" (monthly), "P3M" (quarterly), "P1Y" (annually).
8172+
* @example P1M
8173+
*/
8174+
billingCadence: string
8175+
/**
8176+
* Pro-rating configuration
8177+
* @description Default pro-rating configuration for subscriptions using this plan.
8178+
* @default {
8179+
* "enabled": true,
8180+
* "mode": "prorate_prices"
8181+
* }
8182+
*/
8183+
proRatingConfig?: components['schemas']['ProRatingConfig']
81308184
/**
81318185
* Plan phases
81328186
* @description The plan phase or pricing ramp allows changing a plan's rate cards over time as a subscription progresses.
@@ -8232,6 +8286,24 @@ export interface components {
82328286
metadata?: components['schemas']['Metadata'] | null
82338287
/** @description Alignment configuration for the plan. */
82348288
alignment?: components['schemas']['Alignment']
8289+
/**
8290+
* Billing cadence
8291+
* Format: duration
8292+
* @description The default billing cadence for subscriptions using this plan.
8293+
* Defines how often customers are billed using ISO8601 duration format.
8294+
* Examples: "P1M" (monthly), "P3M" (quarterly), "P1Y" (annually).
8295+
* @example P1M
8296+
*/
8297+
billingCadence: string
8298+
/**
8299+
* Pro-rating configuration
8300+
* @description Default pro-rating configuration for subscriptions using this plan.
8301+
* @default {
8302+
* "enabled": true,
8303+
* "mode": "prorate_prices"
8304+
* }
8305+
*/
8306+
proRatingConfig?: components['schemas']['ProRatingConfig']
82358307
/**
82368308
* Plan phases
82378309
* @description The plan phase or pricing ramp allows changing a plan's rate cards over time as a subscription progresses.
@@ -8358,6 +8430,26 @@ export interface components {
83588430
*/
83598431
unitPrice: components['schemas']['UnitPrice'] | null
83608432
}
8433+
/** @description Configuration for pro-rating behavior. */
8434+
ProRatingConfig: {
8435+
/**
8436+
* Enable pro-rating
8437+
* @description Whether pro-rating is enabled for this plan.
8438+
* @default true
8439+
*/
8440+
enabled: boolean
8441+
/**
8442+
* Pro-rating mode
8443+
* @description How to handle pro-rating for billing period changes.
8444+
* @default prorate_prices
8445+
*/
8446+
mode: components['schemas']['ProRatingMode']
8447+
}
8448+
/**
8449+
* @description Pro-rating mode options for handling billing period changes.
8450+
* @enum {string}
8451+
*/
8452+
ProRatingMode: 'prorate_prices'
83618453
/** @description Progress describes a progress of a task. */
83628454
Progress: {
83638455
/**
@@ -9202,6 +9294,24 @@ export interface components {
92029294
* @default USD
92039295
*/
92049296
currency: components['schemas']['CurrencyCode']
9297+
/**
9298+
* Billing cadence
9299+
* Format: duration
9300+
* @description The billing cadence for the subscriptions.
9301+
* Defines how often customers are billed using ISO8601 duration format.
9302+
* Examples: "P1M" (monthly), "P3M" (quarterly), "P1Y" (annually).
9303+
* @example P1M
9304+
*/
9305+
readonly billingCadence: string
9306+
/**
9307+
* Pro-rating configuration
9308+
* @description The pro-rating configuration for the subscriptions.
9309+
* @default {
9310+
* "enabled": true,
9311+
* "mode": "prorate_prices"
9312+
* }
9313+
*/
9314+
readonly proRatingConfig?: components['schemas']['ProRatingConfig']
92059315
}
92069316
/** @description A subscription add-on, represents concrete instances of an add-on for a given subscription. */
92079317
SubscriptionAddon: {
@@ -9553,6 +9663,24 @@ export interface components {
95539663
* @default USD
95549664
*/
95559665
currency: components['schemas']['CurrencyCode']
9666+
/**
9667+
* Billing cadence
9668+
* Format: duration
9669+
* @description The billing cadence for the subscriptions.
9670+
* Defines how often customers are billed using ISO8601 duration format.
9671+
* Examples: "P1M" (monthly), "P3M" (quarterly), "P1Y" (annually).
9672+
* @example P1M
9673+
*/
9674+
readonly billingCadence: string
9675+
/**
9676+
* Pro-rating configuration
9677+
* @description The pro-rating configuration for the subscriptions.
9678+
* @default {
9679+
* "enabled": true,
9680+
* "mode": "prorate_prices"
9681+
* }
9682+
*/
9683+
readonly proRatingConfig?: components['schemas']['ProRatingConfig']
95569684
/** @description Alignment details enriched with the current billing period. */
95579685
alignment?: components['schemas']['SubscriptionAlignment']
95589686
/** @description The phases of the subscription. */
@@ -10784,6 +10912,8 @@ export type PreconditionFailedProblemResponse =
1078410912
components['schemas']['PreconditionFailedProblemResponse']
1078510913
export type PricePaymentTerm = components['schemas']['PricePaymentTerm']
1078610914
export type PriceTier = components['schemas']['PriceTier']
10915+
export type ProRatingConfig = components['schemas']['ProRatingConfig']
10916+
export type ProRatingMode = components['schemas']['ProRatingMode']
1078710917
export type Progress = components['schemas']['Progress']
1078810918
export type RateCard = components['schemas']['RateCard']
1078910919
export type RateCardBooleanEntitlement =

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

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10073,6 +10073,12 @@ export const createPlanBodyCurrencyMaxOne = 3
1007310073

1007410074
export const createPlanBodyCurrencyRegExpOne = new RegExp('^[A-Z]{3}$')
1007510075
export const createPlanBodyCurrencyDefault = 'USD'
10076+
export const createPlanBodyProRatingConfigEnabledDefault = true
10077+
export const createPlanBodyProRatingConfigModeDefault = 'prorate_prices'
10078+
export const createPlanBodyProRatingConfigDefault = {
10079+
enabled: true,
10080+
mode: 'prorate_prices',
10081+
}
1007610082
export const createPlanBodyPhasesItemKeyMax = 64
1007710083

1007810084
export const createPlanBodyPhasesItemKeyRegExp = new RegExp(
@@ -10179,6 +10185,11 @@ export const createPlanBody = zod
1017910185
.describe('Alignment configuration for a plan or subscription.')
1018010186
.optional()
1018110187
.describe('Alignment configuration for the plan.'),
10188+
billingCadence: zod
10189+
.string()
10190+
.describe(
10191+
'The default billing cadence for subscriptions using this plan.\nDefines how often customers are billed using ISO8601 duration format.\nExamples: \"P1M\" (monthly), \"P3M\" (quarterly), \"P1Y\" (annually).'
10192+
),
1018210193
currency: zod
1018310194
.string()
1018410195
.min(createPlanBodyCurrencyMinOne)
@@ -11050,6 +11061,23 @@ export const createPlanBody = zod
1105011061
.describe(
1105111062
"The plan phase or pricing ramp allows changing a plan's rate cards over time as a subscription progresses.\nA phase switch occurs only at the end of a billing period, ensuring that a single subscription invoice will not include charges from different phase prices."
1105211063
),
11064+
proRatingConfig: zod
11065+
.object({
11066+
enabled: zod
11067+
.boolean()
11068+
.describe('Whether pro-rating is enabled for this plan.'),
11069+
mode: zod
11070+
.enum(['prorate_prices'])
11071+
.describe(
11072+
'Pro-rating mode options for handling billing period changes.'
11073+
)
11074+
.describe('How to handle pro-rating for billing period changes.'),
11075+
})
11076+
.describe('Configuration for pro-rating behavior.')
11077+
.default(createPlanBodyProRatingConfigDefault)
11078+
.describe(
11079+
'Default pro-rating configuration for subscriptions using this plan.'
11080+
),
1105311081
})
1105411082
.describe('Resource create operation model.')
1105511083

@@ -11087,6 +11115,12 @@ export const updatePlanParams = zod.object({
1108711115

1108811116
export const updatePlanBodyNameMax = 256
1108911117
export const updatePlanBodyDescriptionMax = 1024
11118+
export const updatePlanBodyProRatingConfigEnabledDefault = true
11119+
export const updatePlanBodyProRatingConfigModeDefault = 'prorate_prices'
11120+
export const updatePlanBodyProRatingConfigDefault = {
11121+
enabled: true,
11122+
mode: 'prorate_prices',
11123+
}
1109011124
export const updatePlanBodyPhasesItemKeyMax = 64
1109111125

1109211126
export const updatePlanBodyPhasesItemKeyRegExp = new RegExp(
@@ -11193,6 +11227,11 @@ export const updatePlanBody = zod
1119311227
.describe('Alignment configuration for a plan or subscription.')
1119411228
.optional()
1119511229
.describe('Alignment configuration for the plan.'),
11230+
billingCadence: zod
11231+
.string()
11232+
.describe(
11233+
'The default billing cadence for subscriptions using this plan.\nDefines how often customers are billed using ISO8601 duration format.\nExamples: \"P1M\" (monthly), \"P3M\" (quarterly), \"P1Y\" (annually).'
11234+
),
1119611235
description: zod
1119711236
.string()
1119811237
.max(updatePlanBodyDescriptionMax)
@@ -12049,6 +12088,23 @@ export const updatePlanBody = zod
1204912088
.describe(
1205012089
"The plan phase or pricing ramp allows changing a plan's rate cards over time as a subscription progresses.\nA phase switch occurs only at the end of a billing period, ensuring that a single subscription invoice will not include charges from different phase prices."
1205112090
),
12091+
proRatingConfig: zod
12092+
.object({
12093+
enabled: zod
12094+
.boolean()
12095+
.describe('Whether pro-rating is enabled for this plan.'),
12096+
mode: zod
12097+
.enum(['prorate_prices'])
12098+
.describe(
12099+
'Pro-rating mode options for handling billing period changes.'
12100+
)
12101+
.describe('How to handle pro-rating for billing period changes.'),
12102+
})
12103+
.describe('Configuration for pro-rating behavior.')
12104+
.default(updatePlanBodyProRatingConfigDefault)
12105+
.describe(
12106+
'Default pro-rating configuration for subscriptions using this plan.'
12107+
),
1205212108
})
1205312109
.describe('Resource update operation model.')
1205412110

@@ -13659,6 +13715,14 @@ export const createSubscriptionBodyCustomPlanCurrencyRegExpOne = new RegExp(
1365913715
'^[A-Z]{3}$'
1366013716
)
1366113717
export const createSubscriptionBodyCustomPlanCurrencyDefault = 'USD'
13718+
export const createSubscriptionBodyCustomPlanProRatingConfigEnabledDefault =
13719+
true
13720+
export const createSubscriptionBodyCustomPlanProRatingConfigModeDefault =
13721+
'prorate_prices'
13722+
export const createSubscriptionBodyCustomPlanProRatingConfigDefault = {
13723+
enabled: true,
13724+
mode: 'prorate_prices',
13725+
}
1366213726
export const createSubscriptionBodyCustomPlanPhasesItemKeyMax = 64
1366313727

1366413728
export const createSubscriptionBodyCustomPlanPhasesItemKeyRegExp = new RegExp(
@@ -13870,6 +13934,11 @@ export const createSubscriptionBody = zod
1387013934
.describe('Alignment configuration for a plan or subscription.')
1387113935
.optional()
1387213936
.describe('Alignment configuration for the plan.'),
13937+
billingCadence: zod
13938+
.string()
13939+
.describe(
13940+
'The default billing cadence for subscriptions using this plan.\nDefines how often customers are billed using ISO8601 duration format.\nExamples: \"P1M\" (monthly), \"P3M\" (quarterly), \"P1Y\" (annually).'
13941+
),
1387313942
currency: zod
1387413943
.string()
1387513944
.min(createSubscriptionBodyCustomPlanCurrencyMinOne)
@@ -14783,6 +14852,25 @@ export const createSubscriptionBody = zod
1478314852
.describe(
1478414853
"The plan phase or pricing ramp allows changing a plan's rate cards over time as a subscription progresses.\nA phase switch occurs only at the end of a billing period, ensuring that a single subscription invoice will not include charges from different phase prices."
1478514854
),
14855+
proRatingConfig: zod
14856+
.object({
14857+
enabled: zod
14858+
.boolean()
14859+
.describe('Whether pro-rating is enabled for this plan.'),
14860+
mode: zod
14861+
.enum(['prorate_prices'])
14862+
.describe(
14863+
'Pro-rating mode options for handling billing period changes.'
14864+
)
14865+
.describe(
14866+
'How to handle pro-rating for billing period changes.'
14867+
),
14868+
})
14869+
.describe('Configuration for pro-rating behavior.')
14870+
.default(createSubscriptionBodyCustomPlanProRatingConfigDefault)
14871+
.describe(
14872+
'Default pro-rating configuration for subscriptions using this plan.'
14873+
),
1478614874
})
1478714875
.describe('The template for omitting properties.')
1478814876
.describe(
@@ -16146,6 +16234,14 @@ export const changeSubscriptionBodyCustomPlanCurrencyRegExpOne = new RegExp(
1614616234
'^[A-Z]{3}$'
1614716235
)
1614816236
export const changeSubscriptionBodyCustomPlanCurrencyDefault = 'USD'
16237+
export const changeSubscriptionBodyCustomPlanProRatingConfigEnabledDefault =
16238+
true
16239+
export const changeSubscriptionBodyCustomPlanProRatingConfigModeDefault =
16240+
'prorate_prices'
16241+
export const changeSubscriptionBodyCustomPlanProRatingConfigDefault = {
16242+
enabled: true,
16243+
mode: 'prorate_prices',
16244+
}
1614916245
export const changeSubscriptionBodyCustomPlanPhasesItemKeyMax = 64
1615016246

1615116247
export const changeSubscriptionBodyCustomPlanPhasesItemKeyRegExp = new RegExp(
@@ -16325,6 +16421,11 @@ export const changeSubscriptionBody = zod
1632516421
.describe('Alignment configuration for a plan or subscription.')
1632616422
.optional()
1632716423
.describe('Alignment configuration for the plan.'),
16424+
billingCadence: zod
16425+
.string()
16426+
.describe(
16427+
'The default billing cadence for subscriptions using this plan.\nDefines how often customers are billed using ISO8601 duration format.\nExamples: \"P1M\" (monthly), \"P3M\" (quarterly), \"P1Y\" (annually).'
16428+
),
1632816429
currency: zod
1632916430
.string()
1633016431
.min(changeSubscriptionBodyCustomPlanCurrencyMinOne)
@@ -17238,6 +17339,25 @@ export const changeSubscriptionBody = zod
1723817339
.describe(
1723917340
"The plan phase or pricing ramp allows changing a plan's rate cards over time as a subscription progresses.\nA phase switch occurs only at the end of a billing period, ensuring that a single subscription invoice will not include charges from different phase prices."
1724017341
),
17342+
proRatingConfig: zod
17343+
.object({
17344+
enabled: zod
17345+
.boolean()
17346+
.describe('Whether pro-rating is enabled for this plan.'),
17347+
mode: zod
17348+
.enum(['prorate_prices'])
17349+
.describe(
17350+
'Pro-rating mode options for handling billing period changes.'
17351+
)
17352+
.describe(
17353+
'How to handle pro-rating for billing period changes.'
17354+
),
17355+
})
17356+
.describe('Configuration for pro-rating behavior.')
17357+
.default(changeSubscriptionBodyCustomPlanProRatingConfigDefault)
17358+
.describe(
17359+
'Default pro-rating configuration for subscriptions using this plan.'
17360+
),
1724117361
})
1724217362
.describe('The template for omitting properties.')
1724317363
.describe(

0 commit comments

Comments
 (0)