Skip to content

Commit 2f8a011

Browse files
committed
fix: review comments
1 parent 3e3c3d5 commit 2f8a011

8 files changed

Lines changed: 1337 additions & 1154 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
@@ -98,7 +98,7 @@ export type {
9898
PriceUnit,
9999
RateCardDiscounts,
100100
Totals,
101-
InvoiceLineCreditAllocation,
101+
InvoiceLineCreditsApplied,
102102
FeatureManualUnitCost,
103103
FeatureLlmUnitCostPricing,
104104
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
@@ -830,7 +830,7 @@ export const invoiceWorkflowInvoicingSettings = z
830830
)
831831

832832
export const invoiceLineType = z
833-
.enum(['flat_fee', 'usage_based'])
833+
.enum(['standard_line'])
834834
.describe('Line item type discriminator.')
835835

836836
export const invoiceLineManagedBy = z
@@ -1403,7 +1403,7 @@ export const totals = z
14031403
'Totals contains the summaries of all calculations for a billing resource.',
14041404
)
14051405

1406-
export const invoiceLineCreditAllocation = z
1406+
export const invoiceLineCreditsApplied = z
14071407
.object({
14081408
amount: numeric,
14091409
description: z
@@ -3489,12 +3489,37 @@ export const upsertCustomerRequest = z
34893489
})
34903490
.describe('Customer upsert request.')
34913491

3492+
export const invoiceCustomer = z
3493+
.object({
3494+
id: ulid,
3495+
key: externalResourceKey.optional(),
3496+
name: z.string().describe('Human-readable name of the customer.'),
3497+
billing_address: billingAddress.optional(),
3498+
usage_attribution: customerUsageAttribution,
3499+
})
3500+
3501+
.describe(
3502+
"Snapshot of the customer's information at the time the invoice was issued. Extends BillingParty with billing-specific usage attribution data.",
3503+
)
3504+
34923505
export const partyAddresses = z
34933506
.object({
34943507
billing_address: address,
34953508
})
34963509
.describe('A collection of addresses for the party.')
34973510

3511+
export const supplier = z
3512+
.object({
3513+
id: z.string().describe('Unique identifier for the supplier.'),
3514+
name: z.string().describe('Human-readable name of the supplier.'),
3515+
tax_id: z.string().optional().describe('Tax identity of the supplier.'),
3516+
address: address,
3517+
})
3518+
3519+
.describe(
3520+
"Snapshot of the supplier's information at the time the invoice was issued. Extends BillingParty with tax identity and address data.",
3521+
)
3522+
34983523
export const appStripeCreateCheckoutSessionConsentCollection = z
34993524
.object({
35003525
payment_method_reuse_agreement:
@@ -4137,23 +4162,75 @@ export const party = z
41374162
})
41384163
.describe('Party represents a person or business entity.')
41394164

4140-
export const invoiceCustomer = z
4165+
export const invoiceBase = z
41414166
.object({
4142-
id: z.string().optional().describe('Unique identifier for the party.'),
4143-
key: externalResourceKey.optional(),
4144-
name: z
4167+
id: ulid,
4168+
description: z
41454169
.string()
4170+
.max(1024)
41464171
.optional()
4147-
.describe('Legal name or representation of the party.'),
4148-
tax_id: partyTaxIdentity.optional(),
4149-
addresses: partyAddresses.optional(),
4150-
usage_attribution: customerUsageAttribution,
4172+
4173+
.describe(
4174+
'Optional description of the resource. Maximum 1024 characters.',
4175+
),
4176+
labels: labels.optional(),
4177+
created_at: dateTime,
4178+
updated_at: dateTime,
4179+
deleted_at: dateTime.optional(),
4180+
number: invoiceNumber,
4181+
currency: currencyCode,
4182+
supplier: supplier,
4183+
customer: invoiceCustomer,
4184+
totals: totals,
4185+
service_period: closedPeriod,
4186+
validation_issues: z
4187+
.array(invoiceValidationIssue)
4188+
.optional()
4189+
4190+
.describe(
4191+
'Validation issues found during invoice processing. Present only when there are one or more validation findings. An empty list is omitted.',
4192+
),
4193+
external_ids: invoiceExternalIds.optional(),
41514194
})
41524195

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

4200+
export const creditNoteInvoice = z
4201+
.object({
4202+
id: ulid,
4203+
description: z
4204+
.string()
4205+
.max(1024)
4206+
.optional()
4207+
4208+
.describe(
4209+
'Optional description of the resource. Maximum 1024 characters.',
4210+
),
4211+
labels: labels.optional(),
4212+
created_at: dateTime,
4213+
updated_at: dateTime,
4214+
deleted_at: dateTime.optional(),
4215+
number: invoiceNumber,
4216+
currency: currencyCode,
4217+
supplier: supplier,
4218+
customer: invoiceCustomer,
4219+
totals: totals,
4220+
service_period: closedPeriod,
4221+
validation_issues: z
4222+
.array(invoiceValidationIssue)
4223+
.optional()
4224+
4225+
.describe(
4226+
'Validation issues found during invoice processing. Present only when there are one or more validation findings. An empty list is omitted.',
4227+
),
4228+
external_ids: invoiceExternalIds.optional(),
4229+
type: invoiceType,
4230+
status: creditNoteInvoiceStatus,
4231+
})
4232+
.describe('A credit note invoice.')
4233+
41574234
export const appStripeCreateCheckoutSessionRequestOptions = z
41584235
.object({
41594236
billing_address_collection:
@@ -4285,15 +4362,14 @@ export const invoiceDetailedLine = z
42854362
updated_at: dateTime,
42864363
deleted_at: dateTime.optional(),
42874364
managed_by: invoiceLineManagedBy,
4288-
currency: currencyCode,
42894365
service_period: closedPeriod,
42904366
totals: totals,
4291-
category: invoiceDetailedLineCostCategory.optional(),
4367+
category: invoiceDetailedLineCostCategory.default('regular'),
42924368
discounts: invoiceLineDiscounts.optional(),
4293-
credit_allocations: z
4294-
.array(invoiceLineCreditAllocation)
4369+
credits_applied: z
4370+
.array(invoiceLineCreditsApplied)
42954371
.optional()
4296-
.describe('Credit allocations applied to this detailed line.'),
4372+
.describe('Credit applied to this detailed line.'),
42974373
external_ids: invoiceLineExternalIds.optional(),
42984374
quantity: numeric,
42994375
unit_price: numeric,
@@ -4425,75 +4501,6 @@ export const badRequest = z
44254501
)
44264502
.describe('Bad Request.')
44274503

4428-
export const invoiceBase = z
4429-
.object({
4430-
id: ulid,
4431-
description: z
4432-
.string()
4433-
.max(1024)
4434-
.optional()
4435-
4436-
.describe(
4437-
'Optional description of the resource. Maximum 1024 characters.',
4438-
),
4439-
labels: labels.optional(),
4440-
created_at: dateTime,
4441-
updated_at: dateTime,
4442-
deleted_at: dateTime.optional(),
4443-
number: invoiceNumber,
4444-
currency: currencyCode,
4445-
supplier: party,
4446-
customer: invoiceCustomer,
4447-
totals: totals,
4448-
service_period: closedPeriod,
4449-
validation_issues: z
4450-
.array(invoiceValidationIssue)
4451-
.optional()
4452-
4453-
.describe(
4454-
'Validation issues found during invoice processing. Present only when there are one or more validation findings. An empty list is omitted.',
4455-
),
4456-
external_ids: invoiceExternalIds.optional(),
4457-
})
4458-
4459-
.describe(
4460-
'Base fields shared by all invoice types. Spread this model into each concrete invoice variant.',
4461-
)
4462-
4463-
export const creditNoteInvoice = z
4464-
.object({
4465-
id: ulid,
4466-
description: z
4467-
.string()
4468-
.max(1024)
4469-
.optional()
4470-
4471-
.describe(
4472-
'Optional description of the resource. Maximum 1024 characters.',
4473-
),
4474-
labels: labels.optional(),
4475-
created_at: dateTime,
4476-
updated_at: dateTime,
4477-
deleted_at: dateTime.optional(),
4478-
number: invoiceNumber,
4479-
currency: currencyCode,
4480-
supplier: party,
4481-
customer: invoiceCustomer,
4482-
totals: totals,
4483-
service_period: closedPeriod,
4484-
validation_issues: z
4485-
.array(invoiceValidationIssue)
4486-
.optional()
4487-
4488-
.describe(
4489-
'Validation issues found during invoice processing. Present only when there are one or more validation findings. An empty list is omitted.',
4490-
),
4491-
external_ids: invoiceExternalIds.optional(),
4492-
type: invoiceType,
4493-
status: creditNoteInvoiceStatus,
4494-
})
4495-
.describe('A credit note invoice.')
4496-
44974504
export const customerStripeCreateCheckoutSessionRequest = z
44984505
.object({
44994506
stripe_options: appStripeCreateCheckoutSessionRequestOptions,
@@ -4773,16 +4780,15 @@ export const invoiceLine = z
47734780
service_period: closedPeriod,
47744781
totals: totals,
47754782
discounts: invoiceLineDiscounts.optional(),
4776-
credit_allocations: z
4777-
.array(invoiceLineCreditAllocation)
4783+
credits_applied: z
4784+
.array(invoiceLineCreditsApplied)
47784785
.optional()
4779-
.describe('Credit allocations applied to this line item.'),
4786+
.describe('Credit applied to this line item.'),
47804787
external_ids: invoiceLineExternalIds.optional(),
47814788
subscription: subscriptionReference.optional(),
4782-
rate_card: invoiceLineRateCard.optional(),
4789+
rate_card: invoiceLineRateCard,
47834790
detailed_lines: z
47844791
.array(invoiceDetailedLine)
4785-
.optional()
47864792

47874793
.describe(
47884794
'Detailed sub-lines that this line has been broken down into. Present when `status` is `detailed` or `split`.',
@@ -5008,7 +5014,7 @@ export const standardInvoice = z
50085014
deleted_at: dateTime.optional(),
50095015
number: invoiceNumber,
50105016
currency: currencyCode,
5011-
supplier: party,
5017+
supplier: supplier,
50125018
customer: invoiceCustomer,
50135019
totals: totals,
50145020
service_period: closedPeriod,
@@ -5027,7 +5033,7 @@ export const standardInvoice = z
50275033
status_details: invoiceStatusDetails,
50285034
issued_at: dateTime.optional(),
50295035
draft_until: dateTime.optional(),
5030-
quantity_snapshoted_at: dateTime.optional(),
5036+
quantity_snapshotted_at: dateTime.optional(),
50315037
collection_at: dateTime.optional(),
50325038
due_at: dateTime.optional(),
50335039
sent_to_customer_at: dateTime.optional(),

0 commit comments

Comments
 (0)