Files
Dena/app/api/v2/entities/payment_address.rb
2026-08-13 19:50:53 +03:30

42 lines
917 B
Ruby

# encoding: UTF-8
# frozen_string_literal: true
module API
module V2
module Entities
class PaymentAddress < Base
expose(
:currencies,
documentation: {
desc: 'Currencies codes.',
is_array: true,
example: -> { ::Currency.visible.codes }
}
) do |pa|
pa.wallet.currencies.codes
end
expose(
:address,
documentation: {
desc: 'Payment address.',
type: String
}
) do |pa, options|
options[:address_format] ? pa.format_address(options[:address_format]) : pa.address
end
expose(
:state,
documentation: {
desc: 'Payment address state.',
type: String
}
) do |pa|
pa.address.present? ? 'active' : 'pending'
end
end
end
end
end