Mangopay / mangopay2-ruby-sdk

Ruby Gem for MANGOPAY
https://rubygems.org/gems/mangopay
MIT License
42 stars 38 forks source link

In sandbox when creating PayOut return satus "CREATED" #48

Closed dborovsky closed 8 years ago

dborovsky commented 8 years ago

Hello

I am reading documentation mangopay: In the sandbox environment BankWire PayOuts will be processed automatically

You mean with status "SUCCEEDED"?

I work in sandbox. I create new payout and return hash with status: CREATED.

pay_out = MangoPay::PayOut::BankWire.create({
      AuthorId: current_user.mangopay_id,
      DebitedFunds: { Currency: 'EUR', Amount: amount },
      Fees: { Currency: 'EUR', Amount: 0 },
      DebitedWalletId: current_user.wallet_id,
      BankAccountId: banc_acount['Id'],
      Communication: 'This is a test',
      Tag: 'Test Bank Wire'
    })
{"Id"=>"15148471",
 "Tag"=>"Test Bank Wire",
 "CreationDate"=>1470905271,
 "AuthorId"=>"15003823",
 "CreditedUserId"=>nil,
 "DebitedFunds"=>{"Currency"=>"EUR", "Amount"=>324},
 "CreditedFunds"=>{"Currency"=>"EUR", "Amount"=>324},
 "Fees"=>{"Currency"=>"EUR", "Amount"=>0},
 "Status"=>"CREATED",
 "ResultCode"=>nil,
 "ResultMessage"=>nil,
 "ExecutionDate"=>nil,
 "Type"=>"PAYOUT",
 "Nature"=>"REGULAR",
 "CreditedWalletId"=>nil,
 "DebitedWalletId"=>"15003848",
 "PaymentType"=>"BANK_WIRE",
 "BankAccountId"=>"15148463",
 "BankWireRef"=>nil}

Why not SUCCEEDED?

hobailey commented 8 years ago

Hi @dborovsky, it's because it's asyncronous - the response will always show "CREATED" (or maybe "FAILED"), but if it can become "SUCCEEDED", this will happen within a few seconds. I suggest you use the hooks to be notified.

dborovsky commented 8 years ago

thank you.