diff --git a/app/api/v2/account/withdraws.rb b/app/api/v2/account/withdraws.rb index eae682285b..ac34044cca 100644 --- a/app/api/v2/account/withdraws.rb +++ b/app/api/v2/account/withdraws.rb @@ -47,7 +47,7 @@ class Withdraws < Grape::API desc: 'Wallet address on the Blockchain.' requires :currency, type: String, - values: { value: -> { Currency.coins.codes(bothcase: true) }, message: 'account.withdraw.currency_doesnt_exist'}, + values: { value: -> { Currency.coins.codes(bothcase: true) }, message: 'account.currency.doesnt_exist'}, desc: 'The currency code.' requires :amount, type: { value: BigDecimal, message: 'account.withdraw.non_decimal_amount' }, diff --git a/app/api/v2/market/named_params.rb b/app/api/v2/market/named_params.rb index 8130c0823f..3056bca647 100644 --- a/app/api/v2/market/named_params.rb +++ b/app/api/v2/market/named_params.rb @@ -7,13 +7,6 @@ module Market module NamedParams extend ::Grape::API::Helpers - params :currency do - requires :currency, - type: String, - values: { value: -> { Currency.enabled.pluck(:id) }, message: 'account.currency.doesnt_exist' }, - desc: 'The currency code.' - end - params :market do requires :market, type: String, diff --git a/docs/api/errors.md b/docs/api/errors.md new file mode 100644 index 0000000000..637b68bff2 --- /dev/null +++ b/docs/api/errors.md @@ -0,0 +1,91 @@ +/account +``` +account.currency.doesnt_exist Currency doesn't exist +account.deposit.invalid_state Deposit invalid state +account.deposit.non_integer_limit Value you send could not be parsed into Integer type +account.deposit.invalid_limit Invalid limit +account.deposit.non_positive_page Page value must be positive +account.deposit.empty_txid Txid is missing, txid is empty +account.deposit_address.invalid_address_format Invalid deposit address format +account.deposit_address.doesnt_support_cash_address_format Currency doesn't support cash address format +account.withdraw.non_integer_limit Limit Value you send could not be parsed into Integer type +account.withdraw.invalid_limit Invalid limit +account.withdraw.non_positive_page Page value must be positive +account.withdraw.non_integer_otp Otp value could not be parsed into Integer type +account.withdraw.empty_otp Otp is missing, otp is empty +account.withdraw.empty_rid Rid is missing, rid is empty +account.withdraw.non_decimal_amount Amount value you send could not be parsed into Decimal type +account.withdraw.non_positive_amount Amount value must be positive +account.currency.doesnt_exist Currency doesn't exist +account.deposit.not_permitted Please, pass the corresponding verification steps to deposit funds +account.withdraw.not_permitted Please, pass the corresponding verification steps to withdraw funds +account.withdraw.insufficient_balance Account balance is insufficient +account.withdraw.invalid_amount Invalid withdraw amount +account.withdraw.create_error Failed to create withdraw +account.withdraw.invalid_otp Invalid otp +withdraw.status.disabled_api Withdrawal API is disabled +``` + +/market +``` +market.market.doesnt_exist Market doesn't exist +market.order.invalid_state Invalid deposit state +market.order.invalid_limit Invalid limit +market.order.non_integer_limit Limit value you send could not be parsed into Integer type +market.trade.empty_page Page is missing, page is empty +market.order.invalid_order_by Invalid order_by +market.order.invalid_side Invalid order side +market.order.non_decimal_volume Volume value you send could not be parsed into Decimal type +market.order.non_positive_volume Volume value must be positive +market.order.invalid_type Invalid order type +market.order.non_decimal_price Volume value you send could not be parsed into Decimal type +market.order.non_positive_price Volume value must be positive +market.order.non_integer_id Id value you send could not be parsed into Integer type +market.order.empty_id Id is missing, id is empty +market.trade.non_integer_limit Limit value you send could not be parsed into Integer type +market.trade.invalid_limit Invalid limit +market.trade.empty_page Page is missing, page is empty +market.trade.non_integer_timestamp Timestamp value you send could not be parsed into Integer type +market.trade.empty_timestamp Timestamp is missing, timestamp is empty +market.trade.invalid_order_by Invalid order_by +market.order.insufficient_market_liquidity Isufficient market liquidity +market.order.invalid_volume_or_price Invalid volume or price +market.order.create_error Failed to create error +market.order.cancel_error Failed to cancel error +market.order.market_order_price Market order doesn't have price +market.trade.not_permitted Please, pass the corresponding verification steps to enable trading +market.account.insufficient_balance Account balance is insufficient +``` + +/public +``` +public.currency.doesnt_exist Currency doesn't exist +public.currency.invalid_type +public.market.doesnt_exist Market doesn't exist +public.order_book.non_integer_ask_limit +public.order_book.invalid_ask_limit +public.order_book.non_integer_bid_limit +public.order_book.invalid_bid_limit +public.trade.non_integer_limit Limit value you send could not be parsed into Integer type +public.trade.invalid_limit Invalid limit +public.trade.non_integer_limit Limit value you send could not be parsed into Integer type +public.trade.non_positive_page Page value must be positive +public.trade.non_integer_timestamp +public.trade.invalid_order_by +public.market_depth.non_integer_limit Limit value you send could not be parsed into Integer type +public.market_depth.invalid_limit Invalid limit +public.k_line.non_integer_period +public.k_line.invalid_period +public.k_line.non_integer_time_from +public.k_line.empty_time_from +public.k_line.non_integer_time_to +public.k_line.empty_time_to +public.k_line.non_integer_limit Limit value you send could not be parsed into Integer type +public.k_line.invalid_limit Invalid limit +``` +auth +``` +jwt.decode_and_verify Couldn't decode and verify jwt +record.not_found Record not found +server.internal_error Internal Server Error +``` \ No newline at end of file diff --git a/spec/api/v2/account/withdraws_spec.rb b/spec/api/v2/account/withdraws_spec.rb index 206b29d76b..5d3a64a5d5 100644 --- a/spec/api/v2/account/withdraws_spec.rb +++ b/spec/api/v2/account/withdraws_spec.rb @@ -109,7 +109,7 @@ it 'doesn\'t allow fiat' do api_post '/api/v2/account/withdraws', params: data, token: token expect(response).to have_http_status(422) - expect(response).to include_api_error('account.withdraw.currency_doesnt_exist') + expect(response).to include_api_error('account.currency.doesnt_exist') end end @@ -196,7 +196,7 @@ data[:currency] = nil api_post '/api/v2/account/withdraws', params: data, token: token expect(response).to have_http_status(422) - expect(response).to include_api_error('account.withdraw.currency_doesnt_exist') + expect(response).to include_api_error('account.currency.doesnt_exist') end it 'creates new withdraw and immediately submits it' do