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

31 lines
1.9 KiB
Ruby
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# encoding: UTF-8
# frozen_string_literal: true
module API
module V2
module Management
module Entities
class Deposit < Base
expose :tid, documentation: { type: Integer, desc: 'The shared transaction ID.' }
expose :currency_id, as: :currency, documentation: { type: String, desc: 'The currency code.' }
expose(:uid, documentation: { type: String, desc: 'The shared user ID.' }) { |w| w.member.uid }
expose(:type, documentation: { type: String, desc: 'The deposit type (fiat or coin).' }) { |d| d.class.name.demodulize.underscore }
expose :amount, documentation: { type: String, desc: 'The deposit amount.' }, format_with: :decimal
states = [
'«submitted» initial state.',
'«canceled» deposit has been canceled by outer service.',
'«rejected» deposit has been rejected by outer service..',
'«accepted» deposit has been accepted by outer service, money are loaded.'
]
expose :aasm_state, as: :state, documentation: { type: String, desc: 'The deposit state. ' + states.join(' ') }
expose :created_at, format_with: :iso8601, documentation: { type: String, desc: 'The datetime when deposit was created.' }
expose :completed_at, format_with: :iso8601, documentation: { type: String, desc: 'The datetime when deposit was completed.' }
expose :txid, as: :blockchain_txid, if: -> (d, _) { d.currency.coin? }, documentation: { type: String, desc: 'The transaction ID on the Blockchain (coin only).' }
expose :confirmations, as: :blockchain_confirmations, if: -> (d, _) { d.currency.coin? }, documentation: { type: String, desc: 'The number of transaction confirmations on the Blockchain (coin only).' }
expose :transfer_type, documentation: { type: String, desc: 'deposit transfer_type.' }
end
end
end
end
end