Orca Loans NodeJS Client
Installation
Using npm:
$ npm install @jerseydev/orca-loans
Using yarn:
$ yarn add @jerseydev/orca-loans
Using CDN:
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script src="https://storage.googleapis.com/orcaloans/assets/js/orcaloans.min.js"></script>
var OrcaLoans = orcaloans.default;
Import
// ES5
const OrcaLoans = require('@jerseydev/orca-loans');
// ES6
import OrcaLoans from "@jerseydev/orca-loans";
Examples
Initialization
OrcaLoans.init(process.env.ORCA_CLIENT_ID, process.env.ORCA_CLIENT_SECRET);
Authentication
const email = 'my@email.com';
const password = 'mypassword';
OrcaLoans.getTokens(email, password)
.send()
.then(authResult => {
// set the tokens for requests that require authorization
OrcaLoans.tokens = { accessToken: authResult.data.access_token, refreshToken: authResult.data.refresh_token };
}).catch(err => {
});
Cancel a request
const req = OrcaLoans.getBranches();
req.send().then(result => {
const branches = result.data;
}).catch(err => {
});
req.cancel('cancelling request');
Invite an applicant
const applicantData = {
firstName: 'John',
lastName: 'Smith',
email: "johnsmith@email.com",
timezone: 'America/New_York' // US timezones only. See https://momentjs.com/timezone/docs/#/using-timezones/getting-country-zones/ for reference
};
OrcaLoans.inviteUser(applicantData).send().then(result => {
const newUser = result.data;
}).catch(err => {
});
Find a loan officer by email
OrcaLoans.getLoanOfficerByEmail('my@loanofficer.com').send().then(result => {
const loanOfficer = result.data;
}).catch(err => {
});
Create a loan application
const loanOfficer = {_id: ''}; // loan officer object
const applicant = {_id: ''}; // user object
const loanData = {
borrowers: [{
firstName: 'John',
lastName: 'Smith',
email: 'johnsmith@email.com'
}],
loanOfficer: loanOfficer._id, // uuid
user: applicant._id // uuid
};
OrcaLoans.addLoanApplication(loanData).send().then(loanResult => {
}).catch(err => {
});
© 2021 Jersey Dev Inc. All rights reserved