Skip to content

Commit 61e113d

Browse files
committed
feat(invoice): cost on line item
1 parent 209f13a commit 61e113d

File tree

6 files changed

+1384
-1383
lines changed

6 files changed

+1384
-1383
lines changed

api/api.gen.go

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

api/openapi.yaml

Lines changed: 87 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -2219,9 +2219,9 @@ paths:
22192219
$ref: '#/components/schemas/UnexpectedProblemResponse'
22202220
tags:
22212221
- Billing
2222-
/api/v1/billing/invoices/{invoiceId}/features/{featureKey}/cost:
2222+
/api/v1/billing/invoices/{invoiceId}/lines/{lineId}/cost:
22232223
get:
2224-
operationId: getInvoiceFeatureCost
2224+
operationId: getInvoiceLineCost
22252225
summary: Get an invoice feature cost
22262226
description: Get an invoice feature cost.
22272227
parameters:
@@ -2232,21 +2232,21 @@ paths:
22322232
type: string
22332233
pattern: ^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$
22342234
example: 01G65Z755AFWAKHE12NY0CQ9FH
2235-
- name: featureKey
2235+
- name: lineId
22362236
in: path
22372237
required: true
22382238
schema:
22392239
type: string
2240-
- $ref: '#/components/parameters/GetInvoiceFeatureCostParam.windowSize'
2241-
- $ref: '#/components/parameters/GetInvoiceFeatureCostParam.windowTimeZone'
2242-
- $ref: '#/components/parameters/GetInvoiceFeatureCostParam.groupBy'
2240+
- $ref: '#/components/parameters/GetInvoiceLineCostParam.windowSize'
2241+
- $ref: '#/components/parameters/GetInvoiceLineCostParam.windowTimeZone'
2242+
- $ref: '#/components/parameters/GetInvoiceLineCostParam.groupBy'
22432243
responses:
22442244
'200':
22452245
description: The request has succeeded.
22462246
content:
22472247
application/json:
22482248
schema:
2249-
$ref: '#/components/schemas/InvoiceFeatureCost'
2249+
$ref: '#/components/schemas/InvoiceLineCost'
22502250
'400':
22512251
description: The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).
22522252
content:
@@ -11673,7 +11673,7 @@ components:
1167311673
$ref: '#/components/schemas/FeatureOrderBy'
1167411674
explode: false
1167511675
style: form
11676-
GetInvoiceFeatureCostParam.groupBy:
11676+
GetInvoiceLineCostParam.groupBy:
1167711677
name: groupBy
1167811678
in: query
1167911679
required: false
@@ -11687,7 +11687,7 @@ components:
1168711687
items:
1168811688
type: string
1168911689
style: form
11690-
GetInvoiceFeatureCostParam.windowSize:
11690+
GetInvoiceLineCostParam.windowSize:
1169111691
name: windowSize
1169211692
in: query
1169311693
required: false
@@ -11699,7 +11699,7 @@ components:
1169911699
$ref: '#/components/schemas/WindowSize'
1170011700
explode: false
1170111701
style: form
11702-
GetInvoiceFeatureCostParam.windowTimeZone:
11702+
GetInvoiceLineCostParam.windowTimeZone:
1170311703
name: windowTimeZone
1170411704
in: query
1170511705
required: false
@@ -17525,83 +17525,6 @@ components:
1752517525
- preceding
1752617526
- workflow.apps
1752717527
description: InvoiceExpand specifies the parts of the invoice to expand in the list output.
17528-
InvoiceFeatureCost:
17529-
type: object
17530-
required:
17531-
- from
17532-
- to
17533-
- costPerUnit
17534-
- totalUsage
17535-
- totalCost
17536-
- currency
17537-
- rows
17538-
properties:
17539-
from:
17540-
type: string
17541-
format: date-time
17542-
description: The start of the period the value is aggregated over.
17543-
example: '2023-01-01T01:01:01.001Z'
17544-
to:
17545-
type: string
17546-
format: date-time
17547-
description: The end of the period the value is aggregated over.
17548-
example: '2023-01-01T01:01:01.001Z'
17549-
costPerUnit:
17550-
allOf:
17551-
- $ref: '#/components/schemas/Numeric'
17552-
description: The cost per unit of the feature for the invoice.
17553-
totalUsage:
17554-
allOf:
17555-
- $ref: '#/components/schemas/Numeric'
17556-
description: The total usage of the feature for the invoice.
17557-
totalCost:
17558-
allOf:
17559-
- $ref: '#/components/schemas/Numeric'
17560-
description: The total cost of the feature for the invoice.
17561-
currency:
17562-
allOf:
17563-
- $ref: '#/components/schemas/CurrencyCode'
17564-
description: Currency of the cost.
17565-
rows:
17566-
type: array
17567-
items:
17568-
$ref: '#/components/schemas/InvoiceFeatureCostRow'
17569-
description: The rows of the feature cost for the invoice.
17570-
description: InvoiceFeatureCost is the cost of a feature for an invoice.
17571-
InvoiceFeatureCostRow:
17572-
type: object
17573-
required:
17574-
- windowStart
17575-
- windowEnd
17576-
- usage
17577-
- cost
17578-
- groupBy
17579-
properties:
17580-
windowStart:
17581-
type: string
17582-
format: date-time
17583-
description: The start of the window the value is aggregated over.
17584-
example: '2023-01-01T01:01:01.001Z'
17585-
windowEnd:
17586-
type: string
17587-
format: date-time
17588-
description: The end of the window the value is aggregated over.
17589-
example: '2023-01-01T01:01:01.001Z'
17590-
usage:
17591-
allOf:
17592-
- $ref: '#/components/schemas/Numeric'
17593-
description: The usage of the feature for the invoice.
17594-
cost:
17595-
allOf:
17596-
- $ref: '#/components/schemas/Numeric'
17597-
description: The cost of the feature for the invoice.
17598-
groupBy:
17599-
type: object
17600-
additionalProperties:
17601-
type: string
17602-
nullable: true
17603-
description: The group by values the value is aggregated over.
17604-
description: InvoiceFeatureCostRow is a row of the feature cost for the invoice.
1760517528
InvoiceGenericDocumentRef:
1760617529
type: object
1760717530
required:
@@ -18028,6 +17951,83 @@ components:
1802817951
InvoiceLine represents a single item or service sold to the customer.
1802917952

1803017953
This is a base class for all line types, and should not be used directly.
17954+
InvoiceLineCost:
17955+
type: object
17956+
required:
17957+
- from
17958+
- to
17959+
- costPerUnit
17960+
- totalUsage
17961+
- totalCost
17962+
- currency
17963+
- rows
17964+
properties:
17965+
from:
17966+
type: string
17967+
format: date-time
17968+
description: The start of the period the value is aggregated over.
17969+
example: '2023-01-01T01:01:01.001Z'
17970+
to:
17971+
type: string
17972+
format: date-time
17973+
description: The end of the period the value is aggregated over.
17974+
example: '2023-01-01T01:01:01.001Z'
17975+
costPerUnit:
17976+
allOf:
17977+
- $ref: '#/components/schemas/Numeric'
17978+
description: The cost per unit of the feature for the invoice.
17979+
totalUsage:
17980+
allOf:
17981+
- $ref: '#/components/schemas/Numeric'
17982+
description: The total usage of the feature for the invoice.
17983+
totalCost:
17984+
allOf:
17985+
- $ref: '#/components/schemas/Numeric'
17986+
description: The total cost of the feature for the invoice.
17987+
currency:
17988+
allOf:
17989+
- $ref: '#/components/schemas/CurrencyCode'
17990+
description: Currency of the cost.
17991+
rows:
17992+
type: array
17993+
items:
17994+
$ref: '#/components/schemas/InvoiceLineCostRow'
17995+
description: The rows of the feature cost for the invoice.
17996+
description: InvoiceLineCost is the cost of a feature for an invoice.
17997+
InvoiceLineCostRow:
17998+
type: object
17999+
required:
18000+
- windowStart
18001+
- windowEnd
18002+
- usage
18003+
- cost
18004+
- groupBy
18005+
properties:
18006+
windowStart:
18007+
type: string
18008+
format: date-time
18009+
description: The start of the window the value is aggregated over.
18010+
example: '2023-01-01T01:01:01.001Z'
18011+
windowEnd:
18012+
type: string
18013+
format: date-time
18014+
description: The end of the window the value is aggregated over.
18015+
example: '2023-01-01T01:01:01.001Z'
18016+
usage:
18017+
allOf:
18018+
- $ref: '#/components/schemas/Numeric'
18019+
description: The usage of the feature for the invoice.
18020+
cost:
18021+
allOf:
18022+
- $ref: '#/components/schemas/Numeric'
18023+
description: The cost of the feature for the invoice.
18024+
groupBy:
18025+
type: object
18026+
additionalProperties:
18027+
type: string
18028+
nullable: true
18029+
description: The group by values the value is aggregated over.
18030+
description: InvoiceLineCostRow is a row of the feature cost for the invoice.
1803118031
InvoiceLineDiscounts:
1803218032
type: object
1803318033
properties:

api/spec/src/billing/cost.tsp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,25 @@ interface InvoiceCostHandler {
2020
* Get an invoice feature cost.
2121
*/
2222
@get
23-
@route("/api/v1/billing/invoices/{invoiceId}/features/{featureKey}/cost")
23+
@route("/api/v1/billing/invoices/{invoiceId}/lines/{lineId}/cost")
2424
@summary("Get an invoice feature cost")
25-
@operationId("getInvoiceFeatureCost")
26-
getInvoiceFeatureCost(
25+
@operationId("getInvoiceLineCost")
26+
getInvoiceLineCost(
2727
@path
2828
invoiceId: ULID,
2929

3030
@path
31-
featureKey: string,
31+
lineId: string,
3232

33-
...GetInvoiceFeatureCostParam,
34-
): InvoiceFeatureCost | OpenMeter.NotFoundError | OpenMeter.CommonErrors;
33+
...GetInvoiceLineCostParam,
34+
): InvoiceLineCost | OpenMeter.NotFoundError | OpenMeter.CommonErrors;
3535
}
3636

3737
/**
38-
* InvoiceFeatureCost is the cost of a feature for an invoice.
38+
* InvoiceLineCost is the cost of a feature for an invoice.
3939
*/
40-
@friendlyName("InvoiceFeatureCost")
41-
model InvoiceFeatureCost {
40+
@friendlyName("InvoiceLineCost")
41+
model InvoiceLineCost {
4242
/**
4343
* The start of the period the value is aggregated over.
4444
*/
@@ -72,14 +72,14 @@ model InvoiceFeatureCost {
7272
/**
7373
* The rows of the feature cost for the invoice.
7474
*/
75-
rows: InvoiceFeatureCostRow[];
75+
rows: InvoiceLineCostRow[];
7676
}
7777

7878
/**
79-
* InvoiceFeatureCostRow is a row of the feature cost for the invoice.
79+
* InvoiceLineCostRow is a row of the feature cost for the invoice.
8080
*/
81-
@friendlyName("InvoiceFeatureCostRow")
82-
model InvoiceFeatureCostRow {
81+
@friendlyName("InvoiceLineCostRow")
82+
model InvoiceLineCostRow {
8383
/**
8484
* The start of the window the value is aggregated over.
8585
*/
@@ -107,10 +107,10 @@ model InvoiceFeatureCostRow {
107107
}
108108

109109
/**
110-
* GetInvoiceFeatureCostParam is the parameter for the getInvoiceFeatureCost endpoint.
110+
* GetInvoiceLineCostParam is the parameter for the getInvoiceLineCost endpoint.
111111
*/
112-
@friendlyName("GetInvoiceFeatureCostParam")
113-
model GetInvoiceFeatureCostParam {
112+
@friendlyName("GetInvoiceLineCostParam")
113+
model GetInvoiceLineCostParam {
114114
/**
115115
* If not specified, a single usage aggregate will be returned for the entirety of the specified period for each subject and group.
116116
*

openmeter/billing/httpdriver/handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ type InvoiceHandler interface {
4949
}
5050

5151
type InvoiceCostHandler interface {
52-
GetInvoiceFeatureCost() GetInvoiceFeatureCostHandler
52+
GetInvoiceLineCost() GetInvoiceLineCostHandler
5353
}
5454

5555
type CustomerOverrideHandler interface {

0 commit comments

Comments
 (0)