Skip to content

Commit 4ffb020

Browse files
authored
feat(api): expose charge system intent (#4612)
1 parent f229b44 commit 4ffb020

9 files changed

Lines changed: 1533 additions & 867 deletions

File tree

api/spec/packages/aip-client-javascript/src/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ export type {
238238
AppStripeCreateCheckoutSessionConsentCollection,
239239
ListCustomerEntitlementAccessResponseData,
240240
WorkflowCollectionAlignmentAnchored,
241+
ChargeFlatFeeSystemIntent,
241242
SubscriptionPagePaginatedResponse,
242243
SubscriptionChangeResponse,
243244
SubscriptionCancel,
@@ -290,12 +291,13 @@ export type {
290291
ProfileApps,
291292
GovernanceQueryResponse,
292293
ChargeFlatFee,
293-
ChargeUsageBased,
294+
ChargeUsageBasedSystemIntent,
294295
CreateChargeUsageBasedRequest,
295296
RateCard,
296297
InvoiceLineRateCard,
297298
FeaturePagePaginatedResponse,
298299
Workflow,
300+
ChargeUsageBased,
299301
SubscriptionAddonRateCard,
300302
PlanPhase,
301303
Addon,
@@ -305,13 +307,13 @@ export type {
305307
Profile,
306308
CreateBillingProfileRequest,
307309
UpsertBillingProfileRequest,
308-
ChargePagePaginatedResponse,
309310
SubscriptionAddon,
310311
Plan,
311312
CreatePlanRequest,
312313
UpsertPlanRequest,
313314
AddonPagePaginatedResponse,
314315
ProfilePagePaginatedResponse,
316+
ChargePagePaginatedResponse,
315317
SubscriptionAddonPagePaginatedResponse,
316318
PlanPagePaginatedResponse,
317319
InvoiceStandard,

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

Lines changed: 92 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3524,6 +3524,37 @@ export const workflowCollectionAlignmentAnchored = z
35243524
'BillingWorkflowCollectionAlignmentAnchored specifies the alignment for collecting the pending line items into an invoice.',
35253525
)
35263526

3527+
export const chargeFlatFeeSystemIntent = z
3528+
.object({
3529+
name: z
3530+
.string()
3531+
.min(1)
3532+
.max(256)
3533+
.describe('Display name of the resource. Between 1 and 256 characters.'),
3534+
description: z
3535+
.string()
3536+
.max(1024)
3537+
.optional()
3538+
3539+
.describe(
3540+
'Optional description of the resource. Maximum 1024 characters.',
3541+
),
3542+
labels: labels.optional(),
3543+
invoice_at: dateTime,
3544+
service_period: closedPeriod,
3545+
full_service_period: closedPeriod,
3546+
billing_period: closedPeriod,
3547+
payment_term: pricePaymentTerm,
3548+
discounts: chargeFlatFeeDiscounts.optional(),
3549+
proration_configuration: rateCardProrationConfiguration,
3550+
amount_before_proration: currencyAmount,
3551+
deleted_at: dateTime.optional(),
3552+
})
3553+
3554+
.describe(
3555+
'Flat fee intent fields from the system lifecycle controller shadowed by a manual override.',
3556+
)
3557+
35273558
export const subscriptionPagePaginatedResponse = z
35283559
.object({
35293560
data: z.array(subscription),
@@ -4555,12 +4586,12 @@ export const chargeFlatFee = z
45554586
proration_configuration: rateCardProrationConfiguration,
45564587
amount_after_proration: currencyAmount,
45574588
price: price,
4589+
system_intent: chargeFlatFeeSystemIntent.optional(),
45584590
})
45594591
.describe('A flat fee charge for a customer.')
45604592

4561-
export const chargeUsageBased = z
4593+
export const chargeUsageBasedSystemIntent = z
45624594
.object({
4563-
id: ulid,
45644595
name: z
45654596
.string()
45664597
.min(1)
@@ -4575,32 +4606,18 @@ export const chargeUsageBased = z
45754606
'Optional description of the resource. Maximum 1024 characters.',
45764607
),
45774608
labels: labels.optional(),
4578-
created_at: dateTime,
4579-
updated_at: dateTime,
4580-
deleted_at: dateTime.optional(),
4581-
type: z.literal('usage_based').describe('The type of the charge.'),
4582-
customer: billingCustomerReference,
4583-
lifecycle_controller: lifecycleController,
4584-
subscription: subscriptionReference.optional(),
4585-
currency: currencyCode,
4586-
status: chargeStatus,
45874609
invoice_at: dateTime,
45884610
service_period: closedPeriod,
45894611
full_service_period: closedPeriod,
45904612
billing_period: closedPeriod,
4591-
advance_after: dateTime.optional(),
4592-
unique_reference_id: z
4593-
.string()
4594-
.optional()
4595-
.describe('Unique reference ID of the charge.'),
4596-
settlement_mode: settlementMode,
4597-
tax_config: taxConfig.optional(),
45984613
discounts: rateCardDiscounts.optional(),
4599-
feature_key: z.string().describe('The feature associated with the charge.'),
4600-
totals: chargeTotals,
46014614
price: price,
4615+
deleted_at: dateTime.optional(),
46024616
})
4603-
.describe('A usage-based charge for a customer.')
4617+
4618+
.describe(
4619+
'Usage-based intent fields from the system lifecycle controller shadowed by a manual override.',
4620+
)
46044621

46054622
export const createChargeUsageBasedRequest = z
46064623
.object({
@@ -4693,9 +4710,50 @@ export const workflow = z
46934710
})
46944711
.describe('Billing workflow settings.')
46954712

4696-
export const charge = z
4697-
.discriminatedUnion('type', [chargeFlatFee, chargeUsageBased])
4698-
.describe('Customer charge.')
4713+
export const chargeUsageBased = z
4714+
.object({
4715+
id: ulid,
4716+
name: z
4717+
.string()
4718+
.min(1)
4719+
.max(256)
4720+
.describe('Display name of the resource. Between 1 and 256 characters.'),
4721+
description: z
4722+
.string()
4723+
.max(1024)
4724+
.optional()
4725+
4726+
.describe(
4727+
'Optional description of the resource. Maximum 1024 characters.',
4728+
),
4729+
labels: labels.optional(),
4730+
created_at: dateTime,
4731+
updated_at: dateTime,
4732+
deleted_at: dateTime.optional(),
4733+
type: z.literal('usage_based').describe('The type of the charge.'),
4734+
customer: billingCustomerReference,
4735+
lifecycle_controller: lifecycleController,
4736+
subscription: subscriptionReference.optional(),
4737+
currency: currencyCode,
4738+
status: chargeStatus,
4739+
invoice_at: dateTime,
4740+
service_period: closedPeriod,
4741+
full_service_period: closedPeriod,
4742+
billing_period: closedPeriod,
4743+
advance_after: dateTime.optional(),
4744+
unique_reference_id: z
4745+
.string()
4746+
.optional()
4747+
.describe('Unique reference ID of the charge.'),
4748+
settlement_mode: settlementMode,
4749+
tax_config: taxConfig.optional(),
4750+
discounts: rateCardDiscounts.optional(),
4751+
feature_key: z.string().describe('The feature associated with the charge.'),
4752+
totals: chargeTotals,
4753+
price: price,
4754+
system_intent: chargeUsageBasedSystemIntent.optional(),
4755+
})
4756+
.describe('A usage-based charge for a customer.')
46994757

47004758
export const createChargeRequest = z
47014759
.discriminatedUnion('type', [
@@ -4953,12 +5011,9 @@ export const upsertBillingProfileRequest = z
49535011
})
49545012
.describe('BillingProfile upsert request.')
49555013

4956-
export const chargePagePaginatedResponse = z
4957-
.object({
4958-
data: z.array(charge),
4959-
meta: paginatedMeta,
4960-
})
4961-
.describe('Page paginated response.')
5014+
export const charge = z
5015+
.discriminatedUnion('type', [chargeFlatFee, chargeUsageBased])
5016+
.describe('Customer charge.')
49625017

49635018
export const subscriptionAddon = z
49645019
.object({
@@ -5148,6 +5203,13 @@ export const profilePagePaginatedResponse = z
51485203
})
51495204
.describe('Page paginated response.')
51505205

5206+
export const chargePagePaginatedResponse = z
5207+
.object({
5208+
data: z.array(charge),
5209+
meta: paginatedMeta,
5210+
})
5211+
.describe('Page paginated response.')
5212+
51515213
export const subscriptionAddonPagePaginatedResponse = z
51525214
.object({
51535215
data: z.array(subscriptionAddon),

0 commit comments

Comments
 (0)