Skip to content

Commit 5dd1a38

Browse files
tothandrasGAlexIHUturip
authored
feat(backend): add billing cadence and pro-rating config to plan and subscription (#2890)
Co-authored-by: Alex Goth <[email protected]> Co-authored-by: Peter Turi <[email protected]> Co-authored-by: Alex Goth <[email protected]>
1 parent fff5f33 commit 5dd1a38

File tree

82 files changed

+8518
-3736
lines changed

Some content is hidden

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

82 files changed

+8518
-3736
lines changed

api/api.gen.go

Lines changed: 1148 additions & 1073 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 & 1036 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.
@@ -7705,6 +7723,24 @@ export interface components {
77057723
* @default USD
77067724
*/
77077725
currency: components['schemas']['CurrencyCode']
7726+
/**
7727+
* Billing cadence
7728+
* Format: duration
7729+
* @description The default billing cadence for subscriptions using this plan.
7730+
* Defines how often customers are billed using ISO8601 duration format.
7731+
* Examples: "P1M" (monthly), "P3M" (quarterly), "P1Y" (annually).
7732+
* @example P1M
7733+
*/
7734+
billingCadence: string
7735+
/**
7736+
* Pro-rating configuration
7737+
* @description Default pro-rating configuration for subscriptions using this plan.
7738+
* @default {
7739+
* "enabled": true,
7740+
* "mode": "prorate_prices"
7741+
* }
7742+
*/
7743+
proRatingConfig?: components['schemas']['ProRatingConfig']
77087744
/**
77097745
* Effective start date
77107746
* Format: date-time
@@ -7899,6 +7935,24 @@ export interface components {
78997935
* @default USD
79007936
*/
79017937
currency: components['schemas']['CurrencyCode']
7938+
/**
7939+
* Billing cadence
7940+
* Format: duration
7941+
* @description The default billing cadence for subscriptions using this plan.
7942+
* Defines how often customers are billed using ISO8601 duration format.
7943+
* Examples: "P1M" (monthly), "P3M" (quarterly), "P1Y" (annually).
7944+
* @example P1M
7945+
*/
7946+
billingCadence: string
7947+
/**
7948+
* Pro-rating configuration
7949+
* @description Default pro-rating configuration for subscriptions using this plan.
7950+
* @default {
7951+
* "enabled": true,
7952+
* "mode": "prorate_prices"
7953+
* }
7954+
*/
7955+
proRatingConfig?: components['schemas']['ProRatingConfig']
79027956
/**
79037957
* Plan phases
79047958
* @description The plan phase or pricing ramp allows changing a plan's rate cards over time as a subscription progresses.
@@ -8004,6 +8058,24 @@ export interface components {
80048058
metadata?: components['schemas']['Metadata'] | null
80058059
/** @description Alignment configuration for the plan. */
80068060
alignment?: components['schemas']['Alignment']
8061+
/**
8062+
* Billing cadence
8063+
* Format: duration
8064+
* @description The default billing cadence for subscriptions using this plan.
8065+
* Defines how often customers are billed using ISO8601 duration format.
8066+
* Examples: "P1M" (monthly), "P3M" (quarterly), "P1Y" (annually).
8067+
* @example P1M
8068+
*/
8069+
billingCadence: string
8070+
/**
8071+
* Pro-rating configuration
8072+
* @description Default pro-rating configuration for subscriptions using this plan.
8073+
* @default {
8074+
* "enabled": true,
8075+
* "mode": "prorate_prices"
8076+
* }
8077+
*/
8078+
proRatingConfig?: components['schemas']['ProRatingConfig']
80078079
/**
80088080
* Plan phases
80098081
* @description The plan phase or pricing ramp allows changing a plan's rate cards over time as a subscription progresses.
@@ -8130,6 +8202,26 @@ export interface components {
81308202
*/
81318203
unitPrice: components['schemas']['UnitPrice'] | null
81328204
}
8205+
/** @description Configuration for pro-rating behavior. */
8206+
ProRatingConfig: {
8207+
/**
8208+
* Enable pro-rating
8209+
* @description Whether pro-rating is enabled for this plan.
8210+
* @default true
8211+
*/
8212+
enabled: boolean
8213+
/**
8214+
* Pro-rating mode
8215+
* @description How to handle pro-rating for billing period changes.
8216+
* @default prorate_prices
8217+
*/
8218+
mode: components['schemas']['ProRatingMode']
8219+
}
8220+
/**
8221+
* @description Pro-rating mode options for handling billing period changes.
8222+
* @enum {string}
8223+
*/
8224+
ProRatingMode: 'prorate_prices'
81338225
/** @description Progress describes a progress of a task. */
81348226
Progress: {
81358227
/**
@@ -8994,6 +9086,24 @@ export interface components {
89949086
* @default USD
89959087
*/
89969088
currency: components['schemas']['CurrencyCode']
9089+
/**
9090+
* Billing cadence
9091+
* Format: duration
9092+
* @description The billing cadence for the subscriptions.
9093+
* Defines how often customers are billed using ISO8601 duration format.
9094+
* Examples: "P1M" (monthly), "P3M" (quarterly), "P1Y" (annually).
9095+
* @example P1M
9096+
*/
9097+
readonly billingCadence: string
9098+
/**
9099+
* Pro-rating configuration
9100+
* @description The pro-rating configuration for the subscriptions.
9101+
* @default {
9102+
* "enabled": true,
9103+
* "mode": "prorate_prices"
9104+
* }
9105+
*/
9106+
readonly proRatingConfig?: components['schemas']['ProRatingConfig']
89979107
}
89989108
/** @description A subscription add-on, represents concrete instances of an add-on for a given subscription. */
89999109
SubscriptionAddon: {
@@ -9345,6 +9455,24 @@ export interface components {
93459455
* @default USD
93469456
*/
93479457
currency: components['schemas']['CurrencyCode']
9458+
/**
9459+
* Billing cadence
9460+
* Format: duration
9461+
* @description The billing cadence for the subscriptions.
9462+
* Defines how often customers are billed using ISO8601 duration format.
9463+
* Examples: "P1M" (monthly), "P3M" (quarterly), "P1Y" (annually).
9464+
* @example P1M
9465+
*/
9466+
readonly billingCadence: string
9467+
/**
9468+
* Pro-rating configuration
9469+
* @description The pro-rating configuration for the subscriptions.
9470+
* @default {
9471+
* "enabled": true,
9472+
* "mode": "prorate_prices"
9473+
* }
9474+
*/
9475+
readonly proRatingConfig?: components['schemas']['ProRatingConfig']
93489476
/** @description Alignment details enriched with the current billing period. */
93499477
alignment?: components['schemas']['SubscriptionAlignment']
93509478
/** @description The phases of the subscription. */
@@ -10562,6 +10690,8 @@ export type PreconditionFailedProblemResponse =
1056210690
components['schemas']['PreconditionFailedProblemResponse']
1056310691
export type PricePaymentTerm = components['schemas']['PricePaymentTerm']
1056410692
export type PriceTier = components['schemas']['PriceTier']
10693+
export type ProRatingConfig = components['schemas']['ProRatingConfig']
10694+
export type ProRatingMode = components['schemas']['ProRatingMode']
1056510695
export type Progress = components['schemas']['Progress']
1056610696
export type RateCard = components['schemas']['RateCard']
1056710697
export type RateCardBooleanEntitlement =

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

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

91669166
export const createPlanBodyCurrencyRegExpOne = new RegExp('^[A-Z]{3}$')
91679167
export const createPlanBodyCurrencyDefault = 'USD'
9168+
export const createPlanBodyProRatingConfigEnabledDefault = true
9169+
export const createPlanBodyProRatingConfigModeDefault = 'prorate_prices'
9170+
export const createPlanBodyProRatingConfigDefault = {
9171+
enabled: true,
9172+
mode: 'prorate_prices',
9173+
}
91689174
export const createPlanBodyPhasesItemKeyMax = 64
91699175

91709176
export const createPlanBodyPhasesItemKeyRegExp = new RegExp(
@@ -9271,6 +9277,11 @@ export const createPlanBody = zod
92719277
.describe('Alignment configuration for a plan or subscription.')
92729278
.optional()
92739279
.describe('Alignment configuration for the plan.'),
9280+
billingCadence: zod
9281+
.string()
9282+
.describe(
9283+
'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).'
9284+
),
92749285
currency: zod
92759286
.string()
92769287
.min(createPlanBodyCurrencyMinOne)
@@ -10142,6 +10153,23 @@ export const createPlanBody = zod
1014210153
.describe(
1014310154
"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."
1014410155
),
10156+
proRatingConfig: zod
10157+
.object({
10158+
enabled: zod
10159+
.boolean()
10160+
.describe('Whether pro-rating is enabled for this plan.'),
10161+
mode: zod
10162+
.enum(['prorate_prices'])
10163+
.describe(
10164+
'Pro-rating mode options for handling billing period changes.'
10165+
)
10166+
.describe('How to handle pro-rating for billing period changes.'),
10167+
})
10168+
.describe('Configuration for pro-rating behavior.')
10169+
.default(createPlanBodyProRatingConfigDefault)
10170+
.describe(
10171+
'Default pro-rating configuration for subscriptions using this plan.'
10172+
),
1014510173
})
1014610174
.describe('Resource create operation model.')
1014710175

@@ -10179,6 +10207,12 @@ export const updatePlanParams = zod.object({
1017910207

1018010208
export const updatePlanBodyNameMax = 256
1018110209
export const updatePlanBodyDescriptionMax = 1024
10210+
export const updatePlanBodyProRatingConfigEnabledDefault = true
10211+
export const updatePlanBodyProRatingConfigModeDefault = 'prorate_prices'
10212+
export const updatePlanBodyProRatingConfigDefault = {
10213+
enabled: true,
10214+
mode: 'prorate_prices',
10215+
}
1018210216
export const updatePlanBodyPhasesItemKeyMax = 64
1018310217

1018410218
export const updatePlanBodyPhasesItemKeyRegExp = new RegExp(
@@ -10285,6 +10319,11 @@ export const updatePlanBody = zod
1028510319
.describe('Alignment configuration for a plan or subscription.')
1028610320
.optional()
1028710321
.describe('Alignment configuration for the plan.'),
10322+
billingCadence: zod
10323+
.string()
10324+
.describe(
10325+
'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).'
10326+
),
1028810327
description: zod
1028910328
.string()
1029010329
.max(updatePlanBodyDescriptionMax)
@@ -11141,6 +11180,23 @@ export const updatePlanBody = zod
1114111180
.describe(
1114211181
"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."
1114311182
),
11183+
proRatingConfig: zod
11184+
.object({
11185+
enabled: zod
11186+
.boolean()
11187+
.describe('Whether pro-rating is enabled for this plan.'),
11188+
mode: zod
11189+
.enum(['prorate_prices'])
11190+
.describe(
11191+
'Pro-rating mode options for handling billing period changes.'
11192+
)
11193+
.describe('How to handle pro-rating for billing period changes.'),
11194+
})
11195+
.describe('Configuration for pro-rating behavior.')
11196+
.default(updatePlanBodyProRatingConfigDefault)
11197+
.describe(
11198+
'Default pro-rating configuration for subscriptions using this plan.'
11199+
),
1114411200
})
1114511201
.describe('Resource update operation model.')
1114611202

@@ -12755,6 +12811,14 @@ export const createSubscriptionBodyCustomPlanCurrencyRegExpOne = new RegExp(
1275512811
'^[A-Z]{3}$'
1275612812
)
1275712813
export const createSubscriptionBodyCustomPlanCurrencyDefault = 'USD'
12814+
export const createSubscriptionBodyCustomPlanProRatingConfigEnabledDefault =
12815+
true
12816+
export const createSubscriptionBodyCustomPlanProRatingConfigModeDefault =
12817+
'prorate_prices'
12818+
export const createSubscriptionBodyCustomPlanProRatingConfigDefault = {
12819+
enabled: true,
12820+
mode: 'prorate_prices',
12821+
}
1275812822
export const createSubscriptionBodyCustomPlanPhasesItemKeyMax = 64
1275912823

1276012824
export const createSubscriptionBodyCustomPlanPhasesItemKeyRegExp = new RegExp(
@@ -12966,6 +13030,11 @@ export const createSubscriptionBody = zod
1296613030
.describe('Alignment configuration for a plan or subscription.')
1296713031
.optional()
1296813032
.describe('Alignment configuration for the plan.'),
13033+
billingCadence: zod
13034+
.string()
13035+
.describe(
13036+
'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).'
13037+
),
1296913038
currency: zod
1297013039
.string()
1297113040
.min(createSubscriptionBodyCustomPlanCurrencyMinOne)
@@ -13879,6 +13948,25 @@ export const createSubscriptionBody = zod
1387913948
.describe(
1388013949
"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."
1388113950
),
13951+
proRatingConfig: zod
13952+
.object({
13953+
enabled: zod
13954+
.boolean()
13955+
.describe('Whether pro-rating is enabled for this plan.'),
13956+
mode: zod
13957+
.enum(['prorate_prices'])
13958+
.describe(
13959+
'Pro-rating mode options for handling billing period changes.'
13960+
)
13961+
.describe(
13962+
'How to handle pro-rating for billing period changes.'
13963+
),
13964+
})
13965+
.describe('Configuration for pro-rating behavior.')
13966+
.default(createSubscriptionBodyCustomPlanProRatingConfigDefault)
13967+
.describe(
13968+
'Default pro-rating configuration for subscriptions using this plan.'
13969+
),
1388213970
})
1388313971
.describe('The template for omitting properties.')
1388413972
.describe(
@@ -15242,6 +15330,14 @@ export const changeSubscriptionBodyCustomPlanCurrencyRegExpOne = new RegExp(
1524215330
'^[A-Z]{3}$'
1524315331
)
1524415332
export const changeSubscriptionBodyCustomPlanCurrencyDefault = 'USD'
15333+
export const changeSubscriptionBodyCustomPlanProRatingConfigEnabledDefault =
15334+
true
15335+
export const changeSubscriptionBodyCustomPlanProRatingConfigModeDefault =
15336+
'prorate_prices'
15337+
export const changeSubscriptionBodyCustomPlanProRatingConfigDefault = {
15338+
enabled: true,
15339+
mode: 'prorate_prices',
15340+
}
1524515341
export const changeSubscriptionBodyCustomPlanPhasesItemKeyMax = 64
1524615342

1524715343
export const changeSubscriptionBodyCustomPlanPhasesItemKeyRegExp = new RegExp(
@@ -15421,6 +15517,11 @@ export const changeSubscriptionBody = zod
1542115517
.describe('Alignment configuration for a plan or subscription.')
1542215518
.optional()
1542315519
.describe('Alignment configuration for the plan.'),
15520+
billingCadence: zod
15521+
.string()
15522+
.describe(
15523+
'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).'
15524+
),
1542415525
currency: zod
1542515526
.string()
1542615527
.min(changeSubscriptionBodyCustomPlanCurrencyMinOne)
@@ -16334,6 +16435,25 @@ export const changeSubscriptionBody = zod
1633416435
.describe(
1633516436
"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."
1633616437
),
16438+
proRatingConfig: zod
16439+
.object({
16440+
enabled: zod
16441+
.boolean()
16442+
.describe('Whether pro-rating is enabled for this plan.'),
16443+
mode: zod
16444+
.enum(['prorate_prices'])
16445+
.describe(
16446+
'Pro-rating mode options for handling billing period changes.'
16447+
)
16448+
.describe(
16449+
'How to handle pro-rating for billing period changes.'
16450+
),
16451+
})
16452+
.describe('Configuration for pro-rating behavior.')
16453+
.default(changeSubscriptionBodyCustomPlanProRatingConfigDefault)
16454+
.describe(
16455+
'Default pro-rating configuration for subscriptions using this plan.'
16456+
),
1633716457
})
1633816458
.describe('The template for omitting properties.')
1633916459
.describe(

0 commit comments

Comments
 (0)