add mutations to exchange painel
This commit is contained in:
@@ -9,7 +9,9 @@ module Mutations
|
||||
currency_id = decode_id(order[:currency_id])
|
||||
|
||||
ActiveRecord::Base.transaction do
|
||||
current_user.fiat_balance.withdrawal!(order[:amount_cents])
|
||||
current_user
|
||||
.fiat_balance
|
||||
.withdrawal!(order[:amount_cents])
|
||||
|
||||
record = BuyCryptoOrder.create!(
|
||||
paid_amount_cents: order[:amount_cents],
|
||||
|
||||
@@ -10,10 +10,12 @@ module Mutations
|
||||
amount = BigDecimal(order[:amount])
|
||||
|
||||
ActiveRecord::Base.transaction do
|
||||
current_user.balances.find_by!(currency_id: currency_id)
|
||||
current_user
|
||||
.balances
|
||||
.find_by!(currency_id: currency_id)
|
||||
.withdrawal!(amount)
|
||||
|
||||
record = SellCryptoOrder.create(
|
||||
record = SellCryptoOrder.create!(
|
||||
paid_amount: amount,
|
||||
currency_id: currency_id,
|
||||
user_id: current_user.id,
|
||||
|
||||
Reference in New Issue
Block a user