Comparing version 2.2.1 to 2.2.2
@@ -70,6 +70,6 @@ 'use strict'; | ||
method: 'DELETE', | ||
path: '/{customerId}/discounts/{discountId}', | ||
urlParams: ['customerId', 'discountId'] | ||
path: '/{customerId}/discount', | ||
urlParams: ['customerId'] | ||
}) | ||
}); |
{ | ||
"name": "stripe", | ||
"version": "2.2.1", | ||
"version": "2.2.2", | ||
"description": "Stripe API wrapper", | ||
@@ -10,4 +10,4 @@ "homepage": "https://github.com/stripe/stripe-node", | ||
"Michelle Bu <michelle@stripe.com>", | ||
"Alex Sexton <alex@stripe.com", | ||
"James Padolsey <james@stripe.com" | ||
"Alex Sexton <alex@stripe.com>", | ||
"James Padolsey <james@stripe.com>" | ||
], | ||
@@ -31,3 +31,6 @@ "repository": { | ||
"when": "~2.4.0" | ||
}, | ||
"scripts": { | ||
"test": "mocha" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# Stripe node.js bindings | ||
# Stripe node.js bindings [![Build Status](https://travis-ci.org/stripe/stripe-node.png?branch=master)](https://travis-ci.org/stripe/stripe-node) | ||
@@ -163,5 +163,3 @@ ## Version 2 Update Notice | ||
$ npm install -g mocha | ||
$ npm install | ||
$ export STRIPE_TEST_API_KEY="sk_test_..." | ||
$ mocha | ||
$ npm test | ||
``` | ||
@@ -168,0 +166,0 @@ |
@@ -99,29 +99,48 @@ 'use strict'; | ||
it('Allows me to: Create a coupon and subcribe a customer to it', function() { | ||
var customer; | ||
var coupon; | ||
var couponId = 'coupon' + +new Date; | ||
return expect( | ||
when.join( | ||
stripe.coupons.create({ | ||
percent_off: 20, | ||
id: couponId, | ||
duration: 'once' | ||
}), | ||
stripe.customers.create(CUSTOMER_DETAILS) | ||
).then(function(j) { | ||
var coupon = j[0]; | ||
var customer = j[1]; | ||
cleanup.deleteCustomer(customer.id); | ||
cleanup.deleteCoupon(coupon.id); | ||
return stripe.customers.update(customer.id, { | ||
coupon: coupon.id | ||
describe('When I create a coupon & customer', function() { | ||
it('Does so', function() { | ||
return expect( | ||
when.join( | ||
stripe.coupons.create({ | ||
percent_off: 20, | ||
duration: 'once' | ||
}), | ||
stripe.customers.create(CUSTOMER_DETAILS) | ||
).then(function(joined) { | ||
coupon = joined[0]; | ||
customer = joined[1]; | ||
}) | ||
).to.not.be.eventually.rejected; | ||
}); | ||
describe('And I apply the coupon to the customer', function() { | ||
it('Does so', function() { | ||
return expect( | ||
stripe.customers.update(customer.id, { | ||
coupon: coupon.id | ||
}) | ||
).to.not.be.eventually.rejected; | ||
}); | ||
it('Can be retrieved from that customer', function() { | ||
return expect( | ||
stripe.customers.retrieve(customer.id) | ||
).to.eventually.have.deep.property('discount.coupon.id', coupon.id); | ||
}); | ||
describe('The resulting discount', function() { | ||
it('Can be removed', function() { | ||
return expect( | ||
stripe.customers.deleteDiscount(customer.id) | ||
).to.eventually.have.property('deleted', true); | ||
}); | ||
}) | ||
).to.eventually.have.deep.property('discount.coupon.id', couponId); | ||
describe('Re-querying it', function() { | ||
it('Does indeed indicate that it is deleted', function() { | ||
return expect( | ||
stripe.customers.retrieve(customer.id) | ||
).to.eventually.have.deep.property('discount', null); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
@@ -128,0 +147,0 @@ |
@@ -178,6 +178,6 @@ 'use strict'; | ||
stripe.customers.deleteDiscount('customerIdFoo321', 'discountIdFoo456'); | ||
stripe.customers.deleteDiscount('customerIdFoo321'); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'DELETE', | ||
url: '/v1/customers/customerIdFoo321/discounts/discountIdFoo456', | ||
url: '/v1/customers/customerIdFoo321/discount', | ||
data: {} | ||
@@ -184,0 +184,0 @@ }); |
@@ -14,12 +14,4 @@ 'use strict'; | ||
getUserStripeKey: function() { | ||
var key = process.env.STRIPE_TEST_API_KEY; | ||
var key = process.env.STRIPE_TEST_API_KEY || 'tGN0bIwXnHdwOa85VABjPdSn8nWY7G7I'; | ||
if (!key) { | ||
throw new Error('Expected environment variable STRIPE_TEST_API_KEY to be set.'); | ||
} | ||
if (!/^sk_test_/.test(key)) { | ||
throw new Error('Expected STRIPE_TEST_API_KEY to be of the form "sk_test_[...]".'); | ||
} | ||
return key; | ||
@@ -26,0 +18,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
85717
45
2281
173