braintree icon indicating copy to clipboard operation
braintree copied to clipboard

Globally Settings BT Settings

Open patrickml opened this issue 10 years ago • 0 comments

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
}

patrickml avatar Dec 10 '15 18:12 patrickml