Skip to content

Commit c394e83

Browse files
rolosptothandrasborosr
authored
Fix/settlement mode api (#4470)
Co-authored-by: Andras Toth <4157749+tothandras@users.noreply.github.com> Co-authored-by: Robert Boros <robert.boros@konghq.com>
1 parent bfda176 commit c394e83

63 files changed

Lines changed: 3183 additions & 1878 deletions

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: 589 additions & 586 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: 585 additions & 582 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: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9891,6 +9891,8 @@ export interface components {
98919891
* @example 2023-01-01T01:01:01.001Z
98929892
*/
98939893
billingAnchor?: Date
9894+
/** @description The settlement mode of the subscription. */
9895+
settlementMode?: components['schemas']['BillingSettlementMode']
98949896
}
98959897
/**
98969898
* Create from plan
@@ -9912,6 +9914,8 @@ export interface components {
99129914
name?: string
99139915
/** @description Description for the Subscription. */
99149916
description?: string
9917+
/** @description The settlement mode of the subscription. */
9918+
settlementMode?: components['schemas']['BillingSettlementMode']
99159919
/**
99169920
* @description Timing configuration for the change, when the change should take effect.
99179921
* The default is immediate.
@@ -9931,8 +9935,6 @@ export interface components {
99319935
* @example 2023-01-01T01:01:01.001Z
99329936
*/
99339937
billingAnchor?: Date
9934-
/** @description The settlement mode of the subscription. */
9935-
settlementMode?: components['schemas']['BillingSettlementMode']
99369938
}
99379939
/**
99389940
* @description A consumer portal token.

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17228,6 +17228,13 @@ export const ChangeSubscriptionBody = zod
1722817228
'References an exact plan defaulting to the current active version.',
1722917229
)
1723017230
.describe('The plan reference to change to.'),
17231+
settlementMode: zod
17232+
.enum(['credit_then_invoice', 'credit_only'])
17233+
.describe(
17234+
'The settlement mode of a plan.\nIt determines how the billing system generates invoices and credits for the subscriptions using this plan.\n- credit_then_invoice: credits from the previous billing period are applied first, then the remaining balance is invoiced. This is the default and most common settlement mode.\n- credit_only: only credits from the previous billing period are generated and applied. No invoices are generated for the subscription.',
17235+
)
17236+
.optional()
17237+
.describe('The settlement mode of the subscription.'),
1723117238
startingPhase: zod.coerce
1723217239
.string()
1723317240
.min(1)

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

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

api/openapi.cloud.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22589,6 +22589,10 @@ components:
2258922589
format: date-time
2259022590
description: 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.
2259122591
example: '2023-01-01T01:01:01.001Z'
22592+
settlementMode:
22593+
allOf:
22594+
- $ref: '#/components/schemas/BillingSettlementMode'
22595+
description: The settlement mode of the subscription.
2259222596
description: Change subscription based on plan.
2259322597
PlanSubscriptionCreate:
2259422598
type: object
@@ -22619,6 +22623,10 @@ components:
2261922623
description:
2262022624
type: string
2262122625
description: Description for the Subscription.
22626+
settlementMode:
22627+
allOf:
22628+
- $ref: '#/components/schemas/BillingSettlementMode'
22629+
description: The settlement mode of the subscription.
2262222630
timing:
2262322631
allOf:
2262422632
- $ref: '#/components/schemas/SubscriptionTiming'
@@ -22641,10 +22649,6 @@ components:
2264122649
format: date-time
2264222650
description: 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.
2264322651
example: '2023-01-01T01:01:01.001Z'
22644-
settlementMode:
22645-
allOf:
22646-
- $ref: '#/components/schemas/BillingSettlementMode'
22647-
description: The settlement mode of the subscription.
2264822652
description: Create subscription based on plan.
2264922653
title: Create from plan
2265022654
PortalToken:

api/openapi.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23372,6 +23372,10 @@ components:
2337223372
format: date-time
2337323373
description: 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.
2337423374
example: '2023-01-01T01:01:01.001Z'
23375+
settlementMode:
23376+
allOf:
23377+
- $ref: '#/components/schemas/BillingSettlementMode'
23378+
description: The settlement mode of the subscription.
2337523379
description: Change subscription based on plan.
2337623380
PlanSubscriptionCreate:
2337723381
type: object
@@ -23402,6 +23406,10 @@ components:
2340223406
description:
2340323407
type: string
2340423408
description: Description for the Subscription.
23409+
settlementMode:
23410+
allOf:
23411+
- $ref: '#/components/schemas/BillingSettlementMode'
23412+
description: The settlement mode of the subscription.
2340523413
timing:
2340623414
allOf:
2340723415
- $ref: '#/components/schemas/SubscriptionTiming'
@@ -23424,10 +23432,6 @@ components:
2342423432
format: date-time
2342523433
description: 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.
2342623434
example: '2023-01-01T01:01:01.001Z'
23427-
settlementMode:
23428-
allOf:
23429-
- $ref: '#/components/schemas/BillingSettlementMode'
23430-
description: The settlement mode of the subscription.
2343123435
description: Create subscription based on plan.
2343223436
title: Create from plan
2343323437
PortalToken:

api/spec/packages/aip/src/productcatalog/plan.tsp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,19 @@ model Plan {
106106
@minItems(1)
107107
phases: PlanPhase[];
108108

109+
/**
110+
* Settlement mode for plan.
111+
*
112+
* Values:
113+
*
114+
* - `credit_then_invoice`: Credits are applied first, then any remainder is
115+
* invoiced.
116+
* - `credit_only`: Usage is settled exclusively against credits.
117+
*/
118+
@visibility(Lifecycle.Read)
119+
@summary("Settlement Mode")
120+
settlement_mode?: ProductCatalog.SettlementMode = ProductCatalog.SettlementMode.CreditThenInvoice;
121+
109122
/**
110123
* List of validation errors in `draft` state that prevent the plan from being
111124
* published.

api/spec/packages/aip/src/subscriptions/subscription.tsp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import "@typespec/openapi";
22
import "../shared/index.tsp";
3+
import "../productcatalog/ratecard.tsp";
34

45
using TypeSpec.OpenAPI;
56

@@ -166,4 +167,17 @@ model Subscription {
166167
@visibility(Lifecycle.Read)
167168
@summary("Status")
168169
status: SubscriptionStatus;
170+
171+
/**
172+
* Settlement mode for billing.
173+
*
174+
* Values:
175+
*
176+
* - `credit_then_invoice`: Credits are applied first, then any remainder is
177+
* invoiced.
178+
* - `credit_only`: Usage is settled exclusively against credits.
179+
*/
180+
@visibility(Lifecycle.Create, Lifecycle.Read)
181+
@summary("Settlement Mode")
182+
settlement_mode?: ProductCatalog.SettlementMode = ProductCatalog.SettlementMode.CreditThenInvoice;
169183
}

api/spec/packages/legacy/src/productcatalog/subscription.tsp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -459,11 +459,6 @@ model PlanSubscriptionCreate {
459459
* 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.
460460
*/
461461
billingAnchor?: DateTime;
462-
463-
/**
464-
* The settlement mode of the subscription.
465-
*/
466-
settlementMode?: SettlementMode;
467462
}
468463

469464
/**
@@ -513,6 +508,11 @@ model PlanSubscriptionChange {
513508
* 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.
514509
*/
515510
billingAnchor?: DateTime;
511+
512+
/**
513+
* The settlement mode of the subscription.
514+
*/
515+
settlementMode?: SettlementMode;
516516
}
517517

518518
/**

0 commit comments

Comments
 (0)