balanced / balanced-ruby

Balanced API library in ruby.
MIT License
111 stars 47 forks source link

Find all credits with status failed #153

Closed sithara closed 10 years ago

sithara commented 10 years ago

Is there a way to find records or reports with status failed.

I have seen the find method..but can I add extra conditions to it ?

mjallday commented 10 years ago

Thanks for bringing this up @sithara, we have an open ticket to add examples of how to query and filter in the docs balanced/balanced-docs#8

The syntax you're looking for is Balanced::Debit.all(:status => 'failed') where failed can be any state on a transaction.

Let us know if you have any issues.

sithara commented 10 years ago

Just curious what if the admin make un-wanted debits from a customers account.there could be chances of misuse ..is there a debit blocking condition or something of that sort ?

On Thursday, February 13, 2014, Marshall Jones notifications@github.com wrote:

Thanks for bringing this up @sithara https://github.com/sithara, we have an open ticket to add examples of how to query and filter in the docs balanced/balanced-docs#8https://github.com/balanced/balanced-docs/issues/8

The syntax you're looking for is Balanced::Debit.all(:status => 'failed')where failed can be any state on a transaction.

Let us know if you have any issues.

Reply to this email directly or view it on GitHubhttps://github.com/balanced/balanced-ruby/issues/153#issuecomment-35000145 .

mjallday commented 10 years ago

Sorry, I don't understand the question. If you're a marketplace owner you can do anything with the customer's card but you're also on the hook for any dispute charges that result from misuse.

sithara commented 10 years ago

Okies I got my answer .sorry but I have one more doubt I'm creating an app .What I'm doing is wen a customer enters his persnl information in my site..I'm creating a customer ,creating an account using his bank information n linking the account to that customer profile in balanced to credit his account.im saving the bank account token for future reference of that account. http://account.is/

Is this workflow correct ?

On Thursday, February 13, 2014, Marshall Jones notifications@github.com wrote:

Sorry, I don't understand the question. If you're a marketplace owner you can do anything with the customer's card but you're also on the hook for any dispute charges that result from misuse.

Reply to this email directly or view it on GitHubhttps://github.com/balanced/balanced-ruby/issues/153#issuecomment-35007904 .

mjallday commented 10 years ago

yes.

taylorbrooks commented 10 years ago

@mjallday I'm trying to find failed debits originating from a Bank Account. I'm using a similar query to yours above, then iterating over the debits. Like so:

failed_debits = Balanced::Debit.where(status: 'failed')
failed_debits.each do |d| 
  if d.source._type == 'bank_account'
    p "#{d.created_at} #{d.amount} #{d.customer.name} #{d.appears_on_statement_as}"
  end
end

The problem here is that the debit source class is sometimes:

Balanced::Card
Balanced::BankAccount
Hash

Why would it return a hash? Using 0.7.4

sithara commented 10 years ago

hi marshall

now all of a sudden I'm getting an error when I try to access Balanced::Customer

Its giving me unintialized constant.

mjallday commented 10 years ago

@sithara @taylorbrooks can you please open new issues for both these questions?