2019-03-26 14:27:39 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# openAPI documentation for invoices endpoints
|
2016-05-05 15:02:02 +02:00
|
|
|
class OpenAPI::V1::InvoicesDoc < OpenAPI::V1::BaseDoc
|
|
|
|
resource_description do
|
|
|
|
short 'Invoices'
|
|
|
|
desc 'Invoices'
|
|
|
|
formats FORMATS
|
|
|
|
api_version API_VERSION
|
|
|
|
end
|
|
|
|
|
|
|
|
include OpenAPI::V1::Concerns::ParamGroups
|
|
|
|
|
|
|
|
doc_for :index do
|
2019-03-26 14:27:39 +01:00
|
|
|
api :GET, "/#{API_VERSION}/invoices", 'Invoices index'
|
2016-05-05 15:02:02 +02:00
|
|
|
description "Index of users' invoices, with optional pagination. Order by *created_at* descendant."
|
|
|
|
param_group :pagination
|
2019-03-26 14:27:39 +01:00
|
|
|
param :user_id, [Integer, Array], optional: true, desc: 'Scope the request to one or various users.'
|
|
|
|
example <<-INVOICES
|
2016-05-05 15:02:02 +02:00
|
|
|
# /open_api/v1/invoices?user_id=211&page=1&per_page=3
|
|
|
|
{
|
|
|
|
"invoices": [
|
|
|
|
{
|
|
|
|
"id": 2809,
|
|
|
|
"invoiced_id": 3257,
|
|
|
|
"user_id": 211,
|
|
|
|
"invoiced_type": "Reservation",
|
|
|
|
"stp_invoice_id": "in_187DLE4zBvgjueAZ6L7SyQlU",
|
2019-09-10 16:45:45 +02:00
|
|
|
"stp_payment_intent_id": "pi_1Dat4P2eZvKYlo2C3MxszwQp",
|
2016-05-05 15:02:02 +02:00
|
|
|
"reference": "1605017/VL",
|
|
|
|
"total": 1000,
|
|
|
|
"type": null,
|
|
|
|
"description": null,
|
|
|
|
"invoice_url": "/open_api/v1/invoices/2809/download",
|
|
|
|
"invoiced": {
|
|
|
|
"created_at": "2016-05-04T01:54:16.686+02:00"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": 2783,
|
|
|
|
"invoiced_id": 3229,
|
|
|
|
"user_id": 211,
|
|
|
|
"invoiced_type": "Reservation",
|
|
|
|
"stp_invoice_id": "in_185Hmt4zBvgjueAZl5lio1pK",
|
2019-09-10 16:45:45 +02:00
|
|
|
"stp_payment_intent_id": "pi_2Dat4P2eYbKYlo2C3MxszwQp",
|
2016-05-05 15:02:02 +02:00
|
|
|
"reference": "1604176/VL",
|
|
|
|
"total": 2000,
|
|
|
|
"type": null,
|
|
|
|
"description": null,
|
|
|
|
"invoice_url": "/open_api/v1/invoices/2783/download",
|
|
|
|
"invoiced": {
|
|
|
|
"created_at": "2016-04-28T18:14:52.524+02:00"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": 2773,
|
|
|
|
"invoiced_id": 3218,
|
|
|
|
"user_id": 211,
|
|
|
|
"invoiced_type": "Reservation",
|
|
|
|
"stp_invoice_id": "in_184oNK4zBvgjueAZJdOxHJjT",
|
2019-09-10 16:45:45 +02:00
|
|
|
"stp_payment_intent_id": "pi_1Pub4P2eZvKYlo2C3MxszwQm",
|
2016-05-05 15:02:02 +02:00
|
|
|
"reference": "1604166/VL",
|
|
|
|
"total": 2000,
|
|
|
|
"type": null,
|
|
|
|
"description": null,
|
|
|
|
"invoice_url": "/open_api/v1/invoices/2773/download",
|
|
|
|
"invoiced": {
|
|
|
|
"created_at": "2016-04-27T10:50:30.806+02:00"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
2019-03-26 14:27:39 +01:00
|
|
|
INVOICES
|
2016-05-05 15:02:02 +02:00
|
|
|
end
|
|
|
|
|
2019-03-26 14:27:39 +01:00
|
|
|
doc_for :download do
|
|
|
|
api :GET, "/#{API_VERSION}/invoices/:id/download", 'Download an invoice'
|
|
|
|
param :id, Integer, desc: 'Invoice id', required: true
|
2016-05-05 15:02:02 +02:00
|
|
|
|
2019-03-26 14:27:39 +01:00
|
|
|
example <<-URL
|
|
|
|
# /open_api/v1/invoices/2809/download
|
|
|
|
URL
|
|
|
|
end
|
2016-05-05 15:02:02 +02:00
|
|
|
end
|