Add comprehensive unit and e2e tests for invoice collection, queue logic, and modal interactions:

- Introduced e2e test for "Change Invoice Collection" in `change-invoice-collection.spec.ts`.
- Added unit tests for `CollectedOrderInvoiceOverview.vue` including edit flow for `closed_at`.
- Implemented tests for queue reliability, state handling, and customer actions:
  - `CollectedOrderInvoicesQueueHistory.vue`: polling, error handling, richer diagnostics, and retry logic.
  - `InvoicingBillingPeriod` views: refresh and queue state handling.
- Enhanced test coverage for Stripe queue functionality and related actions.
This commit is contained in:
Jeppe Bundgaard
2026-04-08 15:53:52 +02:00
parent 2b6129db29
commit 8eb315f439
40 changed files with 6673 additions and 1064 deletions
+241 -9
View File
@@ -5996,10 +5996,10 @@ paths:
post:
tags:
- Invoices
summary: Queue transfer of collected invoice to e-conomic
summary: Export collected invoice to e-conomic
description: |
Queues collected invoice transfer to e-conomic.
Processing runs asynchronously and can be tracked through queue status endpoints.
Exports collected invoice to e-conomic.
Uses async queue when available, otherwise falls back to synchronous processing.
operationId: queueCollectedInvoiceEconomicTransfer
requestBody:
required: true
@@ -6016,6 +6016,12 @@ paths:
type: boolean
default: false
responses:
'200':
description: Collected invoice export processed synchronously (fallback)
content:
application/json:
schema:
$ref: '#/components/schemas/EconomicTransferSynchronousFallbackResponse'
'202':
description: Collected invoice transfer queued
content:
@@ -6028,6 +6034,45 @@ paths:
'404': { $ref: '#/components/responses/NotFound' }
'500': { $ref: '#/components/responses/InternalServerError' }
/collected-invoices/stripe/book:
post:
tags:
- Invoices
summary: Export Stripe collected invoice to e-conomic
description: |
Exports a Stripe-backed collected invoice to e-conomic.
Uses async queue when available, otherwise falls back to synchronous processing.
operationId: queueStripeCollectedInvoiceEconomicTransfer
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [id]
properties:
id:
type: integer
minimum: 1
responses:
'200':
description: Stripe collected invoice export processed synchronously (fallback)
content:
application/json:
schema:
$ref: '#/components/schemas/EconomicTransferSynchronousFallbackResponse'
'202':
description: Stripe collected invoice transfer queued
content:
application/json:
schema:
$ref: '#/components/schemas/EconomicTransferQueueEnqueueResponse'
'400': { $ref: '#/components/responses/BadRequest' }
'401': { $ref: '#/components/responses/Unauthorized' }
'403': { $ref: '#/components/responses/Forbidden' }
'404': { $ref: '#/components/responses/NotFound' }
'500': { $ref: '#/components/responses/InternalServerError' }
/collected-invoices/economic/queue:
get:
tags:
@@ -6039,9 +6084,14 @@ paths:
in: query
required: false
description: Comma-separated queue statuses to filter by.
style: form
explode: false
schema:
type: string
example: "QUEUED,FAILED"
type: array
items:
$ref: '#/components/schemas/EconomicTransferQueueStatus'
uniqueItems: true
example: [QUEUED, FAILED]
- name: limit
in: query
required: false
@@ -6067,6 +6117,7 @@ paths:
'400': { $ref: '#/components/responses/BadRequest' }
'401': { $ref: '#/components/responses/Unauthorized' }
'403': { $ref: '#/components/responses/Forbidden' }
'503': { $ref: '#/components/responses/ServiceUnavailable' }
'500': { $ref: '#/components/responses/InternalServerError' }
/collected-invoices/economic/queue/status:
@@ -6093,6 +6144,7 @@ paths:
'401': { $ref: '#/components/responses/Unauthorized' }
'403': { $ref: '#/components/responses/Forbidden' }
'404': { $ref: '#/components/responses/NotFound' }
'503': { $ref: '#/components/responses/ServiceUnavailable' }
'500': { $ref: '#/components/responses/InternalServerError' }
/collected-invoices/economic/queue/retry:
@@ -6120,9 +6172,42 @@ paths:
schema:
$ref: '#/components/schemas/EconomicTransferQueueRetryResponse'
'400': { $ref: '#/components/responses/BadRequest' }
'409': { $ref: '#/components/responses/Conflict' }
'401': { $ref: '#/components/responses/Unauthorized' }
'403': { $ref: '#/components/responses/Forbidden' }
'404': { $ref: '#/components/responses/NotFound' }
'503': { $ref: '#/components/responses/ServiceUnavailable' }
'500': { $ref: '#/components/responses/InternalServerError' }
/collected-invoices/economic/queue/run:
post:
tags:
- Invoices
summary: Run one collected-invoice queue batch immediately
operationId: runCollectedInvoiceEconomicQueueBatch
requestBody:
required: false
content:
application/json:
schema:
type: object
properties:
limit:
type: integer
minimum: 1
maximum: 10
default: 10
responses:
'200':
description: Queue batch processed
content:
application/json:
schema:
$ref: '#/components/schemas/EconomicTransferQueueRunResponse'
'400': { $ref: '#/components/responses/BadRequest' }
'401': { $ref: '#/components/responses/Unauthorized' }
'403': { $ref: '#/components/responses/Forbidden' }
'503': { $ref: '#/components/responses/ServiceUnavailable' }
'500': { $ref: '#/components/responses/InternalServerError' }
/collected-invoices/economic/compare:
@@ -7805,8 +7890,8 @@ paths:
post:
tags:
- Modules
summary: Queue draft invoice export to e-conomic
description: Queue a draft invoice export job for asynchronous processing.
summary: Export draft invoice to e-conomic
description: Exports draft invoice using queue processing when available, with synchronous fallback when queue dependencies are unavailable.
operationId: queueDraftInvoiceExportToEconomic
requestBody:
required: true
@@ -7820,6 +7905,12 @@ paths:
type: integer
minimum: 1
responses:
'200':
description: Draft invoice export processed synchronously (fallback)
content:
application/json:
schema:
$ref: '#/components/schemas/EconomicTransferSynchronousFallbackResponse'
'202':
description: Draft invoice export queued
content:
@@ -7856,6 +7947,7 @@ paths:
'401': { $ref: '#/components/responses/Unauthorized' }
'403': { $ref: '#/components/responses/Forbidden' }
'404': { $ref: '#/components/responses/NotFound' }
'503': { $ref: '#/components/responses/ServiceUnavailable' }
'500': { $ref: '#/components/responses/InternalServerError' }
/economic/invoice/draft/export/retry:
@@ -7886,14 +7978,15 @@ paths:
'401': { $ref: '#/components/responses/Unauthorized' }
'403': { $ref: '#/components/responses/Forbidden' }
'404': { $ref: '#/components/responses/NotFound' }
'503': { $ref: '#/components/responses/ServiceUnavailable' }
'500': { $ref: '#/components/responses/InternalServerError' }
/economic/invoice/export:
post:
tags:
- Modules
summary: Queue invoice export to e-conomic
description: Queue booked invoice export job for asynchronous processing.
summary: Export invoice to e-conomic
description: Exports booked invoice using queue processing when available, with synchronous fallback when queue dependencies are unavailable.
operationId: queueInvoiceExportToEconomic
requestBody:
required: true
@@ -7907,6 +8000,12 @@ paths:
type: integer
minimum: 1
responses:
'200':
description: Invoice export processed synchronously (fallback)
content:
application/json:
schema:
$ref: '#/components/schemas/EconomicTransferSynchronousFallbackResponse'
'202':
description: Invoice export queued
content:
@@ -7943,6 +8042,7 @@ paths:
'401': { $ref: '#/components/responses/Unauthorized' }
'403': { $ref: '#/components/responses/Forbidden' }
'404': { $ref: '#/components/responses/NotFound' }
'503': { $ref: '#/components/responses/ServiceUnavailable' }
'500': { $ref: '#/components/responses/InternalServerError' }
/economic/invoice/export/retry:
@@ -7973,6 +8073,7 @@ paths:
'401': { $ref: '#/components/responses/Unauthorized' }
'403': { $ref: '#/components/responses/Forbidden' }
'404': { $ref: '#/components/responses/NotFound' }
'503': { $ref: '#/components/responses/ServiceUnavailable' }
'500': { $ref: '#/components/responses/InternalServerError' }
# Module - Stripe Endpoints
@@ -11056,6 +11157,12 @@ components:
application/json:
schema:
$ref: '#/components/schemas/Error'
Conflict:
description: Conflict - Request could not be completed due to current resource state
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
Unauthorized:
description: Unauthorized - Invalid or missing authentication token
content:
@@ -11074,6 +11181,12 @@ components:
application/json:
schema:
$ref: '#/components/schemas/Error'
ServiceUnavailable:
description: Service unavailable - Required async queue dependencies are unavailable
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
InternalServerError:
description: Internal server error
content:
@@ -12598,6 +12711,10 @@ components:
type: object
nullable: true
additionalProperties: true
details_summary:
type: object
nullable: true
additionalProperties: true
created_by:
type: integer
nullable: true
@@ -12639,10 +12756,14 @@ components:
properties:
message:
type: string
job_id:
type: integer
minimum: 1
job:
$ref: '#/components/schemas/EconomicTransferQueueJob'
required:
- message
- job_id
- job
meta:
oneOf:
@@ -12662,6 +12783,44 @@ components:
- meta
- includes
EconomicTransferSynchronousFallbackResponse:
type: object
properties:
success:
type: boolean
data:
type: object
properties:
message:
type: string
mode:
type: string
enum: [synchronous_fallback]
result:
type: object
additionalProperties: true
required:
- message
- mode
- result
meta:
oneOf:
- type: array
items: {}
- type: object
additionalProperties: true
includes:
oneOf:
- type: array
items: {}
- type: object
additionalProperties: true
required:
- success
- data
- meta
- includes
EconomicTransferQueueStatusResponse:
type: object
properties:
@@ -12720,6 +12879,64 @@ components:
- meta
- includes
EconomicTransferQueueRunResponse:
type: object
properties:
success:
type: boolean
data:
type: object
properties:
message:
type: string
processed:
type: integer
minimum: 0
completed:
type: integer
minimum: 0
failed:
type: integer
minimum: 0
jobs:
type: array
items:
type: integer
minimum: 1
limit:
type: integer
minimum: 1
maximum: 10
transfer_type:
type: string
enum:
- COLLECTED_INVOICE_EXPORT
required:
- message
- processed
- completed
- failed
- jobs
- limit
- transfer_type
meta:
oneOf:
- type: array
items: {}
- type: object
additionalProperties: true
includes:
oneOf:
- type: array
items: {}
- type: object
additionalProperties: true
required:
- success
- data
- meta
- includes
EconomicTransferQueueListResponse:
type: object
properties:
@@ -12735,9 +12952,24 @@ components:
count:
type: integer
minimum: 0
total:
type: integer
minimum: 0
limit:
type: integer
minimum: 1
offset:
type: integer
minimum: 0
has_more:
type: boolean
required:
- items
- count
- total
- limit
- offset
- has_more
meta:
oneOf:
- type: array