calculatePaymentAmount
Description
The calculatePaymentAmount API is designed to generate the Payment Amount for the received Pricing Option. Upon receiving a JSON payload containing pricing option(one), the API runs the Financial Calculator to calculate the Payment Amount for the received pricing option. It is a POST call intended solely to calculate Payment Amounts for the parameters received.
Caller
This API is called by a Salesforce.
Definition
POST https://<domain>/services/apexrest/genesis/pricingCalculator/calculatePaymentAmount
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. | calculatePaymentAmount |
NA |
Request body parameters
The following table provides details of the request body parameters used by this API:
Field | Type | Description |
---|---|---|
Application | JSON |
|
pricingOptions | JSON |
|
rateScheduleMap | JSON |
|
This is the same format that user receives from API calculatePricingOptions.
{
"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
The response JSON is in the same format as the request JSON, with the genesis__Payment_Amount_Derived__c field added to the response. This field displays the payment amount generated for each offer.
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 | Invalid Input | Label.INVALID_INPUT | Any error due to invalid input. | 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 |
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 Product Type 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": "Product Type is null.",
"errorCode": "API_EXCEPTION",
"content": []
}