braintree
braintree copied to clipboard
Globally Settings BT Settings
Instead of settings the config each and everytime you want to make an API call we could have an option for globally settings them by doing something like this.
Meteor.startup(function () {
BrainTreeConnect.setConfig({
environment: process.env.PRODUCTION && Braintree.Environment.Production || Braintree.Environment.Sandbox,
merchantId: Meteor.settings.BRAIN_TREE.MERCHANT_ID,
publicKey: Meteor.settings.BRAIN_TREE.PUBLIC_KEY,
privateKey: Meteor.settings.BRAIN_TREE.PRIVATE_KEY
});
});
and then in the constructor we could check for a config like so
BrainTreeConnect = function (key) {
key = key || BraintreeConnect.getConfig()
//Remaining Code
}