Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for the TaxId resource and APIs #589

Merged
merged 1 commit into from
Apr 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions lib/resources/Customers.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,4 +169,32 @@ module.exports = StripeResource.extend({
urlParams: ['customerId', 'subscriptionId'],
}),

/**
* Customer: TaxId methods
*/

createTaxId: stripeMethod({
method: 'POST',
path: '/{customerId}/tax_ids',
urlParams: ['customerId'],
}),

deleteTaxId: stripeMethod({
method: 'DELETE',
path: '/{customerId}/tax_ids/{taxIdId}',
urlParams: ['customerId', 'taxIdId'],
}),

listTaxIds: stripeMethod({
method: 'GET',
path: '/{customerId}/tax_ids',
urlParams: ['customerId'],
methodType: 'list',
}),

retrieveTaxId: stripeMethod({
method: 'GET',
path: '/{customerId}/tax_ids/{taxIdId}',
urlParams: ['customerId', 'taxIdId'],
}),
});
19 changes: 19 additions & 0 deletions lib/resources/TaxIds.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use strict';

var StripeResource = require('../StripeResource');

/**
* TaxIds is a unique resource in that, upon instantiation,
* requires a customerId, and therefore each of its methods only
* require the taxId argument.
*
* This streamlines the API specifically for the case of accessing a tax id
* on a returned customer object.
*
* E.g. customerObject.tax_ids.retrieve(taxIdId)
* (As opposed to the also-supported stripe.customers.retrieveTaxId(customerId, taxIdId))
*/
module.exports = StripeResource.extend({
path: 'customers/{customerId}/tax_ids',
includeBasic: ['create', 'del', 'list', 'retrieve'],
});
1 change: 1 addition & 0 deletions lib/stripe.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ var resources = {
CustomerSubscriptions: require('./resources/CustomerSubscriptions'),
Persons: require('./resources/Persons'),
SubscriptionScheduleRevisions: require('./resources/SubscriptionScheduleRevisions'),
TaxIds: require('./resources/TaxIds'),
TransferReversals: require('./resources/TransferReversals'),

// Namespaced resources
Expand Down
Loading