-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
23 lines (22 loc) · 888 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
var Braintree42 = require('./lib/Braintree.js');
var braintree = require('braintree');
var assert = require('assert');
module.exports = {
factory: function (options) {
assert(options.MERCHANT_ID,'MERCHANT_ID is mandatory');
assert(options.PUBLIC_KEY,'PUBLIC_KEY is mandatory');
assert(options.PRIVATE_KEY,'PRIVATE_KEY is mandatory');
var service = new Braintree42(options);
options = options || {};
Object.defineProperty(service, '_delegate', {
value: braintree.connect({
environment: options.testMode === true ? braintree.Environment.Sandbox : (process.env.NODE_ENV === 'production' ? braintree.Environment.Production : braintree.Environment.Development),
merchantId: options.MERCHANT_ID,
publicKey: options.PUBLIC_KEY,
privateKey: options.PRIVATE_KEY
})
});
return service;
},
Braintree: Braintree42
};