@instabrain-sdks/api-client 2.3.3 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1140 -85
- package/dist/client/instabrain-client.d.ts +187 -11
- package/dist/client/instabrain-client.js +212 -10
- package/dist/services/application.service.d.ts +41 -3
- package/dist/services/application.service.js +41 -3
- package/dist/services/finalexpense.service.d.ts +129 -0
- package/dist/services/finalexpense.service.js +210 -0
- package/dist/services/gigdb.service.d.ts +25 -3
- package/dist/services/gigdb.service.js +25 -3
- package/dist/services/payment.service.d.ts +94 -0
- package/dist/services/payment.service.js +161 -0
- package/dist/services/pureterm.service.d.ts +96 -10
- package/dist/services/pureterm.service.js +100 -8
- package/dist/services/secure-sign.service.d.ts +19 -3
- package/dist/services/secure-sign.service.js +19 -3
- package/dist/types/enums.d.ts +77 -3
- package/dist/types/enums.js +89 -4
- package/dist/types/errors.js +27 -2
- package/dist/types/finalexpense.types.d.ts +459 -0
- package/dist/types/finalexpense.types.js +2 -0
- package/dist/types/gigdb.types.d.ts +32 -0
- package/dist/types/ibterm.types.d.ts +5 -2
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +2 -0
- package/dist/types/payment.types.d.ts +52 -0
- package/dist/types/payment.types.js +3 -0
- package/dist/types/pureterm.types.d.ts +186 -31
- package/dist/types/secure-sign.types.d.ts +25 -3
- package/dist/utils/error-utils.d.ts +9 -1
- package/dist/utils/error-utils.js +18 -3
- package/dist/utils/http-client.js +11 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ TypeScript SDK for Node.js. All operations go through `InstaBrainClient` — req
|
|
|
8
8
|
|
|
9
9
|
- **GIGDB & ADB** — full client flow: `get*Quote()` → `start*Application()` → `saveEftPayment()` → SecureSign methods → `finalSubmit()`.
|
|
10
10
|
- **IB Term** — client flow ends at `startIBTermApplication()`; use returned `agentLink` / `applicantLink` / `eAppAgentLink` for the InstaBrain frontend.
|
|
11
|
-
- **Pure Term** — pre-fill flow: `getPureTermQuote()` → `
|
|
11
|
+
- **Pure Term** — pre-fill flow: `getPureTermQuote()` → `startPureTermApplication()`; use returned links for the InstaBrain frontend.
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
14
|
import { InstaBrainClient } from '@instabrain-sdks/api-client';
|
|
@@ -48,30 +48,42 @@ Credentials (`userId` and `accessToken`) are provisioned during onboarding.
|
|
|
48
48
|
- [Get existing quote](#ib-term--get-existing-quote)
|
|
49
49
|
7. [Pure Term](#pure-term)
|
|
50
50
|
- [Integration flow](#integration-flow-3)
|
|
51
|
+
- [Rider lookup](#pure-term--rider-lookup)
|
|
51
52
|
- [Get quote](#pure-term--get-quote)
|
|
53
|
+
- [Get existing quote](#pure-term--get-existing-quote)
|
|
52
54
|
- [Start application](#pure-term--start-application)
|
|
53
|
-
8. [
|
|
55
|
+
8. [Final Expense](#final-expense)
|
|
56
|
+
- [Integration flow](#integration-flow-4)
|
|
57
|
+
- [Get quote](#final-expense--get-quote)
|
|
58
|
+
- [Start application](#final-expense--start-application)
|
|
59
|
+
- [Get existing quote](#final-expense--get-existing-quote)
|
|
60
|
+
- [Update quote](#final-expense--update-quote)
|
|
61
|
+
- [Underwriting status (async)](#final-expense--underwriting-status-async)
|
|
62
|
+
9. [Shared methods — GIGDB, ADB & Final Expense](#shared-methods--gigdb-adb--final-expense)
|
|
63
|
+
- [Payment — EFT or credit card](#payment--eft-or-credit-card)
|
|
64
|
+
- [Get credit card iframe URL](#get-credit-card-iframe-url)
|
|
65
|
+
- [Credit card payment status](#credit-card-payment-status)
|
|
54
66
|
- [Save EFT payment](#save-eft-payment)
|
|
55
67
|
- [Prepare docs & get delivery channels](#prepare-docs--get-delivery-channels)
|
|
56
68
|
- [Send PIN & get documents link](#send-pin--get-documents-link)
|
|
57
69
|
- [Resend PIN](#resend-pin)
|
|
58
70
|
- [Verify PIN](#verify-pin)
|
|
59
71
|
- [Final submit](#final-submit)
|
|
60
|
-
|
|
72
|
+
10. [Reporting](#reporting)
|
|
61
73
|
- [Request fields](#request-fields-shared-shape)
|
|
62
74
|
- [Filters (`SQLOperator`)](#filters--sqloperator-enum)
|
|
63
75
|
- [Response shapes](#response-shapes)
|
|
64
|
-
|
|
65
|
-
|
|
76
|
+
11. [Enums & Constants](#enums--constants)
|
|
77
|
+
12. [Beneficiary Reference](#beneficiary-reference)
|
|
66
78
|
- [No extra fields](#variant-1--no-extra-fields)
|
|
67
79
|
- [Named person](#variant-2--named-person)
|
|
68
80
|
- [Named entity](#variant-3--named-entity)
|
|
69
|
-
|
|
81
|
+
13. [Error Handling](#error-handling)
|
|
70
82
|
- [Error class hierarchy](#error-class-hierarchy)
|
|
71
83
|
- [Using `APIValidationError`](#using-apivalidationerror)
|
|
72
84
|
- [`BaseResponse<T>` envelope](#baseresponset-envelope)
|
|
73
85
|
- [Field-level error messages](#field-level-error-messages)
|
|
74
|
-
|
|
86
|
+
14. [Error codes (`APIErrorCode`)](#apierrorcode-reference)
|
|
75
87
|
- [Quote errors](#quote-errors)
|
|
76
88
|
- [Start application errors](#start-application-errors)
|
|
77
89
|
- [Payment & quote update errors](#payment--quote-update-errors)
|
|
@@ -79,10 +91,10 @@ Credentials (`userId` and `accessToken`) are provisioned during onboarding.
|
|
|
79
91
|
- [Final submit errors](#final-submit-errors)
|
|
80
92
|
- [Session](#session)
|
|
81
93
|
- [Deprecated codes (reference only)](#deprecated-codes-reference-only)
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
94
|
+
15. [Environment Configuration](#environment-configuration)
|
|
95
|
+
16. [Token Management](#token-management)
|
|
96
|
+
17. [Examples Directory](#examples-directory)
|
|
97
|
+
18. [Support](#support)
|
|
86
98
|
|
|
87
99
|
---
|
|
88
100
|
|
|
@@ -1637,27 +1649,108 @@ const { quoteResponseId, quoteAmount } = quoteResp.selectedQuote;
|
|
|
1637
1649
|
|
|
1638
1650
|
## Pure Term
|
|
1639
1651
|
|
|
1640
|
-
**InstaBrain Pure Term** —
|
|
1652
|
+
**InstaBrain Pure Term** — term life product.
|
|
1641
1653
|
|
|
1642
|
-
This is a **pre-fill flow**:
|
|
1654
|
+
This is a **pre-fill flow**: quote, start the application via the dedicated Pure Term endpoint, then hand off via `agentLink`, `applicantLink`, and `eAppAgentLink`. All remaining underwriting and signing happens inside the InstaBrain frontend — the same hand-off family as IB Term.
|
|
1643
1655
|
|
|
1644
1656
|
- **Eligible ages:** 18–60
|
|
1645
1657
|
- **Rating:** `rateClass`, `healthClass`, or `height` + `weightInLbs`
|
|
1646
|
-
- **Term lengths:** 10, 20, or 30 years (`benefitPeriod`)
|
|
1658
|
+
- **Term lengths:** 10, 15, 20, or 30 years (`benefitPeriod`) — age and nicotine dependent
|
|
1659
|
+
- **Not available in:** WY, NY
|
|
1660
|
+
- **Dedicated controller:** start application posts to `ThirdPartyPureTermApplication` (not the generic `ThirdPartyStartApp`)
|
|
1661
|
+
|
|
1662
|
+
> **Do not** wire a Pure Term `opportunityId` into `finalSubmit()`, the SecureSign methods, or the credit-card iframe — the credit-card iframe is not supported for this product and returns `CcPaymentIframeNotSupportedForProduct`. Shared `saveEftPayment()` is allowed.
|
|
1663
|
+
|
|
1664
|
+
> **Pure Term follows the same Term SDK pattern as [IB Term](#ib-term)** — rider lookup → quote → start application → link hand-off, with an optional existing-quote fetch. Shared behavior, error models, business rules, and knockouts are the same; treat the IB Term sections as the reference and read the differences below as an overlay.
|
|
1665
|
+
|
|
1666
|
+
**Product differences from IB Term:**
|
|
1667
|
+
|
|
1668
|
+
| Topic | IB Term | Pure Term |
|
|
1669
|
+
|---|---|---|
|
|
1670
|
+
| `benefitPeriod` | 10 / 20 / 30 | 10 / **15** / 20 / 30 |
|
|
1671
|
+
| `rateClass` | Preferred Plus, Preferred, Standard, Standard Extra (`RateClass`) | The same four **plus Rated C and Rated D** (`PureTermRateClass`) |
|
|
1672
|
+
| Living benefits | Included | **Not offered** |
|
|
1673
|
+
| Identity checks | Quote / opportunity must be IB Term | Quote / opportunity must be Pure Term |
|
|
1674
|
+
|
|
1675
|
+
Coverage and benefit-period availability tables are Pure-Term-specific — see [Get Quote](#pure-term--get-quote).
|
|
1647
1676
|
|
|
1648
1677
|
---
|
|
1649
1678
|
|
|
1650
1679
|
## Integration flow
|
|
1651
1680
|
|
|
1652
1681
|
```
|
|
1653
|
-
1. [`
|
|
1654
|
-
|
|
1655
|
-
|
|
1682
|
+
1. [`getPureTermRiderDetails()`](#pure-term--rider-lookup) (optional) Rider availability + codes
|
|
1683
|
+
└── flagProductNotAvailableForState = true → STOP (not sold in this state)
|
|
1684
|
+
2. [`getPureTermQuote()`](#pure-term--get-quote) Get quote → quoteResponseId
|
|
1685
|
+
3. [`startPureTermApplication()`](#pure-term--start-application) Start app → opportunityId + links
|
|
1686
|
+
├── isDeclined = true → STOP (knockout)
|
|
1656
1687
|
└── isQuoteChanged = true → re-present updated premium, then hand off via links
|
|
1657
1688
|
|
|
1689
|
+
[`getPureTermExistingQuote()`](#pure-term--get-existing-quote) (optional) Re-fetch the stored quote
|
|
1690
|
+
|
|
1658
1691
|
→ Direct agent or applicant to agentLink / applicantLink / eAppAgentLink
|
|
1659
1692
|
All remaining steps complete inside the InstaBrain frontend.
|
|
1660
|
-
|
|
1693
|
+
```
|
|
1694
|
+
|
|
1695
|
+
---
|
|
1696
|
+
|
|
1697
|
+
## Pure Term — Rider Lookup
|
|
1698
|
+
|
|
1699
|
+
**Method:** `client.getPureTermRiderDetails(stateCode, age, flagNicotineUse)` · **Returns:** `PureTermRiderDetailsResp`
|
|
1700
|
+
|
|
1701
|
+
Optional pre-quote step. Filters the available Pure Term riders by state, age, and nicotine use so you can present the correct choices before quoting.
|
|
1702
|
+
|
|
1703
|
+
|
|
1704
|
+
***
|
|
1705
|
+
|
|
1706
|
+
### Request Fields
|
|
1707
|
+
|
|
1708
|
+
All three are sent as query-string parameters.
|
|
1709
|
+
|
|
1710
|
+
| Parameter | Type | Required | Description |
|
|
1711
|
+
|---|---|---|---|
|
|
1712
|
+
| `stateCode` | `string` | Yes | 2-letter US state code (e.g. `"TX"`) |
|
|
1713
|
+
| `age` | `number` | Yes | Integer, 18–60 inclusive |
|
|
1714
|
+
| `flagNicotineUse` | `boolean` | Yes | Must be sent explicitly as `true` or `false` — not optional |
|
|
1715
|
+
|
|
1716
|
+
|
|
1717
|
+
***
|
|
1718
|
+
|
|
1719
|
+
### Business Rules
|
|
1720
|
+
|
|
1721
|
+
1. `flagProductNotAvailableForState: true` with an empty `riders` array is a **valid `200` response**, not an error — the SDK returns it as-is and does not throw. Pure Term is not sold in every state (e.g. WY, NY).
|
|
1722
|
+
2. Use `riderCode` from the response as `riders[n].rider` in the Pure Term quote request.
|
|
1723
|
+
3. Backend validation failures (invalid state, age out of range) surface through the SDK error model as usual.
|
|
1724
|
+
|
|
1725
|
+
|
|
1726
|
+
***
|
|
1727
|
+
|
|
1728
|
+
### Response
|
|
1729
|
+
|
|
1730
|
+
| Field | Type | Description |
|
|
1731
|
+
|---|---|---|
|
|
1732
|
+
| `flagProductNotAvailableForState` | `boolean` | `true` = product unavailable for this state/age/nicotine combination; `riders` is empty |
|
|
1733
|
+
| `riders` | `PureTermRider[]` | Available rider options |
|
|
1734
|
+
| `riders[].riderCode` | `string` | Pass as `riders[n].rider` on the quote |
|
|
1735
|
+
| `riders[].riderTitle` | `string` | Display title |
|
|
1736
|
+
| `riders[].riderDescription` | `string` | Display description |
|
|
1737
|
+
|
|
1738
|
+
|
|
1739
|
+
***
|
|
1740
|
+
|
|
1741
|
+
### Example
|
|
1742
|
+
|
|
1743
|
+
```typescript
|
|
1744
|
+
const riderInfo = await client.getPureTermRiderDetails('TX', 35, false);
|
|
1745
|
+
|
|
1746
|
+
if (riderInfo.flagProductNotAvailableForState) {
|
|
1747
|
+
// Pure Term is not sold for this state/age/nicotine combination — stop here.
|
|
1748
|
+
return;
|
|
1749
|
+
}
|
|
1750
|
+
|
|
1751
|
+
for (const rider of riderInfo.riders) {
|
|
1752
|
+
console.log(rider.riderCode, '—', rider.riderTitle);
|
|
1753
|
+
}
|
|
1661
1754
|
```
|
|
1662
1755
|
|
|
1663
1756
|
---
|
|
@@ -1671,16 +1764,16 @@ This is a **pre-fill flow**: use `getPureTermQuote()` then `startApplication()`,
|
|
|
1671
1764
|
|
|
1672
1765
|
### Request Fields
|
|
1673
1766
|
|
|
1674
|
-
Provide
|
|
1767
|
+
Provide at least one rating group (†) and one age input (‡).
|
|
1675
1768
|
|
|
1676
1769
|
| Field | Type | Required | Description | Validation Error |
|
|
1677
1770
|
|---|---|---|---|---|
|
|
1678
|
-
| `faceAmount` | `number` | Yes | Coverage amount — age-based limits apply | `Coverage amount (FaceAmount) is required.` |
|
|
1679
|
-
| `benefitPeriod` | `number` | Yes | Term: 10, 20, or 30 years (state/age/tobacco dependent) | `Benefit period is required.` |
|
|
1771
|
+
| `faceAmount` | `number` | Yes | Coverage amount — age-based limits apply (see below) | `Coverage amount (FaceAmount) is required.` |
|
|
1772
|
+
| `benefitPeriod` | `number` | Yes | Term: 10, 15, 20, or 30 years (state/age/tobacco dependent) | `Benefit period is required.` |
|
|
1680
1773
|
| `flagTobaccoUse` | `boolean` | No | Defaults to `false` when omitted | — |
|
|
1681
1774
|
| `gender` | `Gender` | Yes | `Gender.Male`, `Gender.Female` | `Gender is required.` / `Invalid gender.` |
|
|
1682
|
-
| `stateCode` | `string` | Yes | 2-letter US state code | `State code is required.` / `State code is not valid.` / `This product is not available for the selected state.` |
|
|
1683
|
-
| `rateClass` | `
|
|
1775
|
+
| `stateCode` | `string` | Yes | 2-letter US state code. Send `stateCode` only — do **not** send `zipCode` | `State code is required.` / `State code is not valid.` / `This product is not available for the selected state.` |
|
|
1776
|
+
| `rateClass` | `PureTermRateClass` | One of † | `"Preferred Plus"`, `"Preferred"`, `"Standard"`, `"Standard Extra"`, `"Rated C"`, `"Rated D"` | `Either RateClass, HealthClass, or Height and WeightInLbs must be provided.` / `Rate class is invalid. Allowed values: Preferred Plus, Preferred, Standard, Standard Extra, Rated C, Rated D.` |
|
|
1684
1777
|
| `healthClass` | `HealthClass` | One of † | `"excellent"`, `"great"`, `"good"`, `"average"` (case-insensitive) | `Health class is invalid.` |
|
|
1685
1778
|
| `height` | `ThirdPartyQuoteReqHeight \| null` | One of † | `feet` (1–8), `inches` (0–11) — required with `weightInLbs` | `Height or weight is invalid.` |
|
|
1686
1779
|
| `weightInLbs` | `number \| null` | One of † | Paired with `height` | — |
|
|
@@ -1693,24 +1786,87 @@ Provide exactly one rating group (†) and exactly one age input (‡).
|
|
|
1693
1786
|
| `email` | `string` | No | Lead capture | `Please enter a valid email address.` |
|
|
1694
1787
|
| `phoneNum` | `string` | No | 10 digits or E.164 — lead capture | `Phone number format is incorrect.` |
|
|
1695
1788
|
|
|
1696
|
-
> **†** Supply
|
|
1789
|
+
> **†** Supply **at least one** rating group: `rateClass`, `healthClass`, or both `height` and `weightInLbs`. Sending more than one is accepted — the requirement is that at least one is present.
|
|
1697
1790
|
> **‡** Provide `age` OR `dateOfBirth`. When both are sent, `dateOfBirth` takes priority.
|
|
1698
1791
|
|
|
1792
|
+
**Coverage limits by age** — `faceAmount` outside these ranges returns `CoverageNotAvailable`:
|
|
1793
|
+
|
|
1794
|
+
| Age | Allowed `faceAmount` |
|
|
1795
|
+
|---|---|
|
|
1796
|
+
| Up to 55 | $50,000 – $1,000,000 |
|
|
1797
|
+
| 56 | up to $900,000 |
|
|
1798
|
+
| 57 | up to $800,000 |
|
|
1799
|
+
| 58 | up to $700,000 |
|
|
1800
|
+
| 59 | up to $600,000 |
|
|
1801
|
+
| 60 | up to $500,000 |
|
|
1802
|
+
|
|
1803
|
+
**Benefit periods by age and nicotine use** — other values return `BenefitPeriodNotAvailable`:
|
|
1804
|
+
|
|
1805
|
+
| Age | Non-smoker | Smoker |
|
|
1806
|
+
|---|---|---|
|
|
1807
|
+
| 18–45 | 10, 15, 20, 30 | 10, 15, 20, 30 |
|
|
1808
|
+
| 46–50 | 10, 15, 20, 30 | 10, 15, 20 |
|
|
1809
|
+
| 51–60 | 10, 15, 20 | 10, 15, 20 |
|
|
1810
|
+
|
|
1811
|
+
> **15 is a Pure-Term-only term length.** IB Term offers 10 / 20 / 30 — do not reuse IB Term's benefit-period rules here.
|
|
1812
|
+
|
|
1813
|
+
|
|
1814
|
+
***
|
|
1815
|
+
|
|
1816
|
+
### Validation Rules
|
|
1817
|
+
|
|
1818
|
+
The server applies these in order. Only rules 9's two outcomes get dedicated top-level error codes; everything else surfaces as `InvalidRequestFormat` with PascalCase field keys under `value.fields` (at most one message per field).
|
|
1819
|
+
|
|
1820
|
+
1. `benefitPeriod` is required.
|
|
1821
|
+
2. `stateCode`, when present, must be a state where Pure Term is available.
|
|
1822
|
+
3. At least one of `rateClass`, `healthClass`, or (`height` **and** `weightInLbs`) must be provided.
|
|
1823
|
+
4. `rateClass`, when present, must be a valid **Pure Term** rate class — note Pure Term does **not** offer `Guaranteed`.
|
|
1824
|
+
5. `healthClass`, when present, must be valid (case-insensitive).
|
|
1825
|
+
6. `height` / `weightInLbs`, when present, must be a valid combination.
|
|
1826
|
+
7. Age — from `dateOfBirth` when present, else `age` — must be 18–60 inclusive.
|
|
1827
|
+
8. `riders`, when present, must be valid for Pure Term.
|
|
1828
|
+
9. When `stateCode` and (`age` or `dateOfBirth`) are present: `benefitPeriod` is checked against carrier availability (`BenefitPeriodNotAvailable`) and `faceAmount` against coverage rules (`CoverageNotAvailable`).
|
|
1829
|
+
|
|
1699
1830
|
|
|
1700
1831
|
***
|
|
1701
1832
|
|
|
1702
1833
|
### Error Codes
|
|
1703
1834
|
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
|
1707
|
-
|
|
1708
|
-
| `
|
|
1709
|
-
| `
|
|
1710
|
-
| `
|
|
1711
|
-
| `
|
|
1712
|
-
| `
|
|
1713
|
-
| `
|
|
1835
|
+
`getPureTermQuote()` throws `APIValidationError` when the server returns `flagStatus: false`. The code set matches [IB Term](#ib-term--get-quote):
|
|
1836
|
+
|
|
1837
|
+
| Code | `err.response.value` | When |
|
|
1838
|
+
|---|---|---|
|
|
1839
|
+
| `InvalidRequestFormat` | `fields` object present | Any field validation failure |
|
|
1840
|
+
| `StateNotFound` | `null` | State code not recognized |
|
|
1841
|
+
| `AgeNotFound` | `null` | Neither age nor date of birth supplied, or age could not be derived |
|
|
1842
|
+
| `BenefitPeriodNotAvailable` | `fields` object present | `benefitPeriod` not allowed for state/age/nicotine |
|
|
1843
|
+
| `CoverageNotAvailable` | `fields` object present | `faceAmount` out of range for state/age/nicotine |
|
|
1844
|
+
| `NotAvailableForState` | `null` | Product not available in this state |
|
|
1845
|
+
| `QuoteNotEligibleForGivenConditions` | `null` | State/age/nicotine combination not eligible |
|
|
1846
|
+
| `OutsideBuildChart` | `null` | Height/weight outside carrier build chart |
|
|
1847
|
+
| `RiderNotAvailable` | `null` | Rider not available for this product/state |
|
|
1848
|
+
| `RiderFaceAmountNotValid` | `null` | Rider face amount outside allowed range |
|
|
1849
|
+
|
|
1850
|
+
> **Two stages produce these.** Request validation issues dedicated top-level codes only for `BenefitPeriodNotAvailable` and `CoverageNotAvailable` — everything else at that stage, **including an invalid rate class**, arrives as `InvalidRequestFormat` with a PascalCase key under `value.fields`. Once validation passes, the request still runs through the shared quote-eligibility pipeline, which can return `NotAvailableForState`, `QuoteNotEligibleForGivenConditions`, `RiderNotAvailable`, `RiderFaceAmountNotValid`, or `OutsideBuildChart`. Do not assume those never occur for Pure Term.
|
|
1851
|
+
|
|
1852
|
+
```typescript
|
|
1853
|
+
import { APIValidationError, APIErrorCode } from '@instabrain-sdks/api-client';
|
|
1854
|
+
|
|
1855
|
+
try {
|
|
1856
|
+
await client.getPureTermQuote(request);
|
|
1857
|
+
} catch (err) {
|
|
1858
|
+
if (err instanceof APIValidationError) {
|
|
1859
|
+
if (err.isErrorType(APIErrorCode.BenefitPeriodNotAvailable)) {
|
|
1860
|
+
// Offer a different term length for this age / state / nicotine combination
|
|
1861
|
+
} else if (err.isErrorType(APIErrorCode.CoverageNotAvailable)) {
|
|
1862
|
+
// Offer a face amount inside the age band
|
|
1863
|
+
} else {
|
|
1864
|
+
// InvalidRequestFormat — per-field messages
|
|
1865
|
+
console.log(err.response?.value?.fields);
|
|
1866
|
+
}
|
|
1867
|
+
}
|
|
1868
|
+
}
|
|
1869
|
+
```
|
|
1714
1870
|
|
|
1715
1871
|
|
|
1716
1872
|
***
|
|
@@ -1719,12 +1875,16 @@ Provide exactly one rating group (†) and exactly one age input (‡).
|
|
|
1719
1875
|
|
|
1720
1876
|
| Field | Type | Description |
|
|
1721
1877
|
|---|---|---|
|
|
1722
|
-
| `productName` | `string` | `"
|
|
1723
|
-
| `selectedQuote.quoteResponseId` | `string` | Pass as `quoteResponseId` in `
|
|
1878
|
+
| `productName` | `string` | `"InstaBrain Pure Term"` |
|
|
1879
|
+
| `selectedQuote.quoteResponseId` | `string` | Pass as `quoteResponseId` in `startPureTermApplication()` |
|
|
1724
1880
|
| `selectedQuote.quoteAmount` | `number` | Premium at requested payment frequency |
|
|
1881
|
+
| `selectedQuote.premiumSaveWhenSelectingAnnual` | `number \| null` | Annual-billing savings vs monthly; `null` when already `Annually` |
|
|
1882
|
+
| `selectedQuote.maxQuoteAmount` | `number \| null` | Upper premium bound for the quoted profile |
|
|
1883
|
+
| `selectedQuote.minQuoteAmount` | `number \| null` | Lower premium bound for the quoted profile |
|
|
1725
1884
|
| `selectedQuote.faceAmount` | `number` | Coverage amount |
|
|
1726
1885
|
| `selectedQuote.benefitPeriod` | `number \| null` | Term length in years |
|
|
1727
1886
|
| `selectedQuote.paymentFrequency` | `string \| null` | `"Monthly"` or `"Annually"` |
|
|
1887
|
+
| `selectedQuote.selectedRiders` | `object[]` | Riders on the quote — `rider`, `riderFaceAmount`, `riderQuoteAmount`. Subtract every `riderQuoteAmount` from `quoteAmount` to derive the base premium |
|
|
1728
1888
|
|
|
1729
1889
|
|
|
1730
1890
|
***
|
|
@@ -1750,12 +1910,60 @@ const { quoteResponseId, quoteAmount } = quoteResp.selectedQuote;
|
|
|
1750
1910
|
|
|
1751
1911
|
---
|
|
1752
1912
|
|
|
1913
|
+
## Pure Term — Get Existing Quote
|
|
1914
|
+
|
|
1915
|
+
**Method:** `client.getPureTermExistingQuote(opportunityId)` · **Returns:** `ThirdPartyQuoteResp`
|
|
1916
|
+
|
|
1917
|
+
Re-fetches a previously generated Pure Term quote by its opportunity ID, without re-quoting. Use it to resume or review an in-flight opportunity — for example when `isQuoteChanged` came back `true` from start application.
|
|
1918
|
+
|
|
1919
|
+
|
|
1920
|
+
***
|
|
1921
|
+
|
|
1922
|
+
### Request Fields
|
|
1923
|
+
|
|
1924
|
+
| Parameter | Type | Required | Description |
|
|
1925
|
+
|---|---|---|---|
|
|
1926
|
+
| `opportunityId` | `string` | Yes | Valid UUID, passed as a **query-string** parameter (not a body field) |
|
|
1927
|
+
|
|
1928
|
+
|
|
1929
|
+
***
|
|
1930
|
+
|
|
1931
|
+
### Business Rules
|
|
1932
|
+
|
|
1933
|
+
1. The response reuses the same shape as `getPureTermQuote()` — `productName` is `"InstaBrain Pure Term"`.
|
|
1934
|
+
2. Unlike rider-lookup product-unavailability, a not-found result here **is** an error and is thrown through the SDK error model — it is not a valid business state.
|
|
1935
|
+
|
|
1936
|
+
|
|
1937
|
+
***
|
|
1938
|
+
|
|
1939
|
+
### Error Codes
|
|
1940
|
+
|
|
1941
|
+
| Code | When |
|
|
1942
|
+
|---|---|
|
|
1943
|
+
| `InvalidRequestFormat` | Missing, empty, or non-GUID `opportunityId` (`OpportunityId is required.` / `OpportunityId does not exist.`), or the opportunity belongs to another product (`OpportunityId does not match selected product.`) |
|
|
1944
|
+
| `QuoteNotFound` | The opportunity exists but has no stored quote (top-level, `value: null`) |
|
|
1945
|
+
|
|
1946
|
+
> A valid but unauthorized `opportunityId` returns HTTP `403`.
|
|
1947
|
+
|
|
1948
|
+
|
|
1949
|
+
***
|
|
1950
|
+
|
|
1951
|
+
### Example
|
|
1952
|
+
|
|
1953
|
+
```typescript
|
|
1954
|
+
const existing = await client.getPureTermExistingQuote(opportunityId);
|
|
1955
|
+
console.log(existing.selectedQuote.quoteAmount, existing.selectedQuote.benefitPeriod);
|
|
1956
|
+
```
|
|
1957
|
+
|
|
1958
|
+
---
|
|
1959
|
+
|
|
1753
1960
|
## Pure Term — Start Application
|
|
1754
1961
|
|
|
1755
|
-
**Method:** `client.
|
|
1962
|
+
**Method:** `client.startPureTermApplication(request)` · **Type:** `PureTermStartApplicationReq`
|
|
1756
1963
|
|
|
1964
|
+
A **dedicated** Pure Term endpoint. This is separate from the generic `client.startApplication()`, which is unchanged and still serves other products — do not substitute one for the other.
|
|
1757
1965
|
|
|
1758
|
-
|
|
1966
|
+
The backend shares one request contract between IB Term and Pure Term start-application: same fields, same nesting, same optionality, same validation messages. `PureTermStartApplicationReq` is therefore the same structure as `IBTermStartApplicationReq`, and the full field-by-field tables in [IB Term — Start Application](#ib-term--start-application) apply here unchanged. Only the differences are listed below.
|
|
1759
1967
|
|
|
1760
1968
|
|
|
1761
1969
|
***
|
|
@@ -1764,12 +1972,10 @@ This is the **generic** start-application endpoint shared across products that u
|
|
|
1764
1972
|
|
|
1765
1973
|
| Field | Type | Required | Description |
|
|
1766
1974
|
|---|---|---|---|
|
|
1767
|
-
| `quoteResponseId` | `string` | Yes | UUID from `getPureTermQuote()` |
|
|
1768
|
-
|
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
| `phoneNumber` | `string \| null` | Yes | Applicant phone number — 10-digit local or E.164 |
|
|
1772
|
-
| `proCode` | `string \| null` | No | Product variant code. When omitted the base product is started. Contact InstaBrain support for the correct code if a specific variant is required. |
|
|
1975
|
+
| `quoteResponseId` | `string` | Yes | UUID from `getPureTermQuote()` — must belong to the **Pure Term** product |
|
|
1976
|
+
| *(all other fields)* | — | — | Identical to [IB Term — Start Application](#ib-term--start-application) |
|
|
1977
|
+
|
|
1978
|
+
> `proCode` does **not** apply here — it belongs to the generic `startApplication()` only.
|
|
1773
1979
|
|
|
1774
1980
|
|
|
1775
1981
|
***
|
|
@@ -1777,14 +1983,43 @@ This is the **generic** start-application endpoint shared across products that u
|
|
|
1777
1983
|
### Business Rules
|
|
1778
1984
|
|
|
1779
1985
|
1. `isDeclined: true` is a valid success response (knockout) — the SDK does **not** throw.
|
|
1780
|
-
2. When `isQuoteChanged = true`, the carrier adjusted the premium. Re-present the
|
|
1986
|
+
2. When `isQuoteChanged = true`, the carrier adjusted the premium. Re-present it before directing the applicant to the link, or call `getPureTermExistingQuote()` to read the updated quote.
|
|
1987
|
+
3. `quoteResponseId` must belong to Pure Term, otherwise: `QuoteResponseId does not exist or does not belong to the requested product.`
|
|
1988
|
+
4. `address.state` (when sent) must match the quote state — a mismatch returns `StateMismatchIdentified`.
|
|
1989
|
+
5. `childRiderInfo` is required **only** when the Dependent Child Rider was selected on the originating quote, and must **not** be sent otherwise — sending it without the rider fails with `Child rider was not included in the quote. Cannot add child rider details.`
|
|
1990
|
+
6. `tobaccoNicotineUsage.cigarUsagePerYear` is required only when `productTypesUsed` is **exactly** `['cigars']`. When cigars are selected alongside other product types it is not required.
|
|
1991
|
+
7. `physicianDetails.stateCode` rejects both `"Outside Of The USA"` and `"OutsideUSA"`.
|
|
1992
|
+
8. Pure Term does **not** run the `ApplicationLimitReached` duplicate SSN/email/phone check (that applies to GIGDB, ADB, and Final Expense).
|
|
1993
|
+
9. Validation returns at most one message per field; `value.fields` keys are PascalCase and may be nested (e.g. `ChildRiderInfo.IsAnyChildTakingMedication`).
|
|
1781
1994
|
|
|
1782
1995
|
|
|
1783
1996
|
***
|
|
1784
1997
|
|
|
1785
1998
|
### Knockout Rules
|
|
1786
1999
|
|
|
1787
|
-
|
|
2000
|
+
Any of the following returns HTTP `200` with `isDeclined: true` — the SDK does **not** throw. Check the field explicitly.
|
|
2001
|
+
|
|
2002
|
+
- `isUsCitizenOrIsPermanentResident = false`
|
|
2003
|
+
- `isPayerAlsoOwnerAndInsured = false`
|
|
2004
|
+
- `isHoldingValidDriverLicense = false`
|
|
2005
|
+
- `areListedConditionsNotApplicable = false`
|
|
2006
|
+
- Any of the four `childRiderInfo` knockout questions = `true`
|
|
2007
|
+
- Height / weight outside the carrier's allowed limits
|
|
2008
|
+
|
|
2009
|
+
|
|
2010
|
+
***
|
|
2011
|
+
|
|
2012
|
+
### Error Codes
|
|
2013
|
+
|
|
2014
|
+
Start Application is one shared service across both Term products, so the code set matches [IB Term](#ib-term--start-application). Business failures return HTTP `400` with `value: null`.
|
|
2015
|
+
|
|
2016
|
+
| Code | `err.response.value` | When |
|
|
2017
|
+
|---|---|---|
|
|
2018
|
+
| `InvalidRequestFormat` | `fields` object present | Any field validation failure |
|
|
2019
|
+
| `StateMismatchIdentified` | `null` | Quote state ≠ `address.state` |
|
|
2020
|
+
| `AgentNotFound` | `null` | Quote cannot be linked to the agent account — verify credentials |
|
|
2021
|
+
| `DataNotFound` | `null` | The quote response could not be found for the supplied `quoteResponseId` |
|
|
2022
|
+
| `InternalServerError` | `null` | Unexpected backend failure — retry; contact support if persistent |
|
|
1788
2023
|
|
|
1789
2024
|
|
|
1790
2025
|
***
|
|
@@ -1793,14 +2028,14 @@ Returns `isDeclined: true` on a successful response — the SDK does **not** thr
|
|
|
1793
2028
|
|
|
1794
2029
|
| Field | Type | Description |
|
|
1795
2030
|
|---|---|---|
|
|
1796
|
-
| `opportunityId` | `string` | All-zero UUID when declined before opportunity creation |
|
|
2031
|
+
| `opportunityId` | `string` | All-zero UUID when declined before opportunity creation — never `null` |
|
|
1797
2032
|
| `isDeclined` | `boolean` | `true` = knockout; stop the flow |
|
|
1798
2033
|
| `isQuoteChanged` | `boolean` | `true` = carrier adjusted premium; re-present before handoff |
|
|
1799
2034
|
| `agentLink` | `string \| null` | Agent Conversational UI |
|
|
1800
2035
|
| `applicantLink` | `string \| null` | Applicant Conversational UI |
|
|
1801
2036
|
| `eAppAgentLink` | `string \| null` | Agent E-App |
|
|
1802
2037
|
|
|
1803
|
-
> After a non-declined response, direct the agent or applicant to the appropriate link. All remaining steps (underwriting, payment, signing) complete inside the InstaBrain frontend.
|
|
2038
|
+
> After a non-declined response, direct the agent or applicant to the appropriate link. All remaining steps (underwriting, payment, signing) complete inside the InstaBrain frontend. Do not pass this `opportunityId` to `finalSubmit()`, the SecureSign methods, or the credit-card iframe.
|
|
1804
2039
|
|
|
1805
2040
|
|
|
1806
2041
|
***
|
|
@@ -1808,19 +2043,55 @@ Returns `isDeclined: true` on a successful response — the SDK does **not** thr
|
|
|
1808
2043
|
### Example
|
|
1809
2044
|
|
|
1810
2045
|
```typescript
|
|
1811
|
-
|
|
2046
|
+
import {
|
|
2047
|
+
Gender,
|
|
2048
|
+
BeneficiaryType,
|
|
2049
|
+
BeneficiaryRelationship,
|
|
2050
|
+
TobaccoNicotineLastUsedPeriod
|
|
2051
|
+
} from '@instabrain-sdks/api-client';
|
|
2052
|
+
|
|
2053
|
+
const appResp = await client.startPureTermApplication({
|
|
1812
2054
|
quoteResponseId,
|
|
1813
2055
|
firstName: 'Jane',
|
|
1814
2056
|
lastName: 'Doe',
|
|
1815
2057
|
email: 'jane.doe@example.com',
|
|
1816
2058
|
phoneNumber: '5551234567',
|
|
1817
|
-
|
|
2059
|
+
isUsCitizenOrIsPermanentResident: true,
|
|
2060
|
+
isPayerAlsoOwnerAndInsured: true,
|
|
2061
|
+
dateOfBirth: '1989-03-15',
|
|
2062
|
+
socialSecurityNumber: '123456789',
|
|
2063
|
+
address: { addressLine1: '123 Main St', city: 'Austin', state: 'TX', zipcode: '78701' },
|
|
2064
|
+
birthJurisdiction: { country: 'US', state: 'TX' },
|
|
2065
|
+
height: { feet: 5, inches: 6 },
|
|
2066
|
+
weight: 140,
|
|
2067
|
+
isHoldingValidDriverLicense: true,
|
|
2068
|
+
driverLicenseState: 'TX',
|
|
2069
|
+
driverLicenseNumber: 'D12345678',
|
|
2070
|
+
hasPrimaryCarePhysician: false,
|
|
2071
|
+
physicianDetails: null,
|
|
2072
|
+
tobaccoNicotineUsage: {
|
|
2073
|
+
lastUsedPeriod: TobaccoNicotineLastUsedPeriod.Never,
|
|
2074
|
+
lastTimeUsed: null,
|
|
2075
|
+
productTypesUsed: null
|
|
2076
|
+
},
|
|
2077
|
+
areListedConditionsNotApplicable: true,
|
|
2078
|
+
hasExistingCoverage: false,
|
|
2079
|
+
beneficiaryDetails: {
|
|
2080
|
+
beneficiaryType: BeneficiaryType.Person,
|
|
2081
|
+
beneficiaryPerson: {
|
|
2082
|
+
firstName: 'John',
|
|
2083
|
+
lastName: 'Doe',
|
|
2084
|
+
relationship: BeneficiaryRelationship.Spouse
|
|
2085
|
+
}
|
|
2086
|
+
}
|
|
2087
|
+
// childRiderInfo — send ONLY when the Dependent Child Rider is on the quote
|
|
1818
2088
|
});
|
|
1819
2089
|
|
|
1820
2090
|
if (appResp.isDeclined) {
|
|
1821
2091
|
return;
|
|
1822
2092
|
}
|
|
1823
2093
|
if (appResp.isQuoteChanged) {
|
|
2094
|
+
const updated = await client.getPureTermExistingQuote(appResp.opportunityId);
|
|
1824
2095
|
// Re-present updated premium before directing to link
|
|
1825
2096
|
}
|
|
1826
2097
|
// Hand off to InstaBrain frontend
|
|
@@ -1829,9 +2100,693 @@ console.log('Applicant link:', appResp.applicantLink);
|
|
|
1829
2100
|
|
|
1830
2101
|
---
|
|
1831
2102
|
|
|
1832
|
-
##
|
|
2103
|
+
## Final Expense
|
|
2104
|
+
|
|
2105
|
+
**InstaBrain Final Expense** — simplified-issue whole life product for end-of-life expenses.
|
|
1833
2106
|
|
|
1834
|
-
|
|
2107
|
+
This is a **full-flow product** like GIGDB and ADB: quote → start application → EFT payment → Secure Sign → final submit. The one difference is **asynchronous underwriting** — `finalSubmit()` returns `applicationStatus: 'InProgress'` (not an immediate `policyNumber`), and you poll `pollFinalExpenseUnderwritingStatus()` for the carrier decision.
|
|
2108
|
+
|
|
2109
|
+
- **Eligible ages:** 50–85
|
|
2110
|
+
- **Coverage:** $5,000–$50,000
|
|
2111
|
+
- **Tobacco:** uses `flagTobaccoUse` + `nicotineInfo` — **not** GIGDB's `isSmoker`
|
|
2112
|
+
- **Dedicated controller:** start application posts to `ThirdPartyFinalExpenseApplication` (not the generic `ThirdPartyStartApp`)
|
|
2113
|
+
|
|
2114
|
+
---
|
|
2115
|
+
|
|
2116
|
+
## Integration flow
|
|
2117
|
+
|
|
2118
|
+
```
|
|
2119
|
+
1. getFinalExpenseQuote() Get quote → quoteResponseId
|
|
2120
|
+
2. startFinalExpenseApplication() Start app → opportunityId
|
|
2121
|
+
└── isDeclined = true → STOP (knockout)
|
|
2122
|
+
3. saveEftPayment() Save bank details (shared method)
|
|
2123
|
+
4. Secure Sign flow prepareDocs → sendPin → verifyPin (shared)
|
|
2124
|
+
5. finalSubmit() → applicationStatus: 'InProgress' (async!)
|
|
2125
|
+
6. pollFinalExpenseUnderwritingStatus() Poll until terminal status
|
|
2126
|
+
├── Approved → policyNumber populated
|
|
2127
|
+
├── NotEligible / UnableToOffer / Closed / Abandoned / TimedOut → declined/closed
|
|
2128
|
+
└── (timeout) → resume manually with pingFinalExpenseUnderwritingStatus()
|
|
2129
|
+
```
|
|
2130
|
+
|
|
2131
|
+
Optional: `getFinalExpenseExistingQuote(opportunityId)` to re-fetch a quote, and `updateFinalExpenseQuote()` to change `faceAmount` / `paymentFreq` before payment.
|
|
2132
|
+
|
|
2133
|
+
---
|
|
2134
|
+
|
|
2135
|
+
## Final Expense — Get Quote
|
|
2136
|
+
|
|
2137
|
+
**Method:** `client.getFinalExpenseQuote(request)` · **Type:** `ThirdPartyFinalExpenseQuoteReq`
|
|
2138
|
+
|
|
2139
|
+
The response `selectedQuote.quoteResponseId` is the token for `startFinalExpenseApplication()`.
|
|
2140
|
+
|
|
2141
|
+
***
|
|
2142
|
+
|
|
2143
|
+
### Request Fields
|
|
2144
|
+
|
|
2145
|
+
| Field | Type | Required | Description | Validation Error |
|
|
2146
|
+
|---|---|---|---|---|
|
|
2147
|
+
| `faceAmount` | `number` | Yes | Coverage amount ($5,000–$50,000) | `Coverage amount (FaceAmount) is required.` |
|
|
2148
|
+
| `gender` | `Gender` | Yes | `Gender.Male`, `Gender.Female` | `Gender is required.` / `Invalid gender.` |
|
|
2149
|
+
| `stateCode` | `string` | Yes | 2-letter US state code; product must be available there | `State code is required.` / `State code is not valid.` / `This product is not available for the selected state.` |
|
|
2150
|
+
| `age` | `number` | Yes‡ | 50–85 | `Either age or date of birth must be provided.` / `Age must be between 50 and 85.` |
|
|
2151
|
+
| `dateOfBirth` | `string` (ISO 8601) | Yes‡ | Wins over `age` when both provided; derived age 50–85 | `Date of birth must be a valid date.` |
|
|
2152
|
+
| `paymentFreq` | `PaymentFrequency` | Yes | `"Monthly"` or `"Annually"` | `Payment frequency is required.` / `Invalid payment frequency.` |
|
|
2153
|
+
| `flagTobaccoUse` | `boolean` | Yes | Affects premium | `Nicotine use status is required.` |
|
|
2154
|
+
| `height` | `ThirdPartyQuoteReqHeight \| null` | No | `feet` (1–8), `inches` (0–11) — used for underwriting when provided | `Height is invalid.` |
|
|
2155
|
+
| `weightInLbs` | `number \| null` | No | Independent of `height` | — |
|
|
2156
|
+
| `firstName` | `string` | No | Alphabetic only — lead capture | `First name is invalid. Only alphabetic characters are allowed.` |
|
|
2157
|
+
| `lastName` | `string` | No | Alphabetic only — lead capture | `Last name is invalid. Only alphabetic characters are allowed.` |
|
|
2158
|
+
| `email` | `string` | No | Lead capture | `Please enter a valid email address.` |
|
|
2159
|
+
| `phoneNum` | `string` | No | 10 digits or E.164 — lead capture | `Phone number format is incorrect. Use 10 digits or +1XXXXXXXXXX.` / `Phone number is invalid.` |
|
|
2160
|
+
|
|
2161
|
+
> **‡** Provide `age` OR `dateOfBirth`. When both are sent, `dateOfBirth` takes priority.
|
|
2162
|
+
|
|
2163
|
+
***
|
|
2164
|
+
|
|
2165
|
+
### Response
|
|
2166
|
+
|
|
2167
|
+
| Field | Type | Description |
|
|
2168
|
+
|---|---|---|
|
|
2169
|
+
| `productName` | `string \| null` | `"InstaFinalExpense"` |
|
|
2170
|
+
| `selectedQuote.quoteResponseId` | `string` | **Pass as `quoteResponseId` in start application** |
|
|
2171
|
+
| `selectedQuote.quoteAmount` | `number \| null` | Premium at the requested frequency |
|
|
2172
|
+
| `selectedQuote.premiumSaveWhenSelectingAnnual` | `number \| null` | Annual savings vs monthly; `null` when `Annually` |
|
|
2173
|
+
| `selectedQuote.maxQuoteAmount` / `minQuoteAmount` | `number \| null` | Premium bounds |
|
|
2174
|
+
| `selectedQuote.faceAmount` | `number` | Coverage amount from request |
|
|
2175
|
+
| `selectedQuote.paymentFrequency` | `'Monthly' \| 'Annually' \| null` | Payment frequency |
|
|
2176
|
+
|
|
2177
|
+
***
|
|
2178
|
+
|
|
2179
|
+
### Example
|
|
2180
|
+
|
|
2181
|
+
```typescript
|
|
2182
|
+
import { Gender, PaymentFrequency } from '@instabrain-sdks/api-client';
|
|
2183
|
+
|
|
2184
|
+
const quoteResp = await client.getFinalExpenseQuote({
|
|
2185
|
+
faceAmount: 15000,
|
|
2186
|
+
gender: Gender.Female,
|
|
2187
|
+
stateCode: 'TX',
|
|
2188
|
+
age: 65,
|
|
2189
|
+
paymentFreq: PaymentFrequency.Monthly,
|
|
2190
|
+
flagTobaccoUse: false,
|
|
2191
|
+
});
|
|
2192
|
+
|
|
2193
|
+
const { quoteResponseId } = quoteResp.selectedQuote;
|
|
2194
|
+
```
|
|
2195
|
+
|
|
2196
|
+
---
|
|
2197
|
+
|
|
2198
|
+
## Final Expense — Start Application
|
|
2199
|
+
|
|
2200
|
+
**Method:** `client.startFinalExpenseApplication(request)` · **Type:** `ThirdPartyFinalExpenseStartApplicationReq`
|
|
2201
|
+
|
|
2202
|
+
Uses the **dedicated** `ThirdPartyFinalExpenseApplication` controller. Runs pre-qualification health checks. Knockouts return HTTP 200 with `isDeclined: true` — they are **not** thrown.
|
|
2203
|
+
|
|
2204
|
+
***
|
|
2205
|
+
|
|
2206
|
+
### Top-Level Request Fields
|
|
2207
|
+
|
|
2208
|
+
| Field | Type | Required | Notes |
|
|
2209
|
+
|---|---|---|---|
|
|
2210
|
+
| `quoteResponseId` | `string` | Yes | From `getFinalExpenseQuote()`. Must belong to Final Expense |
|
|
2211
|
+
| `firstName` / `lastName` | `string` | Yes | Alphabetic only |
|
|
2212
|
+
| `email` | `string` | Yes | Valid email |
|
|
2213
|
+
| `phoneNumber` | `string` | Yes | 10-digit or `+1XXXXXXXXXX` |
|
|
2214
|
+
| `isUsCitizen` | `boolean` | Yes | — |
|
|
2215
|
+
| `isLegalUsResident` | `boolean \| null` | Cond. | Required when `isUsCitizen = false` |
|
|
2216
|
+
| `isPayerAlsoOwnerAndInsured` | `boolean` | Yes | `false` → **declined** |
|
|
2217
|
+
| `address` | `FinalExpenseAddress` | Yes | `state` must match the quote state |
|
|
2218
|
+
| `dateOfBirth` | `string` (YYYY-MM-DD) | Yes | Age 50–85 |
|
|
2219
|
+
| `socialSecurityNumber` | `string` | Yes | 9 digits |
|
|
2220
|
+
| `hasExistingCoverage` | `boolean` | Yes | Controls `existingCoverageData` |
|
|
2221
|
+
| `willOtherCoverageBeReplacedOrFinanced` | `boolean \| null` | Cond. | Required when `hasExistingCoverage = true`; must be `null` or `false` when false |
|
|
2222
|
+
| `willOtherCoverageBeReplacedOrFinancedData` | `object \| null` | Cond. | KS / WA replacement flows |
|
|
2223
|
+
| `existingCoverageData` | `object \| null` | Cond. | Required when `hasExistingCoverage = true`; `null` when false |
|
|
2224
|
+
| `beneficiaryDetails` | `FinalExpenseBeneficiaryDetails` | Yes | See allow-list below |
|
|
2225
|
+
| `height` | `ThirdPartyQuoteReqHeight` | Yes | `feet` 1–8, `inches` 0–11 |
|
|
2226
|
+
| `weight` | `number` | Yes | > 0 |
|
|
2227
|
+
| `isHoldingValidDriverLicense` | `boolean` | Yes | `false` → **declined** |
|
|
2228
|
+
| `birthJurisdiction` | `FinalExpenseBirthJurisdiction` | Yes | `country` + `state` (when US) |
|
|
2229
|
+
| `driverLicenseState` / `driverLicenseNumber` | `string \| null` | Cond. | Required when `isHoldingValidDriverLicense = true`; must be `null` when false |
|
|
2230
|
+
| `flagTobaccoUse` | `boolean` | Yes | Final Expense tobacco flag — **not** GIGDB `isSmoker` |
|
|
2231
|
+
| `nicotineInfo` | `object \| null` | Cond. | `{ lastUseDate: 'YYYY-MM' }`. Required when `flagTobaccoUse = true`; `null` when false |
|
|
2232
|
+
| `currentCareConditions` | `object` | Yes | 4 health booleans — see below |
|
|
2233
|
+
| `substanceUseAndMentalHealth` | `object` | Yes | 2 health booleans |
|
|
2234
|
+
| `testsAppointmentsAndLegalHistory` | `object` | Yes | 3 health booleans |
|
|
2235
|
+
| `heartStrokeOrganIssuesInPastTwoYears` | `object` | Yes | 4 health booleans |
|
|
2236
|
+
| `respiratoryDetails` | `RespiratoryDetails` | Yes | See respiratory rules below |
|
|
2237
|
+
| `includeSecondaryAddressee` | `boolean` | Yes | Controls `secondaryAddressee` |
|
|
2238
|
+
| `secondaryAddressee` | `FinalExpenseSecondaryAddressee \| null` | Cond. | Required when `includeSecondaryAddressee = true`; `null` when false — see sub-section below |
|
|
2239
|
+
|
|
2240
|
+
***
|
|
2241
|
+
|
|
2242
|
+
### Beneficiary allow-list
|
|
2243
|
+
|
|
2244
|
+
`beneficiaryDetails.beneficiaryType` (type `FinalExpenseBeneficiaryType`) accepts only: `Person`, `Insured Estate`, `All Children Of The Insured Equally`, `All Children Of The Marriage Equally`, `Trust`. Business / Corporation / Charitable Organization / Employer / Other are **rejected**.
|
|
2245
|
+
|
|
2246
|
+
When `beneficiaryType === 'Person'`, supply `beneficiaryPerson.relationship` (type `FinalExpenseRelationship`) — one of: Brother, Common Law Husband, Common Law Wife, Daughter, Domestic Partner, Father, Father Of Child, Fiance, Fiancee, Former Spouse, Granddaughter, Grandson, Husband, Life Partner, Mother, Mother Of Child, Sister, Son, Spouse, Wife. When `beneficiaryType === 'Trust'`, supply `namedEntity`.
|
|
2247
|
+
|
|
2248
|
+
***
|
|
2249
|
+
|
|
2250
|
+
### Health prequalification (knockout questions)
|
|
2251
|
+
|
|
2252
|
+
Every boolean below is **required**; setting any to `true` declines the application (`isDeclined: true`).
|
|
2253
|
+
|
|
2254
|
+
**Current Care & Serious Conditions** (`currentCareConditions`):
|
|
2255
|
+
- `isOnOxygenOrConfinedToFacility` — On oxygen, or confined to a nursing/assisted living facility?
|
|
2256
|
+
- `hasHospitalizationOrAdvisedAdmissionInPastSixMonths` — Hospitalized 2+ times, or advised to be admitted, in the past 6 months?
|
|
2257
|
+
- `hasLifeExpectancyTwentyFourMonthsOrLess` — Diagnosed with a life expectancy of 24 months or less?
|
|
2258
|
+
- `hasAidsArcOrHiv` — Ever diagnosed with AIDS, ARC, or tested positive for HIV?
|
|
2259
|
+
|
|
2260
|
+
**Substance Use & Mental Health** (`substanceUseAndMentalHealth`):
|
|
2261
|
+
- `hasReceivedDrugAlcoholAdviceInPastTwoYears` — Counseled/treated for illegal drugs, alcohol, or prescription drugs (last 2 years)?
|
|
2262
|
+
- `hasMentalDisorderHospitalizationInPastTwoYears` — Hospitalized for a mental disorder (last 2 years)?
|
|
2263
|
+
|
|
2264
|
+
**Tests, Appointments & Legal History** (`testsAppointmentsAndLegalHistory`):
|
|
2265
|
+
- `hasIncompleteMedicalAppointmentInPastTwoYears` — Advised of an incomplete medical appointment (last 2 years)?
|
|
2266
|
+
- `hasIncompleteMedicalTestInPastTwoYears` — Advised of an incomplete medical test, non-HIV (last 2 years)?
|
|
2267
|
+
- `hasFelonyOrDuiInPastFiveYears` — Convicted of a felony or DUI (last 5 years)?
|
|
2268
|
+
|
|
2269
|
+
**Heart, Stroke, Organ Issues** (`heartStrokeOrganIssuesInPastTwoYears`):
|
|
2270
|
+
- `hasHeartOrVascularConditionInPastTwoYears` — Heart attack, stroke, chest pain, TIA, myocarditis, or vascular disorder (last 2 years)?
|
|
2271
|
+
- `hasKidneyLiverOrganOrDiabeticComplicationsInPastTwoYears` — Kidney/liver disorder, organ transplant, or diabetic complications (last 2 years)?
|
|
2272
|
+
- `hasCognitiveOrNeurologicalConditionInPastTwoYears` — Alzheimer's, dementia, cognitive impairment, or ALS (last 2 years)?
|
|
2273
|
+
- `hasNonBasalCellCancerInPastTwoYears` — Cancer other than basal cell skin cancer (last 2 years)?
|
|
2274
|
+
|
|
2275
|
+
***
|
|
2276
|
+
|
|
2277
|
+
### Respiratory rules (`respiratoryDetails`)
|
|
2278
|
+
|
|
2279
|
+
`hasRespiratoryCondition` gates the block. When `true`, supply `conditions` (type `RespiratoryCondition[]`). Decline rules:
|
|
2280
|
+
|
|
2281
|
+
- Any `conditions` value **other than** `'sleep apnea'` declines (COPD, emphysema, ARDS, ventilator, other).
|
|
2282
|
+
- When only `'sleep apnea'` is selected, `isCurrentlyTreatedForSleepApnea` must be `true` or the applicant is declined.
|
|
2283
|
+
- `sleepApneaComorbidConditions` (type `SleepApneaComorbidCondition[]`) containing `'diabetes'` or `'heart attack/heart disease'` declines. `'hypertension'` alone does not.
|
|
2284
|
+
- `'none of the above'` cannot be combined with other values; all values must be unique.
|
|
2285
|
+
|
|
2286
|
+
***
|
|
2287
|
+
|
|
2288
|
+
### Secondary addressee (`secondaryAddressee`)
|
|
2289
|
+
|
|
2290
|
+
All six fields are required when `includeSecondaryAddressee = true`. When `includeSecondaryAddressee = false`, `secondaryAddressee` must be `null`.
|
|
2291
|
+
|
|
2292
|
+
| Field | Type | Validation Error |
|
|
2293
|
+
|---|---|---|
|
|
2294
|
+
| `firstName` | `string` | `Secondary addressee first name is required.` |
|
|
2295
|
+
| `lastName` | `string` | `Secondary addressee last name is required.` |
|
|
2296
|
+
| `street` | `string` | `Secondary addressee street is required.` |
|
|
2297
|
+
| `city` | `string` | `Secondary addressee city is required.` |
|
|
2298
|
+
| `state` | `string` | `Secondary addressee state is required.` / `Secondary addressee state code is invalid.` |
|
|
2299
|
+
| `zipCode` | `string` | `Secondary addressee zip code is required.` / `Zip code is invalid. It must be in 5-digit format.` |
|
|
2300
|
+
|
|
2301
|
+
> **Note:** `zipCode` uses a **capital C** here — this is intentional and mirrors the backend DTO property name. This differs from `FinalExpenseAddress.zipcode` (lowercase `c`). Do **not** normalize the casing.
|
|
2302
|
+
|
|
2303
|
+
***
|
|
2304
|
+
|
|
2305
|
+
### Knockout summary — returns `isDeclined: true` (not thrown)
|
|
2306
|
+
|
|
2307
|
+
- `isPayerAlsoOwnerAndInsured === false`
|
|
2308
|
+
- `isUsCitizen === false` AND `isLegalUsResident === false`
|
|
2309
|
+
- `isHoldingValidDriverLicense === false`
|
|
2310
|
+
- Any of the 13 health-prequalification booleans `=== true`
|
|
2311
|
+
- Respiratory decline rules above
|
|
2312
|
+
- Height/weight outside the Final Expense build chart (decline occurs after opportunity creation — `opportunityId` is a real GUID)
|
|
2313
|
+
|
|
2314
|
+
***
|
|
2315
|
+
|
|
2316
|
+
### Error Codes
|
|
2317
|
+
|
|
2318
|
+
| Code | When |
|
|
2319
|
+
|---|---|
|
|
2320
|
+
| `InvalidRequestFormat` | Field validation failure — inspect `value.fields` |
|
|
2321
|
+
| `ApplicationLimitReached` | Same SSN, email, or phone used on a Final Expense policy within the last 30 days |
|
|
2322
|
+
| `StateMismatchIdentified` | `address.state` differs from the quote state |
|
|
2323
|
+
| `AgentNotFound` / `InternalServerError` | Service-level failures |
|
|
2324
|
+
|
|
2325
|
+
**`ApplicationLimitReached` field-level messages:**
|
|
2326
|
+
|
|
2327
|
+
| Field | Message |
|
|
2328
|
+
|---|---|
|
|
2329
|
+
| `SocialSecurityNumber` | `An application with the same SSN has a policy generated within the last 30 days.` |
|
|
2330
|
+
| `Email` | `An application with the same email has a policy generated within the last 30 days.` |
|
|
2331
|
+
| `PhoneNumber` | `Two applications with the same phone have policies generated within the last 30 days.` |
|
|
2332
|
+
|
|
2333
|
+
***
|
|
2334
|
+
|
|
2335
|
+
### Response
|
|
2336
|
+
|
|
2337
|
+
| Field | Type | Description |
|
|
2338
|
+
|---|---|---|
|
|
2339
|
+
| `opportunityId` | `string` | All-zero GUID when declined before opportunity creation; real GUID otherwise |
|
|
2340
|
+
| `isDeclined` | `boolean` | `true` = knockout / underwriting decline; stop the flow |
|
|
2341
|
+
| `isQuoteChanged` | `boolean` | `true` = tobacco flag or DOB triggered a requote; re-present premium |
|
|
2342
|
+
|
|
2343
|
+
***
|
|
2344
|
+
|
|
2345
|
+
### Example
|
|
2346
|
+
|
|
2347
|
+
```typescript
|
|
2348
|
+
const appResp = await client.startFinalExpenseApplication({
|
|
2349
|
+
quoteResponseId,
|
|
2350
|
+
firstName: 'Jane',
|
|
2351
|
+
lastName: 'Doe',
|
|
2352
|
+
email: 'jane.doe@example.com',
|
|
2353
|
+
phoneNumber: '5551234567',
|
|
2354
|
+
isUsCitizen: true,
|
|
2355
|
+
isPayerAlsoOwnerAndInsured: true,
|
|
2356
|
+
address: { addressLine1: '123 Main St', city: 'Austin', state: 'TX', zipcode: '78701' },
|
|
2357
|
+
dateOfBirth: '1966-06-15',
|
|
2358
|
+
socialSecurityNumber: '123456789',
|
|
2359
|
+
hasExistingCoverage: false,
|
|
2360
|
+
beneficiaryDetails: { beneficiaryType: BeneficiaryType.InsuredEstate },
|
|
2361
|
+
height: { feet: 5, inches: 10 },
|
|
2362
|
+
weight: 170,
|
|
2363
|
+
isHoldingValidDriverLicense: true,
|
|
2364
|
+
birthJurisdiction: { country: 'US', state: 'TX' },
|
|
2365
|
+
driverLicenseState: 'TX',
|
|
2366
|
+
driverLicenseNumber: '12345678',
|
|
2367
|
+
flagTobaccoUse: false,
|
|
2368
|
+
nicotineInfo: null,
|
|
2369
|
+
currentCareConditions: {
|
|
2370
|
+
isOnOxygenOrConfinedToFacility: false,
|
|
2371
|
+
hasHospitalizationOrAdvisedAdmissionInPastSixMonths: false,
|
|
2372
|
+
hasLifeExpectancyTwentyFourMonthsOrLess: false,
|
|
2373
|
+
hasAidsArcOrHiv: false,
|
|
2374
|
+
},
|
|
2375
|
+
substanceUseAndMentalHealth: {
|
|
2376
|
+
hasReceivedDrugAlcoholAdviceInPastTwoYears: false,
|
|
2377
|
+
hasMentalDisorderHospitalizationInPastTwoYears: false,
|
|
2378
|
+
},
|
|
2379
|
+
testsAppointmentsAndLegalHistory: {
|
|
2380
|
+
hasIncompleteMedicalAppointmentInPastTwoYears: false,
|
|
2381
|
+
hasIncompleteMedicalTestInPastTwoYears: false,
|
|
2382
|
+
hasFelonyOrDuiInPastFiveYears: false,
|
|
2383
|
+
},
|
|
2384
|
+
heartStrokeOrganIssuesInPastTwoYears: {
|
|
2385
|
+
hasHeartOrVascularConditionInPastTwoYears: false,
|
|
2386
|
+
hasKidneyLiverOrganOrDiabeticComplicationsInPastTwoYears: false,
|
|
2387
|
+
hasCognitiveOrNeurologicalConditionInPastTwoYears: false,
|
|
2388
|
+
hasNonBasalCellCancerInPastTwoYears: false,
|
|
2389
|
+
},
|
|
2390
|
+
respiratoryDetails: {
|
|
2391
|
+
hasRespiratoryCondition: false,
|
|
2392
|
+
conditions: null,
|
|
2393
|
+
isCurrentlyTreatedForSleepApnea: null,
|
|
2394
|
+
sleepApneaComorbidConditions: null,
|
|
2395
|
+
},
|
|
2396
|
+
includeSecondaryAddressee: false,
|
|
2397
|
+
secondaryAddressee: null,
|
|
2398
|
+
});
|
|
2399
|
+
|
|
2400
|
+
if (appResp.isDeclined) {
|
|
2401
|
+
return; // knockout — stop
|
|
2402
|
+
}
|
|
2403
|
+
const { opportunityId } = appResp;
|
|
2404
|
+
```
|
|
2405
|
+
|
|
2406
|
+
***
|
|
2407
|
+
|
|
2408
|
+
### Field to Question Mapping
|
|
2409
|
+
|
|
2410
|
+
Every field accepted by `startFinalExpenseApplication()` mapped to the exact question text shown to the applicant. Fields marked `N/A` are internal or container objects — word them however you choose in the UI.
|
|
2411
|
+
|
|
2412
|
+
| API Field | Question Text | When Required |
|
|
2413
|
+
|---|---|---|
|
|
2414
|
+
| `quoteResponseId` | N/A | Always required. |
|
|
2415
|
+
| `firstName` | First Name | Always required. |
|
|
2416
|
+
| `lastName` | Last Name | Always required. |
|
|
2417
|
+
| `email` | Email Address | Always required. |
|
|
2418
|
+
| `phoneNumber` | Preferred Phone Number | Always required. |
|
|
2419
|
+
| `dateOfBirth` | Date of Birth | Always required. |
|
|
2420
|
+
| `isUsCitizen` | Are you a United States citizen? | Always required. |
|
|
2421
|
+
| `isLegalUsResident` | Are you a legal U.S. resident and have you resided in the U.S. for more than 2 years? | Required when `isUsCitizen` is `false`. |
|
|
2422
|
+
| `isPayerAlsoOwnerAndInsured` | This product requires that the payer, the person purchasing the policy, and the owner are the same person. Please confirm that you are both the insured individual and will also be the owner of the policy. | Always required. `false` declines. |
|
|
2423
|
+
| `socialSecurityNumber` | Social Security Number | Always required. |
|
|
2424
|
+
| `address` | N/A | Always required. |
|
|
2425
|
+
| `address.addressLine1` | Street | Always required. |
|
|
2426
|
+
| `address.city` | City | Always required. |
|
|
2427
|
+
| `address.state` | State | Always required. |
|
|
2428
|
+
| `address.zipcode` | Zip Code | Always required. |
|
|
2429
|
+
| `birthJurisdiction` | N/A | Always required. |
|
|
2430
|
+
| `birthJurisdiction.country` | Birth Country | Always required. |
|
|
2431
|
+
| `birthJurisdiction.state` | State (Birth Jurisdiction) | Required when `birthJurisdiction.country` is `US`. |
|
|
2432
|
+
| `height` | What is your height? | Always required. |
|
|
2433
|
+
| `height.feet` | N/A | Always required. |
|
|
2434
|
+
| `height.inches` | N/A | Always required. |
|
|
2435
|
+
| `weight` | What is your weight? | Always required. |
|
|
2436
|
+
| `isHoldingValidDriverLicense` | Do you have a valid driver's license? | Always required. `false` declines. |
|
|
2437
|
+
| `driverLicenseState` | N/A | Required when `isHoldingValidDriverLicense` is `true`. |
|
|
2438
|
+
| `driverLicenseNumber` | N/A | Required when `isHoldingValidDriverLicense` is `true`. |
|
|
2439
|
+
| `flagTobaccoUse` | Within the past 2 years have you used tobacco or any other product that contains nicotine? | Always required. |
|
|
2440
|
+
| `nicotineInfo` | N/A | Cond. |
|
|
2441
|
+
| `nicotineInfo.lastUseDate` | When was the last time you used tobacco or any other product that contains nicotine? | Required when `flagTobaccoUse` is `true`. |
|
|
2442
|
+
| `currentCareConditions` | N/A | Always required. |
|
|
2443
|
+
| `currentCareConditions.isOnOxygenOrConfinedToFacility` | Are you currently on oxygen for a medical condition, or confined to a nursing facility or assisted living facility? | Always required. `true` declines. |
|
|
2444
|
+
| `currentCareConditions.hasHospitalizationOrAdvisedAdmissionInPastSixMonths` | Within the past six months, have you been hospitalized two or more times, or have you been advised by a member of the medical profession to have any hospitalization or to be admitted to a nursing facility that has not yet been completed? | Always required. `true` declines. |
|
|
2445
|
+
| `currentCareConditions.hasLifeExpectancyTwentyFourMonthsOrLess` | Have you been diagnosed by a member of the medical profession as having a life expectancy of 24 months or less? | Always required. `true` declines. |
|
|
2446
|
+
| `currentCareConditions.hasAidsArcOrHiv` | Have you ever been diagnosed by a member of the medical profession as having acquired immune deficiency syndrome (AIDS) or AIDS related complex (ARC), or tested positive for human immunodeficiency virus (HIV)? | Always required. `true` declines. |
|
|
2447
|
+
| `substanceUseAndMentalHealth` | N/A | Always required. |
|
|
2448
|
+
| `substanceUseAndMentalHealth.hasReceivedDrugAlcoholAdviceInPastTwoYears` | Within the past 2 years have you been counseled, treated, or advised by a physician to discontinue or seek treatment for use of illegal drugs, alcohol or prescription drugs? | Always required. `true` declines. |
|
|
2449
|
+
| `substanceUseAndMentalHealth.hasMentalDisorderHospitalizationInPastTwoYears` | Within the past 2 years have you been hospitalized for a mental disorder? | Always required. `true` declines. |
|
|
2450
|
+
| `testsAppointmentsAndLegalHistory` | N/A | Always required. |
|
|
2451
|
+
| `testsAppointmentsAndLegalHistory.hasIncompleteMedicalAppointmentInPastTwoYears` | Within the past 2 years have you been advised by a member of the medical profession to have any medical appointment that has not yet been completed? | Always required. `true` declines. |
|
|
2452
|
+
| `testsAppointmentsAndLegalHistory.hasIncompleteMedicalTestInPastTwoYears` | Within the past 2 years, have you been advised by a member of the medical profession, to have any medical test (other than related to HIV/AIDS) that has not yet been completed? | Always required. `true` declines. |
|
|
2453
|
+
| `testsAppointmentsAndLegalHistory.hasFelonyOrDuiInPastFiveYears` | Within the past 5 years have you been convicted of any felony or driving under the influence of alcohol or drugs? | Always required. `true` declines. |
|
|
2454
|
+
| `heartStrokeOrganIssuesInPastTwoYears` | N/A | Always required. |
|
|
2455
|
+
| `heartStrokeOrganIssuesInPastTwoYears.hasHeartOrVascularConditionInPastTwoYears` | Within the past 2 years have you been diagnosed, been treated, been tested, consulted with, or been given medical advice by a member of the medical profession for heart attack, stroke, chest pain, coronary artery disorder, Transient Ischemic Attack (TIA), myocarditis or any other disorder of the heart, blood vessels or peripheral vascular system? | Always required. `true` declines. |
|
|
2456
|
+
| `heartStrokeOrganIssuesInPastTwoYears.hasKidneyLiverOrganOrDiabeticComplicationsInPastTwoYears` | Within the past 2 years have you been diagnosed, been treated, been tested, consulted with, or been given medical advice by a member of the medical profession for kidney disorder, liver disorder, any organ transplant, or diabetic complications (amputation, coma, or blindness)? | Always required. `true` declines. |
|
|
2457
|
+
| `heartStrokeOrganIssuesInPastTwoYears.hasCognitiveOrNeurologicalConditionInPastTwoYears` | Within the past 2 years have you been diagnosed, been treated, been tested, consulted with, or been given medical advice by a member of the medical profession for Alzheimer's disease, dementia, organic brain syndrome, cognitive impairment (of any degree), or Amyotrophic Lateral Sclerosis (ALS)? | Always required. `true` declines. |
|
|
2458
|
+
| `heartStrokeOrganIssuesInPastTwoYears.hasNonBasalCellCancerInPastTwoYears` | Within the past 2 years have you been diagnosed, been treated, been tested, consulted with, or been given medical advice by a member of the medical profession for cancer, other than basal cell skin cancer? | Always required. `true` declines. |
|
|
2459
|
+
| `respiratoryDetails` | N/A | Always required. |
|
|
2460
|
+
| `respiratoryDetails.hasRespiratoryCondition` | Within the past 2 years have you been diagnosed, been treated, been tested, consulted with, or been given medical advice by a member of the medical profession for Chronic Obstructive Pulmonary Disease (COPD), emphysema, Acute Respiratory Distress Syndrome (ARDS) or any other respiratory disorder other than asthma or required the use of a ventilator? | Always required. |
|
|
2461
|
+
| `respiratoryDetails.conditions` | Please specify | Required when `hasRespiratoryCondition` is `true`. |
|
|
2462
|
+
| `respiratoryDetails.isCurrentlyTreatedForSleepApnea` | Are you presently taking any prescribed medication or receiving treatment for this condition? | Required when `sleep apnea` is selected. |
|
|
2463
|
+
| `respiratoryDetails.sleepApneaComorbidConditions` | Do you suffer from any of the following diseases? | Required when `sleep apnea` is selected. |
|
|
2464
|
+
| `includeSecondaryAddressee` | Do you want to provide a secondary addressee? | Always required. |
|
|
2465
|
+
| `secondaryAddressee` | N/A | Cond. |
|
|
2466
|
+
| `secondaryAddressee.firstName` | First Name | Required when `includeSecondaryAddressee` is `true`. |
|
|
2467
|
+
| `secondaryAddressee.lastName` | Last Name | Required when `includeSecondaryAddressee` is `true`. |
|
|
2468
|
+
| `secondaryAddressee.street` | Street | Required when `includeSecondaryAddressee` is `true`. |
|
|
2469
|
+
| `secondaryAddressee.city` | City | Required when `includeSecondaryAddressee` is `true`. |
|
|
2470
|
+
| `secondaryAddressee.state` | State | Required when `includeSecondaryAddressee` is `true`. |
|
|
2471
|
+
| `secondaryAddressee.zipCode` | Zip Code | Required when `includeSecondaryAddressee` is `true`. |
|
|
2472
|
+
| `beneficiaryDetails` | N/A | Always required. |
|
|
2473
|
+
| `beneficiaryDetails.beneficiaryType` | The beneficiary is a... | Always required. |
|
|
2474
|
+
| `beneficiaryDetails.beneficiaryPerson` | N/A | Required when `beneficiaryType` is `Person`. |
|
|
2475
|
+
| `beneficiaryDetails.beneficiaryPerson.firstName` | First name | Required when `beneficiaryType` is `Person`. |
|
|
2476
|
+
| `beneficiaryDetails.beneficiaryPerson.lastName` | Last name | Required when `beneficiaryType` is `Person`. |
|
|
2477
|
+
| `beneficiaryDetails.beneficiaryPerson.relationship` | Relationship | Required when `beneficiaryType` is `Person`. |
|
|
2478
|
+
| `beneficiaryDetails.namedEntity` | N/A | Required when `beneficiaryType` is `Trust`. |
|
|
2479
|
+
| `beneficiaryDetails.namedEntity.name` | Name | Required when `beneficiaryType` is `Trust`. |
|
|
2480
|
+
| `beneficiaryDetails.namedEntity.taxId` | Tax ID | Required when `beneficiaryType` is `Trust`. |
|
|
2481
|
+
| `beneficiaryDetails.namedEntity.trustDate` | Trust Date (mm/yyyy) | Required when `beneficiaryType` is `Trust`. |
|
|
2482
|
+
| `hasExistingCoverage` | Do you have any existing life insurance or annuity contracts in force or is any application for life insurance, or reinstatement now pending with any insurance company? | Always required. |
|
|
2483
|
+
| `existingCoverageData` | N/A | Required when `hasExistingCoverage` is `true`. |
|
|
2484
|
+
| `existingCoverageData.isExistingPolicyBeingTerminated` | Are you considering discontinuing making premium payments, surrendering, forfeiting, assigning to the insurer, or otherwise terminating your existing policy or contract? | Required when `hasExistingCoverage` is `true`. |
|
|
2485
|
+
| `existingCoverageData.areExistingPoliciesIssuedByFidelity` | Are any of your existing policies issued by Fidelity Life Association? | Required for RI and WV. |
|
|
2486
|
+
| `existingCoverageData.existingCoverages` | Please list all such policies here. | Required when `hasExistingCoverage` is `true`. |
|
|
2487
|
+
| `existingCoverageData.existingCoverages[].nameOfTheCompany` | Name of Company | Required per coverage row. |
|
|
2488
|
+
| `existingCoverageData.existingCoverages[].insuranceAmount` | Insurance Amount | Required per coverage row. |
|
|
2489
|
+
| `existingCoverageData.existingCoverages[].dateOfIssue` | Date of Issue | Required per coverage row. |
|
|
2490
|
+
| `existingCoverageData.existingCoverages[].toBeReplaced` | To Be Replaced | Required per coverage row. |
|
|
2491
|
+
| `existingCoverageData.existingCoverages[].toBeFinanced` | To Be Financed | Required per coverage row. |
|
|
2492
|
+
| `existingCoverageData.existingCoverages[].requestsYieldIndices` | Would you like to request yield indices for cash value policies? | Required per coverage row. |
|
|
2493
|
+
| `existingCoverageData.existingCoverages[].notifyPresentInsurer` | Please notify my present insurer(s) regarding this transaction? | Required per coverage row. |
|
|
2494
|
+
| `existingCoverageData.existingCoverages[].wantsPolicySummary` | Do you want a policy summary statement from your existing insurer? | Required per coverage row. |
|
|
2495
|
+
| `existingCoverageData.existingCoverages[].wantsComparativeInformationForm` | Indicate whether or not you wish a Comparative Information Form from the proposed company and your existing insurer or insurers? | Required per coverage row. |
|
|
2496
|
+
| `willOtherCoverageBeReplacedOrFinanced` | If this policy is issued, will any other existing life insurance or annuity contract be cancelled, lapsed or not renewed or are you considering using funds from your existing policies or contracts to pay premiums on the new policy or contract? | Required when `hasExistingCoverage` is `true`. |
|
|
2497
|
+
| `willOtherCoverageBeReplacedOrFinancedData` | N/A | Required for KS/WA when replacing or financing. |
|
|
2498
|
+
| `willOtherCoverageBeReplacedOrFinancedData.areReplacedPoliciesIssuedByFidelity` | Are any of the policies you are considering replacing issued by Fidelity Life Association? | Required for KS/WA. |
|
|
2499
|
+
| `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData` | N/A | Required for KS/WA. |
|
|
2500
|
+
| `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData.mayReduceBenefitsIncreasePremiums` | Can there be reduced benefits or increased premiums in later years? | Required for KS/WA. |
|
|
2501
|
+
| `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData.specifyReduceBenefitsIncreasePremiums` | Please explain | Cond. |
|
|
2502
|
+
| `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData.hasNewPolicyCharges` | Are there penalties, set up or surrender charges for the new policy? | Required for KS/WA. |
|
|
2503
|
+
| `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData.specifyNewPolicyCharges` | Please explain, emphasizing any extra cost for early withdrawal. | Cond. |
|
|
2504
|
+
| `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData.hasPriorPolicyCharges` | Will there be penalties or surrender charges under the existing insurance as a result of the proposed transaction? | Required for KS/WA. |
|
|
2505
|
+
| `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData.specifyPriorPolicyCharges` | Please explain | Cond. |
|
|
2506
|
+
| `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData.hasTaxConsequences` | Are there adverse tax consequences from the replacement under current tax law? | Required for KS/WA. |
|
|
2507
|
+
| `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData.specifyTaxConsequences` | Please explain | Cond. |
|
|
2508
|
+
| `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData.hasInterestConsiderations` | Are interest earnings a consideration in this replacement? | Required for KS/WA. |
|
|
2509
|
+
| `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData.specifyInterestConsiderations` | Please explain what portions of premiums or contributions will produce limited or no earnings. As pertinent, include the need for minimum deposits to enhance earnings, and the reduction of earnings that may result from set up charges, policy fees, and other factors. | Cond. |
|
|
2510
|
+
| `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData.hasMinRequirementsBeforeInterest` | Are minimum amounts required to be on deposit before excess interest will be paid? | Required for KS/WA. |
|
|
2511
|
+
| `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData.specifyMinRequirementsBeforeInterest` | Please explain | Cond. |
|
|
2512
|
+
| `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData.hasOtherAdverseEffects` | Are there other short or long term effects from the replacement that might be materially adverse? | Required for KS/WA. |
|
|
2513
|
+
| `willOtherCoverageBeReplacedOrFinancedData.otherInsuranceReplacementData.specifyOtherAdverseEffects` | Please explain | Cond. |
|
|
2514
|
+
|
|
2515
|
+
---
|
|
2516
|
+
|
|
2517
|
+
## Final Expense — Get Existing Quote
|
|
2518
|
+
|
|
2519
|
+
**Method:** `client.getFinalExpenseExistingQuote(opportunityId)`
|
|
2520
|
+
|
|
2521
|
+
Re-fetch a Final Expense quote by `opportunityId` without re-quoting. Returns the same shape as Get Quote. Use `selectedQuote.quoteResponseId` for start application.
|
|
2522
|
+
|
|
2523
|
+
| Validation Error | When |
|
|
2524
|
+
|---|---|
|
|
2525
|
+
| `OpportunityId is required.` | Missing `opportunityId` |
|
|
2526
|
+
| `OpportunityId does not exist.` | Unknown opportunity |
|
|
2527
|
+
| `OpportunityId does not match selected product.` | Opportunity belongs to a different product |
|
|
2528
|
+
|
|
2529
|
+
> A valid GUID format that is not found returns **403 Forbidden** (no body) — surfaced as `InstaBrainError`.
|
|
2530
|
+
|
|
2531
|
+
```typescript
|
|
2532
|
+
const existing = await client.getFinalExpenseExistingQuote(opportunityId);
|
|
2533
|
+
console.log('Premium:', existing.selectedQuote.quoteAmount);
|
|
2534
|
+
```
|
|
2535
|
+
|
|
2536
|
+
---
|
|
2537
|
+
|
|
2538
|
+
## Final Expense — Update Quote
|
|
2539
|
+
|
|
2540
|
+
**Method:** `client.updateFinalExpenseQuote(request)` · **Type:** `ThirdPartyFinalExpenseUpdateQuoteReq`
|
|
2541
|
+
|
|
2542
|
+
Change `faceAmount` and/or `paymentFreq` before payment. Only these two fields can change — nicotine, state, and age cannot. **Blocked once EFT payment is recorded.**
|
|
2543
|
+
|
|
2544
|
+
| Field | Type | Required |
|
|
2545
|
+
|---|---|---|
|
|
2546
|
+
| `opportunityId` | `string` | Yes |
|
|
2547
|
+
| `faceAmount` | `number` | Yes |
|
|
2548
|
+
| `paymentFreq` | `PaymentFrequency` | Yes |
|
|
2549
|
+
|
|
2550
|
+
| Validation Error | When |
|
|
2551
|
+
|---|---|
|
|
2552
|
+
| `OpportunityId is required.` | Missing `opportunityId` |
|
|
2553
|
+
| `OpportunityId does not exist.` | Unknown opportunity |
|
|
2554
|
+
| `OpportunityId does not match selected product.` | Opportunity belongs to a different product |
|
|
2555
|
+
| `Quote update is not allowed when payment is already made.` | EFT payment already saved |
|
|
2556
|
+
| `Coverage amount (FaceAmount) is required.` | Missing `faceAmount` |
|
|
2557
|
+
| `Payment frequency is required.` / `Invalid payment frequency.` | Missing/invalid `paymentFreq` |
|
|
2558
|
+
|
|
2559
|
+
```typescript
|
|
2560
|
+
import { PaymentFrequency } from '@instabrain-sdks/api-client';
|
|
2561
|
+
|
|
2562
|
+
const updated = await client.updateFinalExpenseQuote({
|
|
2563
|
+
opportunityId,
|
|
2564
|
+
faceAmount: 20000,
|
|
2565
|
+
paymentFreq: PaymentFrequency.Annually,
|
|
2566
|
+
});
|
|
2567
|
+
```
|
|
2568
|
+
|
|
2569
|
+
---
|
|
2570
|
+
|
|
2571
|
+
## Final Expense — Underwriting Status (async)
|
|
2572
|
+
|
|
2573
|
+
Final Expense underwrites **asynchronously**. After `finalSubmit()` returns `applicationStatus: 'InProgress'`, poll for the carrier decision. **Final Expense only** — calling these for ADB/GIGDB returns `FinalSubmitStatusNotSupported`.
|
|
2574
|
+
|
|
2575
|
+
**Methods:**
|
|
2576
|
+
- `client.pollFinalExpenseUnderwritingStatus(opportunityId, options?)` — poll until terminal (recommended)
|
|
2577
|
+
- `client.pingFinalExpenseUnderwritingStatus(opportunityId)` — single poll (manual control)
|
|
2578
|
+
|
|
2579
|
+
**Response fields** (`ThirdPartyFinalExpensePingRes`): each poll returns `applicationStatus`, `policyNumber` (populated only when `applicationStatus === 'Approved'`), and **`shouldContinuePolling`** — the authoritative stop signal. Poll while `shouldContinuePolling` is `true`; stop as soon as it is `false`, regardless of the status value. `pollFinalExpenseUnderwritingStatus()` handles this for you.
|
|
2580
|
+
|
|
2581
|
+
### `FinalExpenseApplicationStatus`
|
|
2582
|
+
|
|
2583
|
+
| Value | `shouldContinuePolling` | Meaning |
|
|
2584
|
+
|---|---|---|
|
|
2585
|
+
| `InProgress` | `true` | Decision pending — keep polling |
|
|
2586
|
+
| `Approved` | `false` | `policyNumber` is populated |
|
|
2587
|
+
| `NotEligible` | `false` | Declined by carrier |
|
|
2588
|
+
| `UnableToOffer` | `false` | Carrier cannot offer coverage |
|
|
2589
|
+
| `Closed` | `false` | Application closed, not accepted |
|
|
2590
|
+
| `Abandoned` | `false` | Application abandoned |
|
|
2591
|
+
| `TimedOut` | `false` | No carrier decision within 30 minutes of `finalSubmit()` — terminal |
|
|
2592
|
+
|
|
2593
|
+
### Polling strategy (`PollUnderwritingStatusOptions`)
|
|
2594
|
+
|
|
2595
|
+
Defaults implement the recommended two-phase cadence:
|
|
2596
|
+
|
|
2597
|
+
| Option | Default | Meaning |
|
|
2598
|
+
|---|---|---|
|
|
2599
|
+
| `fastIntervalMs` | `10_000` (10s) | Interval during the fast phase |
|
|
2600
|
+
| `fastPhaseDurationMs` | `420_000` (7 min) | Length of the fast phase |
|
|
2601
|
+
| `slowIntervalMs` | `300_000` (5 min) | Interval after the fast phase |
|
|
2602
|
+
| `maxTotalDurationMs` | `1_800_000` (30 min) | Client-side safety-net budget. The backend itself returns a terminal `'TimedOut'` at 30 min; if that isn't seen, the poll resolves with the last response at this budget |
|
|
2603
|
+
| `onPoll` | — | Callback `(result: ThirdPartyFinalExpensePingRes, attempt: number, elapsedMs: number) => void` invoked after **every** poll. Use it to surface "still underwriting…" progress instead of awaiting silently |
|
|
2604
|
+
|
|
2605
|
+
`pollUnderwritingStatus` resolves as soon as `shouldContinuePolling` is `false` (falling back to a non-`'InProgress'` status on older backends that don't yet send the flag). If the client budget is exhausted first, it resolves with the last response — inspect `applicationStatus` / `shouldContinuePolling` and resume manually with `pingFinalExpenseUnderwritingStatus()` if needed.
|
|
2606
|
+
|
|
2607
|
+
> **Rate limit:** the status endpoint allows **1 request per 2 seconds** per `opportunityId`; exceeding it returns `429 Too Many Requests` with `Retry-After: 2`. `pollFinalExpenseUnderwritingStatus()` **transparently retries a `429` after that delay** — the managed poll never aborts on rate limiting. The default 10s / 5min cadence stays well within the limit; if you override the intervals, keep them **≥ `2000`**. A single `pingFinalExpenseUnderwritingStatus()` call does not auto-retry — handle the `429` yourself.
|
|
2608
|
+
|
|
2609
|
+
```typescript
|
|
2610
|
+
const submit = await client.finalSubmit(opportunityId);
|
|
2611
|
+
|
|
2612
|
+
if (submit.applicationStatus === 'InProgress') {
|
|
2613
|
+
// Final Expense — async underwriting. Poll for the decision.
|
|
2614
|
+
const decision = await client.pollFinalExpenseUnderwritingStatus(opportunityId, {
|
|
2615
|
+
onPoll: (r, attempt, ms) => console.log(`poll #${attempt} (${Math.round(ms / 1000)}s): ${r.applicationStatus}`),
|
|
2616
|
+
});
|
|
2617
|
+
switch (decision.applicationStatus) {
|
|
2618
|
+
case 'Approved':
|
|
2619
|
+
console.log('Policy issued:', decision.policyNumber);
|
|
2620
|
+
break;
|
|
2621
|
+
case 'TimedOut':
|
|
2622
|
+
console.log('No carrier decision within 30 min — treat as terminal');
|
|
2623
|
+
break;
|
|
2624
|
+
case 'InProgress':
|
|
2625
|
+
console.log('Client budget exhausted before backend TimedOut (rare) — resume later');
|
|
2626
|
+
break;
|
|
2627
|
+
default:
|
|
2628
|
+
console.log('Not issued:', decision.applicationStatus);
|
|
2629
|
+
}
|
|
2630
|
+
} else {
|
|
2631
|
+
// ADB / GIGDB — synchronous. policyNumber is immediately available.
|
|
2632
|
+
console.log('Policy issued:', submit.policyNumber);
|
|
2633
|
+
}
|
|
2634
|
+
```
|
|
2635
|
+
|
|
2636
|
+
| Validation Error | Code / Status |
|
|
2637
|
+
|---|---|
|
|
2638
|
+
| `OpportunityId is required.` / `OpportunityId does not exist.` | `400` `InvalidRequestFormat` |
|
|
2639
|
+
| `Final submit status polling is not supported for this product.` | `400` `FinalSubmitStatusNotSupported` |
|
|
2640
|
+
| `Too many requests. Retry after 2 seconds.` | `429` (`Retry-After: 2`) — auto-retried by `pollFinalExpenseUnderwritingStatus()` |
|
|
2641
|
+
|
|
2642
|
+
---
|
|
2643
|
+
|
|
2644
|
+
## Shared methods — GIGDB, ADB & Final Expense
|
|
2645
|
+
|
|
2646
|
+
These methods apply to **GIGDB, ADB, and Final Expense**. IB Term and Pure Term use the frontend links returned by Start Application and do **not** call these.
|
|
2647
|
+
|
|
2648
|
+
---
|
|
2649
|
+
|
|
2650
|
+
## Payment — EFT or Credit Card
|
|
2651
|
+
|
|
2652
|
+
The payment step sits between Start Application and Prepare Docs, and offers **two mutually exclusive options** for a given `opportunityId`:
|
|
2653
|
+
|
|
2654
|
+
```
|
|
2655
|
+
Start Application
|
|
2656
|
+
→ Payment — choose exactly ONE:
|
|
2657
|
+
EFT: saveEftPayment()
|
|
2658
|
+
Credit card: getCcPaymentIframeUrl() → render iframe → pollCcPaymentStatus()
|
|
2659
|
+
→ Prepare Docs → PIN → finalSubmit()
|
|
2660
|
+
```
|
|
2661
|
+
|
|
2662
|
+
Pick one per opportunity. After a successful EFT save, `getCcPaymentIframeUrl()` returns `EftPaymentAlreadyCompleted`.
|
|
2663
|
+
|
|
2664
|
+
**Who charges the card, and when** — the most important distinction:
|
|
2665
|
+
|
|
2666
|
+
| Product | Card charged at | `finalSubmit()` payment-decline errors? |
|
|
2667
|
+
|---|---|---|
|
|
2668
|
+
| ADB / GIGDB | **`finalSubmit()`**, by InstaBrain | **Yes** — see the decline codes below |
|
|
2669
|
+
| Final Expense | **Never at `finalSubmit()`** — the carrier collects after underwriting | **No** |
|
|
2670
|
+
|
|
2671
|
+
`'approved'` means the card was **captured**, not charged — for every product.
|
|
2672
|
+
|
|
2673
|
+
---
|
|
2674
|
+
|
|
2675
|
+
## Get Credit Card Iframe URL
|
|
2676
|
+
|
|
2677
|
+
**Method:** `client.getCcPaymentIframeUrl(opportunityId)` · **Returns:** `Promise<string>`
|
|
2678
|
+
|
|
2679
|
+
Returns the TrustCommerce hosted-page URL for card capture. The SDK never handles card data — render this URL and let the applicant complete the form. **Supported for ADB, GIGDB, and Final Expense only.**
|
|
2680
|
+
|
|
2681
|
+
> **Persist the returned URL keyed by `opportunityId` and reuse it.** A new link is only issued once the latest attempt has **failed**. Calling this again while capture is `pending` *or* already `approved` returns `TcIframeLinkAlreadyGenerated` — that's a signal to reuse the URL you already have, not an error to recover from.
|
|
2682
|
+
|
|
2683
|
+
### Request
|
|
2684
|
+
|
|
2685
|
+
| Parameter | Type | Required | Description |
|
|
2686
|
+
|---|---|---|---|
|
|
2687
|
+
| `opportunityId` | `string` (query) | Yes | The `opportunityId` from Start Application |
|
|
2688
|
+
|
|
2689
|
+
### Response
|
|
2690
|
+
|
|
2691
|
+
| Field | Type | Description |
|
|
2692
|
+
|---|---|---|
|
|
2693
|
+
| *(return value)* | `string` | The fully-qualified TrustCommerce iframe URL |
|
|
2694
|
+
|
|
2695
|
+
### Error Codes
|
|
2696
|
+
|
|
2697
|
+
All return HTTP 400, each as a **distinct** top-level code.
|
|
2698
|
+
|
|
2699
|
+
| Code | When | What to do |
|
|
2700
|
+
|---|---|---|
|
|
2701
|
+
| `InvalidRequestFormat` | `opportunityId` missing or unknown | Fix the ID |
|
|
2702
|
+
| `CcPaymentIframeNotSupportedForProduct` | Product is not ADB / GIGDB / Final Expense | Use `saveEftPayment()` instead (IB Term / Pure Term) |
|
|
2703
|
+
| `ApplicationNotReady` | Start Application has not completed successfully | Complete start application, then retry |
|
|
2704
|
+
| `EftPaymentAlreadyCompleted` | A successful EFT payment already exists | EFT and card are mutually exclusive — nothing to do |
|
|
2705
|
+
| `TcIframeLinkAlreadyGenerated` | A link exists and the latest attempt has not failed | **Reuse the stored URL**; only request a new one after `'failed'` |
|
|
2706
|
+
|
|
2707
|
+
### Example
|
|
2708
|
+
|
|
2709
|
+
```typescript
|
|
2710
|
+
const iframeUrl = await client.getCcPaymentIframeUrl(opportunityId);
|
|
2711
|
+
// Persist it — you'll need it again while status is 'pending'.
|
|
2712
|
+
await savePaymentUrl(opportunityId, iframeUrl);
|
|
2713
|
+
// Render iframeUrl to the applicant.
|
|
2714
|
+
```
|
|
2715
|
+
|
|
2716
|
+
---
|
|
2717
|
+
|
|
2718
|
+
## Credit Card Payment Status
|
|
2719
|
+
|
|
2720
|
+
**Methods:** `client.pollCcPaymentStatus(opportunityId, options?)` (recommended) · `client.getCcPaymentStatus(opportunityId)` (single check)
|
|
2721
|
+
**Type:** `ThirdPartyCcPaymentStatusRes`
|
|
2722
|
+
|
|
2723
|
+
Reports whether card capture has completed. Drive your loop off `shouldContinuePolling`, not the `status` string.
|
|
2724
|
+
|
|
2725
|
+
### Response
|
|
2726
|
+
|
|
2727
|
+
| Field | Type | Description |
|
|
2728
|
+
|---|---|---|
|
|
2729
|
+
| `status` | `CcPaymentStatus` | `'pending'` · `'approved'` · `'failed'` |
|
|
2730
|
+
| `shouldContinuePolling` | `boolean` | `true` only while `'pending'` |
|
|
2731
|
+
|
|
2732
|
+
### Status values
|
|
2733
|
+
|
|
2734
|
+
| `status` | `shouldContinuePolling` | Meaning | What to do next |
|
|
2735
|
+
|---|---|---|---|
|
|
2736
|
+
| `pending` | `true` | Capture in progress, or the iframe was never opened | Keep polling. **Reuse the stored URL** — do not call `getCcPaymentIframeUrl()`. Do not call `finalSubmit()` (returns `paymentNotMade`). |
|
|
2737
|
+
| `approved` | `false` | Card captured successfully | Proceed to Prepare Docs → signing → `finalSubmit()` |
|
|
2738
|
+
| `failed` | `false` | Declined in the iframe, or (ADB/GIGDB) the `finalSubmit()` charge failed | Call `getCcPaymentIframeUrl()` for a **new** card, then poll again. Do not call `finalSubmit()` (returns `LatestPaymentNotSuccessful`). |
|
|
2739
|
+
|
|
2740
|
+
### Polling options (`PollCcPaymentStatusOptions`)
|
|
2741
|
+
|
|
2742
|
+
| Option | Default | Meaning |
|
|
2743
|
+
|---|---|---|
|
|
2744
|
+
| `intervalMs` | `10_000` (10s) | Interval between polls — matches the rate limit. **Never set below `10_000`.** |
|
|
2745
|
+
| `maxTotalDurationMs` | `1_800_000` (30 min) | Client-side safety net, matching the Final Expense poller. Card capture has no server-side timeout — it stays `'pending'` until the applicant finishes, so this budget is the only stop. On expiry the poll resolves with the last response rather than throwing. |
|
|
2746
|
+
| `onPoll` | — | `(result, attempt, elapsedMs) => void`, invoked after every poll including the terminal one. Use it to show "waiting for card capture…" instead of awaiting silently. |
|
|
2747
|
+
|
|
2748
|
+
> **Rate limit:** 1 request per 10 seconds per `opportunityId`; exceeding it returns HTTP `429` with `Retry-After: 10`. `pollCcPaymentStatus()` **transparently retries** a 429 after that delay — the managed poll never aborts on rate limiting. A single `getCcPaymentStatus()` call does **not** auto-retry; handle the 429 yourself.
|
|
2749
|
+
|
|
2750
|
+
> `pollCcPaymentStatus()` **never requests a new iframe URL**, including on `'failed'` — the applicant must re-enter card details, so that call is always yours to make.
|
|
2751
|
+
|
|
2752
|
+
### Example — full card-capture flow
|
|
2753
|
+
|
|
2754
|
+
```typescript
|
|
2755
|
+
const iframeUrl = await client.getCcPaymentIframeUrl(opportunityId);
|
|
2756
|
+
// …render iframeUrl, applicant submits the card…
|
|
2757
|
+
|
|
2758
|
+
const result = await client.pollCcPaymentStatus(opportunityId, {
|
|
2759
|
+
onPoll: (r, attempt, ms) =>
|
|
2760
|
+
console.log(`poll #${attempt} (${Math.round(ms / 1000)}s): ${r.status}`),
|
|
2761
|
+
});
|
|
2762
|
+
|
|
2763
|
+
switch (result.status) {
|
|
2764
|
+
case 'approved':
|
|
2765
|
+
// Card captured — continue to signing, then finalSubmit().
|
|
2766
|
+
break;
|
|
2767
|
+
case 'failed':
|
|
2768
|
+
// Capture a NEW card, then poll again.
|
|
2769
|
+
await client.getCcPaymentIframeUrl(opportunityId);
|
|
2770
|
+
break;
|
|
2771
|
+
case 'pending':
|
|
2772
|
+
// Budget expired without the applicant finishing — resume later.
|
|
2773
|
+
break;
|
|
2774
|
+
}
|
|
2775
|
+
```
|
|
2776
|
+
|
|
2777
|
+
### Recovery after a decline (ADB / GIGDB)
|
|
2778
|
+
|
|
2779
|
+
When `finalSubmit()` fails with a payment decline, the application is **not** submitted:
|
|
2780
|
+
|
|
2781
|
+
1. `pollCcPaymentStatus()` reports `'failed'` on the next poll
|
|
2782
|
+
2. Calling `finalSubmit()` again immediately returns `LatestPaymentNotSuccessful`
|
|
2783
|
+
3. Call `getCcPaymentIframeUrl()` for a new capture → poll to `'approved'` → retry `finalSubmit()`
|
|
2784
|
+
|
|
2785
|
+
**Decline codes** (ADB / GIGDB only — Final Expense never produces these):
|
|
2786
|
+
|
|
2787
|
+
`PaymentCvvInvalid` · `PaymentDeclinedContactBank` · `PaymentDeclined` · `PaymentDeclinedPermanent` · `PaymentPinLocked` · `PaymentInsufficientFunds` · `PaymentProcessingError` · `PaymentSuspectedFraud` · `PaymentCardExpired` · `PaymentInvalidCardData` · `PaymentCardError` · `PaymentContactBank` · `PaymentRelatedError`
|
|
2788
|
+
|
|
2789
|
+
Each maps to a distinct `APIErrorCode` with its own `getUserFriendlyMessage()`.
|
|
1835
2790
|
|
|
1836
2791
|
---
|
|
1837
2792
|
|
|
@@ -1849,17 +2804,22 @@ Saves bank account details for premium payment. Call after Start Application, be
|
|
|
1849
2804
|
|
|
1850
2805
|
| Field | Type | Required | Validation Error |
|
|
1851
2806
|
|---|---|---|---|
|
|
1852
|
-
| `opportunityId` | `string` | Yes | `OpportunityId is required.` |
|
|
1853
|
-
| `accountHolderName` | `string` | Yes | `Account holder name is required.` / `Account holder name must be 100 characters or fewer.` |
|
|
2807
|
+
| `opportunityId` | `string` | Yes | `OpportunityId is required.` / `OpportunityId does not exist.` |
|
|
2808
|
+
| `accountHolderName` | `string` | Yes | `Account holder name is required.` / `Account holder name must be 100 characters or fewer.` / `Account holder name may only contain letters, spaces, hyphens, and apostrophes.` |
|
|
1854
2809
|
| `routingNumber` | `string` | Yes | `Routing number is required.` / `Routing number must be 9 digits.` |
|
|
1855
2810
|
| `accountNumber` | `string` | Yes | `Account number is required.` / `Account number must be 4 to 17 digits.` |
|
|
1856
2811
|
|
|
2812
|
+
> `accountHolderName` accepts **letters, spaces, hyphens, and apostrophes only** — max 100 characters. Digits and other punctuation are rejected.
|
|
2813
|
+
|
|
1857
2814
|
|
|
1858
2815
|
***
|
|
1859
2816
|
|
|
1860
2817
|
### Business Rules
|
|
1861
2818
|
|
|
1862
2819
|
1. Once EFT payment is saved, quote update calls for the same `opportunityId` are blocked.
|
|
2820
|
+
2. **EFT and credit card are mutually exclusive per `opportunityId`.** A successful payment that already exists — a prior EFT save, or a card that has already been charged — returns `PaymentAlreadyMade`. After a successful EFT save, [`getCcPaymentIframeUrl()`](#get-credit-card-iframe-url) returns `EftPaymentAlreadyCompleted`.
|
|
2821
|
+
3. **No application-readiness gate here.** Unlike `getCcPaymentIframeUrl()`, this endpoint does not require Start Application to be fully complete at request validation — it only checks that the opportunity exists and that payment has not already completed. Still call it after Start Application in the integration flow.
|
|
2822
|
+
4. A successful save **satisfies the payment prerequisite for [`finalSubmit()`](#final-submit)** — no charge runs again at final submit, and neither `paymentNotMade` nor `LatestPaymentNotSuccessful` will be returned for payment reasons.
|
|
1863
2823
|
|
|
1864
2824
|
|
|
1865
2825
|
***
|
|
@@ -1868,8 +2828,10 @@ Saves bank account details for premium payment. Call after Start Application, be
|
|
|
1868
2828
|
|
|
1869
2829
|
| Code | When |
|
|
1870
2830
|
|---|---|
|
|
1871
|
-
| `InvalidRequestFormat` | Any field validation failure — inspect `value.fields` |
|
|
1872
|
-
| `PaymentAlreadyMade` |
|
|
2831
|
+
| `InvalidRequestFormat` | Any field validation failure, or `opportunityId` does not exist — inspect `value.fields` |
|
|
2832
|
+
| `PaymentAlreadyMade` | A successful payment already exists for this opportunity (prior EFT save, or a card already charged) |
|
|
2833
|
+
|
|
2834
|
+
> A credit card that was only **captured** and not yet charged does not trigger `PaymentAlreadyMade` at request validation. Do not rely on that edge case — treat the two payment methods as mutually exclusive.
|
|
1873
2835
|
|
|
1874
2836
|
|
|
1875
2837
|
***
|
|
@@ -1900,7 +2862,7 @@ await client.saveEftPayment({
|
|
|
1900
2862
|
**Method:** `client.prepareDocsAndGetDeliveryChannels(opportunityId)`
|
|
1901
2863
|
|
|
1902
2864
|
|
|
1903
|
-
Always call this first in the signing flow. Prepares e-signature documents server-side and returns available delivery channels.
|
|
2865
|
+
Always call this first in the signing flow. Prepares e-signature documents server-side and returns available delivery channels. Applies to **ADB, GIGDB, and Final Expense**.
|
|
1904
2866
|
|
|
1905
2867
|
|
|
1906
2868
|
***
|
|
@@ -1917,6 +2879,8 @@ Always call this first in the signing flow. Prepares e-signature documents serve
|
|
|
1917
2879
|
### Business Rules
|
|
1918
2880
|
|
|
1919
2881
|
1. If `isSignCompleted = true`, documents are already signed — skip Send PIN, Resend PIN, and Verify PIN. Call Final Submit directly.
|
|
2882
|
+
2. `isSmsAvailable` / `isEmailAvailable` determine which channels may be selected in [Send PIN](#send-pin--get-documents-link) — only an available channel is accepted.
|
|
2883
|
+
3. **Start Application must have completed successfully** before this endpoint can be called. If not, it returns `ApplicationNotReady` — the same lifecycle gate [`getCcPaymentIframeUrl()`](#get-credit-card-iframe-url) applies.
|
|
1920
2884
|
|
|
1921
2885
|
|
|
1922
2886
|
***
|
|
@@ -1926,11 +2890,14 @@ Always call this first in the signing flow. Prepares e-signature documents serve
|
|
|
1926
2890
|
| Code | When |
|
|
1927
2891
|
|---|---|
|
|
1928
2892
|
| `InvalidRequestFormat` | `OpportunityId is required.` / `OpportunityId does not exist.` / `Documents are already signed.` (field-level) |
|
|
2893
|
+
| `ApplicationNotReady` | Start Application has not completed successfully, or signing was called too early. Message: `Application is not ready for e-signing. Complete Start Application successfully, then retry.` |
|
|
1929
2894
|
| `DocumentsAlreadySigned` | Documents already completed for this opportunity |
|
|
1930
2895
|
| `SecureSignRelatedError` | Generic SecureSign failure during document preparation — retry; if persistent, contact support |
|
|
1931
2896
|
|
|
1932
2897
|
> When signing is already complete, you may see `DocumentsAlreadySigned` or the `InvalidRequestFormat` field message `"Documents are already signed."` — both are terminal; do not retry Prepare Docs / Send PIN.
|
|
1933
2898
|
|
|
2899
|
+
> `ApplicationNotReady` is **retryable** — unlike the terminal codes above. Complete Start Application, then call this again.
|
|
2900
|
+
|
|
1934
2901
|
|
|
1935
2902
|
***
|
|
1936
2903
|
|
|
@@ -2161,7 +3128,7 @@ if (verifyResp.isVerified) {
|
|
|
2161
3128
|
**Method:** `client.finalSubmit(opportunityId)`
|
|
2162
3129
|
|
|
2163
3130
|
|
|
2164
|
-
Submits the signed application to the carrier.
|
|
3131
|
+
Submits the signed application to the carrier.
|
|
2165
3132
|
|
|
2166
3133
|
|
|
2167
3134
|
***
|
|
@@ -2170,9 +3137,7 @@ Submits the signed application to the carrier. Can only be called once per oppor
|
|
|
2170
3137
|
|
|
2171
3138
|
| Field | Type | Required | Validation Error |
|
|
2172
3139
|
|---|---|---|---|
|
|
2173
|
-
| `opportunityId` | `string` | Yes | `OpportunityId is required.` / `OpportunityId does not exist.`
|
|
2174
|
-
|
|
2175
|
-
> `"Application has already been final submitted."` is a terminal state — do not retry.
|
|
3140
|
+
| `opportunityId` | `string` | Yes | `OpportunityId is required.` / `OpportunityId does not exist.` |
|
|
2176
3141
|
|
|
2177
3142
|
> Throws `AuthenticationError` when `opportunityId` is not authorized for the current JWT.
|
|
2178
3143
|
|
|
@@ -2181,8 +3146,49 @@ Submits the signed application to the carrier. Can only be called once per oppor
|
|
|
2181
3146
|
|
|
2182
3147
|
### Business Rules
|
|
2183
3148
|
|
|
2184
|
-
1.
|
|
3149
|
+
1. **A repeat call after a successful submit is idempotent.** The API does not re-submit to the carrier or re-charge payment — it returns the existing result, including the same `policyNumber`. Do not guard against it client-side or treat it as an error.
|
|
2185
3150
|
2. `policyNumber` may be `null` — carrier decisions can be async/pending. A `null` on `flagStatus: true` is **not** an error.
|
|
3151
|
+
3. **Response shape differs by product:**
|
|
3152
|
+
- **ADB / GIGDB (synchronous):** `policyNumber` is a non-null string; `applicationStatus` is **absent**.
|
|
3153
|
+
- **Final Expense (asynchronous):** `policyNumber` is `null` and `applicationStatus` is `'InProgress'`. Check `applicationStatus === 'InProgress'` and then poll [`pollFinalExpenseUnderwritingStatus()`](#final-expense--underwriting-status-async).
|
|
3154
|
+
4. **Payment must already be successful.** How that is satisfied depends on the method:
|
|
3155
|
+
- **EFT (all products)** — collected at `saveEftPayment()`; no charge runs here.
|
|
3156
|
+
- **Credit card, ADB / GIGDB** — the captured card is charged here, and the application is submitted only if the charge succeeds. A decline returns a `Payment*` code and the application is **not** submitted.
|
|
3157
|
+
- **Credit card, Final Expense** — capture to `approved` is required, but InstaBrain does not charge here; the carrier collects after underwriting. Final Expense never returns a `Payment*` decline code.
|
|
3158
|
+
|
|
3159
|
+
|
|
3160
|
+
***
|
|
3161
|
+
|
|
3162
|
+
### Pre-Submit Gates
|
|
3163
|
+
|
|
3164
|
+
Three checks run in this order. They are **separate, distinguishable codes** — do not collapse the last two into one client-side case.
|
|
3165
|
+
|
|
3166
|
+
| Order | Code | Meaning | Recovery |
|
|
3167
|
+
|---|---|---|---|
|
|
3168
|
+
| 1 | `SecureSignNotCompleted` | Signing is not finished | Complete the PIN flow, or confirm `isSignCompleted` from prepare-docs |
|
|
3169
|
+
| 2 | `paymentNotMade` | Nothing to submit yet — no payment was started, **or** a card capture is still `pending` | Finish the iframe and poll to `approved`, or save EFT. While pending, **reuse the stored iframe URL** — do not request a new one |
|
|
3170
|
+
| 3 | `LatestPaymentNotSuccessful` | A payment was attempted and the latest attempt **failed** | Call `getCcPaymentIframeUrl()` for a new capture, poll to `approved`, then retry |
|
|
3171
|
+
|
|
3172
|
+
> The distinction matters: `paymentNotMade` means "keep waiting or start a payment"; `LatestPaymentNotSuccessful` means "a payment was tried and it failed — start a new capture." Retrying final submit after a decline without a new successful capture returns `LatestPaymentNotSuccessful`, not another decline code.
|
|
3173
|
+
|
|
3174
|
+
```typescript
|
|
3175
|
+
import { APIValidationError, APIErrorCode } from '@instabrain-sdks/api-client';
|
|
3176
|
+
|
|
3177
|
+
try {
|
|
3178
|
+
const resp = await client.finalSubmit(opportunityId);
|
|
3179
|
+
} catch (err) {
|
|
3180
|
+
if (err instanceof APIValidationError) {
|
|
3181
|
+
if (err.isErrorType(APIErrorCode.SecureSignNotCompleted)) {
|
|
3182
|
+
// Finish signing first
|
|
3183
|
+
} else if (err.isErrorType(APIErrorCode.PaymentNotMade)) {
|
|
3184
|
+
// Reuse the existing iframe URL and keep polling — do NOT request a new one
|
|
3185
|
+
} else if (err.isErrorType(APIErrorCode.LatestPaymentNotSuccessful)) {
|
|
3186
|
+
// Start a fresh capture
|
|
3187
|
+
const url = await client.getCcPaymentIframeUrl(opportunityId);
|
|
3188
|
+
}
|
|
3189
|
+
}
|
|
3190
|
+
}
|
|
3191
|
+
```
|
|
2186
3192
|
|
|
2187
3193
|
|
|
2188
3194
|
***
|
|
@@ -2191,9 +3197,12 @@ Submits the signed application to the carrier. Can only be called once per oppor
|
|
|
2191
3197
|
|
|
2192
3198
|
| Code | When |
|
|
2193
3199
|
|---|---|
|
|
2194
|
-
| `InvalidRequestFormat` | `opportunityId` missing
|
|
2195
|
-
| `
|
|
3200
|
+
| `InvalidRequestFormat` | `opportunityId` missing or not found |
|
|
3201
|
+
| `SecureSignNotCompleted` | Signing not complete — gate 1 |
|
|
3202
|
+
| `paymentNotMade` | No payment started, or card capture still pending — gate 2 |
|
|
3203
|
+
| `LatestPaymentNotSuccessful` | Latest payment attempt failed — gate 3 |
|
|
2196
3204
|
| `FidelityFinalSubmitError` | Fidelity carrier rejected or failed to process the final submission — contact support with the `opportunityId` |
|
|
3205
|
+
| `Payment*` decline codes | ADB / GIGDB only — the card charge was declined at final submit and the application was **not** submitted. See [Get credit card iframe URL](#get-credit-card-iframe-url) |
|
|
2197
3206
|
|
|
2198
3207
|
|
|
2199
3208
|
***
|
|
@@ -2202,7 +3211,8 @@ Submits the signed application to the carrier. Can only be called once per oppor
|
|
|
2202
3211
|
|
|
2203
3212
|
| Field | Type | Description |
|
|
2204
3213
|
|---|---|---|
|
|
2205
|
-
| `policyNumber` | `string\|null` | Issued policy number.
|
|
3214
|
+
| `policyNumber` | `string\|null` | Issued policy number. `null` while pending (sync) or always on the first call (Final Expense, async). |
|
|
3215
|
+
| `applicationStatus` | `'InProgress'` (optional) | Present only for Final Expense (async underwriting). Absent for ADB/GIGDB. When `'InProgress'`, poll for the decision. |
|
|
2206
3216
|
|
|
2207
3217
|
|
|
2208
3218
|
***
|
|
@@ -2212,8 +3222,12 @@ Submits the signed application to the carrier. Can only be called once per oppor
|
|
|
2212
3222
|
```typescript
|
|
2213
3223
|
const submitResp = await client.finalSubmit(opportunityId);
|
|
2214
3224
|
|
|
2215
|
-
|
|
2216
|
-
|
|
3225
|
+
if (submitResp.applicationStatus === 'InProgress') {
|
|
3226
|
+
// Final Expense — async underwriting. Poll for the carrier decision.
|
|
3227
|
+
const decision = await client.pollFinalExpenseUnderwritingStatus(opportunityId);
|
|
3228
|
+
console.log('Final status:', decision.applicationStatus, decision.policyNumber);
|
|
3229
|
+
} else if (submitResp.policyNumber) {
|
|
3230
|
+
// ADB / GIGDB — synchronous.
|
|
2217
3231
|
console.log('Policy issued:', submitResp.policyNumber);
|
|
2218
3232
|
} else {
|
|
2219
3233
|
console.log('Submission accepted — policy number pending carrier decision');
|
|
@@ -2476,10 +3490,24 @@ Named entity types: `Business` · `Corporation` · `CharitableOrganization` · `
|
|
|
2476
3490
|
```
|
|
2477
3491
|
InstaBrainError
|
|
2478
3492
|
├── AuthenticationError — invalid credentials, expired JWT, or unauthorized opportunityId
|
|
2479
|
-
├── ValidationError —
|
|
2480
|
-
└── APIValidationError —
|
|
3493
|
+
├── ValidationError — retained for backward compatibility; no longer thrown by the SDK
|
|
3494
|
+
└── APIValidationError — business / validation failure (check APIErrorCode)
|
|
3495
|
+
```
|
|
3496
|
+
|
|
3497
|
+
**`APIValidationError` covers both failure shapes.** The API reports a rejected request two ways — HTTP `400` with a top-level `error`, or HTTP `200` with `flagStatus: false` — and which one you get varies by endpoint. Both now produce an `APIValidationError` with the same `errorCode` and `response`, so a single `catch` handles either:
|
|
3498
|
+
|
|
3499
|
+
```typescript
|
|
3500
|
+
catch (err) {
|
|
3501
|
+
if (err instanceof APIValidationError) {
|
|
3502
|
+
err.isErrorType(APIErrorCode.ApplicationNotReady); // works on both paths
|
|
3503
|
+
err.getUserFriendlyMessage();
|
|
3504
|
+
err.response?.value?.fields; // per-field detail
|
|
3505
|
+
}
|
|
3506
|
+
}
|
|
2481
3507
|
```
|
|
2482
3508
|
|
|
3509
|
+
> `ValidationError` is still exported so existing `import` statements keep compiling, but nothing in the SDK throws it. If you have a `catch` branch testing `err instanceof ValidationError`, switch it to `APIValidationError`.
|
|
3510
|
+
|
|
2483
3511
|
|
|
2484
3512
|
***
|
|
2485
3513
|
|
|
@@ -2553,25 +3581,36 @@ if (err instanceof APIValidationError && err.isErrorType(APIErrorCode.InvalidReq
|
|
|
2553
3581
|
|
|
2554
3582
|
Active `APIErrorCode` enum members match the tables below. Compare failures with `err.isErrorType(APIErrorCode.X)` — do not rely on raw string casing; use the **String Value** column when logging or debugging.
|
|
2555
3583
|
|
|
2556
|
-
|
|
3584
|
+
Some enum members remain in the package for backward compatibility but are **not** listed here; the API surfaces those cases via `InvalidRequestFormat` and `value.fields` instead. Note that scope is **per product** — a code that is field-level for one product can be a top-level business code for another, so a member being absent from one product's table does not make it dead.
|
|
2557
3585
|
|
|
2558
3586
|
|
|
2559
3587
|
***
|
|
2560
3588
|
|
|
2561
3589
|
### Quote Errors
|
|
2562
3590
|
|
|
2563
|
-
| Code | String Value |
|
|
2564
|
-
|
|
2565
|
-
| `InvalidRequestFormat` | `'InvalidRequestFormat'` |
|
|
2566
|
-
| `StateNotFound` | `'stateNotFound'` |
|
|
2567
|
-
| `AgeNotFound` | `'AgeNotFound'` |
|
|
2568
|
-
| `NotAvailableForState` | `'NotAvailableForState'` |
|
|
2569
|
-
| `QuoteNotEligibleForGivenConditions` | `'QuoteNotEligibleForGivenConditions'` |
|
|
2570
|
-
| `CoverageNotAvailable` | `'CoverageNotAvailable'` |
|
|
2571
|
-
| `RiderNotAvailable` | `'RiderNotAvailable'` |
|
|
2572
|
-
| `RiderFaceAmountNotValid` | `'RiderFaceAmountNotValid'` |
|
|
2573
|
-
| `BenefitPeriodNotAvailable` | `'BenefitPeriodNotAvailable'` |
|
|
2574
|
-
| `OutsideBuildChart` | `'outsideBuildChart'` |
|
|
3591
|
+
| Code | String Value | When |
|
|
3592
|
+
|---|---|---|
|
|
3593
|
+
| `InvalidRequestFormat` | `'InvalidRequestFormat'` | Any field validation failure — inspect `value.fields` |
|
|
3594
|
+
| `StateNotFound` | `'stateNotFound'` | State code not recognized |
|
|
3595
|
+
| `AgeNotFound` | `'AgeNotFound'` | Neither age nor date of birth supplied, or age could not be derived |
|
|
3596
|
+
| `NotAvailableForState` | `'NotAvailableForState'` | Product not available in state |
|
|
3597
|
+
| `QuoteNotEligibleForGivenConditions` | `'QuoteNotEligibleForGivenConditions'` | State/age/nicotine combo not eligible |
|
|
3598
|
+
| `CoverageNotAvailable` | `'CoverageNotAvailable'` | Face amount out of range |
|
|
3599
|
+
| `RiderNotAvailable` | `'RiderNotAvailable'` | Rider unavailable for product/state |
|
|
3600
|
+
| `RiderFaceAmountNotValid` | `'RiderFaceAmountNotValid'` | Rider face amount out of range |
|
|
3601
|
+
| `BenefitPeriodNotAvailable` | `'BenefitPeriodNotAvailable'` | Benefit period not allowed for state/age/nicotine |
|
|
3602
|
+
| `OutsideBuildChart` | `'outsideBuildChart'` | Height & weight provided and outside carrier build chart |
|
|
3603
|
+
| `HeightNotValid` | `'HeightNotValid'` | `height.feet` / `height.inches` out of range (feet 1–8, inches 0–11) |
|
|
3604
|
+
|
|
3605
|
+
**Which codes each product returns** — the rider codes are the main difference, so branch per product rather than assuming one shared list:
|
|
3606
|
+
|
|
3607
|
+
| Product | Business codes returned as top-level `error` |
|
|
3608
|
+
|---|---|
|
|
3609
|
+
| **ADB** | `QuoteNotEligibleForGivenConditions`, `NotAvailableForState`, `CoverageNotAvailable`, `RiderNotAvailable`, `RiderFaceAmountNotValid` |
|
|
3610
|
+
| **GIGDB** | `QuoteNotEligibleForGivenConditions`, `NotAvailableForState`, `CoverageNotAvailable` — rider codes do **not** apply |
|
|
3611
|
+
| **Final Expense** | `stateNotFound`, `AgeNotFound`, `HeightNotValid`, `BenefitPeriodNotAvailable`, `QuoteNotEligibleForGivenConditions`, `NotAvailableForState`, `CoverageNotAvailable` |
|
|
3612
|
+
| **IB Term** | `BenefitPeriodNotAvailable`, `CoverageNotAvailable`, `outsideBuildChart`, `QuoteNotEligibleForGivenConditions`, `NotAvailableForState`, `RiderNotAvailable`, `RiderFaceAmountNotValid` |
|
|
3613
|
+
| **Pure Term** | Same set as IB Term. Request validation produces dedicated codes only for `BenefitPeriodNotAvailable` / `CoverageNotAvailable` (everything else is field-level `InvalidRequestFormat`), but the shared eligibility pipeline that runs **after** validation can still return `NotAvailableForState`, `QuoteNotEligibleForGivenConditions`, `RiderNotAvailable`, `RiderFaceAmountNotValid`, and `outsideBuildChart` |
|
|
2575
3614
|
|
|
2576
3615
|
|
|
2577
3616
|
***
|
|
@@ -2580,10 +3619,21 @@ Deprecated enum members (`QuoteNotFound`, `HeightNotValid`, `DocumentsNotViewed`
|
|
|
2580
3619
|
|
|
2581
3620
|
| Code | String Value | Products | When |
|
|
2582
3621
|
|---|---|---|---|
|
|
2583
|
-
| `ApplicationLimitReached` | `'ApplicationLimitReached'` | ADB, GIGDB | Same SSN/email/phone has policy within last 30 days. Not used by IB Term. |
|
|
3622
|
+
| `ApplicationLimitReached` | `'ApplicationLimitReached'` | ADB, GIGDB, Final Expense | Same SSN/email/phone has policy within last 30 days. Not used by IB Term or Pure Term. |
|
|
2584
3623
|
| `StateMismatchIdentified` | `'StateMismatchIdentified'` | All | Quote state ≠ application address state — re-quote |
|
|
2585
3624
|
| `AgentNotFound` | `'agentNotFound'` | All | Quote cannot be linked to agent account — verify credentials |
|
|
2586
3625
|
| `InternalServerError` | `'internalServerError'` | All | Unexpected backend failure — retry; if persistent contact support |
|
|
3626
|
+
| `DataNotFound` | `'dataNotFound'` | IB Term, Pure Term | The quote referenced by `quoteResponseId` could not be found — create a new quote |
|
|
3627
|
+
|
|
3628
|
+
**Three outcome shapes — do not conflate them.** Start Application distinguishes field validation, business failure, and knockout:
|
|
3629
|
+
|
|
3630
|
+
| Outcome | HTTP | Response shape | Codes |
|
|
3631
|
+
|---|---|---|---|
|
|
3632
|
+
| **Field validation** | `400` | `value.fields` populated with per-field messages | `InvalidRequestFormat`, `ApplicationLimitReached` |
|
|
3633
|
+
| **Business failure** | `400` | `value: null`, top-level `error` | `StateMismatchIdentified`, `agentNotFound`, `internalServerError`, `dataNotFound` |
|
|
3634
|
+
| **Decline / knockout** | **`200`** | `flagStatus: true`, `value.isDeclined: true` | **None** — a knockout is *not* an error code and the SDK does **not** throw |
|
|
3635
|
+
|
|
3636
|
+
> The decline row is the one that trips integrations up: a knockout arrives as a **successful** response. Check `resp.isDeclined` explicitly — it will never reach your `catch` block.
|
|
2587
3637
|
|
|
2588
3638
|
|
|
2589
3639
|
***
|
|
@@ -2592,7 +3642,9 @@ Deprecated enum members (`QuoteNotFound`, `HeightNotValid`, `DocumentsNotViewed`
|
|
|
2592
3642
|
|
|
2593
3643
|
| Code | String Value | Products | When |
|
|
2594
3644
|
|---|---|---|---|
|
|
2595
|
-
| `PaymentAlreadyMade` | `'PaymentAlreadyMade'` | ADB, GIGDB | `update*Quote()` or `saveEftPayment()`
|
|
3645
|
+
| `PaymentAlreadyMade` | `'PaymentAlreadyMade'` | ADB, GIGDB, Final Expense | `update*Quote()` or `saveEftPayment()` when a **successful** payment already exists — a prior EFT save, or a card already charged. A card that was only captured and not yet charged does not trigger this |
|
|
3646
|
+
| `EftPaymentAlreadyCompleted` | `'EftPaymentAlreadyCompleted'` | ADB, GIGDB, Final Expense | `getCcPaymentIframeUrl()` after a successful EFT save — the two methods are mutually exclusive per opportunity |
|
|
3647
|
+
| `ApplicationNotReady` | `'ApplicationNotReady'` | ADB, GIGDB, Final Expense | `getCcPaymentIframeUrl()` or `prepareDocsAndGetDeliveryChannels()` before Start Application has completed successfully. **Retryable** — complete Start Application, then call again |
|
|
2596
3648
|
|
|
2597
3649
|
|
|
2598
3650
|
***
|
|
@@ -2617,8 +3669,11 @@ Deprecated enum members (`QuoteNotFound`, `HeightNotValid`, `DocumentsNotViewed`
|
|
|
2617
3669
|
|
|
2618
3670
|
| Code | String Value | When |
|
|
2619
3671
|
|---|---|---|
|
|
2620
|
-
| `
|
|
3672
|
+
| `SecureSignNotCompleted` | `'SecureSignNotCompleted'` | **Gate 1** — signing not finished. Complete the PIN flow, or confirm `isSignCompleted` from prepare-docs |
|
|
3673
|
+
| `PaymentNotMade` | `'paymentNotMade'` | **Gate 2** — nothing to submit yet: no payment was started, **or** a card capture is still `pending`. Finish the capture and poll to `approved`, or call `saveEftPayment()`. Reuse the stored iframe URL while pending |
|
|
3674
|
+
| `LatestPaymentNotSuccessful` | `'LatestPaymentNotSuccessful'` | **Gate 3** — a payment was attempted and the latest attempt **failed**. Call `getCcPaymentIframeUrl()` for a new capture, poll to `approved`, then retry |
|
|
2621
3675
|
| `FidelityFinalSubmitError` | `'FidelityFinalSubmitError'` | Fidelity carrier rejected or failed to process the submission — contact support with the `opportunityId` |
|
|
3676
|
+
| `FinalSubmitStatusNotSupported` | `'FinalSubmitStatusNotSupported'` | Underwriting status polling attempted for a non-Final-Expense product — `pingFinalExpenseUnderwritingStatus()` / `pollFinalExpenseUnderwritingStatus()` are Final Expense only |
|
|
2622
3677
|
|
|
2623
3678
|
|
|
2624
3679
|
***
|