How-to for common workflows

Basic RON eNotary package create and schedule



import { PactimaApi, ESignatureEntryPadTypeEnum, ESignatureKindEnum, ENotaryPackageValidationRequest, ENotaryPackageValidationRequestEnforcementCriterionEnum } from '@pactima/node'
import { readFile } from 'fs/promises';
import { join } from 'path';

const SECRET_KEY = 'pctm_sk_live_xxx...;
const TEAM_ID = 'teamId....';
const senderEmail = '[email protected]';
const signerInfo = {
    name: 'Signer Sample',
    email: '[email protected]'
}
// This can be a PDF, DOCX, or any other supported file type
const filePath = join(__dirname, 'sample.pdf');

const main = async () => {
    const pactimaApi = new PactimaApi(SECRET_KEY);

    const members = await pactimaApi.teams.members.list(TEAM_ID);

    // Create a RON package
    const enp = await pactimaApi.eNotaryPackages.create({
        ownerId: members?.data?.find((x) => x.email === senderEmail)?.userId ?? '',
        eSignaturePackageKind: ESignatureKindEnum.Live,
    });

    const eSignaturePackageId = enp.eSignaturePackageId ?? '';

    // Add signers to the package
    const esp = await pactimaApi.eSignaturePackages.update(eSignaturePackageId, {
        title: 'Sample RON package by Node SDK - Signer',
        signers: [ signerInfo ]
    })

    // Add documents to the package
    const d = await pactimaApi.eSignaturePackages.documents.create(esp.id , {
        name: 'Sample Doc',
        data: await readFile(filePath)
    });

    /**
     * Insert an entry pad for the document
     * This could be done via template or even embedded preparation
     */
    await pactimaApi.eSignaturePackages.documents.entryPads.create(esp.id, d.id ?? '', {
        type: ESignatureEntryPadTypeEnum.Signature,
        left: 15,
        top: 4,
        height: 6,
        width: 4.5,
        pageIndex: 0,
        signerId: esp.signers?.find((x) => x.email === signerInfo.email)?.id ?? ''
    });

    // Add required IDV and KBA for the signer
    await pactimaApi.eNotaryPackages.validationRequests.create(enp.id ?? '', {
        signerId: esp.signers?.find((x) => x.email === signerInfo.email)?.id ?? '',
        idv: {
            enforcementCriterion: ENotaryPackageValidationRequestEnforcementCriterionEnum.Required
        },
        kba: {
            enforcementCriterion: ENotaryPackageValidationRequestEnforcementCriterionEnum.Required
        },
        locationVerification: {
            enforcementCriterion: ENotaryPackageValidationRequestEnforcementCriterionEnum.Skip
        },
        vulnerabilityScreening: {
            enforcementCriterion: ENotaryPackageValidationRequestEnforcementCriterionEnum.Skip
        }
    });

    // Trigger the package to be sent / scheduled
    await pactimaApi.eSignaturePackages.actions.trigger(esp.id);

}

(async () => {
    await main();
})();