diff --git a/types/stripe/index.d.ts b/types/stripe/index.d.ts index 14d9d4d952..76dd88dd69 100644 --- a/types/stripe/index.d.ts +++ b/types/stripe/index.d.ts @@ -1045,6 +1045,337 @@ declare namespace Stripe { */ ssn_last_4?: string; } + + interface IPersonDocumentCreateUpdateOptions { + /** + * The back of an ID returned by a file upload with a purpose value of identity_document. + * The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), + * in JPG or PNG format, and less than 10 MB in size. + */ + back?: string; + + /** + * The front of an ID returned by a file upload with a purpose value of identity_document. + * The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), + * in JPG or PNG format, and less than 10 MB in size. + */ + front?: string; + } + + interface IPersonDocument extends IPersonDocumentCreateUpdateOptions { + /** + * A user-displayable string describing the verification state of this document. + * For example, if a document is uploaded and the picture is too fuzzy, this may + * say “Identity document is too unclear to read”. + */ + details?: string; + + /** + * One of document_corrupt, document_country_not_supported, document_expired, document_failed_copy, + * document_failed_other, document_failed_test_mode, document_fraudulent, document_failed_greyscale, + * document_incomplete, document_invalid, document_manipulated, document_missing_back, document_missing_front, + * document_not_readable, document_not_uploaded, document_photo_mismatch, document_too_large, or document_type_not_supported. + * A machine-readable code specifying the verification state for this document. + */ + details_code?: string; + } + + interface IPersonShared { + /** + * The account the person is associated with. + */ + account?: string; + + /** + * The person’s address. + */ + address?: IAddress; + + /** + * The Kana variation of the person’s address (Japan only). + */ + address_kana?: IAddressKana; + + /** + * The Kanji variation of the person’s address (Japan only). + */ + address_kanji?: IAddressKanji; + + /** + * The person’s date of birth. + */ + dob?: { + /** + * The day of birth, between 1 and 31. + */ + day: number; + /** + * The month of birth, between 1 and 12. + */ + month: number; + /** + * The four-digit year of birth. + */ + year: number; + }; + + /** + * The person’s email address. + */ + email?: string; + + /** + * The person’s first name. + */ + first_name?: string; + + /** + * The Kana variation of the the person’s first name (Japan only). + */ + first_name_kana?: string; + + /** + * The Kanji variation of the person’s first name (Japan only). + */ + first_name_kanji?: string; + + /** + * The person’s gender (International regulations require either “male” or “female”). + */ + gender?: 'male' | 'female'; + + /** + * The person’s last name. + */ + last_name?: string; + + /** + * The Kana variation of the person’s last name (Japan only). + */ + last_name_kana?: string; + + /** + * The Kanji variation of the person’s last name (Japan only). + */ + last_name_kanji?: string; + + /** + * The person’s maiden name. + */ + maiden_name?: string; + + /** + * The person’s phone number. + */ + phone?: string; + + /** + * Describes the person’s relationship to the account. + */ + relationship?: { + /** + * Whether the person is a director of the account’s legal entity. Currently only required for accounts in the EU. + * Directors are typically members of the governing board of the company, or responsible for ensuring the + * company meets its regulatory obligations. + */ + director?: boolean; + + /** + * Whether the person has significant responsibility to control, manage, or direct the organization. + */ + executive?: boolean; + + /** + * Whether the person is an owner of the account’s legal entity. + */ + owner?: boolean; + + /** + * The percent owned by the person of the account’s legal entity. + */ + percent_ownership?: number; + + /** + * Whether the person is authorized as the primary representative of the account. + * This is the person nominated by the business to provide information about themselves, + * and general information about the account. There can only be one representative at any given time. + * At the time the account is created, this person should be set to the person responsible for opening the account. + */ + representative?: boolean; + + /** + * The person’s title (e.g., CEO, Support Engineer). + */ + title?: string; + }; + } + + interface IPerson extends IPersonShared { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object’s type. Objects of the same type share the same value. + */ + object: "person"; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + /** + * Set of key-value pairs that you can attach to an object. + * This can be useful for storing additional information about + * the object in a structured format. + */ + metadata: IMetadata; + + /** + * Whether the person’s personal ID number was provided. + */ + id_number_provided: boolean; + + /** + * Information about the requirements for this person, including what information needs to be collected, and by when. + */ + requirements: { + /** + * Fields that need to be collected to keep the person’s account enabled. + * If not collected by the account’s current_deadline, these fields appear in past_due as well, and the account is disabled. + */ + currently_due: string[]; + + /** + * 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. + */ + eventually_due: string[]; + + /** + * 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. + */ + past_due: 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. + */ + pending_verification: string[]; + }; + + /** + * Whether the person’s last 4 SSN digits was provided. + */ + ssn_last_4_provided: boolean; + + /** + * The person’s verification document information. + */ + verification: { + /** + * A document showing address, either a passport, local ID card, or utility bill from a well-known utility company. + */ + additional_document: IPersonDocument; + + /** + * A user-displayable string describing the verification state for the person. + * For example, this may say “Provided identity information could not be verified”. + */ + details: string; + + /** + * One of document_address_mismatch, document_dob_mismatch, document_duplicate_type, document_id_number_mismatch, + * document_name_mismatch, failed_keyed_identity, or failed_other. + * A machine-readable code specifying the verification state for the person. + */ + details_code: string; + + /** + * An identifying document, either a passport or local ID card. + */ + document: IPersonDocument; + + /** + * The state of verification for the person. Possible values are unverified, pending, or verified. + */ + status: string; + }; + } + + interface IPersonCreateUpdateOptions extends IPersonShared { + /** + * The person’s ID number, as appropriate for their country. For example, a social security number + * in the U.S., social insurance number in Canada, etc. Instead of the number itself, + * you can also provide a PII token provided by Stripe.js. + */ + id_number?: string; + + /** + * Set of key-value pairs 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?: IOptionsMetadata; + + /** + * A person token, used to securely provide details to the person. + */ + person_token?: string; + + /** + * The last four digits of the person’s Social Security Number (U.S. only). + */ + ssn_last_4?: string; + + /** + * The person’s verification document information. + */ + verification?: { + /** + * A document showing address, either a passport, local ID card, or utility bill from a well-known utility company. + */ + additional_document?: IPersonDocumentCreateUpdateOptions; + + /** + * An identifying document, either a passport or local ID card. + */ + document?: IPersonDocumentCreateUpdateOptions; + }; + } + + interface IPersonListOptions extends IListOptions { + relationship: { + /** + * A filter on the list of people returned based on whether these people are + * directors of the account’s company. + */ + director?: boolean; + + /** + * A filter on the list of people returned based on whether these people are + * executives of the account’s company. + */ + executive?: boolean; + + /** + * A filter on the list of people returned based on whether these people are + * owners of the account’s company. + */ + owner?: boolean; + + /** + * A filter on the list of people returned based on whether these people are + * the representative of the account’s company. + */ + representative?: boolean; + }; + } } namespace applicationFees { @@ -9427,6 +9758,108 @@ declare namespace Stripe { redirectUrl?: string, response?: IResponseFn, ): Promise; + + /** + * Creates a new person. + */ + createPerson( + accId: string, + data: accounts.IPersonCreateUpdateOptions, + options: HeaderOptions, + response?: IResponseFn, + ): Promise; + createPerson( + accId: string, + data: accounts.IPersonCreateUpdateOptions, + response?: IResponseFn, + ): Promise; + + /** + * Updates an existing person. + */ + updatePerson( + accId: string, + personId: string, + data: accounts.IPersonCreateUpdateOptions, + response?: IResponseFn, + ): Promise; + updatePerson( + accId: string, + personId: string, + data: accounts.IPersonCreateUpdateOptions, + options: HeaderOptions, + response?: IResponseFn, + ): Promise; + + /** + * Retrieves an existing person. + */ + retrievePerson( + accId: string, + personId: string, + data: IDataOptions, + options: HeaderOptions, + response?: IResponseFn, + ): Promise; + retrievePerson( + accId: string, + personId: string, + options: HeaderOptions, + response?: IResponseFn, + ): Promise; + retrievePerson( + accId: string, + personId: string, + data: IDataOptions, + response?: IResponseFn, + ): Promise; + retrievePerson( + accId: string, + personId: string, + response?: IResponseFn, + ): Promise; + + /** + * Deletes an existing person’s relationship to the account’s legal entity. Any person with a relationship for an account + * can be deleted through the API, except if the person is the account_opener. + * If your integration is using the executive parameter, you cannot delete the only verified executive on file. + */ + deletePerson( + accId: string, + personId: string, + options: HeaderOptions, + response?: IResponseFn, + ): Promise; + deletePerson( + accId: string, + personId: string, + response?: IResponseFn, + ): Promise; + + /** + * Returns a list of people associated with the account’s legal entity. + * The people are returned sorted by creation date, with the most recent people appearing first. + */ + listPersons( + accId: string, + data: accounts.IPersonListOptions, + options: HeaderOptions, + response?: IResponseFn, + ): IListPromise; + listPersons( + accId: string, + data: accounts.IPersonListOptions, + response?: IResponseFn, + ): IListPromise; + listPersons( + accId: string, + options: HeaderOptions, + response?: IResponseFn, + ): IListPromise; + listPersons( + accId: string, + response?: IResponseFn, + ): IListPromise; } class ApplicationFees extends StripeResource { diff --git a/types/stripe/stripe-tests.ts b/types/stripe/stripe-tests.ts index 22228195b1..ac9369b189 100644 --- a/types/stripe/stripe-tests.ts +++ b/types/stripe/stripe-tests.ts @@ -1306,6 +1306,49 @@ stripe.accounts.createLoginLink('acct_17wV8KBoqMA9o2xk', 'http://localhost:3000' const created: number = loginLink.created; const url: string = loginLink.url; }); + +//#endregion + +//#region Connect Account Person tests +// ################################################################################## + +stripe.accounts.createPerson('acct_17wV8KBoqMA9o2xk', { + email: 'test@example.com', + relationship: { + executive: true + } +}).then((person) => { + const email: string = person.email; +}); +stripe.accounts.updatePerson('acct_17wV8KBoqMA9o2xk', 'person_G1SCYvWQBpvF37', { + first_name: 'John', + last_name: 'Doe', + phone: '15551234567', +}).then((person) => { + const first_name: string = person.first_name; + const last_name: string = person.last_name; +}); + +stripe.accounts.deletePerson('acct_17wV8KBoqMA9o2xk', 'person_G1SCYvWQBpvF37').then((person) => { + const email: string = person.email; +}); + +stripe.accounts.retrievePerson('acct_17wV8KBoqMA9o2xk', 'person_G1SCYvWQBpvF37').then((person) => { + const email: string = person.email; +}); + +stripe.accounts.listPersons('acct_17wV8KBoqMA9o2xk', { relationship: { executive: true }, limit: 3 }, { stripe_account: 'acct_17wV8KOoqMF9a2xk' }).then((persons) => { + const email: string = persons.data[0].email; +}); +stripe.accounts.listPersons('acct_17wV8KBoqMA9o2xk', { relationship: { executive: true }, limit: 3 }).then((persons) => { + const email: string = persons.data[0].email; +}); +stripe.accounts.listPersons('acct_17wV8KBoqMA9o2xk', { stripe_account: 'acct_17wV8KOoqMF9a2xk' }).then((persons) => { + const email: string = persons.data[0].email; +}); +stripe.accounts.listPersons('acct_17wV8KBoqMA9o2xk').then((persons) => { + const email: string = persons.data[0].email; +}); //#endregion //#region Application Fee Refunds tests