Skip to content

Commit eaeb4d5

Browse files
authored
feat: credit balances final (#4559)
1 parent fcd2968 commit eaeb4d5

37 files changed

Lines changed: 1720 additions & 845 deletions

File tree

api/spec/packages/aip-client-javascript/src/models/schemas.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2910,8 +2910,9 @@ export const creditAdjustment = z
29102910
export const creditBalance = z
29112911
.object({
29122912
currency: billingCurrencyCode,
2913+
live: numeric,
2914+
settled: numeric,
29132915
pending: numeric,
2914-
available: numeric,
29152916
})
29162917
.describe('The credit balance by currency.')
29172918

@@ -3968,6 +3969,7 @@ export const createCreditGrantRequest = z
39683969
.describe(
39693970
'Draw-down priority of the grant. Lower values have higher priority.',
39703971
),
3972+
effective_at: dateTime.optional(),
39713973
expires_after: iso8601Duration.optional(),
39723974
key: externalResourceKey.optional(),
39733975
})
@@ -4011,6 +4013,7 @@ export const creditGrant = z
40114013
.describe(
40124014
'Draw-down priority of the grant. Lower values have higher priority.',
40134015
),
4016+
effective_at: dateTime.optional(),
40144017
expires_after: iso8601Duration.optional(),
40154018
key: externalResourceKey.optional(),
40164019
expires_at: dateTime.optional(),

api/spec/packages/aip-client-javascript/src/models/types.ts

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2176,16 +2176,15 @@ export interface CreditAdjustment {
21762176
/** The credit balance by currency. */
21772177
export interface CreditBalance {
21782178
currency: string
2179+
/** Credits available after applying currently live charge impacts. */
2180+
live: string
2181+
/** Credits that have been booked on the ledger as of the balance timestamp. */
2182+
settled: string
21792183
/**
2180-
* Credits that have been granted but cannot yet be consumed. Includes grants
2181-
* awaiting payment clearance or with a future effective date.
2184+
* Credits that have been granted but are not yet written to the ledger, or are
2185+
* written to the ledger with a future booked time.
21822186
*/
21832187
pending: string
2184-
/**
2185-
* Credits that can be consumed right now. Derived from cleared grants after
2186-
* applying eligibility and restriction rules.
2187-
*/
2188-
available: string
21892188
}
21902189

21912190
/** CreditAdjustment create request. */
@@ -3563,6 +3562,12 @@ export interface CreateCreditGrantRequest {
35633562
filters?: CreateCreditGrantFilters
35643563
/** Draw-down priority of the grant. Lower values have higher priority. */
35653564
priority: number
3565+
/**
3566+
* The timestamp when the credit grant becomes effective.
3567+
*
3568+
* Defaults to the current date and time.
3569+
*/
3570+
effective_at?: string
35663571
/**
35673572
* The duration after which the credit grant expires.
35683573
*
@@ -3627,6 +3632,12 @@ export interface CreditGrant {
36273632
filters?: CreditGrantFilters
36283633
/** Draw-down priority of the grant. Lower values have higher priority. */
36293634
priority: number
3635+
/**
3636+
* The timestamp when the credit grant becomes effective.
3637+
*
3638+
* Defaults to the current date and time.
3639+
*/
3640+
effective_at?: string
36303641
/**
36313642
* The duration after which the credit grant expires.
36323643
*
@@ -5440,6 +5451,12 @@ export interface CreateCreditGrantRequestInput {
54405451
filters?: CreateCreditGrantFilters
54415452
/** Draw-down priority of the grant. Lower values have higher priority. */
54425453
priority?: number
5454+
/**
5455+
* The timestamp when the credit grant becomes effective.
5456+
*
5457+
* Defaults to the current date and time.
5458+
*/
5459+
effective_at?: string
54435460
/**
54445461
* The duration after which the credit grant expires.
54455462
*
@@ -5498,6 +5515,12 @@ export interface CreditGrantInput {
54985515
filters?: CreditGrantFilters
54995516
/** Draw-down priority of the grant. Lower values have higher priority. */
55005517
priority?: number
5518+
/**
5519+
* The timestamp when the credit grant becomes effective.
5520+
*
5521+
* Defaults to the current date and time.
5522+
*/
5523+
effective_at?: string
55015524
/**
55025525
* The duration after which the credit grant expires.
55035526
*

api/spec/packages/aip/src/customers/credits/balance.tsp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,24 @@ model CreditBalance {
3333
currency: Currencies.CurrencyCode;
3434

3535
/**
36-
* Credits that have been granted but cannot yet be consumed. Includes grants
37-
* awaiting payment clearance or with a future effective date.
36+
* Credits available after applying currently live charge impacts.
3837
*/
3938
@visibility(Lifecycle.Read)
4039
@example("200.00")
41-
pending: Shared.Numeric;
40+
live: Shared.Numeric;
4241

4342
/**
44-
* Credits that can be consumed right now. Derived from cleared grants after
45-
* applying eligibility and restriction rules.
43+
* Credits that have been booked on the ledger as of the balance timestamp.
4644
*/
4745
@visibility(Lifecycle.Read)
4846
@example("150.00")
49-
available: Shared.Numeric;
47+
settled: Shared.Numeric;
48+
49+
/**
50+
* Credits that have been granted but are not yet written to the ledger, or are
51+
* written to the ledger with a future booked time.
52+
*/
53+
@visibility(Lifecycle.Read)
54+
@example("50.00")
55+
pending: Shared.Numeric;
5056
}

api/spec/packages/aip/src/customers/credits/grant.tsp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,13 @@ model CreditGrant {
177177
@maxValue(1000)
178178
priority?: int16 = 10;
179179

180-
// /**
181-
// * The timestamp when the credit grant becomes effective.
182-
// *
183-
// * Defaults to the current date and time.
184-
// */
185-
// @visibility(Lifecycle.Create, Lifecycle.Read)
186-
// effective_at?: Shared.DateTime;
180+
/**
181+
* The timestamp when the credit grant becomes effective.
182+
*
183+
* Defaults to the current date and time.
184+
*/
185+
@visibility(Lifecycle.Create, Lifecycle.Read)
186+
effective_at?: Shared.DateTime;
187187

188188
/**
189189
* The duration after which the credit grant expires.

0 commit comments

Comments
 (0)