UNPKG

@adyen/kyc-components

Version:

This guide assumes that you have already an account with Adyen. A legalEntity needs to be created, and you need to have a `legalEntityId` to instatiate a Component.

50 lines (49 loc) 2.26 kB
import type { ExistingLegalEntity } from '../core/models/api/legal-entity'; import { type TaskType } from '../stores/globalStore/taskTypes'; import type { CountryCode } from '../types/datasets/country-code'; /** * Calculates the age of a person based on their birthdate. * @param birthdate - The birthdate of the person in 'YYYY-MM-DD' format. * @returns The age of the person in years. */ export declare const getAgeToday: (birthdate: string) => number; /** * Returns the age range for a legal representative based on the country. * @param country - The country code. * @returns An object with min and max age, or undefined if not applicable. */ export declare const getAgeRangeForLegalRepresentative: (country?: CountryCode) => { min: number; max: number; } | undefined; /** * Checks if a person is under the required age for KYC based on their birthdate and country. * @param birthDate - The birthdate of the person. * @param country - The country of residence. * @returns True if the person is under the required age, false otherwise. */ export declare const isPersonUnderAge: (birthDate?: string, country?: CountryCode) => boolean; /** * Determines if a legal representative is needed based on age, country, and task type. * @param birthDate - The birthdate of the person. * @param country - The country of residence. * @param taskType - The type of task being performed. * @returns True if a legal representative is needed, false otherwise. */ export declare const isLegalRepresentativeNeeded: (birthDate?: string, country?: CountryCode, taskType?: TaskType) => boolean; /** * Checks if an age is within a given range. * @param age - The age to check. * @param ageRange - An object with min and max age. * @returns True if the age is within the range, false otherwise. */ export declare const isAgeWithinRange: (age: number, ageRange: { min: number; max: number; }) => boolean; /** * Checks if a legal entity requires a legal representative based on the individual's age. * @param legalEntity - The existing legal entity. * @returns True if a legal representative is required, false otherwise. */ export declare const doesLegalEntityRequiresLegalRepresentative: (legalEntity?: ExistingLegalEntity) => boolean;