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.

36 lines (35 loc) 2.08 kB
try { let e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack; n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "7d20c313-52eb-4a1d-a168-d1d453caadb9", e._sentryDebugIdIdentifier = "sentry-dbid-7d20c313-52eb-4a1d-a168-d1d453caadb9"); } catch (e) {} import { t as LegalEntityTypes } from "./legal-entity-type-VIfNYnJP.js"; import { s as getOwnEntityAssociations } from "./entityAssociationUtil-BEzUdPbm.js"; //#region src/utils/getName.ts var getIndividualLegalEntityName = (legalEntityResponse) => { if (!legalEntityResponse || !legalEntityResponse?.individual) return ""; return `${legalEntityResponse.individual?.name?.firstName ?? ""} ${legalEntityResponse.individual?.name?.lastName ?? ""}`; }; var getLegalEntityNameBasedOnType = (legalEntityResponse) => { if (legalEntityResponse.type === LegalEntityTypes.INDIVIDUAL) return getIndividualLegalEntityName(legalEntityResponse); return legalEntityResponse.organization?.legalName ?? ""; }; /** * * In payout account the account holder name is always the legal arrangement * ie: trust, soleprops etc, if they exist otherwise the legal entity name is the account holder */ var getPayoutAccountHolderName = (legalEntity, t) => { const ownAssociations = getOwnEntityAssociations(legalEntity); const trustAssociation = ownAssociations.find(({ type }) => type === LegalEntityTypes.TRUST); if (trustAssociation?.name) { const trustName = trustAssociation.name; return t(($) => $["trusteeAsTrusteeForTrust"], { trustName, trusteeName: getLegalEntityNameBasedOnType(legalEntity) }); } const solePropAssociation = ownAssociations.find(({ type }) => type === LegalEntityTypes.SOLE_PROPRIETORSHIP); if (solePropAssociation?.name) return solePropAssociation.name; return getLegalEntityNameBasedOnType(legalEntity); }; //#endregion export { getLegalEntityNameBasedOnType as n, getPayoutAccountHolderName as r, getIndividualLegalEntityName as t };