Skip to content

Commit

Permalink
Add support for the TaxId resource and APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
remi-stripe committed Apr 13, 2019
1 parent 0d40b87 commit 1f4941f
Show file tree
Hide file tree
Showing 5 changed files with 270 additions and 98 deletions.
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_id.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

0 comments on commit 1f4941f

Please sign in to comment.