Comparing version 2.5.5 to 2.6.3
@@ -5,4 +5,4 @@ 'use strict'; | ||
path: 'coupons', | ||
includeBasic: ['create', 'list', 'retrieve', 'del'] | ||
includeBasic: ['create', 'list', 'update', 'retrieve', 'del'] | ||
}); | ||
@@ -12,5 +12,35 @@ 'use strict'; | ||
'setMetadata', 'getMetadata' | ||
] | ||
], | ||
createCard: stripeMethod({ | ||
method: 'POST', | ||
path: '/{recipientId}/cards', | ||
urlParams: ['recipientId'] | ||
}), | ||
listCards: stripeMethod({ | ||
method: 'GET', | ||
path: '/{recipientId}/cards', | ||
urlParams: ['recipientId'] | ||
}), | ||
retrieveCard: stripeMethod({ | ||
method: 'GET', | ||
path: '/{recipientId}/cards/{cardId}', | ||
urlParams: ['recipientId', 'cardId'] | ||
}), | ||
updateCard: stripeMethod({ | ||
method: 'POST', | ||
path: '/{recipientId}/cards/{cardId}', | ||
urlParams: ['recipientId', 'cardId'] | ||
}), | ||
deleteCard: stripeMethod({ | ||
method: 'DELETE', | ||
path: '/{recipientId}/cards/{cardId}', | ||
urlParams: ['recipientId', 'cardId'] | ||
}), | ||
}); | ||
@@ -37,2 +37,3 @@ 'use strict'; | ||
Plans: require('./resources/Plans'), | ||
RecipientCards: require('./resources/RecipientCards'), | ||
Recipients: require('./resources/Recipients'), | ||
@@ -39,0 +40,0 @@ Tokens: require('./resources/Tokens'), |
{ | ||
"name": "stripe", | ||
"version": "2.5.5", | ||
"version": "2.6.3", | ||
"description": "Stripe API wrapper", | ||
@@ -29,3 +29,3 @@ "homepage": "https://github.com/stripe/stripe-node", | ||
"dependencies": { | ||
"when": "~2.4.0" | ||
"when": "~3.1.0" | ||
}, | ||
@@ -32,0 +32,0 @@ "scripts": { |
@@ -35,7 +35,7 @@ 'use strict'; | ||
before(function() { | ||
stripe.setHost('revoked.stripe.com', 443); | ||
stripe.setHost('revoked.stripe.com', 444); | ||
}); | ||
after(function() { | ||
stripe.setHost('api.stripe.com'); | ||
stripe.setHost('api.stripe.com', 443); | ||
}); | ||
@@ -371,16 +371,38 @@ | ||
describe('Expanding a customer within a charge', function() { | ||
it('Allows you to expand a customer object', function() { | ||
return expect( | ||
stripe.customers.create(CUSTOMER_DETAILS) | ||
.then(function(cust) { | ||
cleanup.deleteCustomer(cust.id); | ||
return stripe.charges.create({ | ||
customer: cust.id, | ||
amount: 1700, | ||
currency: CURRENCY, | ||
expand: ['customer'] | ||
}); | ||
describe('Expanding', function() { | ||
describe('A customer within a charge', function() { | ||
it('Allows you to expand a customer object', function() { | ||
return expect( | ||
stripe.customers.create(CUSTOMER_DETAILS) | ||
.then(function(cust) { | ||
cleanup.deleteCustomer(cust.id); | ||
return stripe.charges.create({ | ||
customer: cust.id, | ||
amount: 1700, | ||
currency: CURRENCY, | ||
expand: ['customer'] | ||
}); | ||
}) | ||
).to.eventually.have.deep.property('customer.created'); | ||
}); | ||
}); | ||
describe('A customer\'s default card', function() { | ||
it('Allows you to expand a default_card', function() { | ||
return expect( | ||
stripe.customers.create({ | ||
description: 'Some customer', | ||
card: { | ||
number: '4242424242424242', | ||
exp_month: 12, | ||
exp_year: 2015 | ||
}, | ||
expand: ['default_card'] | ||
}) | ||
).to.eventually.have.deep.property('customer.created'); | ||
.then(function(cust) { | ||
cleanup.deleteCustomer(cust.id); | ||
return cust; | ||
}) | ||
// Confirm it's expanded by checking that some prop (e.g. exp_year) exists: | ||
).to.eventually.have.deep.property('default_card.exp_year'); | ||
}); | ||
}); | ||
@@ -387,0 +409,0 @@ }); |
@@ -38,2 +38,20 @@ 'use strict'; | ||
describe('update', function() { | ||
it('Sends the correct request', function() { | ||
stripe.coupons.update('couponId123', { | ||
metadata: { a: '1234' } | ||
}); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'POST', | ||
url: '/v1/coupons/couponId123', | ||
data: { | ||
metadata: { a: '1234' } | ||
} | ||
}); | ||
}); | ||
}); | ||
describe('create', function() { | ||
@@ -40,0 +58,0 @@ |
@@ -6,2 +6,4 @@ 'use strict'; | ||
var TEST_AUTH_KEY = 'aGN0bIwXnHdw5645VABjPdSn8nWY7G11'; | ||
describe('Recipients Resource', function() { | ||
@@ -88,2 +90,135 @@ | ||
describe('Card methods', function() { | ||
describe('retrieveCard', function() { | ||
it('Sends the correct request', function() { | ||
stripe.recipients.retrieveCard('recipientIdFoo321', 'cardIdFoo456'); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'GET', | ||
url: '/v1/recipients/recipientIdFoo321/cards/cardIdFoo456', | ||
data: {} | ||
}); | ||
}); | ||
it('Sends the correct request [with specified auth]', function() { | ||
stripe.recipients.retrieveCard('recipientIdFoo321', 'cardIdFoo456', TEST_AUTH_KEY); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'GET', | ||
url: '/v1/recipients/recipientIdFoo321/cards/cardIdFoo456', | ||
data: {}, | ||
auth: TEST_AUTH_KEY | ||
}); | ||
}); | ||
}); | ||
describe('createCard', function() { | ||
it('Sends the correct request', function() { | ||
stripe.recipients.createCard('recipientIdFoo321', { | ||
number: '123456', exp_month: '12' | ||
}); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'POST', | ||
url: '/v1/recipients/recipientIdFoo321/cards', | ||
data: { number: '123456', exp_month: '12' } | ||
}); | ||
}); | ||
it('Sends the correct request [with specified auth]', function() { | ||
stripe.recipients.createCard('recipientIdFoo321', { | ||
number: '123456', exp_month: '12' | ||
}, TEST_AUTH_KEY); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'POST', | ||
url: '/v1/recipients/recipientIdFoo321/cards', | ||
data: { number: '123456', exp_month: '12' }, | ||
auth: TEST_AUTH_KEY | ||
}); | ||
}); | ||
}); | ||
describe('updateCard', function() { | ||
it('Sends the correct request', function() { | ||
stripe.recipients.updateCard('recipientIdFoo321', 'cardIdFoo456', { | ||
name: 'Bob M. Baz' | ||
}); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'POST', | ||
url: '/v1/recipients/recipientIdFoo321/cards/cardIdFoo456', | ||
data: { name: 'Bob M. Baz' } | ||
}); | ||
}); | ||
}); | ||
describe('deleteCard', function() { | ||
it('Sends the correct request', function() { | ||
stripe.recipients.deleteCard('recipientIdFoo321', 'cardIdFoo456'); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'DELETE', | ||
url: '/v1/recipients/recipientIdFoo321/cards/cardIdFoo456', | ||
data: {} | ||
}); | ||
}); | ||
it('Sends the correct request [with specified auth]', function() { | ||
stripe.recipients.deleteCard('recipientIdFoo321', 'cardIdFoo456', TEST_AUTH_KEY); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'DELETE', | ||
url: '/v1/recipients/recipientIdFoo321/cards/cardIdFoo456', | ||
data: {}, | ||
auth: TEST_AUTH_KEY | ||
}); | ||
}); | ||
}); | ||
describe('listCards', function() { | ||
it('Sends the correct request', function() { | ||
stripe.recipients.listCards('recipientIdFoo321'); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'GET', | ||
url: '/v1/recipients/recipientIdFoo321/cards', | ||
data: {} | ||
}); | ||
}); | ||
it('Sends the correct request [with specified auth]', function() { | ||
stripe.recipients.listCards('recipientIdFoo321', TEST_AUTH_KEY); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'GET', | ||
url: '/v1/recipients/recipientIdFoo321/cards', | ||
data: {}, | ||
auth: TEST_AUTH_KEY | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
115558
52
3048
+ Addedwhen@3.1.0(transitive)
- Removedwhen@2.4.0(transitive)
Updatedwhen@~3.1.0