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

Misc. manual formatting #623

Merged
merged 5 commits into from
May 9, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/resources/AccountLinks.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
'use strict';

module.exports = require('../StripeResource').extend({
const StripeResource = require('../StripeResource');

module.exports = StripeResource.extend({
path: 'account_links',

includeBasic: ['create'],
});
5 changes: 4 additions & 1 deletion lib/resources/ApplePayDomains.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
'use strict';

module.exports = require('../StripeResource').extend({
const StripeResource = require('../StripeResource');

module.exports = StripeResource.extend({
path: 'apple_pay/domains',

includeBasic: ['create', 'del', 'list', 'retrieve'],
});
1 change: 1 addition & 0 deletions lib/resources/ApplicationFeeRefunds.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ const StripeResource = require('../StripeResource');
*/
module.exports = StripeResource.extend({
path: 'application_fees/{feeId}/refunds',

includeBasic: ['create', 'list', 'retrieve', 'update'],
});
5 changes: 4 additions & 1 deletion lib/resources/BalanceTransactions.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
'use strict';

module.exports = require('../StripeResource').extend({
const StripeResource = require('../StripeResource');

module.exports = StripeResource.extend({
path: 'balance/history',

includeBasic: ['list', 'retrieve'],
});
1 change: 1 addition & 0 deletions lib/resources/Checkout/Sessions.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ const StripeResource = require('../../StripeResource');

module.exports = StripeResource.extend({
path: 'checkout/sessions',

includeBasic: ['create', 'retrieve'],
});
5 changes: 4 additions & 1 deletion lib/resources/Coupons.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
'use strict';

module.exports = require('../StripeResource').extend({
const StripeResource = require('../StripeResource');

module.exports = StripeResource.extend({
path: 'coupons',

includeBasic: ['create', 'del', 'list', 'retrieve', 'update'],
});
3 changes: 2 additions & 1 deletion lib/resources/CreditNotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ const stripeMethod = StripeResource.method;

module.exports = StripeResource.extend({
path: 'credit_notes',

includeBasic: ['create', 'list', 'retrieve', 'update'],

voidCreditNote: stripeMethod({
method: 'POST',
path: '{id}/void',
path: '/{id}/void',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that correct? Other paths do not have a leading /.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ob-stripe Some do, some don’t. I’m assuming they should all be consistent at the very least and unless I’m misremembering, @rattrayalex-stripe suggested leading /

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did. I'm pretty sure we have something that normalizes this. just in case, @irace-stripe can you check that there is test coverage for credit notes?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There seems to be, though I’m not 100% sure if these tests cover the difference between leading / and no leading /? https://github.com/stripe/stripe-node/blob/master/test/resources/CreditNotes.spec.js

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/stripe/stripe-node/blob/master/test/resources/CreditNotes.spec.js#L62-L65 seems to give us coverage – if the leading slash was problematic, it would fail since the request would include a //.

urlParams: ['id'],
}),
});
1 change: 1 addition & 0 deletions lib/resources/Customers.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const stripeMethod = StripeResource.method;

module.exports = StripeResource.extend({
path: 'customers',

includeBasic: ['create', 'del', 'list', 'retrieve', 'update'],

/**
Expand Down
6 changes: 1 addition & 5 deletions lib/resources/Disputes.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,5 @@ module.exports = StripeResource.extend({

includeBasic: ['list', 'retrieve', 'update'],

close: stripeMethod({
method: 'POST',
path: '/{id}/close',
urlParams: ['id'],
}),
close: stripeMethod({method: 'POST', path: '/{id}/close', urlParams: ['id']}),
});
8 changes: 4 additions & 4 deletions lib/resources/EphemeralKeys.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ const StripeResource = require('../StripeResource');
const stripeMethod = StripeResource.method;

module.exports = StripeResource.extend({
path: 'ephemeral_keys',

includeBasic: ['del'],

create: stripeMethod({
method: 'POST',
validator: (data, options) => {
Expand All @@ -14,8 +18,4 @@ module.exports = StripeResource.extend({
}
},
}),

path: 'ephemeral_keys',

includeBasic: ['del'],
});
5 changes: 4 additions & 1 deletion lib/resources/Events.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
'use strict';

module.exports = require('../StripeResource').extend({
const StripeResource = require('../StripeResource');

module.exports = StripeResource.extend({
path: 'events',

includeBasic: ['list', 'retrieve'],
});
1 change: 1 addition & 0 deletions lib/resources/FileLinks.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ const StripeResource = require('../StripeResource');

module.exports = StripeResource.extend({
path: 'file_links',

includeBasic: ['create', 'list', 'retrieve', 'update'],
});
11 changes: 6 additions & 5 deletions lib/resources/Files.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@

const Buffer = require('safe-buffer').Buffer;
const utils = require('../utils');
const StripeResource = require('../StripeResource');
const stripeMethod = StripeResource.method;
const multipartDataGenerator = require('../MultipartDataGenerator');
const Error = require('../Error');
const StripeResource = require('../StripeResource');
const stripeMethod = StripeResource.method;

module.exports = StripeResource.extend({
path: 'files',

includeBasic: ['list', 'retrieve'],

requestDataProcessor(method, data, headers, callback) {
data = data || {};

Expand Down Expand Up @@ -67,9 +71,6 @@ module.exports = StripeResource.extend({
}
},

path: 'files',
includeBasic: ['list', 'retrieve'],

create: stripeMethod({
method: 'POST',
headers: {
Expand Down
5 changes: 4 additions & 1 deletion lib/resources/InvoiceItems.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
'use strict';

module.exports = require('../StripeResource').extend({
const StripeResource = require('../StripeResource');

module.exports = StripeResource.extend({
path: 'invoiceitems',

includeBasic: ['create', 'del', 'list', 'retrieve', 'update'],
});
1 change: 1 addition & 0 deletions lib/resources/Invoices.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const utils = require('../utils');

module.exports = StripeResource.extend({
path: 'invoices',

includeBasic: ['create', 'del', 'list', 'retrieve', 'update'],

finalizeInvoice: stripeMethod({
Expand Down
1 change: 1 addition & 0 deletions lib/resources/Issuing/Cardholders.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ const StripeResource = require('../../StripeResource');

module.exports = StripeResource.extend({
path: 'issuing/cardholders',

includeBasic: ['create', 'list', 'retrieve', 'update'],
});
1 change: 1 addition & 0 deletions lib/resources/Issuing/Disputes.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ const StripeResource = require('../../StripeResource');

module.exports = StripeResource.extend({
path: 'issuing/disputes',

includeBasic: ['create', 'list', 'retrieve', 'update'],
});
1 change: 1 addition & 0 deletions lib/resources/Issuing/Transactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ const StripeResource = require('../../StripeResource');

module.exports = StripeResource.extend({
path: 'issuing/transactions',

includeBasic: ['list', 'retrieve', 'update'],
});
3 changes: 2 additions & 1 deletion lib/resources/LoginLinks.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const StripeResource = require('../StripeResource');

module.exports = StripeResource.extend({
path: 'accounts/{accountId}/login_links',
path: 'accounts/{account}/login_links',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be accountId, no?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rattrayalex-stripe Not as per OpenAPI, but we can override if necessary?


includeBasic: ['create'],
});
6 changes: 1 addition & 5 deletions lib/resources/Orders.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ module.exports = StripeResource.extend({

includeBasic: ['create', 'list', 'retrieve', 'update'],

pay: stripeMethod({
method: 'POST',
path: '/{id}/pay',
urlParams: ['id'],
}),
pay: stripeMethod({method: 'POST', path: '/{id}/pay', urlParams: ['id']}),

returnOrder: stripeMethod({
method: 'POST',
Expand Down
7 changes: 4 additions & 3 deletions lib/resources/PaymentIntents.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,24 @@ const stripeMethod = StripeResource.method;

module.exports = StripeResource.extend({
path: 'payment_intents',

includeBasic: ['create', 'list', 'retrieve', 'update'],

cancel: stripeMethod({
method: 'POST',
path: '{id}/cancel',
path: '/{id}/cancel',
urlParams: ['id'],
}),

capture: stripeMethod({
method: 'POST',
path: '{id}/capture',
path: '/{id}/capture',
urlParams: ['id'],
}),

confirm: stripeMethod({
method: 'POST',
path: '{id}/confirm',
path: '/{id}/confirm',
urlParams: ['id'],
}),
});
5 changes: 3 additions & 2 deletions lib/resources/PaymentMethods.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@ const stripeMethod = StripeResource.method;

module.exports = StripeResource.extend({
path: 'payment_methods',

includeBasic: ['create', 'list', 'retrieve', 'update'],

attach: stripeMethod({
method: 'POST',
path: '{id}/attach',
path: '/{id}/attach',
urlParams: ['id'],
}),

detach: stripeMethod({
method: 'POST',
path: '{id}/detach',
path: '/{id}/detach',
urlParams: ['id'],
}),
});
2 changes: 1 addition & 1 deletion lib/resources/Payouts.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = StripeResource.extend({

cancel: stripeMethod({
method: 'POST',
path: '{id}/cancel',
path: '/{id}/cancel',
urlParams: ['id'],
}),
});
15 changes: 2 additions & 13 deletions lib/resources/Persons.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,8 @@

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

/**
* Persons is a unique resource in that, upon instantiation,
* requires an accountId, and therefore each of its methods only
* require the personId argument.
*
* This streamlines the API specifically for the case of accessing person
* on a returned transfer object.
*
* E.g. accountObject.person.retrieve(personId)
* (As opposed to the also-supported stripe.accounts.retrievePerson(accountId,
* personId))
*/
module.exports = StripeResource.extend({
path: 'accounts/{accountId}/persons',
path: 'accounts/{account}/persons',

includeBasic: ['create', 'del', 'list', 'retrieve', 'update'],
});
5 changes: 4 additions & 1 deletion lib/resources/Plans.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
'use strict';

module.exports = require('../StripeResource').extend({
const StripeResource = require('../StripeResource');

module.exports = StripeResource.extend({
path: 'plans',

includeBasic: ['create', 'del', 'list', 'retrieve', 'update'],
});
1 change: 1 addition & 0 deletions lib/resources/Radar/ValueListItems.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ const StripeResource = require('../../StripeResource');

module.exports = StripeResource.extend({
path: 'radar/value_list_items',

includeBasic: ['create', 'del', 'list', 'retrieve'],
});
1 change: 1 addition & 0 deletions lib/resources/Radar/ValueLists.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ const StripeResource = require('../../StripeResource');

module.exports = StripeResource.extend({
path: 'radar/value_lists',

includeBasic: ['create', 'del', 'list', 'retrieve', 'update'],
});
1 change: 1 addition & 0 deletions lib/resources/Recipients.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const stripeMethod = StripeResource.method;

module.exports = StripeResource.extend({
path: 'recipients',

includeBasic: ['create', 'del', 'list', 'retrieve', 'update'],

/**
Expand Down
1 change: 1 addition & 0 deletions lib/resources/Reporting/ReportRuns.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ const StripeResource = require('../../StripeResource');

module.exports = StripeResource.extend({
path: 'reporting/report_runs',

includeBasic: ['create', 'list', 'retrieve'],
});
1 change: 1 addition & 0 deletions lib/resources/Reporting/ReportTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ const StripeResource = require('../../StripeResource');

module.exports = StripeResource.extend({
path: 'reporting/report_types',

includeBasic: ['list', 'retrieve'],
});
1 change: 1 addition & 0 deletions lib/resources/SubscriptionItems.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ const StripeResource = require('../StripeResource');

module.exports = StripeResource.extend({
path: 'subscription_items',

includeBasic: ['create', 'del', 'list', 'retrieve', 'update'],
});
15 changes: 2 additions & 13 deletions lib/resources/SubscriptionScheduleRevisions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,8 @@

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

/**
* SubscriptionScheduleRevisions is a unique resource in that, upon instantiation,
* requires a subscription schedule id, and therefore each of its methods only
* require the scheduleId argument.
*
* This streamlines the API specifically for the case of accessing a revision
* on a returned subscription schedule object.
*
* E.g. scheduleObject.revisions.retrieve(revisionId)
* (As opposed to the also-supported stripe.subscriptionSchedules.retrieveRevision(scheduleId,
* revisionId))
*/
module.exports = StripeResource.extend({
path: 'subscription_schedules/{scheduleId}/revisions',
path: 'subscription_schedules/{schedule}/revisions',

includeBasic: ['list', 'retrieve'],
});