2019-05-28 16:49:36 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-06-29 16:09:27 +02:00
|
|
|
max_invoices = @invoices.except(:offset, :limit, :order).count
|
2016-05-31 17:01:26 +02:00
|
|
|
|
2016-05-31 10:02:27 +02:00
|
|
|
json.array!(@invoices) do |invoice|
|
2016-06-29 16:09:27 +02:00
|
|
|
json.maxInvoices max_invoices
|
2019-05-28 16:49:36 +02:00
|
|
|
json.extract! invoice, :id, :created_at, :reference, :invoiced_type, :avoir_date
|
|
|
|
json.user_id invoice.invoicing_profile.user_id
|
2019-07-29 12:17:57 +02:00
|
|
|
json.total invoice.total / 100.00
|
2020-06-02 11:37:24 +02:00
|
|
|
|
2019-05-28 16:49:36 +02:00
|
|
|
json.name invoice.invoicing_profile.full_name
|
2019-01-09 16:28:23 +01:00
|
|
|
json.has_avoir invoice.refunded?
|
2016-05-31 10:02:27 +02:00
|
|
|
json.is_avoir invoice.is_a?(Avoir)
|
2019-01-09 16:28:23 +01:00
|
|
|
json.is_subscription_invoice invoice.subscription_invoice?
|
2019-09-10 16:45:45 +02:00
|
|
|
json.stripe invoice.paid_with_stripe?
|
2016-05-31 10:02:27 +02:00
|
|
|
json.date invoice.is_a?(Avoir) ? invoice.avoir_date : invoice.created_at
|
|
|
|
json.prevent_refund invoice.prevent_refund?
|
2019-02-12 16:00:36 +01:00
|
|
|
json.chained_footprint invoice.check_footprint
|
2020-05-04 10:56:27 +02:00
|
|
|
if invoice.operator_profile
|
|
|
|
json.operator do
|
|
|
|
json.id invoice.operator_profile.user_id
|
|
|
|
json.extract! invoice.operator_profile, :first_name, :last_name
|
|
|
|
end
|
|
|
|
end
|
2019-01-09 16:28:23 +01:00
|
|
|
end
|