Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Withdrawal of crypto (both BTC & XRP) not working #285

Closed
dan-turner opened this issue Jan 12, 2018 · 6 comments
Closed

Withdrawal of crypto (both BTC & XRP) not working #285

dan-turner opened this issue Jan 12, 2018 · 6 comments

Comments

@dan-turner
Copy link

Getting the following error on submit, identical stack trace for BTC too:

Started POST "/withdraws/ripples" for 35.227.218.32 at 2018-01-12 05:58:43 +0000
Processing by Private::Withdraws::RipplesController#create as HTML
  Parameters: {"authenticity_token"=>"YcObOadly2jfJJp+iU8qWnGpMDMPBXPFScyVGbQOS7DJPFWACmDd+Z6ZH0IgjLsEVrNnhwDOZjMwJyGlaLyKEA==", "data"=>{"withdraw"=>{"currency"=>"xrp", "sum"=>0.1, "fund_source_id"=>6}}, "ripple"=>{"data"=>{"withdraw"=>{"currency"=>"xrp", "sum"=>0.1, "fund_source_id"=>6}}}}
  Member Load (1.7ms)  SELECT  `members`.* FROM `members` WHERE `members`.`disabled` = 0 AND `members`.`id` = 3  ORDER BY `members`.`id` ASC LIMIT 1
  Account Load (1.4ms)  SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`member_id` = 3
  IdDocument Load (1.0ms)  SELECT  `id_documents`.* FROM `id_documents` WHERE `id_documents`.`member_id` = 3 LIMIT 1
  Account Load (1.0ms)  SELECT  `accounts`.* FROM `accounts` WHERE `accounts`.`member_id` = 3 AND `accounts`.`currency` = 3  ORDER BY `accounts`.`id` ASC LIMIT 1
Completed 500 Internal Server Error in 23ms (ActiveRecord: 5.1ms)

NoMethodError (undefined method `[]=' for nil:NilClass):
  app/controllers/concerns/withdraws/withdrawable.rb:33:in `withdraw_params'
  app/controllers/concerns/withdraws/withdrawable.rb:10:in `create'
  lib/middleware/security.rb:11:in `call'
@dan-turner dan-turner changed the title Withdraw crypto (both BTC & XRP) not working Withdrawal of crypto (both BTC & XRP) not working Jan 12, 2018
@yivo
Copy link

yivo commented Jan 12, 2018

Here is the patch which broke this: gfedorenko@204c3c3#diff-f6b6994f503d9b14c7e8f06a7f954ef0R54

@yivo
Copy link

yivo commented Jan 12, 2018

The problem is that data which is passed should be { DATA } but { data: DATA } is passed.

@yivo
Copy link

yivo commented Jan 12, 2018

We need to globally configure default angular HTTP adapter to send forgery token. Example of code:

app.config ['$httpProvider', ($httpProvider) ->

  $httpProvider.defaults.headers.common['X-CSRF-Token'] =
    document.querySelector('meta[name="csrf-token"]').getAttribute('content')

]

@maniharicse
Copy link

tried the above workaround.
$http.post("/withdraws/#{withdraw_channel.resource_name}", data)

Getting the below error now.

NoMethodError at /withdraws/ripples

undefined method `fund_source_id=' for #Withdraws::Ripple:0x00007f8039c8a8a0
Did you mean? fund_source=
fund_source

app/controllers/concerns/withdraws/withdrawable.rb, line 10

    5       included do
    6         before_filter :fetch
    7       end
    8   
    9       def create
>  10         @withdraw = model_kls.new(withdraw_params)
   11   
   12       end
   13   
   14       def destroy
   15         Withdraw.transaction do

App backtrace

  • app/controllers/concerns/withdraws/withdrawable.rb:10:in `create'
  • lib/middleware/security.rb:11:in `call'
  • lib/middleware/i18n_js.rb:9:in `call'

@yivo
Copy link

yivo commented Jan 13, 2018

@maniharicse Hi

$http.post("/withdraws/#{withdraw_channel.resource_name}", data) will not work since data is missing CSRF token. Our team has already started several issues and PR which fixes issue (https://github.com/rubykube/peatio/pull/288, https://github.com/rubykube/peatio/issues/290). It will be pushed at v0.2.5 at the beginning of the week.

@yivo
Copy link

yivo commented Jan 16, 2018

Closed in #288.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants