2021-02-04 17:51:16 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
json.extract! payment_schedule, :id, :reference, :created_at, :payment_method
|
|
|
|
json.total payment_schedule.total / 100.00
|
|
|
|
json.chained_footprint payment_schedule.check_footprint
|
|
|
|
json.user do
|
2021-02-09 12:09:26 +01:00
|
|
|
json.id payment_schedule.invoicing_profile&.user&.id
|
2021-02-04 17:51:16 +01:00
|
|
|
json.name payment_schedule.invoicing_profile.full_name
|
|
|
|
end
|
|
|
|
if payment_schedule.operator_profile
|
|
|
|
json.operator do
|
|
|
|
json.id payment_schedule.operator_profile.user_id
|
|
|
|
json.extract! payment_schedule.operator_profile, :first_name, :last_name
|
|
|
|
end
|
|
|
|
end
|
2021-05-28 17:34:20 +02:00
|
|
|
json.main_object do
|
|
|
|
json.type payment_schedule.main_object.object_type
|
|
|
|
json.id payment_schedule.main_object.object_id
|
|
|
|
end
|
2021-06-04 18:26:20 +02:00
|
|
|
if payment_schedule.gateway_subscription
|
2022-01-03 17:13:35 +01:00
|
|
|
# this attribute is used to known which gateway should we interact with, in the front-end
|
2022-01-17 12:38:53 +01:00
|
|
|
json.gateway payment_schedule.gateway_subscription.gateway
|
2021-06-04 18:26:20 +02:00
|
|
|
end
|
2021-02-04 17:51:16 +01:00
|
|
|
json.items payment_schedule.payment_schedule_items do |item|
|
2022-01-03 11:24:08 +01:00
|
|
|
json.partial! 'api/payment_schedules/payment_schedule_item', item: item
|
2021-02-04 17:51:16 +01:00
|
|
|
end
|