calculatePricing
Description
The calculatePricing API generates pricing options based on parameters provided in request parameters. The pricing options are determined using the existing configuration of Rate Cards in the FIs organization. Rate Cards contain predefined interest rates and pricing criteria established by the FIs for various financial products and services.
Caller
This API can be called by any user of the FIs who has access to the Origination.
Definition
POST https://<domain>/services/apexrest/genesis/pricingCalculator/calculatePricing
Authentication
Bearer <Access Token>
Parameters
There are several types of parameters found in REST APIs. While building a REST API, you need to decide which parameter suits an endpoint. In simple terms, API parameters are options that can be passed with the endpoint to influence the response. They are like search filters; they single out the data you want to receive from the API.
The types of parameters used for this REST API are as follows:
HTTP Header Parameters
The following table provides the details of the header parameters used by this API:
Key | Value |
---|---|
Content-Type |
application/json |
Authorization | Bearer <Access Token> |
Path Parameters
The following table provides details of the path parameters used by this REST API:
Parameter | Type | Required | Description | Value | Default Value |
---|---|---|---|---|---|
action |
String |
Yes |
This parameter defines the action that must be performed on this API. |
calculatePricing |
NA |
calculatePaymentAmount | Boolean | No | This parameter determines if the payment amount includes pricing. | true/false |
false |
Request Body Parameters
The following table provides the details of the request body parameters used by this API:
Field | Type | Description |
---|---|---|
application | JSON |
|
The following is a sample JSON of request body parameters for creating pricing.
{
"genesis__Expected_Start_Date__c": "2024-07-24",
"genesis__Loan_Amount__c": 10000,
"genesis__Payment_Frequency__c": "MONTHLY",
"genesis__CL_Product__c": "a0mHo00000BtxNqIAJ",
"genesis__Term__c": 40,
"genesis__CL_Company__c": "a1AHo000005wImCMAU",
"genesis__Product_Type__c": "LOAN"
}
Where:
Expected Start Date: 2024-07-24
Loan Amount: 10000
Payment Frequency: MONTHLY
CL Product: a0mHo00000BtxNqIAJ (Construction)
Term: 40
CL Company: a1AHo000005wImCMAU (Head Quarters)
Product Type: LOAN
Response JSON
The following response is received , where pricing generated along with the rate schedule.
{
"status": "SUCCESS",
"rowNumber": null,
"responseJson": "{\"rateScheduleMap\":{\"aBEHo000000PuvyOAC\":[{\"attributes\":{\"type\":\"rateScheduleOptions\"},
\"genesis__Application__c\":\"aC3Ho000000PZfIKAW\",
\"genesis__Index__c\":null,\"genesis__Interest_Rate__c\":22,
\"genesis__Spread__c\":0,
\"genesis__Rate_Card_Setup_Detail__c\":\"aBEHo000000PuvyOAC\",
\"genesis__Rate_Type__c\":\"Fixed\",
\"genesis__Sequence__c\":1,
\"genesis__Start_Date__c\":\"2025-07-24\",\"genesis__Terms__c\":12,
\"genesis__Unit__c\":\"Months\",\"genesis__Adjustments__c\":12,
\"genesis__End_Date__c\":\"2025-09-24\",\"genesis__Base_Rate__c\":10,
\"genesis__Margin_Rate__c\":0},
{\"attributes\":{\"type\":\"rateScheduleOptions\"},
\"genesis__Application__c\":\"aC3Ho000000PZfIKAW\",
\"genesis__Index__c\":null,\"genesis__Interest_Rate__c\":20,
\"genesis__Spread__c\":0,
\"genesis__Rate_Card_Setup_Detail__c\":\"aBEHo000000PuvyOAC\",
\"genesis__Rate_Type__c\":\"Fixed\",\"genesis__Sequence__c\":2,
\"genesis__Start_Date__c\":\"2025-09-24\",\"genesis__Terms__c\":12,
\"genesis__Unit__c\":\"Months\",\"genesis__Adjustments__c\":10,
\"genesis__End_Date__c\":\"2026-07-24\",
\"genesis__Base_Rate__c\":10,\"genesis__Margin_Rate__c\":0},
{\"attributes\":{\"type\":\"rateScheduleOptions\"},
\"genesis__Application__c\":\"aC3Ho000000PZfIKAW\",
\"genesis__Index__c\":\"a29Ho0000057AXhIAM\",
\"genesis__Interest_Rate__c\":7.75,\"genesis__Spread__c\":0,
\"genesis__Rate_Card_Setup_Detail__c\":\"aBEHo000000PuvyOAC\",
\"genesis__Rate_Type__c\":\"Floating\",\"genesis__Sequence__c\":3,
\"genesis__Start_Date__c\":\"2026-07-24\",\"genesis__Terms__c\":6,
\"genesis__Unit__c\":\"Months\",\"genesis__Adjustments__c\":0,
\"genesis__End_Date__c\":\"2027-01-24\",
\"genesis__Base_Rate__c\":7.75,\"genesis__Margin_Rate__c\":0}]},
\"pricingOptions\":[{\"attributes\":{\"type\":\"pricingOptionDetails\"},
\"genesis__Type__c\":\"RATECARD\",
\"genesis__Arrears__c\":false,\"genesis__Credit_Grade__c\":null,
\"genesis__Credit_Rating__c\":null,\"genesis__Days_Convention__c\":\"30/360\",
\"genesis__Enabled_Flag__c\":true,
\"genesis__Equipment_Class__c\":\"TRUCK\",
\"genesis__Equipment_Condition__c\":\"NEW\",\"genesis__Maximum_Financed_Amount__c\":0,
\"genesis__Minimum_Financed_Amount__c\":0,
\"genesis__Payment_Amount_Per_Period__c\":0,\"genesis__Rate_Factor__c\":0,
\"genesis__Rate_Factor_Based_On_Amount__c\":0,\"genesis__Residual_Percent__c\":0,
\"genesis__Residual_Term__c\":0,
\"genesis__Residual_Type__c\":null,
\"genesis__Residual_Amount__c\":0,
\"genesis__Pricing_Method__c\":\"INTERESTRATE\",
\"genesis__Yield_Percent__c\":0,
\"genesis__Total_Payments__c\":0,\"genesis__Usage_Of_Equipment__c\":null,
\"genesis__Year_Of_Manufacture__c\":null,\"genesis__Interest_Rate__c\":2,
\"genesis__Rate_Card_Setup_Detail__c\":\"aBEHo000000PuuWOAS\",
\"genesis__Application__c\":null,
\"genesis__Term__c\":12,
\"genesis__Payment_Frequency__c\":\"MONTHLY\"},
{\"attributes\":{\"type\":\"pricingOptionDetails\"},\"genesis__Type__c\":\"RATECARD\",\"genesis__Arrears__c\":false,
\"genesis__Credit_Grade__c\":null,\"genesis__Credit_Rating__c\":null,
\"genesis__Days_Convention__c\":\"30/360\",
\"genesis__Enabled_Flag__c\":true,
\"genesis__Equipment_Class__c\":\"TRUCK\",\"genesis__Equipment_Condition__c\":\"NEW\",
\"genesis__Maximum_Financed_Amount__c\":0,
\"genesis__Minimum_Financed_Amount__c\":0,
\"genesis__Payment_Amount_Per_Period__c\":0,\"genesis__Rate_Factor__c\":0,\"genesis__Rate_Factor_Based_On_Amount__c\":0,
\"genesis__Residual_Percent__c\":0,\"genesis__Residual_Term__c\":0,
\"genesis__Residual_Type__c\":null,
\"genesis__Residual_Amount__c\":0,
\"genesis__Pricing_Method__c\":\"RATESCHEDULE\",\"genesis__Yield_Percent__c\":0,\"genesis__Total_Payments__c\":0,\"genesis__Usage_Of_Equipment__c\":null,
\"genesis__Year_Of_Manufacture__c\":null,
\"genesis__Interest_Rate__c\":22,
\"genesis__Rate_Card_Setup_Detail__c\":\"aBEHo000000PuvyOAC\",\"genesis__Application__c\":null,
\"genesis__Payment_Frequency__c\":\"MONTHLY\",\"genesis__Term__c\":40}],
\"application\":{\"attributes\":{\"type\":\"Application\"},\"genesis__Product_Type__c\":\"LOAN\",\"genesis__CL_Product__c\":\"a0mHo00000BtxNqIAJ\",
\"genesis__CL_Company__c\":\"a1AHo000005wImCMAU\",\"genesis__Term__c\":40,\"genesis__Expected_Close_Date__c\":\"2025-07-24\",
\"genesis__Loan_Amount__c\":10000,
\"genesis__Expected_Start_Date__c\":\"2024-07-24\",\"genesis__Payment_Frequency__c\":\"MONTHLY\"}}",
"response": [],
"errorNumber": null,
"errorMessage": null,
"errorCode": "NO_ERROR",
"content": []
}
The following table provides the details of this API's response:
Field | Type | Description |
---|---|---|
application | JSON | The fields sent in the request are returned in the response as part of the application. |
pricingOptions | JSON |
|
rateScheduleMap | JSON |
|
Here is a sample response received that states that the request was successful:
{
"status": "SUCCESS",
"rowNumber": null,
"responseJson": "<response Json with generated Pricing in form of genesis.PricingOptionsOutput class>",
"response": [],
"errorNumber": null,
"errorMessage": null,
"errorCode": "NO_ERROR",
"content": []
}
Response JSON with generated Pricing in the form of PricingOptionsOutput class
The following table provides the details of this API's response:
Field | Type | Description |
---|---|---|
application | JSON | The fields sent in the request are returned in the response as part of the application. |
pricingOptions | JSON |
|
rateScheduleMap | JSON |
|
Here is a sample response where pricing gets generated along with the rate schedule.
{
"rateScheduleMap": {
"aBEHo000000PuvyOAC": [
{
"attributes": {
"type": "rateScheduleOptions"
},
"genesis__Application__c": "aC3Ho000000PZahKAG",
"genesis__Index__c": null,
"genesis__Interest_Rate__c": 22.00,
"genesis__Spread__c": 0.00,
"genesis__Rate_Card_Setup_Detail__c": "aBEHo000000PuvyOAC",
"genesis__Rate_Type__c": "Fixed",
"genesis__Sequence__c": 1,
"genesis__Start_Date__c": "2024-07-24",
"genesis__Terms__c": 12,
"genesis__Unit__c": "Months",
"genesis__Adjustments__c": 12.00,
"genesis__End_Date__c": "2024-09-24",
"genesis__Base_Rate__c": 10.00,
"genesis__Margin_Rate__c": 0
},
{
"attributes": {
"type": "rateScheduleOptions"
},
"genesis__Application__c": "aC3Ho000000PZahKAG",
"genesis__Index__c": null,
"genesis__Interest_Rate__c": 20.00,
"genesis__Spread__c": 0.00,
"genesis__Rate_Card_Setup_Detail__c": "aBEHo000000PuvyOAC",
"genesis__Rate_Type__c": "Fixed",
"genesis__Sequence__c": 2,
"genesis__Start_Date__c": "2024-09-24",
"genesis__Terms__c": 12,
"genesis__Unit__c": "Months",
"genesis__Adjustments__c": 10.00,
"genesis__End_Date__c": "2025-07-24",
"genesis__Base_Rate__c": 10.00,
"genesis__Margin_Rate__c": 0
}
]
},
"pricingOptions": [
{
"attributes": {
"type": "pricingOptionDetails"
},
"genesis__Type__c": "RATE CARD",
"genesis__Arrears__c": false,
"genesis__Credit_Grade__c": null,
"genesis__Credit_Rating__c": null,
"genesis__Days_Convention__c": "30/360",
"genesis__Enabled_Flag__c": true,
"genesis__Equipment_Class__c": "TRUCK",
"genesis__Equipment_Condition__c": "NEW",
"genesis__Maximum_Financed_Amount__c": 2000000.00,
"genesis__Minimum_Financed_Amount__c": 12000.00,
"genesis__Payment_Amount_Per_Period__c": 0.00,
"genesis__Rate_Factor__c": 0E-12,
"genesis__Rate_Factor_Based_On_Amount__c": 0.00,
"genesis__Residual_Percent__c": 0.00,
"genesis__Residual_Term__c": 0,
"genesis__Residual_Type__c": null,
"genesis__Residual_Amount__c": 0.00,
"genesis__Pricing_Method__c": "INTEREST RATE",
"genesis__Yield_Percent__c": 0.00,
"genesis__Total_Payments__c": 0.00,
"genesis__Usage_Of_Equipment__c": null,
"genesis__Year_Of_Manufacture__c": null,
"genesis__Interest_Rate__c": 12.00,
"genesis__Rate_Card_Setup_Detail__c": "aBEHo000000Xx7VOAS",
"genesis__Application__c": null,
"genesis__Term__c": 60,
"genesis__Payment_Frequency__c": "MONTHLY",
"genesis__Payment_Amount_Derived__c": 22244.45
},
{
"attributes": {
"type": "pricingOptionDetails"
},
"genesis__Type__c": "RATE CARD",
"genesis__Arrears__c": false,
"genesis__Credit_Grade__c": null,
"genesis__Credit_Rating__c": null,
"genesis__Days_Convention__c": "30/360",
"genesis__Enabled_Flag__c": true,
"genesis__Equipment_Class__c": "TRUCK",
"genesis__Equipment_Condition__c": "NEW",
"genesis__Maximum_Financed_Amount__c": 0.00,
"genesis__Minimum_Financed_Amount__c": 0.00,
"genesis__Payment_Amount_Per_Period__c": 0.00,
"genesis__Rate_Factor__c": 0E-12,
"genesis__Rate_Factor_Based_On_Amount__c": 0.00,
"genesis__Residual_Percent__c": 0.00,
"genesis__Residual_Term__c": 0,
"genesis__Residual_Type__c": null,
"genesis__Residual_Amount__c": 0.00,
"genesis__Pricing_Method__c": "RATE SCHEDULE",
"genesis__Yield_Percent__c": 0.00,
"genesis__Total_Payments__c": 0.00,
"genesis__Usage_Of_Equipment__c": null,
"genesis__Year_Of_Manufacture__c": null,
"genesis__Interest_Rate__c": 22.00,
"genesis__Rate_Card_Setup_Detail__c": "aBEHo000000PuvyOAC",
"genesis__Application__c": null,
"genesis__Payment_Frequency__c": "MONTHLY",
"genesis__Term__c": 48.0,
"genesis__Payment_Amount_Derived__c": 27069.20
}
],
"application": {
"attributes": {
"type": "Application"
},
"genesis__Product_Type__c": "LOAN",
"genesis__CL_Product_Name__c": "Construction",
"genesis__CL_Company__c": "a1AHo000005wImCMAU",
"genesis__Term__c": 48.0,
"genesis__Loan_Amount__c": 1000000.0,
"genesis__Expected_Start_Date__c": "2024-07-24",
"genesis__CL_Product__c": "a0mHo00000BtxNqIAJ",
}
}
Response JSON format
public class PricingOptionOutput {
public List<Application_Pricing_Detail__c> pricingOptions;
public Map<Id,List<Rate_Schedule_Setup__c>> rateScheduleMap;
public Applications__c application;
}
Error Messages
When you use this REST API you can receive the following possible error messages:
Error Code | Error Message | System.Label | Reason | HTTP Status Code |
---|---|---|---|---|
INVALID_INPUT | Invalid Input | Label.INVALID_INPUT | One of the required parameters is missing. | 400 |
INVALID_INPUT | Unable to parse the Request parameters. | Label.UNABLE_PARSE_REQ_PARAMS | Error getting the request params from the request body. | 400 |
INVALID_INPUT | Invalid Input | Label.INVALID_INPUT | Error when no request body provided. | 400 |
API_EXCEPTION | <NA> | Label.API_EXCEPTION | Any error due to setup issue, example : Expected Close date not provided when custom setting is on for it. | 500 |
API_EXCEPTION | To generate pricing, Expected Start Date must be populated on the application. | Label.EXPECTED_START_DATE_MISSING | Error because of 'Expected Start Date' Missing in Request body. | 500 |
API_EXCEPTION |
To generate pricing, CL Product must be selected on the application | Label.CL_PRODUCT_MISSING | Error because of 'CL Product' missing in the Request body. | 500 |
APEX_ERROR | System.JSONException: Unexpected character ('}' (code 125)): was expecting double-quote to start field name at [line:12, column:2]\n\n(System Code) | NA | Error in parsing the request body provided | 500 |
API_EXCEPTION | Term cannot be null. | NA | Error because of 'Term' not provided in the Request body. | 500 |
API_EXCEPTION | To generate pricing, Company must be selected on the application. | Label.COMPANY_MISSING | Error because of 'Company' not provided in the Request body. | 500 |
API_EXCEPTION |
Product Type is null. | Label.PRODUCT_TYPE_NULL | Error because of 'Product' not provided in the Request body. | 500 |
Sample response with status as Error
Here is a sample response where the Term is provided as null, hence the request is not successful and displayed API_EXCEPTION error.
{
"status": "ERROR",
"rowNumber": null,
"responseJson": null,
"response": [],
"errorNumber": null,
"errorMessage": "Term cannot be null.",
"errorCode": "API_EXCEPTION",
"content": []
}
If the Use Expected Close Date custom setting is marked as true in the org, and we do not provide the Closed Date in our JSON payload, the JSON results in an error.