Annuity Module - Response
The Data object for a response from the Annuity module is defined below, in the
order the fields are returned:
| Object | Fields |
|---|---|
🟥 Data | 🔸Balance, 🔸Rate, 🔸Income, 🔸Term, 🔸TotalIncome, 🔸Gain |
🟥 Errors[] | |
🟥 Warnings[] |
🟥 Data
| Type | Required |
|---|---|
| Object | yes |
The Data object encapsulates the response data for a given module, and will
always be present.
Fields:
🔸Balance,🔸Rate,🔸Income,🔸Term,🔸TotalIncome,🔸GainObjects:
🟥 Errors[],🟥 Warnings[]
🔸 Data.Balance
| Type | Required | Values |
|---|---|---|
| String | yes | Currency |
The beginning balance is the amount which is present in the retirment account when the annuity starts.
🔸 Data.Rate
| Type | Required | Values |
|---|---|---|
| String | yes | Number in [-99.999...600] |
The rate at which interest will accrue on the balance during the term of the annuity.
🔸 Data.Income
| Type | Required | Values |
|---|---|---|
| String | yes | Currency |
The amount of the monthly disbursement.
🔸 Data.Term
| Type | Required | Values |
|---|---|---|
| String | yes | Integer |
This number of months of income provided by the annuity.
🔸 Data.TotalIncome
| Type | Required | Values |
|---|---|---|
| String | yes | Currency |
The TotalIncome is the sum of all monthly disbursements made during
the term of the annuity.
🔸 Data.Gain
| Type | Required | Values |
|---|---|---|
| String | yes | Currency |
The Gain is the difference between the total income and the beginning balance.
It is the total amount of interest accrued over the term of the annuity.
🟥 Data.Errors[]
| Type | Required |
|---|---|
| Array of String | yes |
The Errors[] field contains an array of Strings which describe any errors
encountered while handling the request. If the length of the Errors[] Array is
zero (0), then the module processed the request successfully, and the Data
object can be further processed by the calling application for the returned
data.
On the other hand, if the length of the Errors[] Array is greater than zero
(0), then this indicates that an error condition has been detected, and the
calling application should not process the respons Data object further. In
this case, the contents of the Errors[] array will describe the error(s)
encountered.
Typical errors include the omission of 🟥 required fields, invalid field values, etc.
🟥 Data.Warnings[]
| Type | Required |
|---|---|
| Array of String | yes |
The Warnings[] field contains an array of Strings which describe any warnings
generated by the module handling the request. The most common warnings returned
by modules inform the calling application that the module does not recognize a
specified field (which may help to isolate a field name spelling error in the
calling application's code). Note that field names which start with "//" will
bre treated as comment fields by the SCE, and no warnings will be generated
for these unrecognized fields.
Example - Request and response illustrating warnings when passing unrecognized fields:
{
"Module" : "Annuity",
"Data" : {
"//" : "This is a comment.",
"Hello" : "Friend!",
"How" : "are you?"
}
}
{
{
"Result" : 200,
"Module" : "Annuity",
"Data" : {
"Errors" : [
"Data.Balance (StringFloat) not found.",
"Data.Rate (StringFloat) not found.",
"Data.Term (StringInt) not found."
],
"Warnings" : [
"Request field Data.Hello (String) not recognized.",
"Request field Data.How (String) not recognized."
]
}
}