Skip to content

Instantly share code, notes, and snippets.

@1dolinski
Created August 15, 2016 23:27
Show Gist options
  • Select an option

  • Save 1dolinski/e67d077661af47dd89ef07dbff607b2f to your computer and use it in GitHub Desktop.

Select an option

Save 1dolinski/e67d077661af47dd89ef07dbff607b2f to your computer and use it in GitHub Desktop.
const stripeProvider = require('../helpers/providers-stripe');
module.exports = class Charge {
constructor(opts = {}) {
this.amount = opts.amount;
this.currency = 'cad';
this.customer = opts.customer;
this.description = opts.description;
}
execute() {
const self = this;
return new Promise((resolve, reject) => {
stripeProvider.charges.create(self, (err, charge) => {
if (err) {
reject(err);
return;
}
resolve(charge);
});
});
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment