1.0.0 • Published 8 years ago

braintree-as-promised v1.0.0

Weekly downloads
41
License
-
Repository
github
Last release
8 years ago

braintree-as-promised

Build Status Code Climate Test Coverage

Add native promises to braintree gateway

Getting Started

Install the module with: npm install braintree-as-promised

var braintree = require('braintree');
var promised = require('braintree-as-promised');
var gateway = promised(braintree.connect({ ... }));

gateway.clientToken
    .generate({})
    .then((result) => {
        console.log(result.clientToken);
    });

gateway.transaction
    .sale({
        ...
    })
    .then((result) => {
        console.log(result.transaction);
    });

Documentation

calling promised(gateway) will return a new gateway object with all the methods converted to promise-based ones, using native promises. You can continue to use your gateway object normal, as it does not change anything on the original object.

Additionally it handles the "result.success" parameter, so that if success === false, the promise is rejected with the returned error message.

License

Copyright (c) 2016 Enhancv Licensed under the MIT license.

1.0.0

8 years ago

0.4.0

8 years ago

0.3.2

8 years ago

0.3.1

9 years ago

0.3.0

9 years ago

0.2.0

9 years ago

0.1.0

9 years ago