@simple-dealer/autofill-puppeteer-client
v2.0.2
Published
Web client to create autofill requests and connect to autofill-daemon
Downloads
5
Readme
Description
Client library to connect to Simple Dealer's Autofill from the web
Pre-Requisites
Installation
Add this as a dependency to your project using [npm] with
$ npm i @simple-dealer/autofill-puppeteer-client
or using [Yarn] with
$ yarn add @simple-dealer/autofill-puppeteer-client
Usage
Connect to autofill client
import {
createDownloadAutofillDaemon,
errors,
createHandleAutofillS3,
createHandleAutofillWs,
listenToDaemon
} from '@simple-dealer/autofill-puppeteer-client'
const s3 = {
accessKeyId: '',
secretAccessKey: '',
region: ''
};
const { connected } = listenToDaemon()
const autoFillClient = connected ? createHandleAutofillWs() : createHandleAutofillS3({ s3 })
const downloadAutofillDaemon = createDownloadAutofillDaemon()
Autofill lender
try {
await autoFillClient({
lenders,
mainApplicant,
coApplicant,
deal,
userInformation,
type: 'lender'
})
alert('Autofill started')
} catch (e) {
if (equals(e, errors.DaemonNotInstalledError)) downloadAutofillDaemon()
if (equals(e, errors.AutofillUnknownError)) alert('Unknown error occurred')
}
Autofill OFAC
try {
await autoFillClient({
mainApplicant,
type: 'ofac'
})
alert('Autofill started')
} catch (e) {
if (equals(e, errors.DaemonNotInstalledError)) downloadAutofillDaemon()
if (equals(e, errors.AutofillUnknownError)) alert('Unknown error occurred')
}
Test Lender
try {
await autoFillClient({
lenders: [
{
"exists": true,
"platform": "sheffield",
"name": "sheffield",
"credentials": {
"username": "",
"password": ""
}
}
],
type: 'test'
})
alert('Autofill started')
} catch (e) {
if (equals(e, errors.DaemonNotInstalledError)) downloadAutofillDaemon()
if (equals(e, errors.AutofillUnknownError)) alert('Unknown error occurred')
}