Comparing version 2.0.0 to 2.0.1
@@ -25,6 +25,6 @@ 'use strict'; | ||
method: 'GET', | ||
path: 'upcoming', | ||
urlParams: [] | ||
path: 'upcoming?customer={customerId}', | ||
urlParams: ['customerId'] | ||
}) | ||
}); |
@@ -43,3 +43,3 @@ 'use strict'; | ||
}, function(err) { | ||
setTimeout(function(){ callback(err); }, 0); | ||
setTimeout(function(){ callback(err, null); }, 0); | ||
}); | ||
@@ -58,3 +58,3 @@ } | ||
if (urlParams[i] && !arg) { | ||
throw new Error('I require argument "' + urlParams[i] + '", but I got: ' + arg); | ||
throw new Error('Stripe: I require argument "' + urlParams[i] + '", but I got: ' + arg); | ||
} | ||
@@ -89,14 +89,2 @@ urlData[urlParams[i]] = arg; | ||
} else { | ||
// There is an opportunity to provide a thin API on the returned data | ||
// objects, useful for pre-populated resources (e.g. CustomerCard). | ||
switch (response.object) { | ||
// Currently only customer objects are augmented with an API Layer: | ||
case 'customer': | ||
response.cards = new resources.CustomerCards(self._stripe, { | ||
customerId: response.id | ||
}); | ||
} | ||
deferred.resolve( | ||
@@ -103,0 +91,0 @@ spec.transformResponseData ? |
{ | ||
"name": "stripe", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Stripe API wrapper", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/stripe/stripe-node", |
# Stripe node.js bindings | ||
## Version 2 Update Notice | ||
This repo has just been transferred to Stripe. Alongside this transfer, Stripe has released version 2.0.0 of the bindings. **[Read about Version 2 here](https://github.com/stripe/stripe-node/wiki/Version-2)**. We'll be going through the backlogged issues in the next few days. | ||
## Installation | ||
@@ -107,3 +111,3 @@ | ||
* `retrieveLines(invoiceId)` | ||
* `retrieveUpcoming()` | ||
* `retrieveUpcoming(customerId)` | ||
* `pay(invoiceId)` | ||
@@ -110,0 +114,0 @@ * plans |
@@ -41,69 +41,2 @@ 'use strict'; | ||
describe('Customer+Card flow', function() { | ||
it('allows me to: create Customer', function(done) { | ||
return expect( | ||
stripe.customers.create(CUSTOMER_DETAILS) | ||
.then(function(customer) { | ||
cleanup.deleteCustomer(customer.id); | ||
return customer; | ||
}, function(err) { | ||
throw err; | ||
}) | ||
).to.eventually.have.property('description', 'Some customer'); | ||
}); | ||
it('allows me to: create a customer and list their cards', function() { | ||
return expect( | ||
stripe.customers.create(CUSTOMER_DETAILS) | ||
.then(function(customer) { | ||
cleanup.deleteCustomer(customer.id); | ||
return customer.cards.list(); | ||
}, function(err) { | ||
throw err; | ||
}) | ||
).to | ||
.eventually | ||
.have.deep.property('data[0].exp_year', 2015); | ||
}); | ||
it('gives me an error if I incorrectly try to create a new card', function() { | ||
return expect( | ||
stripe.customers.create(CUSTOMER_DETAILS) | ||
.then(function(customer) { | ||
cleanup.deleteCustomer(customer.id); | ||
return stripe.cards.create(customer.id, { | ||
card: { | ||
number: 'invalid!', | ||
exp_month: '12', | ||
exp_year: '2016' | ||
} | ||
}); | ||
}) | ||
).to.be.eventually.rejected; | ||
}); | ||
it('allows me to add an additional card', function() { | ||
return expect( | ||
stripe.customers.create(CUSTOMER_DETAILS) | ||
.then(function(customer) { | ||
cleanup.deleteCustomer(customer.id); | ||
return customer.cards.create({ | ||
card: { | ||
number: '4242424242424242', | ||
exp_month: '12', | ||
exp_year: '2016' | ||
} | ||
}); | ||
}) | ||
).to.eventually.have.property('exp_year', 2016); | ||
}); | ||
}); | ||
describe('Plan+Subscription flow', function() { | ||
@@ -110,0 +43,0 @@ |
@@ -72,7 +72,7 @@ 'use strict'; | ||
stripe.invoices.retrieveUpcoming({ customer: 'customerId1' }); | ||
stripe.invoices.retrieveUpcoming('customerId1'); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'GET', | ||
url: '/v1/invoices/upcoming', | ||
data: { customer: 'customerId1' } | ||
url: '/v1/invoices/upcoming?customer=customerId1', | ||
data: {} | ||
}); | ||
@@ -79,0 +79,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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
152
3
64736
1856