Comparing version 1.0.0-beta5 to 1.0.0-beta6
@@ -10,2 +10,10 @@ var crypto = require('crypto'); | ||
var state = params.state; | ||
var cancel_uri = params.cancel_uri; | ||
var redirect_uri = params.redirect_uri; | ||
delete params.state; | ||
delete params.cancel_uri; | ||
delete params.redirect_uri; | ||
var query = { | ||
@@ -18,2 +26,6 @@ client_id: this.opts.appId, | ||
state && (query.state = state); | ||
cancel_uri && (query.cancel_uri = cancel_uri); | ||
redirect_uri && (query.redirect_uri = redirect_uri); | ||
var signature = Signer.toQuery(query); | ||
@@ -20,0 +32,0 @@ query.signature = Signer.sign(signature, this.opts.secret); |
@@ -8,3 +8,3 @@ { | ||
], | ||
"version": "1.0.0-beta5", | ||
"version": "1.0.0-beta6", | ||
"author": { | ||
@@ -11,0 +11,0 @@ "name": "Andy Appleton", |
@@ -5,3 +5,3 @@ # GoCardless Node.js client library | ||
## Version 1.0.0-beta5 note | ||
## Version 1.0.0-beta6 note | ||
@@ -8,0 +8,0 @@ This replaces the previous [gocardless npm module](https://npmjs.org/package/gocardless/0.1.1) and is not API compatible. It will be released as 1.0. |
@@ -92,4 +92,32 @@ var url = require('url'); | ||
}); | ||
describe('non-preauth, subscription or bill parms', function() { | ||
beforeEach(function() { | ||
params = { | ||
amount: '10', | ||
state: 'id=123', | ||
redirect_uri: 'http://example.com/redirect', | ||
cancel_uri: 'http://example.com/cancel' | ||
}; | ||
queryString = url.parse(resource.newUrl(params)).query; | ||
parsedQuery = qs.parse(queryString); | ||
}); | ||
it('extracts state out of the resource params', function() { | ||
expect(parsedQuery.state).to.be('id=123'); | ||
expect(parsedQuery[resource.paramName].state).to.be(undefined); | ||
}); | ||
it('extracts redirect_uri out of the resource params', function() { | ||
expect(parsedQuery.redirect_uri).to.be('http://example.com/redirect'); | ||
expect(parsedQuery[resource.paramName].redirect_uri).to.be(undefined); | ||
}); | ||
it('extracts cancel_uri out of the resource params', function() { | ||
expect(parsedQuery.cancel_uri).to.be('http://example.com/cancel'); | ||
expect(parsedQuery[resource.paramName].cancel_uri).to.be(undefined); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}; |
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
54113
1442