Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

braintree-as-promised

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

braintree-as-promised

Add native promises to braintree gateway

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source

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.

FAQs

Package last updated on 27 Mar 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc