Class: Event::Participant
Constant Summary
Constants included
from Currency
Currency::COMMISSION_PRECISION, Currency::LIABILITY_CODES, Currency::RATIO_PRECISION, Currency::REVENUE_CODES, Currency::TOKENS_AMOUNT_PRECISION
Instance Method Summary
collapse
Methods included from Currency
#fetch_currency
Instance Method Details
#transfer_amount ⇒ Object
Instance Methods =====================================================
32
33
34
35
|
# File 'app/models/event/participant.rb', line 32
def transfer_amount
perform_transfer(transfer_params)
save!
end
|
#transfer_params ⇒ Object
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# File 'app/models/event/participant.rb', line 37
def transfer_params
currency = fetch_currency(event.currency_id)
.fetch(:type)
.to_sym
operations =
[
{ currency: event.currency_id,
amount: event.amount,
account_src: {code: Currency::LIABILITY_CODES[currency][:main],
uid: event.creator_uid},
account_dst: {code: Currency::LIABILITY_CODES[currency][:main],
uid: uid}
}
]
{
key: "event-#{self.id}",
category: :purchases,
description: "Event deposit participant prize #{uid}",
operations: operations
}
end
|