I'm having trouble promisifying a braintree method. Specifically, gateway.transaction.sale. https://developers.braintreepayments.com/reference/request/transaction/sale/node
I am using node.js with the bluebird library for promisification.
...
var sale = bluebird.promisify(gateway.transaction.sale);
return sale({
amount: '10.00',
paymentMethodNonce: nonce,
});
})
.then( // doesn't reach here)
.catch(// logs out error)
Specifically, the .catch block at the bottom of the promise chain logs out:
[TypeError: this.create is not a function]
When not attempting to promisify, the code works fine.
gateway.transaction.sale({
amount: '10.00',
paymentMethodNonce: nonce,
}, function(err, result) {
... no errors, everything works fine
}
Is this a problem with how the braintree library is implemented? Am I promisifying wrong? Are there any alternative promisification strategies I can try so I can avoid callback hell?