2022-11-16 15:41:08 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# openAPI documentation for accounting endpoints
|
|
|
|
class OpenAPI::V1::AccountingDoc < OpenAPI::V1::BaseDoc
|
|
|
|
resource_description do
|
|
|
|
short 'Accounting lines'
|
|
|
|
desc 'Accounting lines according to the French General Accounting Plan (PCG)'
|
|
|
|
formats FORMATS
|
|
|
|
api_version API_VERSION
|
|
|
|
end
|
|
|
|
|
|
|
|
include OpenAPI::V1::Concerns::ParamGroups
|
|
|
|
|
|
|
|
doc_for :index do
|
|
|
|
api :GET, "/#{API_VERSION}/accounting", 'Accounting lines'
|
2022-11-23 17:35:39 +01:00
|
|
|
description 'All accounting lines, paginated (necessarily becauce there is a lot of data) with optional dates filtering. ' \
|
2022-12-08 16:14:59 +01:00
|
|
|
'Ordered by *date* descendant.<br><br>The field *status* indicates if the accounting data is being built ' \
|
|
|
|
'or if the build is over. Possible status are: <i>building</i> or <i>built</i>.'
|
2022-11-16 15:41:08 +01:00
|
|
|
param_group :pagination
|
|
|
|
param :after, DateTime, optional: true, desc: 'Filter accounting lines to lines after the given date.'
|
|
|
|
param :before, DateTime, optional: true, desc: 'Filter accounting lines to lines before the given date.'
|
2022-11-23 17:35:39 +01:00
|
|
|
param :invoice_id, [Integer, Array], optional: true, desc: 'Scope the request to one or various invoices.'
|
|
|
|
|
2022-11-16 15:41:08 +01:00
|
|
|
example <<-LINES
|
|
|
|
# /open_api/v1/accounting?after=2022-01-01T00:00:00+02:00&page=1&per_page=3
|
|
|
|
{
|
|
|
|
"lines": [
|
|
|
|
{
|
2022-11-23 17:35:39 +01:00
|
|
|
"id": 1,
|
|
|
|
"line_type": "client",
|
2022-11-16 15:41:08 +01:00
|
|
|
"journal_code": "VT01",
|
|
|
|
"date": "2022-01-02T18:14:21+01:00",
|
|
|
|
"account_code": "5802",
|
2022-11-23 17:35:39 +01:00
|
|
|
"account_label": "Card customers",
|
|
|
|
"analytical_code": "",
|
2022-11-16 15:41:08 +01:00
|
|
|
"invoice": {
|
|
|
|
"reference": "22010009/VL",
|
|
|
|
"id": 274,
|
2022-11-23 17:35:39 +01:00
|
|
|
"label": "Subscription of Dupont Marcel for 1 month starting from 2022, january 2nd",
|
|
|
|
"url": "/open_api/v1/invoices/247/download"
|
2022-11-16 15:41:08 +01:00
|
|
|
},
|
2022-11-23 17:35:39 +01:00
|
|
|
"user_invoicing_profile_id": 6512,
|
|
|
|
"debit": 1400,
|
|
|
|
"credit": 0
|
2022-11-16 15:41:08 +01:00
|
|
|
"currency": "EUR",
|
2022-11-23 17:35:39 +01:00
|
|
|
"summary": "Dupont Marcel, 22010009/VL, subscr."
|
2022-11-16 15:41:08 +01:00
|
|
|
},
|
|
|
|
{
|
2022-11-23 17:35:39 +01:00
|
|
|
"id": 2,
|
|
|
|
"line_type": "item",
|
2022-11-16 15:41:08 +01:00
|
|
|
"journal_code": "VT01",
|
|
|
|
"date": "2022-01-02T18:14:21+01:00",
|
2022-11-23 17:35:39 +01:00
|
|
|
"account_code": "7071",
|
|
|
|
"account_label": "Subscriptions",
|
2022-11-16 15:41:08 +01:00
|
|
|
"analytical_code": "P3D71",
|
|
|
|
"invoice": {
|
|
|
|
"reference": "22010009/VL",
|
|
|
|
"id": 274,
|
2022-11-23 17:35:39 +01:00
|
|
|
"label": "Subscription of Dupont Marcel for 1 month starting from 2022, january 2nd",
|
|
|
|
"url": "/open_api/v1/invoices/247/download"
|
2022-11-16 15:41:08 +01:00
|
|
|
},
|
2022-11-23 17:35:39 +01:00
|
|
|
"user_invoicing_profile_id": 6512,
|
|
|
|
"debit": 0,
|
|
|
|
"credit": 1167
|
2022-11-16 15:41:08 +01:00
|
|
|
"currency": "EUR",
|
2022-11-23 17:35:39 +01:00
|
|
|
"summary": "Dupont Marcel, 22010009/VL, subscr."
|
2022-11-16 15:41:08 +01:00
|
|
|
},
|
|
|
|
{
|
2022-11-23 17:35:39 +01:00
|
|
|
"id": 3,
|
|
|
|
"line_type": "vat",
|
2022-11-16 15:41:08 +01:00
|
|
|
"journal_code": "VT01",
|
|
|
|
"date": "2022-01-02T18:14:21+01:00",
|
2022-11-23 17:35:39 +01:00
|
|
|
"account_code": "4457",
|
|
|
|
"account_label": "Collected VAT",
|
2022-11-16 15:41:08 +01:00
|
|
|
"analytical_code": "P3D71",
|
|
|
|
"invoice": {
|
|
|
|
"reference": "22010009/VL",
|
|
|
|
"id": 274,
|
2022-11-23 17:35:39 +01:00
|
|
|
"label": "Subscription of Dupont Marcel for 1 month starting from 2022, january 2nd",
|
|
|
|
"url": "/open_api/v1/invoices/247/download"
|
2022-11-16 15:41:08 +01:00
|
|
|
},
|
2022-11-23 17:35:39 +01:00
|
|
|
"user_invoicing_profile_id": 6512,
|
|
|
|
"debit": 0,
|
|
|
|
"credit": 233
|
2022-11-16 15:41:08 +01:00
|
|
|
"currency": "EUR",
|
2022-11-23 17:35:39 +01:00
|
|
|
"summary": "Dupont Marcel, 22010009/VL, subscr."
|
2022-11-16 15:41:08 +01:00
|
|
|
}
|
2022-12-08 16:14:59 +01:00
|
|
|
],
|
|
|
|
"status": "built"
|
2022-11-16 15:41:08 +01:00
|
|
|
}
|
|
|
|
LINES
|
|
|
|
end
|
|
|
|
end
|