Skip to content

Commit af8b060

Browse files
committed
fix: review comments
1 parent e694980 commit af8b060

8 files changed

Lines changed: 1339 additions & 1156 deletions

File tree

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export type {
9797
PriceUnit,
9898
RateCardDiscounts,
9999
Totals,
100-
InvoiceLineCreditAllocation,
100+
InvoiceLineCreditsApplied,
101101
FeatureManualUnitCost,
102102
FeatureLlmUnitCostPricing,
103103
LlmCostModelPricing,
@@ -232,7 +232,9 @@ export type {
232232
CreateCustomerRequest,
233233
Customer,
234234
UpsertCustomerRequest,
235+
InvoiceCustomer,
235236
PartyAddresses,
237+
Supplier,
236238
AppStripeCreateCheckoutSessionConsentCollection,
237239
ListCustomerEntitlementAccessResponseData,
238240
WorkflowCollectionAlignmentAnchored,
@@ -269,7 +271,8 @@ export type {
269271
MeterQueryRequest,
270272
CustomerPagePaginatedResponse,
271273
Party,
272-
InvoiceCustomer,
274+
InvoiceBase,
275+
CreditNoteInvoice,
273276
AppStripeCreateCheckoutSessionRequestOptions,
274277
TaxCodePagePaginatedResponse,
275278
InvoiceWorkflowSettings,
@@ -281,8 +284,6 @@ export type {
281284
UpdateFeatureRequest,
282285
CreditGrantPagePaginatedResponse,
283286
BadRequest,
284-
InvoiceBase,
285-
CreditNoteInvoice,
286287
CustomerStripeCreateCheckoutSessionRequest,
287288
WorkflowCollectionSettings,
288289
AppPagePaginatedResponse,
@@ -347,12 +348,14 @@ export type {
347348
MeterQueryRequestInput,
348349
AppStripeCreateCheckoutSessionRequestOptionsInput,
349350
InvoiceWorkflowSettingsInput,
351+
InvoiceDetailedLineInput,
350352
CreditGrantPagePaginatedResponseInput,
351353
BadRequestInput,
352354
CustomerStripeCreateCheckoutSessionRequestInput,
353355
WorkflowCollectionSettingsInput,
354356
RateCardInput,
355357
WorkflowInput,
358+
InvoiceLineInput,
356359
PlanPhaseInput,
357360
AddonInput,
358361
CreateAddonRequestInput,

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

Lines changed: 98 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,7 @@ export const invoiceWorkflowInvoicingSettings = z
808808
)
809809

810810
export const invoiceLineType = z
811-
.enum(['flat_fee', 'usage_based'])
811+
.enum(['standard_line'])
812812
.describe('Line item type discriminator.')
813813

814814
export const invoiceLineManagedBy = z
@@ -1381,7 +1381,7 @@ export const totals = z
13811381
'Totals contains the summaries of all calculations for a billing resource.',
13821382
)
13831383

1384-
export const invoiceLineCreditAllocation = z
1384+
export const invoiceLineCreditsApplied = z
13851385
.object({
13861386
amount: numeric,
13871387
description: z
@@ -3497,12 +3497,37 @@ export const upsertCustomerRequest = z
34973497
})
34983498
.describe('Customer upsert request.')
34993499

3500+
export const invoiceCustomer = z
3501+
.object({
3502+
id: ulid,
3503+
key: externalResourceKey.optional(),
3504+
name: z.string().describe('Human-readable name of the customer.'),
3505+
billing_address: billingAddress.optional(),
3506+
usage_attribution: customerUsageAttribution,
3507+
})
3508+
3509+
.describe(
3510+
"Snapshot of the customer's information at the time the invoice was issued. Extends BillingParty with billing-specific usage attribution data.",
3511+
)
3512+
35003513
export const partyAddresses = z
35013514
.object({
35023515
billing_address: address,
35033516
})
35043517
.describe('A collection of addresses for the party.')
35053518

3519+
export const supplier = z
3520+
.object({
3521+
id: z.string().describe('Unique identifier for the supplier.'),
3522+
name: z.string().describe('Human-readable name of the supplier.'),
3523+
tax_id: z.string().optional().describe('Tax identity of the supplier.'),
3524+
address: address,
3525+
})
3526+
3527+
.describe(
3528+
"Snapshot of the supplier's information at the time the invoice was issued. Extends BillingParty with tax identity and address data.",
3529+
)
3530+
35063531
export const appStripeCreateCheckoutSessionConsentCollection = z
35073532
.object({
35083533
payment_method_reuse_agreement:
@@ -4145,23 +4170,75 @@ export const party = z
41454170
})
41464171
.describe('Party represents a person or business entity.')
41474172

4148-
export const invoiceCustomer = z
4173+
export const invoiceBase = z
41494174
.object({
4150-
id: z.string().optional().describe('Unique identifier for the party.'),
4151-
key: externalResourceKey.optional(),
4152-
name: z
4175+
id: ulid,
4176+
description: z
41534177
.string()
4178+
.max(1024)
41544179
.optional()
4155-
.describe('Legal name or representation of the party.'),
4156-
tax_id: partyTaxIdentity.optional(),
4157-
addresses: partyAddresses.optional(),
4158-
usage_attribution: customerUsageAttribution,
4180+
4181+
.describe(
4182+
'Optional description of the resource. Maximum 1024 characters.',
4183+
),
4184+
labels: labels.optional(),
4185+
created_at: dateTime,
4186+
updated_at: dateTime,
4187+
deleted_at: dateTime.optional(),
4188+
number: invoiceNumber,
4189+
currency: currencyCode,
4190+
supplier: supplier,
4191+
customer: invoiceCustomer,
4192+
totals: totals,
4193+
service_period: closedPeriod,
4194+
validation_issues: z
4195+
.array(invoiceValidationIssue)
4196+
.optional()
4197+
4198+
.describe(
4199+
'Validation issues found during invoice processing. Present only when there are one or more validation findings. An empty list is omitted.',
4200+
),
4201+
external_ids: invoiceExternalIds.optional(),
41594202
})
41604203

41614204
.describe(
4162-
"Snapshot of the customer's information at the time the invoice was issued. Extends BillingParty with billing-specific usage attribution data.",
4205+
'Base fields shared by all invoice types. Spread this model into each concrete invoice variant.',
41634206
)
41644207

4208+
export const creditNoteInvoice = z
4209+
.object({
4210+
id: ulid,
4211+
description: z
4212+
.string()
4213+
.max(1024)
4214+
.optional()
4215+
4216+
.describe(
4217+
'Optional description of the resource. Maximum 1024 characters.',
4218+
),
4219+
labels: labels.optional(),
4220+
created_at: dateTime,
4221+
updated_at: dateTime,
4222+
deleted_at: dateTime.optional(),
4223+
number: invoiceNumber,
4224+
currency: currencyCode,
4225+
supplier: supplier,
4226+
customer: invoiceCustomer,
4227+
totals: totals,
4228+
service_period: closedPeriod,
4229+
validation_issues: z
4230+
.array(invoiceValidationIssue)
4231+
.optional()
4232+
4233+
.describe(
4234+
'Validation issues found during invoice processing. Present only when there are one or more validation findings. An empty list is omitted.',
4235+
),
4236+
external_ids: invoiceExternalIds.optional(),
4237+
type: invoiceType,
4238+
status: creditNoteInvoiceStatus,
4239+
})
4240+
.describe('A credit note invoice.')
4241+
41654242
export const appStripeCreateCheckoutSessionRequestOptions = z
41664243
.object({
41674244
billing_address_collection:
@@ -4293,15 +4370,14 @@ export const invoiceDetailedLine = z
42934370
updated_at: dateTime,
42944371
deleted_at: dateTime.optional(),
42954372
managed_by: invoiceLineManagedBy,
4296-
currency: currencyCode,
42974373
service_period: closedPeriod,
42984374
totals: totals,
4299-
category: invoiceDetailedLineCostCategory.optional(),
4375+
category: invoiceDetailedLineCostCategory.default('regular'),
43004376
discounts: invoiceLineDiscounts.optional(),
4301-
credit_allocations: z
4302-
.array(invoiceLineCreditAllocation)
4377+
credits_applied: z
4378+
.array(invoiceLineCreditsApplied)
43034379
.optional()
4304-
.describe('Credit allocations applied to this detailed line.'),
4380+
.describe('Credit applied to this detailed line.'),
43054381
external_ids: invoiceLineExternalIds.optional(),
43064382
quantity: numeric,
43074383
unit_price: numeric,
@@ -4433,75 +4509,6 @@ export const badRequest = z
44334509
)
44344510
.describe('Bad Request.')
44354511

4436-
export const invoiceBase = z
4437-
.object({
4438-
id: ulid,
4439-
description: z
4440-
.string()
4441-
.max(1024)
4442-
.optional()
4443-
4444-
.describe(
4445-
'Optional description of the resource. Maximum 1024 characters.',
4446-
),
4447-
labels: labels.optional(),
4448-
created_at: dateTime,
4449-
updated_at: dateTime,
4450-
deleted_at: dateTime.optional(),
4451-
number: invoiceNumber,
4452-
currency: currencyCode,
4453-
supplier: party,
4454-
customer: invoiceCustomer,
4455-
totals: totals,
4456-
service_period: closedPeriod,
4457-
validation_issues: z
4458-
.array(invoiceValidationIssue)
4459-
.optional()
4460-
4461-
.describe(
4462-
'Validation issues found during invoice processing. Present only when there are one or more validation findings. An empty list is omitted.',
4463-
),
4464-
external_ids: invoiceExternalIds.optional(),
4465-
})
4466-
4467-
.describe(
4468-
'Base fields shared by all invoice types. Spread this model into each concrete invoice variant.',
4469-
)
4470-
4471-
export const creditNoteInvoice = z
4472-
.object({
4473-
id: ulid,
4474-
description: z
4475-
.string()
4476-
.max(1024)
4477-
.optional()
4478-
4479-
.describe(
4480-
'Optional description of the resource. Maximum 1024 characters.',
4481-
),
4482-
labels: labels.optional(),
4483-
created_at: dateTime,
4484-
updated_at: dateTime,
4485-
deleted_at: dateTime.optional(),
4486-
number: invoiceNumber,
4487-
currency: currencyCode,
4488-
supplier: party,
4489-
customer: invoiceCustomer,
4490-
totals: totals,
4491-
service_period: closedPeriod,
4492-
validation_issues: z
4493-
.array(invoiceValidationIssue)
4494-
.optional()
4495-
4496-
.describe(
4497-
'Validation issues found during invoice processing. Present only when there are one or more validation findings. An empty list is omitted.',
4498-
),
4499-
external_ids: invoiceExternalIds.optional(),
4500-
type: invoiceType,
4501-
status: creditNoteInvoiceStatus,
4502-
})
4503-
.describe('A credit note invoice.')
4504-
45054512
export const customerStripeCreateCheckoutSessionRequest = z
45064513
.object({
45074514
stripe_options: appStripeCreateCheckoutSessionRequestOptions,
@@ -4781,16 +4788,15 @@ export const invoiceLine = z
47814788
service_period: closedPeriod,
47824789
totals: totals,
47834790
discounts: invoiceLineDiscounts.optional(),
4784-
credit_allocations: z
4785-
.array(invoiceLineCreditAllocation)
4791+
credits_applied: z
4792+
.array(invoiceLineCreditsApplied)
47864793
.optional()
4787-
.describe('Credit allocations applied to this line item.'),
4794+
.describe('Credit applied to this line item.'),
47884795
external_ids: invoiceLineExternalIds.optional(),
47894796
subscription: subscriptionReference.optional(),
4790-
rate_card: invoiceLineRateCard.optional(),
4797+
rate_card: invoiceLineRateCard,
47914798
detailed_lines: z
47924799
.array(invoiceDetailedLine)
4793-
.optional()
47944800

47954801
.describe(
47964802
'Detailed sub-lines that this line has been broken down into. Present when `status` is `detailed` or `split`.',
@@ -5016,7 +5022,7 @@ export const standardInvoice = z
50165022
deleted_at: dateTime.optional(),
50175023
number: invoiceNumber,
50185024
currency: currencyCode,
5019-
supplier: party,
5025+
supplier: supplier,
50205026
customer: invoiceCustomer,
50215027
totals: totals,
50225028
service_period: closedPeriod,
@@ -5035,7 +5041,7 @@ export const standardInvoice = z
50355041
status_details: invoiceStatusDetails,
50365042
issued_at: dateTime.optional(),
50375043
draft_until: dateTime.optional(),
5038-
quantity_snapshoted_at: dateTime.optional(),
5044+
quantity_snapshotted_at: dateTime.optional(),
50395045
collection_at: dateTime.optional(),
50405046
due_at: dateTime.optional(),
50415047
sent_to_customer_at: dateTime.optional(),

0 commit comments

Comments
 (0)