From 7b50b6f463bb2fbca28b2e66a752232e811b86b2 Mon Sep 17 00:00:00 2001 From: Richard Marmorstein Date: Tue, 18 May 2021 12:13:19 -0400 Subject: [PATCH 1/4] Codegen for openapi 6f9da2d --- lib/resources.js | 4 + lib/resources/Identity/VerificationReports.js | 11 + .../Identity/VerificationSessions.js | 22 + types/2020-08-27/Accounts.d.ts | 14 +- types/2020-08-27/Capabilities.d.ts | 14 +- types/2020-08-27/Coupons.d.ts | 13 +- types/2020-08-27/FileLinks.d.ts | 2 +- types/2020-08-27/Files.d.ts | 4 + .../Identity/VerificationReports.d.ts | 418 +++++++++++++++ .../Identity/VerificationSessions.d.ts | 477 ++++++++++++++++++ types/2020-08-27/Persons.d.ts | 8 +- types/2020-08-27/index.d.ts | 6 + 12 files changed, 968 insertions(+), 25 deletions(-) create mode 100644 lib/resources/Identity/VerificationReports.js create mode 100644 lib/resources/Identity/VerificationSessions.js create mode 100644 types/2020-08-27/Identity/VerificationReports.d.ts create mode 100644 types/2020-08-27/Identity/VerificationSessions.d.ts diff --git a/lib/resources.js b/lib/resources.js index 824f71f5af..74c0331c29 100644 --- a/lib/resources.js +++ b/lib/resources.js @@ -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'), diff --git a/lib/resources/Identity/VerificationReports.js b/lib/resources/Identity/VerificationReports.js new file mode 100644 index 0000000000..bdd300f947 --- /dev/null +++ b/lib/resources/Identity/VerificationReports.js @@ -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'], +}); diff --git a/lib/resources/Identity/VerificationSessions.js b/lib/resources/Identity/VerificationSessions.js new file mode 100644 index 0000000000..fc515b88c5 --- /dev/null +++ b/lib/resources/Identity/VerificationSessions.js @@ -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', + }), +}); diff --git a/types/2020-08-27/Accounts.d.ts b/types/2020-08-27/Accounts.d.ts index f347fef129..47c8d4d21a 100644 --- a/types/2020-08-27/Accounts.d.ts +++ b/types/2020-08-27/Accounts.d.ts @@ -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 | 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 | 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 | 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 | 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 become required and move to `currently_due` or `past_due`. */ pending_verification: Array | null; } diff --git a/types/2020-08-27/Capabilities.d.ts b/types/2020-08-27/Capabilities.d.ts index 320e00429f..10e2fdcc22 100644 --- a/types/2020-08-27/Capabilities.d.ts +++ b/types/2020-08-27/Capabilities.d.ts @@ -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; /** - * 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: * @@ -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; /** - * 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; /** - * 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; /** - * 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 become required and move to `currently_due` or `past_due`. */ pending_verification: Array; } diff --git a/types/2020-08-27/Coupons.d.ts b/types/2020-08-27/Coupons.d.ts index 92dbefdbe3..14ca1e4342 100644 --- a/types/2020-08-27/Coupons.d.ts +++ b/types/2020-08-27/Coupons.d.ts @@ -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). */ @@ -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. */ @@ -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>; + create(options?: RequestOptions): Promise>; /** * Retrieves the coupon with the given ID. diff --git a/types/2020-08-27/FileLinks.d.ts b/types/2020-08-27/FileLinks.d.ts index a51b543421..e8fe93046a 100644 --- a/types/2020-08-27/FileLinks.d.ts +++ b/types/2020-08-27/FileLinks.d.ts @@ -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; diff --git a/types/2020-08-27/Files.d.ts b/types/2020-08-27/Files.d.ts index e9d22b46e3..9c66ee1233 100644 --- a/types/2020-08-27/Files.d.ts +++ b/types/2020-08-27/Files.d.ts @@ -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'; } @@ -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'; } diff --git a/types/2020-08-27/Identity/VerificationReports.d.ts b/types/2020-08-27/Identity/VerificationReports.d.ts new file mode 100644 index 0000000000..8d66e86900 --- /dev/null +++ b/types/2020-08-27/Identity/VerificationReports.d.ts @@ -0,0 +1,418 @@ +// File generated from our OpenAPI spec + +declare module 'stripe' { + namespace Stripe { + namespace Identity { + /** + * The VerificationReport object. + */ + interface VerificationReport { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'identity.verification_report'; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + /** + * Result from a document check + */ + document?: VerificationReport.Document; + + /** + * Result from an id_number check + */ + id_number?: VerificationReport.IdNumber; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + options: VerificationReport.Options; + + /** + * Result from a selfie check + */ + selfie?: VerificationReport.Selfie; + + /** + * Type of report. + */ + type: VerificationReport.Type; + + /** + * ID of the VerificationSession that created this report. + */ + verification_session: string | null; + } + + namespace VerificationReport { + interface Document { + /** + * Address as it appears in the document. + */ + address: Stripe.Address | null; + + /** + * Date of birth as it appears in the document. + */ + dob: Document.Dob | null; + + /** + * Details on the verification error. Present when status is `unverified`. + */ + error: Document.Error | null; + + /** + * Expiration date of the document. + */ + expiration_date: Document.ExpirationDate | null; + + /** + * Array of [File](https://stripe.com/docs/api/files) ids containing images for this document. + */ + files: Array | null; + + /** + * First name as it appears in the document. + */ + first_name: string | null; + + /** + * Issued date of the document. + */ + issued_date: Document.IssuedDate | null; + + /** + * Issuing country of the document. + */ + issuing_country: string | null; + + /** + * Last name as it appears in the document. + */ + last_name: string | null; + + /** + * Document ID number. + */ + number: string | null; + + /** + * Status of this `document` check. + */ + status: Document.Status; + + /** + * Type of the document. + */ + type: Document.Type | null; + } + + namespace Document { + interface Dob { + /** + * Numerical day between 1 and 31. + */ + day: number | null; + + /** + * Numerical month between 1 and 12. + */ + month: number | null; + + /** + * The four-digit year. + */ + year: number | null; + } + + interface Error { + /** + * A short machine-readable string giving the reason for the verification failure. + */ + code: Error.Code | null; + + /** + * A human-readable message giving the reason for the failure. These messages can be shown to your users. + */ + reason: string | null; + } + + namespace Error { + type Code = + | 'document_expired' + | 'document_type_not_supported' + | 'document_unverified_other'; + } + + interface ExpirationDate { + /** + * Numerical day between 1 and 31. + */ + day: number | null; + + /** + * Numerical month between 1 and 12. + */ + month: number | null; + + /** + * The four-digit year. + */ + year: number | null; + } + + interface IssuedDate { + /** + * Numerical day between 1 and 31. + */ + day: number | null; + + /** + * Numerical month between 1 and 12. + */ + month: number | null; + + /** + * The four-digit year. + */ + year: number | null; + } + + type Status = 'unverified' | 'verified'; + + type Type = 'driving_license' | 'id_card' | 'passport'; + } + + interface IdNumber { + /** + * Date of birth. + */ + dob: IdNumber.Dob | null; + + /** + * Details on the verification error. Present when status is `unverified`. + */ + error: IdNumber.Error | null; + + /** + * First name. + */ + first_name: string | null; + + /** + * ID number. + */ + id_number: string | null; + + /** + * Type of ID number. + */ + id_number_type: IdNumber.IdNumberType | null; + + /** + * Last name. + */ + last_name: string | null; + + /** + * Status of this `id_number` check. + */ + status: IdNumber.Status; + } + + namespace IdNumber { + interface Dob { + /** + * Numerical day between 1 and 31. + */ + day: number | null; + + /** + * Numerical month between 1 and 12. + */ + month: number | null; + + /** + * The four-digit year. + */ + year: number | null; + } + + interface Error { + /** + * A short machine-readable string giving the reason for the verification failure. + */ + code: Error.Code | null; + + /** + * A human-readable message giving the reason for the failure. These messages can be shown to your users. + */ + reason: string | null; + } + + namespace Error { + type Code = + | 'id_number_insufficient_document_data' + | 'id_number_mismatch' + | 'id_number_unverified_other'; + } + + type IdNumberType = 'br_cpf' | 'sg_nric' | 'us_ssn'; + + type Status = 'unverified' | 'verified'; + } + + interface Options { + document?: Options.Document; + + id_number?: Options.IdNumber; + } + + namespace Options { + interface Document { + /** + * Restrict the list of allowed document type to these types. + */ + allowed_types?: Array; + + /** + * Require that the user provide an id number which will be verified. + */ + require_id_number?: boolean; + + /** + * Require that the user capture documents live with their webcam or phone camera. + */ + require_live_capture?: boolean; + + /** + * Require that the user provide a selfie to compare against the document photo. + */ + require_matching_selfie?: boolean; + } + + namespace Document { + type AllowedType = 'driving_license' | 'id_card' | 'passport'; + } + + interface IdNumber {} + } + + interface Selfie { + /** + * ID of the [File](https://stripe.com/docs/api/files) holding the image of the identity document used in this check. + */ + document: string | null; + + /** + * Details on the verification error. Present when status is `unverified`. + */ + error: Selfie.Error | null; + + /** + * ID of the [File](https://stripe.com/docs/api/files) holding the image of the selfie used in this check. + */ + selfie: string | null; + + /** + * Status of this `selfie` check. + */ + status: Selfie.Status; + } + + namespace Selfie { + interface Error { + /** + * A short machine-readable string giving the reason for the verification failure. + */ + code: Error.Code | null; + + /** + * A human-readable message giving the reason for the failure. These messages can be shown to your users. + */ + reason: string | null; + } + + namespace Error { + type Code = + | 'selfie_document_missing_photo' + | 'selfie_face_mismatch' + | 'selfie_manipulated' + | 'selfie_unverified_other'; + } + + type Status = 'unverified' | 'verified'; + } + + type Type = 'document' | 'id_number'; + } + + interface VerificationReportRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface VerificationReportListParams extends PaginationParams { + created?: Stripe.RangeQueryParam | number; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Only return VerificationReports of this type + */ + type?: VerificationReportListParams.Type; + + /** + * Only return VerificationReports created by this VerificationSession ID. It is allowed to provide a VerificationIntent ID. + */ + verification_session?: string; + } + + namespace VerificationReportListParams { + type Type = 'document' | 'id_number'; + } + + class VerificationReportsResource { + /** + * Retrieves an existing VerificationReport + */ + retrieve( + id: string, + params?: VerificationReportRetrieveParams, + options?: RequestOptions + ): Promise>; + retrieve( + id: string, + options?: RequestOptions + ): Promise>; + + /** + * List all verification reports. + */ + list( + params?: VerificationReportListParams, + options?: RequestOptions + ): ApiListPromise; + list( + options?: RequestOptions + ): ApiListPromise; + } + } + } +} diff --git a/types/2020-08-27/Identity/VerificationSessions.d.ts b/types/2020-08-27/Identity/VerificationSessions.d.ts new file mode 100644 index 0000000000..a419ef7e78 --- /dev/null +++ b/types/2020-08-27/Identity/VerificationSessions.d.ts @@ -0,0 +1,477 @@ +// File generated from our OpenAPI spec + +declare module 'stripe' { + namespace Stripe { + namespace Identity { + /** + * The VerificationSession object. + */ + interface VerificationSession { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'identity.verification_session'; + + /** + * This string value can be passed to stripe.js to embed a verification flow directly into your app. + */ + client_secret?: string; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + /** + * Hash of details on the last error encountered in the verification process. + */ + last_error: VerificationSession.LastError | null; + + /** + * Link to the most recent completed VerificationReport for this Session. + */ + last_verification_report: + | string + | Stripe.Identity.VerificationReport + | null; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. + */ + metadata: Stripe.Metadata; + + options: VerificationSession.Options; + + /** + * Redaction status of this VerificationSession. If the VerificationSession is not redacted, this field will be null. + */ + redaction: VerificationSession.Redaction | null; + + /** + * Status of this VerificationSession. Read more about each [VerificationSession status](https://stripe.com/docs/identity/how-sessions-work). + */ + status: VerificationSession.Status; + + /** + * Type of report requested. + */ + type: VerificationSession.Type; + + /** + * Link to the Stripe-hosted identity verification portal that you can send a user to for verification. + */ + url: string | null; + + /** + * Hash of verified data about this person that results from a successful verification report. + */ + verified_outputs: VerificationSession.VerifiedOutputs | null; + } + + namespace VerificationSession { + interface LastError { + /** + * A short machine-readable string giving the reason for the verification or user-session failure. + */ + code: LastError.Code | null; + + /** + * A human-readable message giving the reason for the failure. These messages can be shown to your users. + */ + reason: string | null; + } + + namespace LastError { + type Code = + | 'abandoned' + | 'consent_declined' + | 'country_not_supported' + | 'device_not_supported' + | 'document_expired' + | 'document_type_not_supported' + | 'document_unverified_other' + | 'id_number_insufficient_document_data' + | 'id_number_mismatch' + | 'id_number_unverified_other' + | 'selfie_document_missing_photo' + | 'selfie_face_mismatch' + | 'selfie_manipulated' + | 'selfie_unverified_other' + | 'under_supported_age'; + } + + interface Options { + document?: Options.Document; + + id_number?: Options.IdNumber; + } + + namespace Options { + interface Document { + /** + * Restrict the list of allowed document type to these types. + */ + allowed_types?: Array; + + /** + * Require that the user provide an id number which will be verified. + */ + require_id_number?: boolean; + + /** + * Require that the user capture documents live with their webcam or phone camera. + */ + require_live_capture?: boolean; + + /** + * Require that the user provide a selfie to compare against the document photo. + */ + require_matching_selfie?: boolean; + } + + namespace Document { + type AllowedType = 'driving_license' | 'id_card' | 'passport'; + } + + interface IdNumber {} + } + + interface Redaction { + /** + * Indicates whether this object and its related objects have been redacted or not. + */ + status: Redaction.Status; + } + + namespace Redaction { + type Status = 'processing' | 'redacted'; + } + + type Status = 'canceled' | 'processing' | 'requires_input' | 'verified'; + + type Type = 'document' | 'id_number'; + + interface VerifiedOutputs { + /** + * Verified address of the user. + */ + address: Stripe.Address | null; + + /** + * Verified date of birth of the user. + */ + dob: VerifiedOutputs.Dob | null; + + /** + * Verified first name of the user. + */ + first_name: string | null; + + /** + * Verified national id number of the user. + */ + id_number: string | null; + + /** + * Country / type of verified national id number. + */ + id_number_type: VerifiedOutputs.IdNumberType | null; + + /** + * Verified last name of the user. + */ + last_name: string | null; + } + + namespace VerifiedOutputs { + interface Dob { + /** + * Numerical day between 1 and 31. + */ + day: number | null; + + /** + * Numerical month between 1 and 12. + */ + month: number | null; + + /** + * The four-digit year. + */ + year: number | null; + } + + type IdNumberType = 'br_cpf' | 'sg_nric' | 'us_ssn'; + } + } + + interface VerificationSessionCreateParams { + /** + * The primary type of verification being performed with this Session. + */ + type: VerificationSessionCreateParams.Type; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`. + */ + metadata?: Stripe.MetadataParam; + + /** + * An optional hash of configuration options for each verification rule that is requested + */ + options?: VerificationSessionCreateParams.Options; + + /** + * The URL the user will be redirected to after Stripe collects the required identity information. + */ + return_url?: string; + } + + namespace VerificationSessionCreateParams { + interface Options { + /** + * Verification configuration options for the `document` record_type. + */ + document?: Stripe.Emptyable; + } + + namespace Options { + interface Document { + /** + * Restrict the list of allowed document type to these types. + */ + allowed_types?: Array; + + /** + * Require that the user provide an id number which will be verified. + */ + require_id_number?: boolean; + + /** + * Require that the user capture documents live with their webcam or phone camera. + */ + require_live_capture?: boolean; + + /** + * Require that the user provide a selfie to compare against the document photo. + */ + require_matching_selfie?: boolean; + } + + namespace Document { + type AllowedType = 'driving_license' | 'id_card' | 'passport'; + } + } + + type Type = 'document' | 'id_number'; + } + + interface VerificationSessionRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface VerificationSessionUpdateParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`. + */ + metadata?: Stripe.MetadataParam; + + /** + * New configuration options. + */ + options?: VerificationSessionUpdateParams.Options; + + /** + * New verification type. + */ + type?: VerificationSessionUpdateParams.Type; + } + + namespace VerificationSessionUpdateParams { + interface Options { + /** + * Verification configuration options for the `document` record_type. + */ + document?: Stripe.Emptyable; + } + + namespace Options { + interface Document { + /** + * Restrict the list of allowed document type to these types. + */ + allowed_types?: Array; + + /** + * Require that the user provide an id number which will be verified. + */ + require_id_number?: boolean; + + /** + * Require that the user capture documents live with their webcam or phone camera. + */ + require_live_capture?: boolean; + + /** + * Require that the user provide a selfie to compare against the document photo. + */ + require_matching_selfie?: boolean; + } + + namespace Document { + type AllowedType = 'driving_license' | 'id_card' | 'passport'; + } + } + + type Type = 'document' | 'id_number'; + } + + interface VerificationSessionListParams extends PaginationParams { + created?: Stripe.RangeQueryParam | number; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * Only return VerificationSessions with this status. + */ + status?: VerificationSessionListParams.Status; + } + + namespace VerificationSessionListParams { + type Status = 'canceled' | 'processing' | 'requires_input' | 'verified'; + } + + interface VerificationSessionCancelParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface VerificationSessionRedactParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + class VerificationSessionsResource { + /** + * Create a new VerificationSession to begin the verification process. + */ + create( + params: VerificationSessionCreateParams, + options?: RequestOptions + ): Promise>; + + /** + * Retrieves an existing VerificationSession. When the session status is requires_input, this method guarantees + * that the redirect url is fresh: if your user has previously visited this session, a new url will be returned. + * Before redirecting your user to Stripe, ensure that you have just Created or Retrieved the VerificationSession; + * never cache or store the url. + */ + retrieve( + id: string, + params?: VerificationSessionRetrieveParams, + options?: RequestOptions + ): Promise>; + retrieve( + id: string, + options?: RequestOptions + ): Promise>; + + /** + * Update properties on a VerificationSession + */ + update( + id: string, + params?: VerificationSessionUpdateParams, + options?: RequestOptions + ): Promise>; + + /** + * List all verification sessions. Can optionally provide a status to return only VerificationSessions with that status. Can optionally specify a query filter on created timestamp. + */ + list( + params?: VerificationSessionListParams, + options?: RequestOptions + ): ApiListPromise; + list( + options?: RequestOptions + ): ApiListPromise; + + /** + * Mark a VerificationSession as canceled. + * + * If the VerificationSession is in the processing state, you must wait until it + * finishes before cancelling it. + */ + cancel( + id: string, + params?: VerificationSessionCancelParams, + options?: RequestOptions + ): Promise>; + cancel( + id: string, + options?: RequestOptions + ): Promise>; + + /** + * Redact a VerificationSession to delete all collected information from Stripe. + * This will redact the VerificationSession and all objects related to it, including + * VerificationReports, Events, Files, request logs, etc. This redaction process may + * take up to four days. When the redaction process is in progress, the + * VerificationSession's redaction.status field will be set to processing; when + * the process is finished, it will change to redacted. + * + * Redaction is irreversible. Redacted objects are still accessible in the Stripe API, + * but all the fields that contain personal data will be replaced by the string + * [redacted] or a similar placeholder. The metadata field will also be erased. + * Redacted objects cannot be updated or used for any purpose. + * + * If the VerificationSession is in the processing state, you must wait until it + * finishes before redacting it. Redacting a VerificationSession in requires_action + * state will automatically [cancel](https://stripe.com/docs/api/verification_sessions/cancel) it. + * + * An [identity.verification_session.redacted](https://stripe.com/docs/api/events/types#event_types-identity.verification_session.redacted) + * webhook will be sent when a VerificationSession is redacted. + */ + redact( + id: string, + params?: VerificationSessionRedactParams, + options?: RequestOptions + ): Promise>; + redact( + id: string, + options?: RequestOptions + ): Promise>; + } + } + } +} diff --git a/types/2020-08-27/Persons.d.ts b/types/2020-08-27/Persons.d.ts index f942cbd3a4..85ba44cad8 100644 --- a/types/2020-08-27/Persons.d.ts +++ b/types/2020-08-27/Persons.d.ts @@ -260,22 +260,22 @@ declare module 'stripe' { currently_due: Array; /** - * 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; /** - * Fields that need to be collected assuming all volume thresholds are reached. As fields are needed, they are moved to `currently_due` and the account's `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 the account's `current_deadline` becomes set. */ eventually_due: Array; /** - * Fields that weren't collected by the account's `current_deadline`. These fields need to be collected to enable payouts for the person's account. + * Fields that weren't collected by the account's `current_deadline`. These fields need to be collected to enable the person's account. */ past_due: Array; /** - * 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 become required and move to `currently_due` or `past_due`. */ pending_verification: Array; } diff --git a/types/2020-08-27/index.d.ts b/types/2020-08-27/index.d.ts index 52ea3e3839..6d252604da 100644 --- a/types/2020-08-27/index.d.ts +++ b/types/2020-08-27/index.d.ts @@ -39,6 +39,8 @@ /// /// /// +/// +/// /// /// /// @@ -168,6 +170,10 @@ declare module 'stripe' { sessions: Stripe.BillingPortal.SessionsResource; }; checkout: {sessions: Stripe.Checkout.SessionsResource}; + identity: { + verificationReports: Stripe.Identity.VerificationReportsResource; + verificationSessions: Stripe.Identity.VerificationSessionsResource; + }; issuing: { authorizations: Stripe.Issuing.AuthorizationsResource; cards: Stripe.Issuing.CardsResource; From 6a01daecdc1c1c0affd5647ec3c9182ec5681a15 Mon Sep 17 00:00:00 2001 From: Richard Marmorstein Date: Tue, 18 May 2021 23:07:28 -0400 Subject: [PATCH 2/4] Add test --- .../Identity/VerificationReport.spec.js | 34 +++++++ .../Identity/VerificationSession.spec.js | 96 +++++++++++++++++++ 2 files changed, 130 insertions(+) create mode 100644 test/resources/Identity/VerificationReport.spec.js create mode 100644 test/resources/Identity/VerificationSession.spec.js diff --git a/test/resources/Identity/VerificationReport.spec.js b/test/resources/Identity/VerificationReport.spec.js new file mode 100644 index 0000000000..18bfa7c5d4 --- /dev/null +++ b/test/resources/Identity/VerificationReport.spec.js @@ -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: {}, + }); + }); + }); + }); +}); diff --git a/test/resources/Identity/VerificationSession.spec.js b/test/resources/Identity/VerificationSession.spec.js new file mode 100644 index 0000000000..28bae0f26e --- /dev/null +++ b/test/resources/Identity/VerificationSession.spec.js @@ -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: 'GET', + url: '/v1/identity/verification_sessions/vs_123', + data: {}, + 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: {}, + }); + }); + }); + }); +}); From 53052796db8a88eed74f45678b92e01d592e2aea Mon Sep 17 00:00:00 2001 From: Richard Marmorstein Date: Tue, 18 May 2021 23:18:07 -0400 Subject: [PATCH 3/4] Fix test --- test/resources/Identity/VerificationSession.spec.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/resources/Identity/VerificationSession.spec.js b/test/resources/Identity/VerificationSession.spec.js index 28bae0f26e..4b93e9ae27 100644 --- a/test/resources/Identity/VerificationSession.spec.js +++ b/test/resources/Identity/VerificationSession.spec.js @@ -9,9 +9,9 @@ describe('Identity', () => { it('Sends the correct request', () => { stripe.identity.verificationSessions.create({type: 'id_number'}); expect(stripe.LAST_REQUEST).to.deep.equal({ - method: 'GET', - url: '/v1/identity/verification_sessions/vs_123', - data: {}, + method: 'POST', + url: '/v1/identity/verification_sessions', + data: {type: 'id_number'}, headers: {}, settings: {}, }); From 714c525cd1fb939f77934e440f23443866740a2c Mon Sep 17 00:00:00 2001 From: Richard Marmorstein Date: Wed, 19 May 2021 21:13:48 -0400 Subject: [PATCH 4/4] Latest codegen --- types/2020-08-27/Accounts.d.ts | 2 +- types/2020-08-27/BillingPortal/Sessions.d.ts | 2 +- types/2020-08-27/Capabilities.d.ts | 2 +- types/2020-08-27/Checkout/Sessions.d.ts | 2 +- types/2020-08-27/Coupons.d.ts | 2 +- types/2020-08-27/Identity/VerificationSessions.d.ts | 2 +- types/2020-08-27/PaymentMethods.d.ts | 7 +++++++ types/2020-08-27/Persons.d.ts | 2 +- types/2020-08-27/WebhookEndpoints.d.ts | 12 ++++++++++++ 9 files changed, 26 insertions(+), 7 deletions(-) diff --git a/types/2020-08-27/Accounts.d.ts b/types/2020-08-27/Accounts.d.ts index 47c8d4d21a..a9765096c7 100644 --- a/types/2020-08-27/Accounts.d.ts +++ b/types/2020-08-27/Accounts.d.ts @@ -537,7 +537,7 @@ declare module 'stripe' { past_due: Array | null; /** - * 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 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 | null; } diff --git a/types/2020-08-27/BillingPortal/Sessions.d.ts b/types/2020-08-27/BillingPortal/Sessions.d.ts index d40d0e8004..d6ebca263d 100644 --- a/types/2020-08-27/BillingPortal/Sessions.d.ts +++ b/types/2020-08-27/BillingPortal/Sessions.d.ts @@ -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; diff --git a/types/2020-08-27/Capabilities.d.ts b/types/2020-08-27/Capabilities.d.ts index 10e2fdcc22..63ca410584 100644 --- a/types/2020-08-27/Capabilities.d.ts +++ b/types/2020-08-27/Capabilities.d.ts @@ -78,7 +78,7 @@ declare module 'stripe' { past_due: Array; /** - * 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 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; } diff --git a/types/2020-08-27/Checkout/Sessions.d.ts b/types/2020-08-27/Checkout/Sessions.d.ts index d767b91376..b46dbaef3f 100644 --- a/types/2020-08-27/Checkout/Sessions.d.ts +++ b/types/2020-08-27/Checkout/Sessions.d.ts @@ -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; diff --git a/types/2020-08-27/Coupons.d.ts b/types/2020-08-27/Coupons.d.ts index 14ca1e4342..8b9ed35837 100644 --- a/types/2020-08-27/Coupons.d.ts +++ b/types/2020-08-27/Coupons.d.ts @@ -184,7 +184,7 @@ declare module 'stripe' { /** * An array of Product IDs that this Coupon will apply to. */ - products: Array; + products?: Array; } type Duration = 'forever' | 'once' | 'repeating'; diff --git a/types/2020-08-27/Identity/VerificationSessions.d.ts b/types/2020-08-27/Identity/VerificationSessions.d.ts index a419ef7e78..15ac00f3ec 100644 --- a/types/2020-08-27/Identity/VerificationSessions.d.ts +++ b/types/2020-08-27/Identity/VerificationSessions.d.ts @@ -20,7 +20,7 @@ declare module 'stripe' { /** * This string value can be passed to stripe.js to embed a verification flow directly into your app. */ - client_secret?: string; + client_secret: string | null; /** * Time at which the object was created. Measured in seconds since the Unix epoch. diff --git a/types/2020-08-27/PaymentMethods.d.ts b/types/2020-08-27/PaymentMethods.d.ts index e3960e09db..1bf3879d18 100644 --- a/types/2020-08-27/PaymentMethods.d.ts +++ b/types/2020-08-27/PaymentMethods.d.ts @@ -1044,6 +1044,11 @@ declare module 'stripe' { } interface PaymentMethodUpdateParams { + /** + * This is a legacy parameter that will be removed in the future. It is a hash that does not accept any keys. + */ + acss_debit?: PaymentMethodUpdateParams.AcssDebit; + /** * This is a legacy parameter that will be removed in the future. It is a hash that does not accept any keys. */ @@ -1081,6 +1086,8 @@ declare module 'stripe' { } namespace PaymentMethodUpdateParams { + interface AcssDebit {} + interface AuBecsDebit {} interface BacsDebit {} diff --git a/types/2020-08-27/Persons.d.ts b/types/2020-08-27/Persons.d.ts index 85ba44cad8..8c11c01fa9 100644 --- a/types/2020-08-27/Persons.d.ts +++ b/types/2020-08-27/Persons.d.ts @@ -275,7 +275,7 @@ declare module 'stripe' { past_due: Array; /** - * 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 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; } diff --git a/types/2020-08-27/WebhookEndpoints.d.ts b/types/2020-08-27/WebhookEndpoints.d.ts index 2d664b28a9..85e0033e20 100644 --- a/types/2020-08-27/WebhookEndpoints.d.ts +++ b/types/2020-08-27/WebhookEndpoints.d.ts @@ -282,6 +282,12 @@ declare module 'stripe' { | 'customer.tax_id.updated' | 'customer.updated' | 'file.created' + | 'identity.verification_session.canceled' + | 'identity.verification_session.created' + | 'identity.verification_session.processing' + | 'identity.verification_session.redacted' + | 'identity.verification_session.requires_input' + | 'identity.verification_session.verified' | 'invoice.created' | 'invoice.deleted' | 'invoice.finalization_failed' @@ -492,6 +498,12 @@ declare module 'stripe' { | 'customer.tax_id.updated' | 'customer.updated' | 'file.created' + | 'identity.verification_session.canceled' + | 'identity.verification_session.created' + | 'identity.verification_session.processing' + | 'identity.verification_session.redacted' + | 'identity.verification_session.requires_input' + | 'identity.verification_session.verified' | 'invoice.created' | 'invoice.deleted' | 'invoice.finalization_failed'