Ensuring balanced customer has just one balanced bank account

123 Views Asked by At

I'm trying to get this to work by removing bank accounts already associated with a customer and create a fresh bank account and then associate that with customer.

I keep getting errors like these when I do that.

Balanced::NotFound(404)::Not Found:: GET https://api.balancedpayments.com/v1/bank_accounts/BA2PG7jrXzlrEcfpEERh0zD1: not-found: "/v1/bank_accounts/BA2PG7jrXzlrEcfpEERh0zD1" has been deleted. Your request id is OHM152584f2fea211e2ad13026ba7f8ec28. 

Where am I going wrong ?

1

There are 1 best solutions below

1
On

Without seeing code I can't say for sure what's going on. It looks like you're actually invalidating or deleting the bank account somewhere along the way.

For limiting each Customer to one and only one bank account, I would do the following:

  • Store the bank account URI in your database, probably in a column on your user table
  • When the user updates their bank account info, find the old bank account via URI and invalidate/delete it
  • Store the URI for the new bank account