Working with Server Automation Scripts
Within the FintechOS Studio, there are server scripts that execute several actions, which feature business needs such as automated application numbers, the number of applications in progress, etc. On-demand automation scripts are available for being called from any object or context.
The FTOS_EXTD_POST_AddressesSearch script is used in the Company Representative and Business Details pages.
It is called with the following parameter { query: { address: addressLine } }. It represents one the API methods of the Ideal Postcodes Connector.
The FTOS_BASME_WelcomeWidget script gets the bank representative's first name, the number of closed applications, and the number of applications that need a response after reviewing. This script is used to display the details available in the welcome message from the Dashboard.
Input: N/A
Output:
{
userInfo : {
userFirstName: userFirstName,
closedApps: parseInt(closedApps),
returnedApps: parseInt(returnedApps)
}
}
The FTOS_DBK_GetSMELoanApplications script gets information about all the loan applications available in the database. It is used in the Applications section.
Input: var selectedCulture
Output:
{
allApps: allApps,
myApps: myApps,
myReturnedApps: myReturnedApps,
allReturnedApps: allReturnedApps,
allAppsReturnedCount: allAppsReturnedCount,
myAppsReturnedCount: myAppsReturnedCount,
appsLength: appsLength
}
The FTOS_BARET_SMELoanLinkApplicantData script generates an automated application number containing seven unique numbers and the prefix SMEL.
Input: selfLed=true
Output: N/A
You can update the parameters according to your needs. For more details see ApplicationNumberSettings section.
If you enter minimum of 5 characters on the Search Company screen, then the system makes a call in the database and returns the list of companies using FTOS_BASME_SearchCompany script. If there is no available data or if the data is older than 5 days, then a call is made to the Companies House API to return the list with the companies.
Note that the days are configurable in FintechOS Studio > Admin > System Parameter > FTOS_DBK_General > expirationDays parameter and represent the validity of the data that was saved from the Companies House.
In the Search Company screen, after the company is found, if you click the expand button, then the system makes a call in the database and returns the company details using the FTOS_BASME_GetCompanyDetails script. If there is no available data, then a call is made to the Companies House API to return the company's details.
Input: loanId
methods (personsWithSignificantControl,exemptions, ukEstablishments, officers, insolvency, companyProfile, filingHistory, charges, personsWithSignificantControlStatements, officerAppointments, documents, quantitativeIndicators).
Output: object with requested values
The FTOS_BNKAP_GetCompanyApplicationsNo script is used to return the number of applications for the selected company. It is used in the Existing Applications page.
The FTOS_DBK_CheckEligibilityAnswers script takes the answers to the questions, inserts them into the answer entity, and then runs the FTOS_DBK_CheckEligibilityQuestions formula through API. This script is used in the Eligibility step.
Input: an array with response objects
Output:
{
ok: bool,
message: "string",
}
The FTOS_DBK_GetProductAgreementsMapped script gets the agreements and it is used in the Company Representatives for Application step.
Input: N/A
Output:
{
agreements: [{
'name': 'gdpr',
'displayName' 'GDPR Agreement',
'name': 'marketing',
'displayName' 'Marketing Agreement',
'name': 'relative',
'displayName' 'Relative Agreement',
'name': 'information',
'displayName' 'Information Agreement',
'name': 'affiliates',
'displayName' 'Affiliates Agreement',
'name': 'business',
'displayName' 'Business Agreement'
}]
}
The FTOS_DBK_CheckAgreementsAnswers script takes the answers to the agreements, inserts them into the answer entity, and then runs the FTOS_DBK_CheckAgreementsAnswers formula. This script is used in the Company Representatives for Application step when the Send email button is clicked.
Input: an array with the names and values of the attributes considered by the FTOS_DBK_CheckAgreementsAnswers formula.
Example of input parameters for formula:
{
gdpr: 1,
marketing: 0,
relative: 1,
information: 1,
affiliates: 0,
business: 0
}
Output: {ok:true/false}
The FTOS_BASME_AgreementNotification script sends an e-mail to the SME representative.
The email contains the agreements from the configured banking product (set in a processor setting - Credit Line product) and the OK button, which the Customer Representative should click to continue the application. All six documents (static documents) are attached to the e-mail.
Also, the script changes the status of the application from New to Pending Agreements.
This script is used in the Company Representatives for Application step when the bank representative clicks the Send Email with Agreements button.
Input: an array with the names and values of the attributes, email, and FirstName.
Output: sends the email.
The FTOS_DBK_UserAgreed script determines whether or not the customer representative has clicked OK in the email received. It changes the business status of the application in AGREEMENTS ACCEPTED.
This script is used in the Confirm Agreements page.
Input: sessionId
Output: changes the application status in AGREEMENTS ACCEPTED.
The FTOS_DBK_EmailApplicantCodat script sends the email to the Customer Representative to allow accounting access. It is used in the obtaining accounting access step.
Input: N/A
Output: sends email
The FTOS_DBK_GetCodatData script checks if the customer representative has given their consent on the Codat Sandbox.
When a response is received from the CODAT.checkDataStatus(codetCompanyId) an insert is made in the Codat entity with the following data:
codedJobObj= {
retailApplicantDataId: retailApplicantDataId,
loanId: loanId,
codatCompanyId: codatCompanyId,
codatDataType: item.dataType,
codatCurrentStatus: item.currentStatus,
jobStatus: 'New'
}
where item.dataType is a line retrieved from the Codat answer (eg: access for balanceSheet, access for profitAndLoss, etc.).
This means that for a customer representative with granted access rights to Codat, several records are inserted in the Codat entity.
The FTOS_DBK_ProcessCodat script receives the accounting data based on the CodatDataJob entity records from the Codat integration and saves it to the database.
The FTOS_DBK_NewRequestProductConfig script gets the following banking product configurations: product type, grace type, grace period, possible loan periods, possible loan destinations, requested amount constraints, and previously saved values (if applicable).
It is used in the Credit Line configuration step.
Input: N/A
The FTOS_DBK_SaveCreditLineDetails script saves the credit line details and performs validation on the data input.
It is used in the Credit Line configuration step.
Input:
{
"model": {
"requestedAmount": "",
"loanDestination": "",
"loanPeriod": "",
"productType": "",
"graceType": "",
"gracePeriod": "",
"interestMargin": null,
"referenceIndicator": null,
"analysisFee": null,
"administrativeFee": null
}
}
Output:
{
ok: bool,
message: "string",
}
The FTOS_BASME_CheckQualitativeIndicatorScore script takes the weights from the FTOS_BASME_NewRequest_QualitativeIndicators data set and computes the FTOS_DBK_QualitativeIndicators formula.
It is used in the Company Details > Indicators > Qualitative tab when the bank representative clicks the Check Score button.
Input:
{
businessPractice:businessPractice,
historicalRelationsip:historicalRelationsip,
managementQuality:managementQuality,
marketCondifions:marketCondifions,
shareholderQUality:shareholderQUality
}
Output: qualitative score
FTOS_DBK_EXP_GetShareholderDetails is called every time when the user clicks on the expand option of any row of the Group > Company or Group > Persons tabs. The correlation between the Companies House and Experian data for persons is made using the name of the person.
FTOS_DBK_EXP_GetShareholderDetails provides in depth details/data fetched from Experian. The data is fetched only once, then it's saved in the database (FTOS_BNKAP_ApplicantDataExt, field experianDetails). It has no expiration date.
Input: personName/companyNumber
Output if the script was called with personName:
{
status: bool,
shareholderDetails: {
numShares: "string",
totalNominalCapital: "string",
percentage: "string",
lastUpdate: "string"
}
}
Output if the script was called with companyNumber:
[{financialData:{
auditor:"string",
votingRights :"string",
totalNominalCapital:"string",
noOfShares:"string",
percentage:"string",
lastUpdate:"string"
} , additionalInfo:{
comDelphiScore: "string",
avgDBT12Months:"string",
numCorrection: "string",
numOfCCJLast12Months: "string",
bankruptcies: "string"
}}]
Provides shallow data for all the tables in the Group tab. For the table Corporate Structure, the data is either fetched from Experian or from the database in case it has been fetched before. For the other tables (Company and person shareholders) from the Group tab, the data's origin is Companies House, but it is brought from the database. The data was saved in the database before the Codat integration was performed.
Input:
It doesn't use any input parameters, but it uses the current loanId provided by the context object.
Outputs the following structure:
{
shareholder: [{
ownerName: "string",
registrationNumber: "string",
type: "string",
ceasedOn: "string",
placeRegistered: "string",
incorporationDate: "string",
address: "string",
naturesOfControl: "string",
source: "string"
}],
corporateStructure: [{
parentRegNumber: "string",
treePosition: "string",
totalNumbSubs: "string",
totalElements: "string"
}],
persons: [{
ownerName: "string",
dateOfBirth: "string",
citizenship: "string",
address: "string",
ceasedOn: "string",
naturesOfControl: "string",
source: "string"
}]
}