pinax/pinax-stripe-light

KeyErrors while creating an account: Conflicting fields in the API response body and actions/accounts.py

georgy95 opened this issue · 0 comments

Issue Summary

In actions/accounts.py it's impossible to create the account from stripe data.

In particular, the following pieces are conflicting:

    # transfer schedule to external account
    ps = data["payout_schedule"]
    obj.payout_schedule_interval = ps["interval"]
    obj.payout_schedule_delay_days = ps.get("delay_days")
    obj.payout_schedule_weekly_anchor = ps.get("weekly_anchor")
    obj.payout_schedule_monthly_anchor = ps.get("monthly_anchor")

    obj.legal_entity_personal_id_number_provided = le["personal_id_number_provided"]

It could be more conflicts, but these are the ones I found.

If we are using pre (Transfer/Payout) API version, we get KeyError because payout_schedule is not there (it's called transfer_schedule instead)

Otherwise, if we are using the newest API version, we get the key error on
le["personal_id_number_provided"] because this is now not returned by the API in response.


Steps to Reproduce

Try to create a custom account using out-of-box library.

What were you expecting to happen?

To create an account

What actually happened?

Key errors as explained above. Let me know if you wish me to submit a PR