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

API Updates #1159

Merged
merged 4 commits into from
May 20, 2021
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
4 changes: 4 additions & 0 deletions lib/resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ module.exports = {
Checkout: resourceNamespace('checkout', {
Sessions: require('./resources/Checkout/Sessions'),
}),
Identity: resourceNamespace('identity', {
VerificationReports: require('./resources/Identity/VerificationReports'),
VerificationSessions: require('./resources/Identity/VerificationSessions'),
}),
Issuing: resourceNamespace('issuing', {
Authorizations: require('./resources/Issuing/Authorizations'),
Cards: require('./resources/Issuing/Cards'),
Expand Down
11 changes: 11 additions & 0 deletions lib/resources/Identity/VerificationReports.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// File generated from our OpenAPI spec

'use strict';

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

module.exports = StripeResource.extend({
path: 'identity/verification_reports',

includeBasic: ['retrieve', 'list'],
});
22 changes: 22 additions & 0 deletions lib/resources/Identity/VerificationSessions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// File generated from our OpenAPI spec

'use strict';

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

module.exports = StripeResource.extend({
path: 'identity/verification_sessions',

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

cancel: stripeMethod({
method: 'POST',
path: '/{session}/cancel',
}),

redact: stripeMethod({
method: 'POST',
path: '/{session}/redact',
}),
});
34 changes: 34 additions & 0 deletions test/resources/Identity/VerificationReport.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
'use strict';

const stripe = require('../../../testUtils').getSpyableStripe();
const expect = require('chai').expect;

describe('Identity', () => {
describe('VerificationReport Resource', () => {
describe('retrieve', () => {
it('Sends the correct request', () => {
stripe.identity.verificationReports.retrieve('vr_123');
expect(stripe.LAST_REQUEST).to.deep.equal({
method: 'GET',
url: '/v1/identity/verification_reports/vr_123',
data: {},
headers: {},
settings: {},
});
});
});

describe('list', () => {
it('Sends the correct request', () => {
stripe.identity.verificationReports.list();
expect(stripe.LAST_REQUEST).to.deep.equal({
method: 'GET',
url: '/v1/identity/verification_reports',
data: {},
headers: {},
settings: {},
});
});
});
});
});
96 changes: 96 additions & 0 deletions test/resources/Identity/VerificationSession.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
'use strict';

const stripe = require('../../../testUtils').getSpyableStripe();
const expect = require('chai').expect;

describe('Identity', () => {
describe('VerificationSession Resource', () => {
describe('create', () => {
it('Sends the correct request', () => {
stripe.identity.verificationSessions.create({type: 'id_number'});
expect(stripe.LAST_REQUEST).to.deep.equal({
method: 'POST',
url: '/v1/identity/verification_sessions',
data: {type: 'id_number'},
headers: {},
settings: {},
});
});
});

describe('retrieve', () => {
it('Sends the correct request', () => {
stripe.identity.verificationSessions.retrieve('vs_123');
expect(stripe.LAST_REQUEST).to.deep.equal({
method: 'GET',
url: '/v1/identity/verification_sessions/vs_123',
data: {},
headers: {},
settings: {},
});
});
});

describe('list', () => {
it('Sends the correct request', () => {
stripe.identity.verificationSessions.list();
expect(stripe.LAST_REQUEST).to.deep.equal({
method: 'GET',
url: '/v1/identity/verification_sessions',
data: {},
headers: {},
settings: {},
});
});
});

describe('update', () => {
it('Sends the correct request', () => {
stripe.identity.verificationSessions.update('vs_123', {
metadata: {
thing1: true,
thing2: 'yes',
},
});
expect(stripe.LAST_REQUEST).to.deep.equal({
method: 'POST',
url: '/v1/identity/verification_sessions/vs_123',
headers: {},
data: {
metadata: {
thing1: true,
thing2: 'yes',
},
},
settings: {},
});
});
});

describe('cancel', () => {
it('Sends the correct request', () => {
stripe.identity.verificationSessions.cancel('vs_123');
expect(stripe.LAST_REQUEST).to.deep.equal({
method: 'POST',
url: '/v1/identity/verification_sessions/vs_123/cancel',
headers: {},
data: {},
settings: {},
});
});
});

describe('redact', () => {
it('Sends the correct request', () => {
stripe.identity.verificationSessions.redact('vs_123');
expect(stripe.LAST_REQUEST).to.deep.equal({
method: 'POST',
url: '/v1/identity/verification_sessions/vs_123/redact',
headers: {},
data: {},
settings: {},
});
});
});
});
});
14 changes: 7 additions & 7 deletions types/2020-08-27/Accounts.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -507,37 +507,37 @@ declare module 'stripe' {

interface Requirements {
/**
* The date the fields in `currently_due` must be collected by to keep payouts enabled for the account. These fields might block payouts sooner if the next threshold is reached before these fields are collected.
* Date by which the fields in `currently_due` must be collected to keep the account enabled. These fields may disable the account sooner if the next threshold is reached before they are collected.
*/
current_deadline: number | null;

/**
* The fields that need to be collected to keep the account enabled. If not collected by the `current_deadline`, these fields appear in `past_due` as well, and the account is disabled.
* Fields that need to be collected to keep the account enabled. If not collected by `current_deadline`, these fields appear in `past_due` as well, and the account is disabled.
*/
currently_due: Array<string> | null;

/**
* If the account is disabled, this string describes why the account can't create charges or receive payouts. Can be `requirements.past_due`, `requirements.pending_verification`, `rejected.fraud`, `rejected.terms_of_service`, `rejected.listed`, `rejected.other`, `listed`, `under_review`, or `other`.
* If the account is disabled, this string describes why. Can be `requirements.past_due`, `requirements.pending_verification`, `listed`, `platform_paused`, `rejected.fraud`, `rejected.listed`, `rejected.terms_of_service`, `rejected.other`, `under_review`, or `other`.
*/
disabled_reason: string | null;

/**
* The fields that are `currently_due` and need to be collected again because validation or verification failed for some reason.
* Fields that are `currently_due` and need to be collected again because validation or verification failed.
*/
errors: Array<Requirements.Error> | null;

/**
* The fields that need to be collected assuming all volume thresholds are reached. As they become required, these fields appear in `currently_due` as well, and the `current_deadline` is set.
* Fields that need to be collected assuming all volume thresholds are reached. As they become required, they appear in `currently_due` as well, and `current_deadline` becomes set.
*/
eventually_due: Array<string> | null;

/**
* The fields that weren't collected by the `current_deadline`. These fields need to be collected to re-enable the account.
* Fields that weren't collected by `current_deadline`. These fields need to be collected to enable the account.
*/
past_due: Array<string> | null;

/**
* Fields that may become required depending on the results of verification or review. An empty array unless an asynchronous verification is pending. If verification fails, the fields in this array become required and move to `currently_due` or `past_due`.
* Fields that may become required depending on the results of verification or review. Will be an empty array unless an asynchronous verification is pending. If verification fails, these fields move to `eventually_due`, `currently_due`, or `past_due`.
*/
pending_verification: Array<string> | null;
}
Expand Down
2 changes: 1 addition & 1 deletion types/2020-08-27/BillingPortal/Sessions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ declare module 'stripe' {
customer: string;

/**
* The [configuration](https://stripe.com/docs/api/customer_portal/configuration) to use for this session, describing its functionality and features. If not specified, the session uses the default configuration.
* The ID of an existing [configuration](https://stripe.com/docs/api/customer_portal/configuration) to use for this session, describing its functionality and features. If not specified, the session uses the default configuration.
*/
configuration?: string;

Expand Down
14 changes: 7 additions & 7 deletions types/2020-08-27/Capabilities.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@ declare module 'stripe' {
namespace Capability {
interface Requirements {
/**
* The date the fields in `currently_due` must be collected by to keep the capability enabled for the account.
* Date by which the fields in `currently_due` must be collected to keep the capability enabled for the account. These fields may disable the capability sooner if the next threshold is reached before they are collected.
*/
current_deadline: number | null;

/**
* The fields that need to be collected to keep the capability enabled. If not collected by the `current_deadline`, these fields appear in `past_due` as well, and the capability is disabled.
* Fields that need to be collected to keep the capability enabled. If not collected by `current_deadline`, these fields appear in `past_due` as well, and the capability is disabled.
*/
currently_due: Array<string>;

/**
* If the capability is disabled, this string describes why. Possible values are `requirement.fields_needed`, `pending.onboarding`, `pending.review`, `rejected_fraud`, `rejected.unsupported_business` or `rejected.other`.
* If the capability is disabled, this string describes why. Can be `requirements.past_due`, `requirements.pending_verification`, `listed`, `platform_paused`, `rejected.fraud`, `rejected.listed`, `rejected.terms_of_service`, `rejected.other`, `under_review`, or `other`.
*
* `rejected.unsupported_business` means that the account's business is not supported by the capability. For example, payment methods may restrict the businesses they support in their terms of service:
*
Expand All @@ -63,22 +63,22 @@ declare module 'stripe' {
disabled_reason: string | null;

/**
* The fields that are `currently_due` and need to be collected again because validation or verification failed for some reason.
* Fields that are `currently_due` and need to be collected again because validation or verification failed.
*/
errors: Array<Requirements.Error>;

/**
* The fields that need to be collected assuming all volume thresholds are reached. As they become required, these fields appear in `currently_due` as well, and the `current_deadline` is set.
* Fields that need to be collected assuming all volume thresholds are reached. As they become required, they appear in `currently_due` as well, and `current_deadline` becomes set.
*/
eventually_due: Array<string>;

/**
* The fields that weren't collected by the `current_deadline`. These fields need to be collected to enable the capability for the account.
* Fields that weren't collected by `current_deadline`. These fields need to be collected to enable the capability on the account.
*/
past_due: Array<string>;

/**
* Fields that may become required depending on the results of verification or review. An empty array unless an asynchronous verification is pending. If verification fails, the fields in this array become required and move to `currently_due` or `past_due`.
* Fields that may become required depending on the results of verification or review. Will be an empty array unless an asynchronous verification is pending. If verification fails, these fields move to `eventually_due`, `currently_due`, or `past_due`.
*/
pending_verification: Array<string>;
}
Expand Down
2 changes: 1 addition & 1 deletion types/2020-08-27/Checkout/Sessions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ declare module 'stripe' {
customer: string | Stripe.Customer | Stripe.DeletedCustomer | null;

/**
* The customer details including the customer's tax exempt status and the customer's tax IDs.
* The customer details including the customer's tax exempt status and the customer's tax IDs. Only present on Sessions in `payment` or `subscription` mode.
*/
customer_details: Session.CustomerDetails | null;

Expand Down
15 changes: 8 additions & 7 deletions types/2020-08-27/Coupons.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,6 @@ declare module 'stripe' {
}

interface CouponCreateParams {
/**
* Specifies how long the discount will be in effect. Can be `forever`, `once`, or `repeating`.
*/
duration: CouponCreateParams.Duration;

/**
* A positive integer representing the amount to subtract from an invoice total (required if `percent_off` is not passed).
*/
Expand All @@ -138,6 +133,11 @@ declare module 'stripe' {
*/
currency?: string;

/**
* Specifies how long the discount will be in effect if used on a subscription. Can be `forever`, `once`, or `repeating`. Defaults to `once`.
*/
duration?: CouponCreateParams.Duration;

/**
* Required only if `duration` is `repeating`, in which case it must be a positive integer that specifies the number of months the discount will be in effect.
*/
Expand Down Expand Up @@ -184,7 +184,7 @@ declare module 'stripe' {
/**
* An array of Product IDs that this Coupon will apply to.
*/
products: Array<string>;
products?: Array<string>;
}

type Duration = 'forever' | 'once' | 'repeating';
Expand Down Expand Up @@ -235,9 +235,10 @@ declare module 'stripe' {
* A coupon has either a percent_off or an amount_off and currency. If you set an amount_off, that amount will be subtracted from any invoice's subtotal. For example, an invoice with a subtotal of 100 will have a final total of 0 if a coupon with an amount_off of 200 is applied to it and an invoice with a subtotal of 300 will have a final total of 100 if a coupon with an amount_off of 200 is applied to it.
*/
create(
params: CouponCreateParams,
params?: CouponCreateParams,
options?: RequestOptions
): Promise<Stripe.Response<Stripe.Coupon>>;
create(options?: RequestOptions): Promise<Stripe.Response<Stripe.Coupon>>;

/**
* Retrieves the coupon with the given ID.
Expand Down
2 changes: 1 addition & 1 deletion types/2020-08-27/FileLinks.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ declare module 'stripe' {

interface FileLinkCreateParams {
/**
* The ID of the file. The file's `purpose` must be one of the following: `business_icon`, `business_logo`, `customer_signature`, `dispute_evidence`, `finance_report_run`, `pci_document`, `sigma_scheduled_query`, or `tax_document_user_upload`.
* The ID of the file. The file's `purpose` must be one of the following: `business_icon`, `business_logo`, `customer_signature`, `dispute_evidence`, `finance_report_run`, `identity_document_downloadable`, `pci_document`, `selfie`, `sigma_scheduled_query`, or `tax_document_user_upload`.
*/
file: string;

Expand Down
4 changes: 4 additions & 0 deletions types/2020-08-27/Files.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ declare module 'stripe' {
| 'document_provider_identity_document'
| 'finance_report_run'
| 'identity_document'
| 'identity_document_downloadable'
| 'pci_document'
| 'selfie'
| 'sigma_scheduled_query'
| 'tax_document_user_upload';
}
Expand Down Expand Up @@ -112,7 +114,9 @@ declare module 'stripe' {
| 'document_provider_identity_document'
| 'finance_report_run'
| 'identity_document'
| 'identity_document_downloadable'
| 'pci_document'
| 'selfie'
| 'sigma_scheduled_query'
| 'tax_document_user_upload';
}
Expand Down
Loading