Skip to content

Commit

Permalink
update invoice with failed status, add error_details object, add retr…
Browse files Browse the repository at this point in the history
…y endpoint on invoice
  • Loading branch information
annvelents committed Aug 23, 2024
1 parent ec4c7cb commit 5fbd131
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 0 deletions.
46 changes: 46 additions & 0 deletions openapi.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/openapi.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions src/resources/invoice_retry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
put:
tags:
- invoices
summary: Retry generation of a failed invoice
description: This endpoint is used for retrying to generate a failed invoice.
parameters:
- $ref: '../parameters/lago_invoice_id.yaml'

operationId: retryInvoice
responses:
'200':
description: Invoice generation has been retried
content:
application/json:
schema:
$ref: '../schemas/Invoice.yaml'
'401':
$ref: '../responses/Unauthorized.yaml'
'404':
$ref: '../responses/NotFound.yaml'
20 changes: 20 additions & 0 deletions src/schemas/ErrorDetailObject.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
type: object
required:
- lago_id
- error_code
- details
properties:
lago_id:
type: string
format: "uuid"
nullable: true
description: Unique identifier assigned to the error_detail within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the error's record within the Lago system.
example: "1a901a90-1a90-1a90-1a90-1a901a901a90"
error_code:
type: string
description: Code that specifies part of the application / connection, where the error originally happened
example: "tax_error"
details:
type: object
description: Key value list of more elaborated error detail, where by the key of error_code an external service error details are stored
example: { tax_error: 'taxDateTooFarInFuture' }
2 changes: 2 additions & 0 deletions src/schemas/InvoiceObject.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,13 @@ properties:
- draft
- finalized
- voided
- failed
description: |-
The status of the invoice. It indicates the current state of the invoice and can have two possible values:
- `draft`: the invoice is in the draft state, waiting for the end of the grace period to be finalized. During this period, events can still be ingested and added to the invoice.
- `finalized`: the invoice has been issued and finalized. In this state, events cannot be ingested or added to the invoice anymore.
- `voided`: the invoice has been issued and subsequently voided. In this state, events cannot be ingested or added to the invoice anymore.
- `failed`: during an attempt of finalization of the invoice, an error happened. This invoice will have an array of error_details, explaining, in which part of the system an error happened and how it's possible to fix it. This invoice can't be edited or updated, only retried. This action will discard current error_details and will create new ones if the finalization failed again.
example: finalized
payment_status:
type: string
Expand Down
4 changes: 4 additions & 0 deletions src/schemas/InvoiceObjectExtended.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ allOf:
type: array
items:
$ref: './SubscriptionObject.yaml'
error_details:
type: array
items:
$ref: './ErrorDetailObject.yaml'

0 comments on commit 5fbd131

Please sign in to comment.