ghost-payment-service
Advanced tools
Comparing version 1.1.3 to 1.1.4
@@ -200,4 +200,19 @@ 'use strict'; | ||
} | ||
/** | ||
* @param {object} data | ||
* @param {string} data.cardId | ||
* @param {string} data.customerId | ||
* @return Promise | ||
*/ | ||
setDefaultCard (data) { | ||
return new Promise((resolve, reject) => { | ||
this._stripe.customers.update(data.customerId, {default_source: data.cardId}, (err, customer) => { | ||
if (err) reject(err); | ||
else resolve(customer); | ||
}) | ||
}) | ||
} | ||
/** | ||
* @param {StripeCustomer} data | ||
@@ -204,0 +219,0 @@ * @return Promise |
{ | ||
"name": "ghost-payment-service", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"description": "nodejs client to interact with the authorize.net & stripe apis", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "mocha ./test --recursive" | ||
"test": "NODE_ENV=test mocha ./test --recursive" | ||
}, | ||
@@ -9,0 +9,0 @@ "repository": { |
@@ -26,2 +26,4 @@ const Chai = require('chai'); | ||
.then(_customer_ => stripeSetup.setupCard({ customerId: _customer_.id })) | ||
.then(() => stripeSetup.setupCard({ customerId: customer.id })) | ||
.then(() => stripeSetup.setupCard({ customerId: customer.id })) | ||
.tap(_card_ => card = _card_) | ||
@@ -72,2 +74,10 @@ .then(_card_ => stripeSetup.setupToken()) | ||
}); | ||
it('should update a customer\'s default card', () => { | ||
return service.setDefaultCard({ cardId: card.id, customerId: customer.id }) | ||
.then(customer => { | ||
expect(customer).to.exist; | ||
expect(customer.default_source).to.be.equal(card.id); | ||
}) | ||
}) | ||
}); | ||
@@ -107,3 +117,3 @@ | ||
expect(_customer_).to.exist; | ||
expect(_customer_.id).to.be.equal(_customer_.id); | ||
expect(_customer_.id).to.be.equal(customer.id); | ||
}) | ||
@@ -110,0 +120,0 @@ }); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34671
14
1005