braintree / braintree_java

Braintree Java library
https://developer.paypal.com/braintree/docs/start/overview
MIT License
158 stars 98 forks source link

Is there a way to find default MerchantAccount? #52

Closed anverus closed 7 years ago

anverus commented 7 years ago

Method gateway.merchantAccount().find(merchantAccountId) requires non-empty merchantAccount to get MerchantAccount object back. For default accounts we do not keep merchantAccount in configuration settings (as it is not required for transaction operations). So my question is : How can I get a MerchantAccount object from Braintree API for default merchant account?

I understand that I can get it using merchant account id associated with default merchant account but is there a way to get it if I do not have id of default merchant account?

MerchantAccount defaultAccount = gateway.merchantAccount().find(null)? MerchantAccount defaultAccount = gateway.merchantAccount().default()?

mtmarsh3 commented 7 years ago

Hi @anverus!

Currently there is not a way to get the default merchant account directly through the API. Typically, the default merchant account will not change, so it's suggested to save the id of the default merchant account and retrieve it when needed. The id could then be used in MerchantAccount.find() to retrieve the default merchant account. You can also always find the default merchant account id through your control panel.

anverus commented 7 years ago

We could do that but it would require modification to currently working configuration that is externalized, works and I have no control of (i.e. done by secure site ops), while any modification to configuration has potential of breaking functionality :)

But I guess there is no way around at this point. Thank you.