Using Banking Products in Digital Journeys
To use a banking product built previously in a Form Driven Flow, a consultant or developer has to create an endpoint with a script. Later, in the Advanced tab of a digital journey, they must call the endpoint and add the product to the journey.
In the Advanced tab of a digital journey, apply the code example in FTOS_BP_GetBankingProductDetails
, but changing the Banking product ID.
In this entity all information regarding a banking product is stored, therefore, all fields configured prior are available.
The endpoints are configured during the installation process. For more, details see Creating Endpoints.
The following are the endpoints that call the information built in a banking product:
Returns the discount information.
Inputs:
-
productDiscountId - from
FTOS_BP_BankingProductDiscount
; -
bankingProductId - from
FTOS_BP_BankingProduct
(attribute:FTOS_BP_BankingProductid
); optional/ provided for formula association; -
formulaInputId - id of any entity used as master entity in data mapping input/ output at the formula setup; optional;
-
discountInput -
json
for formula input if necessary when no mapping was done for formula. The form of thisjson
should look like the one in test formula.
Outputs:
Object with details about the provided discount from FTOS_BP_BankingProductDiscount
and associated FTOS_BP_Discount
. If use Banking Formula
is checked, then the value is equal to the formula result.
Call example:
//with formula
var data = {
"productDiscountId": "32d391e4-9f26-4315-9c1d-ebd54bfa4e1d",
"bankingProductId": "25b9efdf-6ca5-48c5-8507-5543a22377b2",
"discountInput": {
"Amount": 6000.00
}
};
ebs.callActionByName("FTOS_BP_GetDiscountDetail", data,
function(s){ if(s.UIResult){console.log(s.UIResult.Data.discountDetail);}});
/*
[
{
"id": "32d391e4-9f26-4315-9c1d-ebd54bfa4e1d",
"name": "discountAAAA",
"discountTypeId": "f0da4a04-a513-4394-8b60-96d0a9409d7c",
"value": 5.3,
"startDate": {
"invariantDate": "2021-03-01"
},
"endDate": {
"invariantDate": "2021-12-31"
},
"appliedToDimension": "a16d6728-76ac-4d72-8fa7-a992e9a6a63f",
"interestTypeId": "3a5ffd12-bfc6-4826-bb81-7e49d2f1c2c6",
"commissionTypeId": null,
"insuranceClassId": null,
"insuranceId": null,
"isOptionalDiscount": false,
"isPercentage": true,
"useFormula": true,
"formulaTypeId": "a0dd56a6-a0b9-446b-8e1d-b2c052cafe0b"
}
]
*/
//without formula (value only)
var data = {
"productDiscountId": "32d391e4-9f26-4315-9c1d-ebd54bfa4e1d"
};
ebs.callActionByName("FTOS_BP_GetDiscountDetail", data,
function(s){ if(s.UIResult){console.log(s.UIResult.Data.discountDetail);}});
/*
[
{
"id": "32d391e4-9f26-4315-9c1d-ebd54bfa4e1d",
"name": "discountAAAA",
"discountTypeId": "f0da4a04-a513-4394-8b60-96d0a9409d7c",
"value": 5,
"startDate": {
"invariantDate": "2021-03-01"
},
"endDate": {
"invariantDate": "2021-12-31"
},
"appliedToDimension": "a16d6728-76ac-4d72-8fa7-a992e9a6a63f",
"interestTypeId": "3a5ffd12-bfc6-4826-bb81-7e49d2f1c2c6",
"commissionTypeId": null,
"insuranceClassId": null,
"insuranceId": null,
"isOptionalDiscount": false,
"isPercentage": true,
"useFormula": false,
"formulaTypeId": null
}
]
*/
Returns the product image.
Input:
-
bakingProductId - from
FTOS_BP_BankingProduct
(attribute:FTOS_BP_BankingProductid
)
Output:
-
productImage - from
FTOS_BP_BankingProduct
(attribute:productImage
)
Call example:
ebs.callActionByNameAsync("FTOS_BP_GetAvailableProductImage", { bankingProductId : "f625e5e5-bc51-4bf8-8ff0-b8a295694a23" })
.then(function (e) {
var img = e.UIResult.Data;
}).catch(function (err) {
console.log(err);
});
Returns the product details.
Input:
-
bakingProductId - from
FTOS_BP_BankingProduct
(attribute:FTOS_BP_BankingProductid
)
Output:
Section with the following fields:
-
product.Name - from
FTOS_BP_BankingProduct
(attribute:Name
) -
product.ProductImage - from
FTOS_BP_BankingProduct
(attribute: productImage ) -
product.Benefits - from
FTOS_BP_BankingProduct
(attribute:Benefits
) -
product.DisplayConditions - from
FTOS_BP_BankingProduct
(attribute:displayConditions
) -
product.NoOfDebtor - from
FTOS_BP_BankingProduct
(attribute:NoOfDebtor
)
Call example:
ebs.callActionByNameAsync('FTOS_BP_GetBankingProductDetails', { bankingProductId : "f625e5e5-bc51-4bf8-8ff0-b8a295694a23"})
.then(function (res) {
res = res.UIResult;
}).catch(function (err) {
console.log(err);
})
Returns the availability filters configured on a product.
Input:
-
BankingProductId - from
FTOS_BP_BankingProduct
(attribute:FTOS_BP_BankingProductid
)
Output:
-
filterName - from
FTOS_BP_ProductAvailabilityItemFilter
(attribute:name
) -
FilterValue - from
FTOS_BP_ProductAvailabilityItemFilter
(attribute:textValue
)
Call example:
ebs.callActionByNameAsync('FTOS_BP_GetAvailabilityFiltersOnProduct', { bankingProductId : "f625e5e5-bc51-4bf8-8ff0-b8a295694a23"})
.then(function (res) {
res = res.UIResult;
}).catch(function (err) {
console.log(err);
})
Returns the types of banking product in which there are active banking products.
Input:
-
currentDate -
new Date()
;
Output:
-
function getProductType from library
BankingProductHelper.Utils
- returns an object with product types.
Call example:
var p = {};
p.currentDate = new Date();
ebs.callActionByNameAsync("FTOS_BP_GetProductType", p).then(function (e) {
var type = e.UIResult.Data;
}).catch(function (err) {
console.log(err);
});
Returns the product features.
Input:
-
BankingProductId - from
FTOS_BP_BankingProduct
(attribute:FTOS_BP_BankingProductid
)
Output:
-
section with all features from
FTOS_BP_Feature
for the sent banking product.
Call example:
ebs.callActionByNameAsync("FTOS_BP_GetAvailableProductFeatures", { bankingProductId : "f625e5e5-bc51-4bf8-8ff0-b8a295694a23"})
.then(function (e) {
var features = e.UIResult.Data;
});
Returns the product extras.
Input:
-
currentDate - date
-
productTypeId - ID of banking product Type - from
FTOS_BP_BankingProduct
(attribute:bpProductTypeId
)
Output:
Call example:
var p = {}
p.currentDate = new Date();
p.productTypeId = "E9F52E35-1FAA-4CB7-B4BC-D685F326C907"
p.filterList = [{ "name": "age", "value": 25 }];
ebs.callActionByNameAsync("FTOS_BP_GetAvailableProductsExtra", p).then(function (e) {
var data = e.UIResult.Data.products;
});
Returns the primary attribute.
Input:
-
FromEntity - entity ID
Output:
-
the name of Primary attribute from current entity.
Call example:
var p={};
p.FromEntity = "9a9ec886-296b-487d-aff9-30b8e1eb43b8"; //ID of FTOS_BP_BankingProduct entity
ebs.callActionByNameAsync("FTOS_BP_GetPrimaryAttribute", p).then(function (s) {
if (s.UIResult.Data) {
var primaryattribute = s.UIResult.Data.Records[0].Name;
}
});
//Returns "Name"
Returns the documents on a banking product.
Input:
-
bankingProductId - from
FTOS_BP_BankingProduct
(attribute:FTOS_BP_BankingProductid
)
Output:
-
section with data from
FTOS_BP_BankingProductDocument
for the current banking product.
Call example:
var p = {};
p.bankingProductId = "f625e5e5-bc51-4bf8-8ff0-b8a295694a23";
ebs.callActionByNameAsync('FTOS_BP_GetProductDocuments', p).then(function (res) {
res = res.UIResult;
});
Returns the interest details.
Input:
-
interestListId - from
FTOS_BP_InterestLis
t (attribute:FTOS_BP_InterestListid
); -
interestId - from
FTOS_BP_Interest
(attribute:FTOS_BP_Interestid
); -
bankingProductId - from
FTOS_BP_BankingProduct
(attribute:FTOS_BP_BankingProductid
) - optional/ provided for formula association; -
formulaInputId - id of any entity used as master entity in data mapping input/ output at the formula setup; optional;
-
interestInput -
json
for formula input if necessary when no mapping was done for formula. The form of thisjson
should look like the one in test formula.
The scope of the endpoint can be an interestListId
returning all interests in that list or an interestId
returning all the details for a specific interest.
Output:
-
object with details about all the interests in the interest list from
FTOS_BP_Interest
andFTOS_BP_InterestValue
. If interest type isBankingFormula
, theninterestRate
is equal to the formula result.
Call example:
-
minimal:
var data = {};
data.interestListId = "c7a1b28c-e3f4-4259-b8e5-638b21bb69a7";
ebs.callActionByName("FTOS_BP_GetInterestDetail", data,
function(s){ if(s.UIResult){console.log(s.UIResult.Data);}});
-
maximal:
var data = {
"interestListId": "a8d82639-82e3-464f-aa40-e6592daf6bd1",
"bankingProductId": "3438f5a5-fd00-4745-bb77-820baeffe3f6",
"formulaInputId": "2872f33f-b757-48b2-a1d1-203bef75813d",
"interestInput": {
"Amount": 6000.00
}
};
ebs.callActionByName("FTOS_BP_GetInterestDetail", data,
function(s){ if(s.UIResult){console.log(s.UIResult.Data);}});
Returns details from the commission.
Input:
-
commissionListId - from
FTOS_BP_CommissionList
(attribute:FTOS_BP_CommissionListid
); -
commissionId - from
FTOS_BP_Commission
(attribute:FTOS_BP_Commissionid
); -
bankingProductId - from
FTOS_BP_BankingProduct
(attribute:FTOS_BP_BankingProductid
); optional/ provided for formula association; -
formulaInputId - id of any entity used as master entity in data mapping input/ output at the formula setup; optional;
-
commissionInput -
json
for formula input if necessary when no mapping was done for formula. The form of thisjson
should look like the one in test formula.
The scope of the endpoint can be a commissionListId
returning all interests in that list, or a commissionId
returning all the details for a specific commission.
Output:
-
object with details about all the commissions in the commission list from
FTOS_BP_Commission
andFTOS_BP_CommissionValue
. Ifuse Banking Formula
is selected, thencommission value
orcommission percent
is equal to the formula result.
Call example:
var data = {
"commissionListId": "86309408-6bf6-4550-9bb8-6d49919175bd",
"bankingProductId": "25b9efdf-6ca5-48c5-8507-5543a22377b2",
"commissionInput": {
"Amount": 6000.00
}
};
ebs.callActionByName("FTOS_BP_GetCommissionDetail", data,
function(s){ if(s.UIResult){console.log(s.UIResult.Data.commissionList);}});
/*
[
{
"id": "01c0ad2e-21bd-4290-aba5-5230a6c184e8",
"name": "TC1",
"commissionTypeId": "6e2653aa-73ee-452a-b6d6-8c0a8cdb89cb",
"periodicityTypeId": "1cc04a28-88e0-46df-a089-31d04bbde6df",
"currencyId": "fc9c53a8-31c6-41ff-a979-9c7788d32fb0",
"entityStatusId": "faccc388-151a-4c83-8953-cbac7d6c442a",
"isForUnusage": false,
"valueIsPercent": false,
"includedInRepaymentSchedule": true,
"percentAppliedTo": "f87376c8-15fc-45cc-b8c2-7786b03593aa",
"automaticLoadOnContract": false,
"mandatoryForApplicant": true,
"useFormula": true,
"formulaTypeId": "a0dd56a6-a0b9-446b-8e1d-b2c052cafe0b",
"commissionValue": 5.3,
"commissionPercent": null,
"rateValidFrom": null,
"rateValidTo": null
}
]
*/
var data = {
"commissionId": "01c0ad2e-21bd-4290-aba5-5230a6c184e8",
"bankingProductId": "25b9efdf-6ca5-48c5-8507-5543a22377b2",
"commissionInput": {
"Amount": 15000.00
}
};
ebs.callActionByName("FTOS_BP_GetCommissionDetail", data,
function(s){ if(s.UIResult){console.log(s.UIResult.Data.commissionList);}});
/*
[
{
"id": "01c0ad2e-21bd-4290-aba5-5230a6c184e8",
"name": "TC1",
"commissionTypeId": "6e2653aa-73ee-452a-b6d6-8c0a8cdb89cb",
"periodicityTypeId": "1cc04a28-88e0-46df-a089-31d04bbde6df",
"currencyId": "fc9c53a8-31c6-41ff-a979-9c7788d32fb0",
"entityStatusId": "faccc388-151a-4c83-8953-cbac7d6c442a",
"isForUnusage": false,
"valueIsPercent": false,
"includedInRepaymentSchedule": true,
"percentAppliedTo": "f87376c8-15fc-45cc-b8c2-7786b03593aa",
"automaticLoadOnContract": false,
"mandatoryForApplicant": true,
"useFormula": true,
"formulaTypeId": "a0dd56a6-a0b9-446b-8e1d-b2c052cafe0b",
"commissionValue": 5.1,
"commissionPercent": null,
"rateValidFrom": null,
"rateValidTo": null
}
]
*/
Call a formula from banking product.
Input:
-
formulaType - from
FTOS_BP_Formula
( attribute:formulaTypeId
); -
bankingProductId - from
FTOS_BP_BankingProduct
(attribute:FTOS_BP_BankingProductid
); -
id - input ID.
Call example:
ebs.callActionByNameAsync("FTOS_BP_CallFormula",
{
"formulaType": FORMULA_TYPE_ID,
"bankingProductId": BANKING_PRODUCT_ID,
"id": RECORD_ID
})
.then(function (result) { console.log(JSON.stringify(result))})
Get a simulation from PaymentSchedule
with different parameters.
Input:
Mandatory inputs:
- Amount
- LoanPeriod
- BankingProductId
- ScheduleType.
Optional inputs:
-
InterestType - Fixed, Variable, Collection, BankingFormula
-
Optional - list of selected optional product discounts (ex:[{"Name":"Insurance","ProductDiscountId":"35b36b84-24e0-409c-9799-7426d4273c9e"}] )
-
InterestCommission - list of filtered interest list and commission list (ex: [{"interestListId":"0e096545-f9f2-4a24-8cf9-12b39e8af039","interestListName":"ListaPL2","commissionListId":"a2e435ed-4998-4750-ab0d-e89cb81d2ecb","commissionListName":"AdminFee"}] )
-
Insurance - list of the selected or filtered insurances: (ex: [{"insuranceListId":"dbfc46f3-9f5c-4f89-ba15-383210c4cd48"}] )
-
interestCommissionFilterList - interest/ commission filter list
-
insuranceFilterList - insurance filter list
-
discountFilterList - discount filter List
-
givenInterestRate - a given interest rate that overwrites Interest Rate from product for Fixed interest type
-
givenInterestMargin - a given interest margin that overwrites Interest Margin from product for interest type Variable
-
jsonMultipleInterestRates - the list of interests to use for repayment plan Calculation (ex: [{"InterestRate":8.000000, "FromInstNo":1, "ToInstNo":5},{"InterestRate":10.00000, "FromInstNo":6, "ToInstNo":300}])
-
"InterestRate": 8.000000 interest percent defined as interest type = Collection on the banking product/Dimensions/InterestList/Interes
-
from-to installment numbers defined as interest type = Collection on the banking product/Dimensions/InterestList/Interest
-
ProductField
-
used currently only for CreditCard product
-
you can use it as bellow, multiple numeric attributes defined at the banking product level
-
"FieldName": "CapitalPercent" - percentage field defined at the banking product level / Details section, representing a percentage to be applied as formula for the schedule detail principal column
-
"FieldValue": 6 - if provided, its value is considered for calculation. If not provided the value is read from the banking product configuration.
-
jsonInputFormula - it is usually provided when interest type is BankingFormula or Collection and represents the formula input json (just like test formula). It can contain inputs for interest/commission/insurance/discount
"jsonInputFormula": {
"interestInput":{
"Amount": 6000.00
}
}
Call example:
-
The reduced version:
-
The full version:
ebs.callActionByNameAsync("FTOS_BP_Simulate", {
"bankingProductId": "3783c622-c15a-476a-8834-d0850d5e8ca2",
"amount": 712000,
"downPayment": 356000,
"loanPeriod": 240,
"interestType": "f37646db-739c-477c-91df-f294737b59bd",
"recordId": "bcd1358c-aef7-4e13-bc91-c3f6e56885f3",
"scheduleType": "Loan Equal Installments",
"optional": [
{
"Name": "Income Receiving",
"ProductDiscountId": "8c1cf49e-9aff-4353-8341-9daed8e9fa88"
}
],
"discount": [
{
"Name": "Interest Discount",
"ProductDiscountId": "de770415-9bfe-4a7f-8425-02c0ebd1a5e7"
}
],
"jsonFilterCommission": [
{
"name": "FinancedAmount",
"value": 356000
}
],
"jsonInsuranceFilter": [
{
"name": "FinancedAmount",
"value": 356000
}
],
"jsonDiscountFilter": [
{
"name": "FinancedAmount",
"value": 356000
}
]
})
.then(function (result) {
console.log(result.UIResult.Data.Records[0]);
});
-
Another example for Interest Type = Banking Formula:
ebs.callActionByNameAsync("FTOS_BP_Simulate", {
"bankingProductId": "3783c622-c15a-476a-8834-d0850d5e8ca2",
"amount": 712000,
"downPayment": 356000,
"loanPeriod": 240,
"interestType":"f37646db-739c-477c-91df-f294737b59bd",
"scheduleType": "Loan Equal Installments",
"optional": [{
"Name": "Income Receiving",
"ProductDiscountId": "8c1cf49e-9aff-4353-8341-9daed8e9fa88",
}],
"jsonFilterCommission": [],
"jsonInsuranceFilter": [],
"jsonDiscountFilter": [],
"jsonInputFormula": {
"interestInput":{
"Amount": 6000.00
}
}
})
.then(function (result) {
console.table(result.UIResult.Data.Records[0]);
});
-
Another example for Interest Type = Collection and child interest as formula:
ebs.callActionByNameAsync("FTOS_BP_Simulate", {
"bankingProductId": "3783c622-c15a-476a-8834-d0850d5e8ca2",
"amount": 700000.00,
"downPayment": 350000,
"loanPeriod": 240,
"interestType": "f37646db-739c-477c-91df-f294737b59bd",
"scheduleType": "Loan Equal Installments",
"optional": [{
"Name": "Income Receiving",
"ProductDiscountId": "8c1cf49e-9aff-4353-8341-9daed8e9fa880",
}],
"jsonFilterCommission": [],
"jsonInsuranceFilter": [],
"jsonDiscountFilter": [],
"jsonInputFormula": {
"interestInput":{
"Amount": 700000.00
}
}
})
.then(function (result) {
console.table(result.UIResult.Data.Records[0]);
});
Returns details from an insurance.
Input:
-
insuranceListId - from
FTOS_BP_InsuranceList
(attribute:FTOS_BP_InsuranceListid
); -
insuranceId - from
FTOS_BP_Insurance
(attribute:FTOS_BP_Insuranceid
); -
bankingProductId - from
FTOS_BP_BankingProduct
(attribute:FTOS_BP_BankingProductid
) - optional/ provided for formula association; -
formulaInputId - id of any entity used as master entity in data mapping input/ output at the formula setup; optional;
-
insuranceInput -
json
for formula input if necessary when no mapping was done for formula. The form of thisjson
should look like the one in test formula.
The scope of the endpoint can be an interestListId
returning all interests in that list or an interestId
returning all the details for a specific interest.
Output:
Object with details about all the insurances in the insurance list from FTOS_BP_Insurance
and FTOS_BP_InsuranceValue
. If use Banking Formula
is selected, then insurance value
or insurance percent
is equal to the formula result.
Call example:
var data = {
"insuranceListId": "bf2c45ba-3ea4-4447-9c96-45a708fc94c8",
"bankingProductId": "25b9efdf-6ca5-48c5-8507-5543a22377b2",
"insuranceInput": {
"Amount": 6000.00
}
};
ebs.callActionByName("FTOS_BP_GetInsuranceDetail", data,
function(s){ if(s.UIResult){console.log(s.UIResult.Data.insuranceList);}});
/*
[
{
"id": "f93416a9-c3f9-4824-9d72-05160c3666bc",
"name": "Test Insurance Formula1",
"code": "testI_F1",
"description": null,
"insurer": "ASIROM",
"isMandatoryForApplicant": true,
"isMandatoryForDebtor": false,
"valueIsPercent": false,
"periodicityTypeId": "1cc04a28-88e0-46df-a089-31d04bbde6df",
"currencyId": "fc9c53a8-31c6-41ff-a979-9c7788d32fb0",
"useOnPaymentSchedule": true,
"scheduleElementClassId": "d74c21fe-bb12-413f-83d7-26ab40f34226",
"operationItemId": null,
"useFormula": true,
"formulaTypeId": "a0dd56a6-a0b9-446b-8e1d-b2c052cafe0b",
"insuranceValue": 5.3,
"insurancePercent": null,
"interestDiscount": null,
"rateValidFrom": null,
"rateValidTo": null
},
{
"id": "24284701-7d60-4a80-8589-5ab867f9db81",
"name": "TestInsurance_Values2_Percentage",
"code": "testI_V2P",
"description": null,
"insurer": "Generali",
"isMandatoryForApplicant": true,
"isMandatoryForDebtor": false,
"valueIsPercent": false,
"periodicityTypeId": "1cc04a28-88e0-46df-a089-31d04bbde6df",
"currencyId": "fc9c53a8-31c6-41ff-a979-9c7788d32fb0",
"useOnPaymentSchedule": true,
"scheduleElementClassId": "d74c21fe-bb12-413f-83d7-26ab40f34226",
"operationItemId": null,
"useFormula": false,
"formulaTypeId": null,
"insuranceValue": 146,
"insurancePercent": null,
"interestDiscount": null,
"rateValidFrom": "2021-03-07T22:00:00Z",
"rateValidTo": "2021-12-30T22:00:00Z"
}
]
*/
var data = {
"insuranceId": "f93416a9-c3f9-4824-9d72-05160c3666bc",
"bankingProductId": "25b9efdf-6ca5-48c5-8507-5543a22377b2",
"insuranceInput": {
"Amount": 6000.00
}
};
ebs.callActionByName("FTOS_BP_GetInsuranceDetail", data,
function(s){ if(s.UIResult){console.log(s.UIResult.Data.insuranceList);}});
/*
[
{
"id": "f93416a9-c3f9-4824-9d72-05160c3666bc",
"name": "Test Insurance Formula1",
"code": "testI_F1",
"description": null,
"insurer": "ASIROM",
"isMandatoryForApplicant": true,
"isMandatoryForDebtor": false,
"valueIsPercent": false,
"periodicityTypeId": "1cc04a28-88e0-46df-a089-31d04bbde6df",
"currencyId": "fc9c53a8-31c6-41ff-a979-9c7788d32fb0",
"useOnPaymentSchedule": true,
"scheduleElementClassId": "d74c21fe-bb12-413f-83d7-26ab40f34226",
"operationItemId": null,
"useFormula": true,
"formulaTypeId": "a0dd56a6-a0b9-446b-8e1d-b2c052cafe0b",
"insuranceValue": 5.3,
"insurancePercent": null,
"interestDiscount": null,
"rateValidFrom": null,
"rateValidTo": null
}
]
*/
Returns the value for the calculated PMT, or payment terms for a loan or investment.
Input:
Mandatory input parameters:
-
InstallmentsNo - The number of installments
-
PeriodicityType - The type of periodicity for PMT calculation. The possible values are the names of the records from the
FTOS_CB_PeriodicityType
entity. -
InterestCalculationMethod - The method to be used for interest calculation. The possible values are the names of the records from the
FTOS_BP_InterestCalculationType
option set.
Optional input parameters:
-
FinancedAmount - The loan's financed amount
-
InterestPercent - The annual interest percentage
-
GracePeriodPrincipal - If the value is 1, then the installment is skipped at the beginning. If the parameter is not present, its value is considered 0.
-
FutureValue - The balloon value. If the parameter is not present, its value is considered 0.
-
InterestType - The type of calculation for the interest, with 0 for InArrears and 1 for InAdvance.
Output:
-
PMTValue - the calculated value of the PMT
-
PrincipalValue - the principal value.
Call example:
ebs.callActionByNameAsync('FTOS_BP_CalculatePMT', {
"jsonParam": {
"FinancedAmount": 10000,
"InterestPercent": 5,
"InstallmentsNo": 12,
"GracePeriodPrincipal": 1,
"PeriodicityType": "Monthly",
"FutureValue": 1000,
"InterestCalculationMethod": "30/360",
"InterestType":0
}
}).then(function (o) {
console.table(o.UIResult.Data)
});
Returns an array of json
records representing the installments of a repayment schedule, that must be stored and presented as in the picture bellow, customized for every project:
Input:
Mandatory input parameters:
-
ScheduleType - the name of the Payment Schedule found in the
FTOS_BP_PaymentScheduleType
entity -
InterestPercent - the interest rate for the calculation, defined at the banking product level. The interest rate must be annual, so if you are using a monthly interest rate, you must transform it into an annual rate, multiplying it with 12.
-
Amount - the financed amount, usually also containing the residual value if present, but not the advance value
-
InstallmentsNo - the number of installments
-
PeriodicityType - the periodicity of the schedule. The possible values are the names of the records from the
FTOS_CB_PeriodicityType
entity. -
InstallmentDay - the day of month for each installment
Optional input parameters:
-
AdvanceAmount - the advance value, where AdvanceAmount + Amount = CreditValue
-
GracePeriodInterest - the number of installments having grace period applied on the Interest column
-
GracePeriodPrincipal - the number of installments having grace period applied on the Principal column
-
LastDueDate - the date of the last installment unmodified for recalculation
-
BlockInstallmentNo - the installment number that is blocked for recalculation
-
BlockAmount - the value of the capital that is blocked for recalculation
-
ActivationDate - the activation date of the contract. This is considered at the adjustment of the first installment for the columns that have Effective Rate as calculation method.
-
FirstDueDate - the due date of the first installment
-
BlockInterestAmount - the value of the interest for the grace period if recalculation includes the grace period
-
HolidayShift - the system takes into account not working days/ national holidays, according to the sent value. If
true
and Sunday or Saturday are defined as nonworking days, then the DueDate excepts these dates. -
CalculateDAE - specifies whether to show the effective annual interest rate: for 0 or null, the DAE is not displayed; for 1, only the DAE percent is displayed, and for 2, the original schedule containing a column wiht DAE percent is displayed.
-
installmentValue - if there is a locked value for installments, this value should be provided here (equal installments)
-
principalValue - if there is a locked value for principal, this value should be provided here (equal principal)
-
InstallmentMethod - the method for calculating the installment (Actual Month or Next Month)
-
MaturityDate - the date for the end of the contract
-
InterestCapitalization - specifies if the interest is capitalized for deposit calculation
-
UpFrontValue - the amount for upfront commissions, taxes, insurances payed once at the beginning of the contract
-
ResidualValue - the residual value amount for insurance business
-
ResidualInInstallment - the method of display for the residual value: for 0, it is displayed in a new schedule line, for 1, it is displayed in the last schedule line
-
Commission - an array [] of commissions with periodicity different than
Once
.
[
-
SourceValue - the value of the commission when the commission is a defined as value. Mandatory if the line is present.
-
SourcePercent - the percent of the commission when the commission is defined as a percentage. Mandatory if the line is present.
-
FeePeriodicityType - the periodicity of the commission. Mandatory if the line is present.
-
GracePeriodFee - it can have its own grace period for a number of installments
-
BlockFeeAmount - the blocked amount is case of recalculation
-
FeeDate - the date of the fee being applied to the contract. Mandatory if the line is present.
-
FeeId - the fee from the
FTOS_BP_Commission
entity selected from the banking product level. Mandatory if the line is present. -
IsUpfront - for commissions that are included into the payment schedule and the first commission value is paid at the activation date. Possible values: 0,1. The parameter is optional and if it is not included into the JSON request, the value comes from payment schedule detail column setting.
]
-
Insurance - an array [] of insurances with periodicity different than
Once
.
[
-
SourceValue - the value of the insurance when the insurance is defined as value. Mandatory if the line is present, and mutually exclusive if the SourcePercent is present.
-
SourcePercent - the percent of the insurance when the insurance is defined as a percentage. Mandatory if the line is present, and mutually exclusive if the SourceValue is present.
-
InsurancePeriodicityType - the periodicity of the insurance. Mandatory if the line is present.
-
GracePeriodInsurance - it can have its own grace period for a number of installments
-
BlockInsuranceAmount - the blocked amount is case of recalculation
-
InsuranceDate - the date of the insurance applied to the contract. Mandatory if the line is present.
-
InsuranceId - the insurance from the
FTOS_BP_Insurance
entity selected from the banking product. Optional if InsuranceClassId is present. -
InsuranceClassId - the insurance class from the
FTOS_BP_ScheduleElementClass
entity selected on theFTOS_BP_Insurance
entity when defining the insurance. Optional if InsuranceId is present. -
IsUpfront - for insurances that are included into the payment schedule and the first commission value is paid at the activation date. Possible values: 0,1. The parameter is optional and if it is not included into the JSON request, the value comes from payment schedule detail column setting.
]
-
MultipleInterestRates - an array [] of interest rates
[
-
InterestRate - the interest percent defined as interest type =
Collection
on the banking product Dimensions > Interest List > Interest level -
FromInstNo - the From installment number defined as interest type =
Collection
on the banking product Dimensions > Interest List > Interest level -
ToInstNo - the To installment number defined as interest type =
Collection
on the banking product Dimensions > Interest List > Interest level
]
-
CapitalPercent - the percentage field defined at the banking product level (Credit Card) in the Details tab, representing a percentage to be applied as a formula to the schedule detail principal column.
Input variables example:
{
"ScheduleType": "Loan Equal Principal Actual with ResidualValue",
"InterestPercent": 6,
"Amount": 10000,
"InstallmentsNo": 13,
"AdvanceAmount": 400,
"GracePeriodInterest": null,
"GracePeriodPrincipal": 0,
"PeriodicityType": "Monthly",
"LastDueDate": "2020-8-12",
"BlockInstallmentNo": 0,
"BlockAmount": 0,
"ActivationDate": "2020-8-12",
"FirstDueDate": "2020-8-12",
"BlockInterestAmount": 0,
"HolidayShift": true,
"HolidayCountry": "Country:Thailand",
"CalculateDAE": 2,
"installmentValue": 796.42,
"principalValue": null,
"InstallmentDay": 15,
"InstallmentMethod": "ActualMonth",
"MaturityDate": "2021-8-12",
"InterestCapitalization": 0,
"UpFrontValue": 400.00,
"ResidualValue": 200,
"ResidualInInstallment": 0,
"Commission": [
{
"SourceValue": 1,
"SourcePercent": 0.01,
"FeePeriodicityType": "Trimestrial",
"GracePeriodFee": 0,
"BlockFeeAmount": 0,
"FeeDate": "2020-8-12",
"FeeId": "c86d68e5-2b48-439f-9bc6-38df317bff2a",
"IsUpfront": 0
}
],
"Insurance": [
{
"SourceValue": 10,
"SourcePercent": null,
"InsurancePeriodicityType": "Trimestrial",
"GracePeriodInsurance": 0,
"BlockInsuranceAmount": 0,
"InsuranceDate": "2020-8-12",
"InsuranceId": "66128D6D-C2AA-4B5C-932B-7502C2E18288",
"InsuranceClassId": "61D36493-3DF9-44F0-B372-BAC569346E80",
"IsUpfront": 0
}
],
"MultipleInterestRates":[{
"InterestRate": 8.000000,
"FromInstNo":1,
"ToInstNo":3
}],
"CapitalPercent":6
}
Output:
An array of json
records representing the installments of a repayment schedule.
Case Studies
Loan Equal Installment - Minimal Call
Call example:
var jp = {
"ScheduleType": "Loan Equal Installments",
"InterestPercent": 6,
"Amount": 10000,
"InstallmentsNo": 13,
"PeriodicityType": "Monthly",
"ActivationDate": "2020-8-12",
"InstallmentDay": 15
};
ebs.callActionByName("FTOS_BP_CalculateRepaymentSchedule", {jsonParam:jp},
function(s){ if(s.UIResult){console.log(s.UIResult.Data);}});
Returned data:
Loan Equal Principal Actual with Fees and Insurances
The actual Annual Admin Fee must be defined within the FTOS_BP_Commission
entity, and also the Insurances within the FTOS_BP_Insurance
entity, Make sure you have at least one insurance with class Life Insurance, Monthly, defined as percentage, and one with class HomeInsurance, Monthly, defined as value. These Commissions and Insurances are called by Id within the request of the FTOS_BP_CalculateRepaymentSchedule
endpoint.
Call example:
var jp = {
"ScheduleType": "Loan Equal Principal Actual",
"InterestPercent": 6,
"Amount": 10000,
"InstallmentsNo": 13,
"PeriodicityType": "Monthly",
"ActivationDate": "2020-8-12",
"InstallmentDay": 15,
"InstallmentMethod": "ActualMonth",
"Commission": [
{
"SourceValue": null,
"SourcePercent": 2,
"FeePeriodicityType": "Monthly",
"GracePeriodFee": 0,
"BlockFeeAmount": 0,
"FeeDate": "2020-8-12",
"FeeId": "6ab39765-f535-4560-be0b-24c92755946c"
}
],
"Insurance": [
{
"SourceValue": 5,
"SourcePercent": null,
"InsurancePeriodicityType": "Monthly",
"GracePeriodInsurance": 0,
"BlockInsuranceAmount": 0,
"InsuranceDate": "2020-8-12",
"InsuranceId": "a2f2230e-ec59-44ad-bf73-39556b2ed15d" ,
"InsuranceClassId": null
},
{
"SourceValue": null,
"SourcePercent": 1.5,
"InsurancePeriodicityType": "Monthly",
"GracePeriodInsurance": 0,
"BlockInsuranceAmount": 0,
"InsuranceDate": "2020-8-12",
"InsuranceId": "1c67cf62-032d-49d1-bfa1-e36299ace050" ,
"InsuranceClassId": null
}
]
};
ebs.callActionByName("FTOS_BP_CalculateRepaymentSchedule", {jsonParam:jp},
function(s){ if(s.UIResult){console.log(s.UIResult.Data);}});
Part of the returned data:
Loan Equal Installments with Residual Value
Call example:
var jp = {
"ScheduleType": "Loan Equal Installments with ResidualValue",
"InterestPercent": 6,
"Amount": 10000,
"InstallmentsNo": 13,
"AdvanceAmount": 400,
"GracePeriodInterest": null,
"GracePeriodPrincipal": 0,
"PeriodicityType": "Monthly",
"LastDueDate": "2020-8-12",
"BlockInstallmentNo": 0,
"BlockAmount": 0,
"ActivationDate": "2020-8-12",
"FirstDueDate": "2020-8-12",
"BlockInterestAmount": 0,
"HolidayShift": true,
"HolidayCountry": "Country:Thailand",
"CalculateDAE": 2,
"installmentValue": 796.42,
"principalValue": null,
"InstallmentDay": 15,
"InstallmentMethod": "ActualMonth",
"MaturityDate": "2021-8-12",
"InterestCapitalization": 0,
"UpFrontValue": 0.00,
"ResidualValue": 200,
"ResidualInInstallment": 0,
"Commission": [],
"Insurance": []
};
ebs.callActionByName("FTOS_BP_CalculateRepaymentSchedule", {jsonParam:jp},
function(s){ if(s.UIResult){console.log(s.UIResult.Data);}});
Part of the returned data:
Data Visualization Example
Code:
<div class="row" data-template-id="row_11">
<div class="col-xs-12">
<div id="payment-details"> </div>
</div>
</div>
Call example:
var stId = ebs.getCurrentEntityData().scheduleTypeId; // stId = Schedule Type Id
function unCapitalize(string) {
return string[0].toLowerCase() + string.slice(1);
}
var status = '';
function compareValues(key, order = 'asc') {
return function innerSort(a, b) {
if (!a.hasOwnProperty(key) || !b.hasOwnProperty(key)) {
return 0;
}
const varA = (typeof a[key] === 'string')
? a[key].toUpperCase() : a[key];
const varB = (typeof b[key] === 'string')
? b[key].toUpperCase() : b[key];
let comparison = 0;
if (varA > varB) {
comparison = 1;
} else if (varA < varB) {
comparison = -1;
}
return (
(order === 'desc') ? (comparison * -1) : comparison
);
};
}
showRepaymentSchedule ();
function showRepaymentSchedule () {
//here we have used other entities contract, ContractRepaymentSchedule, ContractRepaymentScheduleDetai (basically this last entity contain the schedule details)
//so this endpoint bellow is arbitrary and usualy get replaced by something else
ebs.callActionByName('FTOS_CB_PaymentScheduleFields', { scheduleId: ebs.getCurrentEntityId(), scheduleTypeId: stId }, function (rsp) {
var columnsFields = [];
rsp.UIResult.Data.fields.map(function (o) {
columnsFields.push(o);
});
columnsFields.sort(compareValues('order'));
var values = rsp.UIResult.Data.values;
columnsFields.unshift({ name: 'DueDate', display: 'Due Date', cap: false });
columnsFields.unshift({ name: 'InstallmentNo', display: 'No.', cap: false, decimal: false });
paymentDetail(columnsFields, values, hasButton);
}
function paymentDetail(fields, values, hasButton) {
var dataSource = [];
values.forEach(function (v) {
var obj = JSON.parse(v.json);
var dateToFormat = new Date(obj.DueDate.invariantDate);
obj.DueDate = (dateToFormat.getDate() < 10 ? '0' + dateToFormat.getDate() : dateToFormat.getDate()) + '-' + ((dateToFormat.getMonth() + 1) < 10 ? '0' + (dateToFormat.getMonth() + 1) : (dateToFormat.getMonth() + 1)) + '-' + dateToFormat.getFullYear()
obj.InstallmentTypeId = v.sd_installmentTypeId_displayname;
obj.id = v.id;
obj.payed = v.payed;
obj.notification = v.notificationId;
dataSource.push(obj);
});
var columns = [];
fields.forEach(function (o) {
var object = {
dataField: typeof o.cap === 'undefined' ? unCapitalize(o.name) : o.name,
caption: o.display,
format: typeof o.decimal !== 'undefined' ? {} : { type: "fixedPoint", precision: 2 }
};
columns.push(object);
});
if (hasButton) {
columns.push({
type: "buttons",
width: 110,
buttons: [{
hint: "Pay Installsssment",
icon: "money",
visible: function (e) {
return e.row.data.notification === null;
},
onClick: function (e) {
//custom code on pay installment
});
}
}]
});
}
$("#payment-details").dxDataGrid({
rowAlternationEnabled: true,
showColumnHeaders: true,
alignment: "left",
repaintChangesOnly: true,
paging: {
pageSize: 10000
},
onCellPrepared: function (e) {
//console.log(e)
if (e.rowType === 'data' && e.row.data.payed === true) {
//console.log(e.row.data.payed)
e.cellElement[0].className += " payed";
}
},
columnAutoWidth: false,
columns: columns,
dataSource: {
store: dataSource,
reshapeOnPush: true
}
});
}
Credit Card Schedule
Call example:
var jp = {
"ScheduleType":"Credit Card Installments",
"InterestPercent":32.000000,
"Amount":3770.00,
"HolidayShift":true,
"InstallmentsNo":60,
"PeriodicityType":"Monthly",
"LastDueDate":"2021-02-01",
"ActivationDate":"2021-02-01",
"InstallmentDay":1,
"InstallmentMethod":"ActualMonth",
"MaturityDate":"2026-02-01",
"Commission":[
{ "SourceValue":5.00,
"SourcePercent":null,
"FeePeriodicityType":"Monthly",
"FeeDate":"2021-02-01",
"FeeId":"365221CE-9F6D-4B4C-A8CE-2A2D62A38353",
"IsUpfront":null}
],
"CalculateDAE":2,
"CapitalPercent":5.000000
};
ebs.callActionByName("FTOS_BP_CalculateRepaymentSchedule", {jsonParam:jp},
function(s){ if(s.UIResult){console.log(s.UIResult.Data);}});
Part of the returned data:
Returns the banking product information based on its product code. If more versions are available, only the approved one is taken into consideration.
Input:
Mandatory input parameters:
-
BankingProductCode - string, from
FTOS_BP_BankingProduct
(attribute:BankingProductCode
).
Optional input parameters:
- displayBPDetails - boolean, specifies whether to show the details of the banking product, such as general data, calendars, associated products or payment schedule types, product guarantees or destination types. Possible values:
true
,false
. The Details section of the output is only displayed fortrue
value. -
displayBPAvailability - boolean, specifies whether to show the availability information of the banking product, such as currency, period, minimum and maximum amounts and advances, or covenants. Possible values:
true
,false
. The Availability section of the output is only displayed fortrue
value. -
displayBPDimensions - boolean, specifies whether to show the dimensions information of the banking product, such as interests and commissions, insurances, discounts or questions. Possible values:
true
,false
. The Dimensions section of the output is only displayed fortrue
value.
Output:
Object with details about a specific banking product from the FTOS_BP_BankingProduct
entity. The data enclosed in Banking Product is returned by default. Data within Details, Availability and Dimensions is returned only if their corresponding flags are set to true.
Call example:
var data = {
"BankingProductCode": "APICodeTst",
"displayBPDetails": true,
"displayBPAvailability": true,
"displayBPDimensions": true
};
ebs.callActionByName("FTOS_BP_GetBankingProductByCode", data, function(response) {
if (response.UIResult) {
console.log(response.UIResult.Data);
}
});
Returned data:
// API Response example below:
{
"BankingProduct": {
"BankingProductCode": "APICodeTst",
"Name": "APIName",
"StartDate": "2021-10-07T21:00:00Z",
"EndDate": "2022-03-30T21:00:00Z"
},
"Details": {
"GeneralData": {
"BankAccountType": "LoanTermAccount",
"IsRevolving": true,
"AutoDisbursement": false,
"MaxNoDisbursements": 12,
"ActivationTranchesOnDocumentSubmission": false,
"IsGuaranteed": true,
"AllowCollateralPartialRelease": true,
"AllowCoDebtor": false,
"AllowRefinancing": true,
"MaxNoOfCodebtors": 5,
"PeriodicityType": "Monthly",
"RepaymentAllocationMethod": "CostOrder",
"HolidayShiftForRepaymentInstallments": true,
"HolidayShiftMethod": "Forward",
"DeferDueDate": true,
"GraceType": "Interest",
"ProductGrace": "FiveDaysGrace",
"GraceDaysForRepayment": 123,
"PenaltyForGracePeriod": false
},
"CountryCalendars": [
{
"CountryName": "Belgium"
},
{
"CountryName": "Thailand"
}
],
"AssociatedPaymentScheduleTypes": [
{
"PaymentScheduleTypeName": "Credit Card Installments"
}
],
"ProductGuarantees": [
{
"ProductGuaranteeName": "APITestProductGuarantee"
}
],
"ProductDestinationTypes": [],
"DisbursementMatrix": [
{
"Name": "DisbMatrixAPITest"
}
],
"AssociatedProducts": [
{
"AssociatedProductName": "TLVlad"
},
{
"AssociatedProductName": "TLVladAutoCommLoad"
}
]
},
"Availability": {
"Currency": "RON",
"PeriodType": "Months",
"MaxPeriodForDisbursement": 1,
"MinimumPeriod": 2,
"MaximumPeriod": 3,
"MinimumEarlyRepaymentValue": 4,
"MinimumAmount": 500,
"MaximumAmount": 50000,
"UnusageStartPeriod": 5,
"MinimumAdvance": 10,
"MaximumAdvance": 90,
"AvailabilityItemFilters": [
{
"Description": "Account Filter API TEST"
}
],
"ProductCovenants": [
{
"Name": "Lender can monitor borrower's current ratio"
}
]
},
"Dimensions": {
"InterestsAndCommissions": [
{
"InterestCommissionItemName": "InterestCommAPITest",
"CommissionListName": "Current Account RON commission ",
"InterestListName": "eMag CA Interest List",
"Commissions": [
"CA Administration Fee",
"Administration Fee ODV MAGDA"
],
"Interests": [
"Zero Interest Rate",
"Banded Test"
]
}
],
"Insurance": [
{
"Name": "InsuranceAPITEst"
}
],
"Discounts": [
{
"Name": "DiscountAPITest"
}
],
"Questions": [
{
"Name": "Question1"
},
{
"Name": "Question2"
}
]
}
}