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

Hook up stripe external account with connect account, expose bank_account info #604

Merged
merged 2 commits into from
Jan 4, 2017

Conversation

paulsullivanjr
Copy link
Contributor

@paulsullivanjr paulsullivanjr commented Jan 3, 2017

What's in this PR?

This is in progress and not complete. Initial changes to associated the external account with StripeConnectAccount to provide access to the last 4 digits of the account and routing numbers.

References

Fixes #597

@joshsmith joshsmith added this to the Launch Donations milestone Jan 3, 2017
@begedin begedin changed the title WIP initial changes for saving bank account last 4 from external account Hook up stripe external account with connect account, expose bank_account info Jan 4, 2017
@begedin
Copy link
Contributor

begedin commented Jan 4, 2017

@paulsullivanjr In the interest of wrapping this up and launching the feature as soon as possible, I hope you don't mind my taking this PR over. Good work up to this point!

@begedin makes sense. Definitely didn't want to hold you guys up from finishing!

@begedin begedin force-pushed the 597-save-bank-account-last4-and-routing-number branch from daf283d to c50aef8 Compare January 4, 2017 11:58
do
%StripeExternalAccount{}
|> StripeExternalAccount.changeset(params)
|> Repo.insert
end
end

defp get_connect_account(account_id_from_stripe) do
Copy link
Contributor

@begedin begedin Jan 4, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason we do this at the service instead of the adapter level is because we want the service to return a useful error response in case the connect account was not found.

Specifically, the service will return {:ok, created_external_account} if everything is ok, and {:error, :not_found} if the associated connect account was not found locally.

Due to this behavior, the event handling system will mark the event as errored.

We could technically push it further into the adapter, but the code would be more complicated.

@begedin begedin force-pushed the 597-save-bank-account-last4-and-routing-number branch from c50aef8 to cce5203 Compare January 4, 2017 12:15
@begedin begedin force-pushed the 597-save-bank-account-last4-and-routing-number branch from cce5203 to d5ab57f Compare January 4, 2017 12:39
@begedin
Copy link
Contributor

begedin commented Jan 4, 2017

@joshsmith Should be good to go.

The relationship is stored on the external account record. My reasoning is that we may end up at one point having a

:stripe_connect_account -> has_many -> :stripe_external_account

With that in mind,

:stripe_connect_account -> has_one -> :stripe_external_account

makes more sense at the moment

There is no chance of us having

:stripe_external_account -> has_many -> :stripe_connect_account

so

:stripe_external_account -> has_one -> :stripe_connect_account

makes much less sense.

@joshsmith
Copy link
Contributor

I think we should also add a bank_account_bank_name to this so that we can render that out to the user, as well.

@joshsmith joshsmith merged commit c4d9876 into develop Jan 4, 2017
@joshsmith joshsmith deleted the 597-save-bank-account-last4-and-routing-number branch January 4, 2017 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants