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

Ability to test bank account debit transitions #275

Open
shlomozippel opened this issue Mar 8, 2013 · 18 comments
Open

Ability to test bank account debit transitions #275

shlomozippel opened this issue Mar 8, 2013 · 18 comments
Labels

Comments

@shlomozippel
Copy link

At the moment we are able to test debits that get a status during creation (paid, failed, pending) using the test bank account numbers. Unfortunately, we have no way to test an async transition from pending to paid/failed. Ideally we'd like to be able to trigger a status change for a pending test debit and consume an event for that change.

@kurioscreative
Copy link

+1

@shlomozippel How are you testing the status during creation? I've only received the "succeeded" status on a bank account debit.

@shlomozippel
Copy link
Author

There are test bank accounts that automatically succeed, fail, or remain pending: https://docs.balancedpayments.com/current/overview.html?language=bash#test-bank-account-numbers

@jonez734
Copy link

In my testing, the bank accounts always showed paid. They would never "transistion" from pending to failed or whatever.

I have an idea for resolving this, and it involves a mod to the dashboard where I am allowed to set the state/status of any transaction and have my webhook(s) fired.

@mjallday
Copy link
Contributor

👍 on this issue. I cannot test bank account debits. e.g.

  1. Create a bank account that has pending transactions according to the docs.

    curl https://api.balancedpayments.com/bank_accounts      -H "Accept: application/vnd.api+json;revision=1.1"      -u ak-test-1PPfI4CmXSaOHFgIYzWdA5fpdkYe9mvLL:      -d "routing_number=121000358"      -d "account_type=checking"      -d "name=Johann Bernoulli"      -d "account_number=9900000001"
    
  2. Verify bank account (not shown for brevity)

  3. Debit bank account

    curl https://api.balancedpayments.com/bank_accounts/BA7M24Ka1z1agCPjus6O0Qkh/debits      -H "Accept: application/vnd.api+json;revision=1.1"      -u ak-test-1PPfI4CmXSaOHFgIYzWdA5fpdkYe9mvLL:      -d "appears_on_statement_as=Statement text"      -d "amount=5000"      -d "description=Some descriptive text for the debit in the dashboard"
    
    {
    "debits": [
      {
        "status": "succeeded",
        "description": "Some descriptive text for the debit in the dashboard",
        "links": {
          "customer": null,
          "source": "BA7M24Ka1z1agCPjus6O0Qkh",
          "order": null,
          "dispute": null
        },
        "updated_at": "2014-04-24T00:48:56.953208Z",
        "created_at": "2014-04-24T00:48:56.688716Z",
        "transaction_number": "W501-753-1933",
        "failure_reason": null,
        "currency": "USD",
        "amount": 5000,
        "failure_reason_code": null,
        "meta": {},
        "href": "/debits/WD1Gkl1rndj2QsfLIkZvs7r3",
        "appears_on_statement_as": "BAL*Statement text",
        "id": "WD1Gkl1rndj2QsfLIkZvs7r3"
      }
    ],
    "links": {
      "debits.customer": "/customers/{debits.customer}",
      "debits.dispute": "/disputes/{debits.dispute}",
      "debits.source": "/resources/{debits.source}",
      "debits.order": "/orders/{debits.order}",
      "debits.refunds": "/debits/{debits.id}/refunds",
      "debits.events": "/debits/{debits.id}/events"
    }
    }

This is impacting the ability of the front end team to test operations on transactions in certain statuses. e.g. balanced/balanced-dashboard#1186

@mjallday
Copy link
Contributor

I believe that the issue is that we're not configuring the PENDING_BANK_ACCOUNT_HASHES values in precog. I just checked the cookbook that configures these values and it's being set to an empty list. This should be an easy fix. https://github.com/balanced-cookbooks/precog/blob/master/attributes/default.rb#L101

@steveklabnik
Copy link
Contributor

That would be amazing because this has been broken for an embarrassing amount of time. 😬

@cyrusstoller
Copy link

+1

Any guess when this will be fixed?

In the meantime, can you guys put a note on your docs. I spent a frustrating amount of time trying to figure out if I was doing something wrong. I couldn't figure out why my tests started failing even though I hadn't changed them when I deleted my vcr cassettes.

@remear
Copy link
Contributor

remear commented May 30, 2014

The fix should be coming soon, although I don't have any specific timeline yet.

Github issues are where we note problems, not the documentation. Whenever you're having trouble, you should check the corresponding repository to see if it's a known issue. If one exists, please comment with a +1 and add an applicable code example. If you don't see one, jump in IRC and talk with technical support about the problem. If it's not an issue that's immediately solvable, support will create an issue in the appropriate repository or ask you to do so with information from the discussion.

@cyrusstoller
Copy link

@remear Thanks for the reply. I ended up getting an answer on IRC.

You guys have to set policies that make the sense for you, but for me as an end user a note in the docs that acknowledges this functionality isn't working properly would have gone a long way. Especially since my integration with Balanced is going to be dealing with money, I want to be sure that I have good test coverage and this bug makes that more difficult.

@cyrusstoller
Copy link

Any guestimate on when this will be fixed?

@msherry
Copy link
Contributor

msherry commented Jun 11, 2014

I believe this was fixed recently -- @matthewfl ?

@matthewfl
Copy link
Contributor

the transactions aren't going to transition in an async way as this issue is requesting. The issue with the bank accounts not working as reported has been fixed.

@cyrusstoller
Copy link

Just tried running tests again. It looks like they're passing. But I had to run them a couple times because I was getting:

Faraday::TimeoutError:
  Net::ReadTimeout
Faraday::TimeoutError:
  execution expired
Balanced::InternalServerError:
  Balanced::InternalServerError

@remear
Copy link
Contributor

remear commented Oct 1, 2014

Confirmed, the status changes to pending as expected.

@mjallday
Copy link
Contributor

mjallday commented Oct 6, 2014

Re-opening. This issue covers asynchronous testing.

@mjallday mjallday reopened this Oct 6, 2014
@mahmoudimus
Copy link
Contributor

@mjallday should this issue continue to be closed due to #708?

@mjallday
Copy link
Contributor

mjallday commented Oct 7, 2014

They are separate issues:

This one covers how to asynchronously test transaction state changes.
#708 covers how to test failed bank account debits (the issue lies with the fact that the verifications are debits and as such it's impossible to verify the bank account).

@sophistry
Copy link

+1 - Just came upon this limitation when trying to model passing along the $15 Chargeback fee and trying to understand how the system reacts when that $15 debit is rejected due to low funds.

Here is the message I sent to support describing it as easily as possible:

"I want to be able to simulate a bank_account that has zero funds in it so that when I tell Balanced API to debit that account it responds with failure state.

I do not see any way to manipulate bank_account balances to $0 in the API or using the testing numbers for bank accounts.

Thanks!"

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

No branches or pull requests