-
Notifications
You must be signed in to change notification settings - Fork 757
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #588 from stripe/remi-add-tax-rates
Add support for the TaxRate resource and APIs
- Loading branch information
Showing
3 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
'use strict'; | ||
|
||
module.exports = require('../StripeResource').extend({ | ||
path: 'tax_rates', | ||
includeBasic: ['create', 'list', 'update', 'retrieve'], | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
'use strict'; | ||
|
||
var stripe = require('../../testUtils').getSpyableStripe(); | ||
var expect = require('chai').expect; | ||
|
||
describe('TaxRates Resource', function() { | ||
describe('retrieve', function() { | ||
it('Sends the correct request', function() { | ||
stripe.taxRates.retrieve('txr_123'); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'GET', | ||
url: '/v1/tax_rates/txr_123', | ||
headers: {}, | ||
data: {}, | ||
}); | ||
}); | ||
}); | ||
|
||
describe('update', function() { | ||
it('Sends the correct request', function() { | ||
var data = { | ||
metadata: {a: '1234'}, | ||
}; | ||
stripe.taxRates.update('txr_123', data); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'POST', | ||
url: '/v1/tax_rates/txr_123', | ||
headers: {}, | ||
data: data, | ||
}); | ||
}); | ||
}); | ||
|
||
describe('create', function() { | ||
it('Sends the correct request', function() { | ||
var data = { | ||
display_name: 'name', | ||
inclusive: false, | ||
percentage: 10.15, | ||
}; | ||
stripe.taxRates.create(data); | ||
|
||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'POST', | ||
url: '/v1/tax_rates', | ||
headers: {}, | ||
data: data, | ||
}); | ||
}); | ||
}); | ||
|
||
describe('list', function() { | ||
it('Sends the correct request', function() { | ||
stripe.taxRates.list(); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'GET', | ||
url: '/v1/tax_rates', | ||
headers: {}, | ||
data: {}, | ||
}); | ||
}); | ||
}); | ||
}); |