Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Error on bank account config #2111

Closed
qrush opened this issue Mar 3, 2014 · 15 comments
Closed

Error on bank account config #2111

qrush opened this issue Mar 3, 2014 · 15 comments

Comments

@qrush
Copy link

qrush commented Mar 3, 2014

https://www.gittip.com/bank-account.html errors for me. 😢

screen shot 2014-03-03 at 3 29 40 pm

@chadwhitacre
Copy link
Contributor

Ditto. :-(

/me looking into it ...

@zbynekwinkler
Copy link
Contributor

No error for me, but I do not have a bank account attached.

@chadwhitacre
Copy link
Contributor

https://app.getsentry.com/gittip/gittip/group/15259519/

Traceback (most recent call last):
  File "site-packages/algorithm.py", line 288, in run
    new_state = function(**deps.as_kwargs)
  File "aspen/algorithms/website.py", line 88, in get_response_for_resource
    return {'response': resource.respond(request)}
  File "aspen/resources/dynamic_resource.py", line 68, in respond
    response = self.get_response(context)
  File "aspen/resources/negotiated_resource.py", line 98, in get_response
    response.body = render(context)
  File "aspen/renderers/__init__.py", line 99, in __call__
    return self.render_content(context)
  File "site-packages/aspen_jinja2_renderer.py", line 66, in render_content
    return self.compiled.render(context).encode(charset)
  File "jinja2/environment.py", line 969, in render
    return self.environment.handle_exception(exc_info, True)
  File "jinja2/environment.py", line 742, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/app/www/bank-account.html.spt", line 1, in top-level template code
    import traceback
  File "/app/templates/base.html", line 54, in top-level template code
    {% block killbox %}
  File "/app/templates/base.html", line 56, in block "killbox"
    {% block box %}{% endblock %}
  File "/app/www/bank-account.html.spt", line 56, in block "box"
UndefinedError: 'gittip.billing.BalancedBankAccount object' has no attribute 'account_number'

@chadwhitacre
Copy link
Contributor

I'm trying to debug this locally, but I'm having trouble connecting a bank account because I'm not getting error messages back because of #1850.

@chadwhitacre
Copy link
Contributor

Actually, I think I'm not hitting #1850. I think it's a failure to deal with an error coming back from balanced.js.

@chadwhitacre
Copy link
Contributor

I've managed to get a bank account to save. It didn't work cleanly, though. The button stayed on "saving" and I wasn't redirected back to my profile.

@chadwhitacre
Copy link
Contributor

So it looks like the immediate issue on this ticket has to do with changes to the Balanced API in #2036. cc: @matthewfl

@chadwhitacre
Copy link
Contributor

IRC.

@chadwhitacre
Copy link
Contributor

So what did BalancedBankAccount used to be?

@chadwhitacre
Copy link
Contributor

Here's what it is now:

class BalancedBankAccount(BalancedThing):
    """This is a dict-like wrapper around a Balanced Account.
    """

    thing_type = 'bank_account'

    def __getitem__(self, item):
        mapper = {
            'id': 'href',
            'customer_href': 'customer.href',
            'bank_name': 'bank_name',
            'last_four': 'last_four',
        }
        if item not in mapper:
            raise IndexError()
        if not self._thing:
            return None

        return self._get(mapper[item])

@chadwhitacre
Copy link
Contributor

The bug is that we are asking for account_number, but that's not in the mapper dict so we raise IndexError. That item not in mapper check seems like a bit of a WTF. The original purpose of mapper was to flatten nested attribute access, as in the case of customer_href. But we lost that dereferencing code in e9961b8. And why shouldn't we have? It's not like it was documented or anything. 😞

@chadwhitacre
Copy link
Contributor

Actually, it looks like the dereferencing got pushed down into the parent class in that same commit.

chadwhitacre added a commit that referenced this issue Mar 3, 2014
chadwhitacre added a commit that referenced this issue Mar 3, 2014
DRY out the BalancedThings.
@bruceadams
Copy link
Contributor

Does this support case https://gittip.supportbee.com/tickets/2090846 come from a user hitting this error?

@chadwhitacre
Copy link
Contributor

@bruceadams Yes, thanks for linking it here.

@chadwhitacre
Copy link
Contributor

I've heard from @qrush in private IRC that this is working for him. Closing.

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

No branches or pull requests

4 participants