forked from stripe/stripe-node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Delete nested resource files"
This reverts commit d88a3e7.
- Loading branch information
1 parent
e52219b
commit e5eccb8
Showing
13 changed files
with
416 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,21 @@ | ||
'use strict'; | ||
|
||
const StripeResource = require('../StripeResource'); | ||
|
||
/** | ||
* ApplicationFeeRefunds is a unique resource in that, upon instantiation, | ||
* requires an application fee id , and therefore each of its methods only | ||
* require the refundId argument. | ||
* | ||
* This streamlines the API specifically for the case of accessing refunds | ||
* on a returned application fee object. | ||
* | ||
* E.g. applicationFeeObject.refunds.retrieve(refundId) | ||
* (As opposed to the also-supported stripe.applicationFees.retrieveRefund(chargeId, | ||
* refundId)) | ||
*/ | ||
module.exports = StripeResource.extend({ | ||
path: 'application_fees/{feeId}/refunds', | ||
|
||
includeBasic: ['create', 'list', 'retrieve', 'update'], | ||
}); |
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,9 @@ | ||
'use strict'; | ||
|
||
const StripeResource = require('../StripeResource'); | ||
|
||
module.exports = StripeResource.extend({ | ||
path: 'accounts/{accountId}/login_links', | ||
|
||
includeBasic: ['create'], | ||
}); |
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,9 @@ | ||
'use strict'; | ||
|
||
const StripeResource = require('../StripeResource'); | ||
|
||
module.exports = StripeResource.extend({ | ||
path: 'accounts/{accountId}/persons', | ||
|
||
includeBasic: ['create', 'del', 'list', 'retrieve', 'update'], | ||
}); |
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,9 @@ | ||
'use strict'; | ||
|
||
const StripeResource = require('../StripeResource'); | ||
|
||
module.exports = StripeResource.extend({ | ||
path: 'subscription_schedules/{scheduleId}/revisions', | ||
|
||
includeBasic: ['list', '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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
'use strict'; | ||
|
||
const StripeResource = require('../StripeResource'); | ||
|
||
module.exports = StripeResource.extend({ | ||
path: 'customers/{customerId}/tax_ids', | ||
|
||
includeBasic: ['create', 'del', 'list', '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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
'use strict'; | ||
|
||
const StripeResource = require('../StripeResource'); | ||
|
||
module.exports = StripeResource.extend({ | ||
path: 'transfers/{transferId}/reversals', | ||
|
||
includeBasic: ['create', 'list', 'retrieve', 'update'], | ||
}); |
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,56 @@ | ||
'use strict'; | ||
|
||
const resources = require('../../lib/stripe').resources; | ||
const stripe = require('../../testUtils').getSpyableStripe(); | ||
const expect = require('chai').expect; | ||
|
||
const APPFEE_TEST_ID = 'appFeeIdTest999'; | ||
const REFUND_TEST_ID = 'refundIdTest999'; | ||
|
||
// Create new CustomerCard instance with pre-filled customerId: | ||
const appFeeRefund = new resources.ApplicationFeeRefunds(stripe, { | ||
feeId: APPFEE_TEST_ID, | ||
}); | ||
|
||
// Use spy from existing resource: | ||
appFeeRefund._request = stripe.customers._request; | ||
|
||
describe('ApplicationFeeRefund Resource', () => { | ||
describe('retrieve', () => { | ||
it('Sends the correct request', () => { | ||
appFeeRefund.retrieve(REFUND_TEST_ID); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'GET', | ||
url: `/v1/application_fees/${APPFEE_TEST_ID}/refunds/${REFUND_TEST_ID}`, | ||
data: {}, | ||
headers: {}, | ||
}); | ||
}); | ||
}); | ||
|
||
describe('update', () => { | ||
it('Sends the correct request', () => { | ||
appFeeRefund.update(REFUND_TEST_ID, { | ||
metadata: {key: 'value'}, | ||
}); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'POST', | ||
url: `/v1/application_fees/${APPFEE_TEST_ID}/refunds/${REFUND_TEST_ID}`, | ||
data: {metadata: {key: 'value'}}, | ||
headers: {}, | ||
}); | ||
}); | ||
}); | ||
|
||
describe('list', () => { | ||
it('Sends the correct request', () => { | ||
appFeeRefund.list(); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'GET', | ||
url: `/v1/application_fees/${APPFEE_TEST_ID}/refunds`, | ||
data: {}, | ||
headers: {}, | ||
}); | ||
}); | ||
}); | ||
}); |
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,27 @@ | ||
'use strict'; | ||
|
||
const resources = require('../../lib/stripe').resources; | ||
const stripe = require('../../testUtils').getSpyableStripe(); | ||
const expect = require('chai').expect; | ||
|
||
const ACCOUNT_ID = 'acct_EXPRESS'; | ||
|
||
// Create new LoginLink instance with pre-filled accountId: | ||
const loginLink = new resources.LoginLinks(stripe, {accountId: ACCOUNT_ID}); | ||
|
||
// Use spy from existing resource: | ||
loginLink._request = stripe.customers._request; | ||
|
||
describe('LoginLink Resource', () => { | ||
describe('create', () => { | ||
it('Sends the correct request', () => { | ||
loginLink.create(); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'POST', | ||
url: `/v1/accounts/${ACCOUNT_ID}/login_links`, | ||
headers: {}, | ||
data: {}, | ||
}); | ||
}); | ||
}); | ||
}); |
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,80 @@ | ||
'use strict'; | ||
|
||
const resources = require('../../lib/stripe').resources; | ||
const stripe = require('../../testUtils').getSpyableStripe(); | ||
const expect = require('chai').expect; | ||
|
||
const ACCOUNT_TEST_ID = 'acct_123'; | ||
const PERSON_TEST_ID = 'person_123'; | ||
|
||
// Create new Person instance with pre-filled accountId: | ||
const person = new resources.Persons(stripe, {accountId: ACCOUNT_TEST_ID}); | ||
|
||
// Use spy from existing resource: | ||
person._request = stripe.customers._request; | ||
|
||
describe('Person Resource', () => { | ||
describe('create', () => { | ||
it('Sends the correct request', () => { | ||
person.create({ | ||
first_name: 'John', | ||
}); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'POST', | ||
url: `/v1/accounts/${ACCOUNT_TEST_ID}/persons`, | ||
data: {first_name: 'John'}, | ||
headers: {}, | ||
}); | ||
}); | ||
}); | ||
|
||
describe('delete', () => { | ||
it('Sends the correct request', () => { | ||
person.del(PERSON_TEST_ID); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'DELETE', | ||
url: `/v1/accounts/${ACCOUNT_TEST_ID}/persons/${PERSON_TEST_ID}`, | ||
data: {}, | ||
headers: {}, | ||
}); | ||
}); | ||
}); | ||
|
||
describe('list', () => { | ||
it('Sends the correct request', () => { | ||
person.list(); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'GET', | ||
url: `/v1/accounts/${ACCOUNT_TEST_ID}/persons`, | ||
data: {}, | ||
headers: {}, | ||
}); | ||
}); | ||
}); | ||
|
||
describe('retrieve', () => { | ||
it('Sends the correct request', () => { | ||
person.retrieve(PERSON_TEST_ID); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'GET', | ||
url: `/v1/accounts/${ACCOUNT_TEST_ID}/persons/${PERSON_TEST_ID}`, | ||
data: {}, | ||
headers: {}, | ||
}); | ||
}); | ||
}); | ||
|
||
describe('update', () => { | ||
it('Sends the correct request', () => { | ||
person.update(PERSON_TEST_ID, { | ||
first_name: 'John', | ||
}); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'POST', | ||
url: `/v1/accounts/${ACCOUNT_TEST_ID}/persons/${PERSON_TEST_ID}`, | ||
data: {first_name: 'John'}, | ||
headers: {}, | ||
}); | ||
}); | ||
}); | ||
}); |
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,42 @@ | ||
'use strict'; | ||
|
||
const resources = require('../../lib/stripe').resources; | ||
const stripe = require('../../testUtils').getSpyableStripe(); | ||
const expect = require('chai').expect; | ||
|
||
const SCHEDULE_TEST_ID = 'sub_sched_123'; | ||
const REVISION_TEST_ID = 'sub_sched_rev_123'; | ||
|
||
// Create new SubscriptionScheduleRevision instance with pre-filled scheduleId: | ||
const revision = new resources.SubscriptionScheduleRevisions(stripe, { | ||
scheduleId: SCHEDULE_TEST_ID, | ||
}); | ||
|
||
// Use spy from existing resource: | ||
revision._request = stripe.customers._request; | ||
|
||
describe('SubscriptionScheduleRevision Resource', () => { | ||
describe('list', () => { | ||
it('Sends the correct request', () => { | ||
revision.list(); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'GET', | ||
url: `/v1/subscription_schedules/${SCHEDULE_TEST_ID}/revisions`, | ||
data: {}, | ||
headers: {}, | ||
}); | ||
}); | ||
}); | ||
|
||
describe('retrieve', () => { | ||
it('Sends the correct request', () => { | ||
revision.retrieve(REVISION_TEST_ID); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'GET', | ||
url: `/v1/subscription_schedules/${SCHEDULE_TEST_ID}/revisions/${REVISION_TEST_ID}`, | ||
data: {}, | ||
headers: {}, | ||
}); | ||
}); | ||
}); | ||
}); |
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,67 @@ | ||
'use strict'; | ||
|
||
const resources = require('../../lib/stripe').resources; | ||
const stripe = require('../../testUtils').getSpyableStripe(); | ||
const expect = require('chai').expect; | ||
|
||
const CUSTOMER_TEST_ID = 'cus_123'; | ||
const TAX_ID_TEST_ID = 'txi_123'; | ||
|
||
const taxId = new resources.TaxIds(stripe, {customerId: CUSTOMER_TEST_ID}); | ||
|
||
// Use spy from existing resource: | ||
taxId._request = stripe.customers._request; | ||
|
||
describe('TaxId Resource', () => { | ||
describe('create', () => { | ||
it('Sends the correct request', () => { | ||
const data = { | ||
type: 'eu_vat', | ||
value: '11111', | ||
}; | ||
taxId.create(data); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'POST', | ||
url: `/v1/customers/${CUSTOMER_TEST_ID}/tax_ids`, | ||
data, | ||
headers: {}, | ||
}); | ||
}); | ||
}); | ||
|
||
describe('delete', () => { | ||
it('Sends the correct request', () => { | ||
taxId.del(TAX_ID_TEST_ID); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'DELETE', | ||
url: `/v1/customers/${CUSTOMER_TEST_ID}/tax_ids/${TAX_ID_TEST_ID}`, | ||
data: {}, | ||
headers: {}, | ||
}); | ||
}); | ||
}); | ||
|
||
describe('list', () => { | ||
it('Sends the correct request', () => { | ||
taxId.list(); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'GET', | ||
url: `/v1/customers/${CUSTOMER_TEST_ID}/tax_ids`, | ||
data: {}, | ||
headers: {}, | ||
}); | ||
}); | ||
}); | ||
|
||
describe('retrieve', () => { | ||
it('Sends the correct request', () => { | ||
taxId.retrieve(TAX_ID_TEST_ID); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'GET', | ||
url: `/v1/customers/${CUSTOMER_TEST_ID}/tax_ids/${TAX_ID_TEST_ID}`, | ||
data: {}, | ||
headers: {}, | ||
}); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.