balanced / balanced-ruby

Balanced API library in ruby.
MIT License
111 stars 47 forks source link

Error crediting amount to Merchant's Bank Account #207

Open waqarshahid opened 9 years ago

waqarshahid commented 9 years ago

I'm trying to credit a customer's bank account but getting this error:

Funding instrument BA2EDdQer0F48BDLIr4d21iD is not associated with order customer CU2PswXDvLkVKrUfFdTWv3gc or marketplace owner customer CU6xgfUyWFkWPUlx5tzQDquN Your request id is OHM8a8cec00c34311e4940e0230f00c9248

I have a created a customer(Buyer)whose href is - '/customers/CU2PswXDvLkVKrUfFdTWv3gc' then created a order with this customer with href is '/orders/OR7h5b44UHklirBOln9HCrSB'. My merchant id href '/orders/OR7h5b44UHklirBOln9HCrSB'. Created a bank account for this merchant using the balanced js - https://docs.balancedpayments.com/1.1/guides/balanced-js/. Bank account href for this merchant is '/bank_accounts/BA2EDdQer0F48BDLIr4d21iD'. Now, I want to credit this bank account for the above order. But somehow i'm not able to do so and getting above error. When see this transaction inside balanced web app it says that this 'This transaction is unlinked'. Any help would be greatly appreciated.

remear commented 9 years ago

@waqarshahid

Orders are created via Customer instances that represent merchants, not buyers. You may only credit funding instruments of the order customer (merchant) and the marketplace owner customer.

The order customer (merchant) is CU2PswXDvLkVKrUfFdTWv3gc.

Customer CU2PswXDvLkVKrUfFdTWv3gc has no bank accounts associated to it.

The marketplace owner customer bank account (there's only 1) is BA6xlBu5MK2hJ9aG2vGcpZo9.

BankAccount BA2EDdQer0F48BDLIr4d21iD is associated to CU66AMtDaItZLT5wxkBAlQhq. As the error message states, it's not associated to the order customer, nor is it associated to the marketplace owner customer. Therefore, crediting BankAccount BA2EDdQer0F48BDLIr4d21iD from Order OR7h5b44UHklirBOln9HCrSB is not allowed.