@instabrain-sdks/api-client 2.6.0 → 2.7.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 +430 -53
- package/dist/client/instabrain-client.d.ts +49 -13
- package/dist/client/instabrain-client.js +49 -13
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -1
- package/dist/services/adb.service.d.ts +1 -1
- package/dist/services/adb.service.js +1 -1
- package/dist/services/application.service.d.ts +9 -2
- package/dist/services/application.service.js +9 -2
- package/dist/services/finalexpense.service.d.ts +1 -1
- package/dist/services/finalexpense.service.js +1 -1
- package/dist/services/gigdb.service.d.ts +19 -8
- package/dist/services/gigdb.service.js +20 -9
- package/dist/services/ibterm.service.d.ts +17 -5
- package/dist/services/ibterm.service.js +17 -5
- package/dist/services/pureterm.service.d.ts +12 -4
- package/dist/services/pureterm.service.js +12 -4
- package/dist/types/application.types.d.ts +27 -5
- package/dist/types/constants.d.ts +11 -0
- package/dist/types/constants.js +12 -1
- package/dist/types/enums.d.ts +17 -4
- package/dist/types/enums.js +18 -4
- package/dist/types/errors.d.ts +4 -4
- package/dist/types/errors.js +3 -2
- package/dist/types/gigdb.types.d.ts +34 -7
- package/dist/types/ibterm.types.d.ts +9 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/webhook.types.d.ts +55 -0
- package/dist/types/webhook.types.js +3 -0
- package/dist/utils/webhook-signature.d.ts +72 -0
- package/dist/utils/webhook-signature.js +172 -0
- package/package.json +19 -13
|
@@ -48,9 +48,20 @@ export declare class InstaBrainClient {
|
|
|
48
48
|
*/
|
|
49
49
|
getQuote(quoteRequest: ThirdPartyQuoteReq): Promise<ThirdPartyQuoteResp>;
|
|
50
50
|
/**
|
|
51
|
-
* Start an
|
|
51
|
+
* Start an application from a quote via the generic
|
|
52
|
+
* `POST /api/ThirdPartyStartApp/start-application` endpoint.
|
|
53
|
+
*
|
|
54
|
+
* Returns `opportunityId` plus `agentLink`, `applicantLink`, and `eAppAgentLink`.
|
|
55
|
+
* Pass `proCode` to start a specific product variant. For IB Term and Pure Term,
|
|
56
|
+
* InstaBrain recommends the dedicated `startIBTermApplication()` /
|
|
57
|
+
* `startPureTermApplication()` instead.
|
|
58
|
+
*
|
|
59
|
+
* Optionally opt in to application-status webhooks with
|
|
60
|
+
* `webhookRegistrationDetails`, and verify each delivery with
|
|
61
|
+
* `verifyWebhookSignature()`.
|
|
62
|
+
*
|
|
52
63
|
* @param applicationRequest - The application request parameters
|
|
53
|
-
* @returns Promise with the application
|
|
64
|
+
* @returns Promise with `opportunityId` and the application links
|
|
54
65
|
*/
|
|
55
66
|
startApplication(applicationRequest: ThirdPartyStartApplicationReq): Promise<ThirdPartyStartAppResp>;
|
|
56
67
|
/**
|
|
@@ -85,12 +96,21 @@ export declare class InstaBrainClient {
|
|
|
85
96
|
*/
|
|
86
97
|
startGigdbApplication(request: ThirdPartyGigdbAppReq): Promise<ThirdPartyStartAppResp>;
|
|
87
98
|
/**
|
|
88
|
-
* Save EFT payment details for
|
|
89
|
-
*
|
|
90
|
-
*
|
|
99
|
+
* Save EFT (bank account) payment details for an application. Shared across
|
|
100
|
+
* all products. Call after start-application and, for full-flow products,
|
|
101
|
+
* before the SecureSign flow.
|
|
102
|
+
*
|
|
103
|
+
* `accountHolderName` is required: at most 100 characters and, in practice,
|
|
104
|
+
* about 35 under the name format rules. `routingNumber` is 9 digits;
|
|
105
|
+
* `accountNumber` is 4–17.
|
|
91
106
|
*
|
|
92
|
-
* `
|
|
93
|
-
*
|
|
107
|
+
* **Pay Later:** send `payLaterDate` (`yyyy-MM-dd`, date only) to schedule the
|
|
108
|
+
* draft; omit it to draft immediately. The date must be after today in **UTC**
|
|
109
|
+
* and no later than the earlier of the pay later window (30 days by default)
|
|
110
|
+
* and the applicant's next birthday (the birthday itself is allowed); nothing
|
|
111
|
+
* is accepted on the applicant's birthday (UTC date). Failures return
|
|
112
|
+
* `InvalidPaymentScheduledDate`, or `PayLaterNotAvailable` when Pay Later is
|
|
113
|
+
* switched off on the platform; both carry `value.fields.PayLaterDate`.
|
|
94
114
|
*
|
|
95
115
|
* EFT and credit card are mutually exclusive per opportunity — a successful
|
|
96
116
|
* payment that already exists returns `PaymentAlreadyMade`, and after a
|
|
@@ -98,8 +118,10 @@ export declare class InstaBrainClient {
|
|
|
98
118
|
* `EftPaymentAlreadyCompleted`. A successful save satisfies the payment
|
|
99
119
|
* prerequisite for `finalSubmit()`; no charge runs again at final submit.
|
|
100
120
|
*
|
|
101
|
-
* @param request - The EFT payment request with opportunityId
|
|
102
|
-
* @returns
|
|
121
|
+
* @param request - The EFT payment request with opportunityId, bank account details, and optional payLaterDate
|
|
122
|
+
* @returns Resolves on success; failures throw. The declared type is `boolean`
|
|
123
|
+
* for backward compatibility — at runtime the value is the API's per-field
|
|
124
|
+
* validation result object, which is truthy.
|
|
103
125
|
*/
|
|
104
126
|
saveEftPayment(request: ThirdPartyEftPaymentReq): Promise<boolean>;
|
|
105
127
|
/**
|
|
@@ -181,9 +203,16 @@ export declare class InstaBrainClient {
|
|
|
181
203
|
/**
|
|
182
204
|
* Start an IB Term application from a prior IB Term quote.
|
|
183
205
|
*
|
|
184
|
-
* `isDeclined: true` is a valid success response
|
|
206
|
+
* `isDeclined: true` is a valid success response, not an error. Read it together
|
|
207
|
+
* with `opportunityId`: an empty or all-zero id is a knockout — no application
|
|
208
|
+
* exists, so stop. A real id means the application exists but was declined —
|
|
209
|
+
* keep the id and any returned links.
|
|
185
210
|
* IB Term does NOT use `ApplicationLimitReached` (that applies to ADB/GIGDB only).
|
|
186
211
|
*
|
|
212
|
+
* Optionally opt in to application-status webhooks with
|
|
213
|
+
* `webhookRegistrationDetails`, and verify each delivery with
|
|
214
|
+
* `verifyWebhookSignature()`.
|
|
215
|
+
*
|
|
187
216
|
* @param request - The IB Term application request payload
|
|
188
217
|
* @returns Promise with opportunityId, isDeclined flag, and isQuoteChanged
|
|
189
218
|
*/
|
|
@@ -252,16 +281,23 @@ export declare class InstaBrainClient {
|
|
|
252
281
|
/**
|
|
253
282
|
* Start a Pure Term application from a prior Pure Term quote.
|
|
254
283
|
*
|
|
255
|
-
* Dedicated endpoint — separate from the generic `startApplication()
|
|
256
|
-
*
|
|
284
|
+
* Dedicated endpoint — separate from the generic `startApplication()`. Do not
|
|
285
|
+
* substitute one for the other.
|
|
257
286
|
*
|
|
258
|
-
* `isDeclined: true` is a valid success response
|
|
287
|
+
* `isDeclined: true` is a valid success response, not an error. Read it together
|
|
288
|
+
* with `opportunityId`: an empty or all-zero id is a knockout — no application
|
|
289
|
+
* exists, so stop. A real id means the application exists but was declined —
|
|
290
|
+
* keep the id and any returned links.
|
|
259
291
|
* Pure Term does NOT use `ApplicationLimitReached` (ADB / GIGDB / Final Expense
|
|
260
292
|
* only). `childRiderInfo` must be sent only when the Dependent Child Rider was
|
|
261
293
|
* on the quote. After a non-declined start, hand off via the returned links —
|
|
262
294
|
* do not wire this `opportunityId` into SecureSign, `finalSubmit()`, or the
|
|
263
295
|
* credit-card iframe.
|
|
264
296
|
*
|
|
297
|
+
* Optionally opt in to application-status webhooks with
|
|
298
|
+
* `webhookRegistrationDetails`, and verify each delivery with
|
|
299
|
+
* `verifyWebhookSignature()`.
|
|
300
|
+
*
|
|
265
301
|
* @param request - The Pure Term application request payload
|
|
266
302
|
* @returns Promise with opportunityId, links, isDeclined flag, and isQuoteChanged
|
|
267
303
|
*/
|
|
@@ -63,9 +63,20 @@ class InstaBrainClient {
|
|
|
63
63
|
return this.quote.getQuote(quoteRequest);
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
66
|
-
* Start an
|
|
66
|
+
* Start an application from a quote via the generic
|
|
67
|
+
* `POST /api/ThirdPartyStartApp/start-application` endpoint.
|
|
68
|
+
*
|
|
69
|
+
* Returns `opportunityId` plus `agentLink`, `applicantLink`, and `eAppAgentLink`.
|
|
70
|
+
* Pass `proCode` to start a specific product variant. For IB Term and Pure Term,
|
|
71
|
+
* InstaBrain recommends the dedicated `startIBTermApplication()` /
|
|
72
|
+
* `startPureTermApplication()` instead.
|
|
73
|
+
*
|
|
74
|
+
* Optionally opt in to application-status webhooks with
|
|
75
|
+
* `webhookRegistrationDetails`, and verify each delivery with
|
|
76
|
+
* `verifyWebhookSignature()`.
|
|
77
|
+
*
|
|
67
78
|
* @param applicationRequest - The application request parameters
|
|
68
|
-
* @returns Promise with the application
|
|
79
|
+
* @returns Promise with `opportunityId` and the application links
|
|
69
80
|
*/
|
|
70
81
|
async startApplication(applicationRequest) {
|
|
71
82
|
return this.application.startApplication(applicationRequest);
|
|
@@ -112,12 +123,21 @@ class InstaBrainClient {
|
|
|
112
123
|
return this.gigdb.startApplication(request);
|
|
113
124
|
}
|
|
114
125
|
/**
|
|
115
|
-
* Save EFT payment details for
|
|
116
|
-
*
|
|
117
|
-
*
|
|
126
|
+
* Save EFT (bank account) payment details for an application. Shared across
|
|
127
|
+
* all products. Call after start-application and, for full-flow products,
|
|
128
|
+
* before the SecureSign flow.
|
|
129
|
+
*
|
|
130
|
+
* `accountHolderName` is required: at most 100 characters and, in practice,
|
|
131
|
+
* about 35 under the name format rules. `routingNumber` is 9 digits;
|
|
132
|
+
* `accountNumber` is 4–17.
|
|
118
133
|
*
|
|
119
|
-
* `
|
|
120
|
-
*
|
|
134
|
+
* **Pay Later:** send `payLaterDate` (`yyyy-MM-dd`, date only) to schedule the
|
|
135
|
+
* draft; omit it to draft immediately. The date must be after today in **UTC**
|
|
136
|
+
* and no later than the earlier of the pay later window (30 days by default)
|
|
137
|
+
* and the applicant's next birthday (the birthday itself is allowed); nothing
|
|
138
|
+
* is accepted on the applicant's birthday (UTC date). Failures return
|
|
139
|
+
* `InvalidPaymentScheduledDate`, or `PayLaterNotAvailable` when Pay Later is
|
|
140
|
+
* switched off on the platform; both carry `value.fields.PayLaterDate`.
|
|
121
141
|
*
|
|
122
142
|
* EFT and credit card are mutually exclusive per opportunity — a successful
|
|
123
143
|
* payment that already exists returns `PaymentAlreadyMade`, and after a
|
|
@@ -125,8 +145,10 @@ class InstaBrainClient {
|
|
|
125
145
|
* `EftPaymentAlreadyCompleted`. A successful save satisfies the payment
|
|
126
146
|
* prerequisite for `finalSubmit()`; no charge runs again at final submit.
|
|
127
147
|
*
|
|
128
|
-
* @param request - The EFT payment request with opportunityId
|
|
129
|
-
* @returns
|
|
148
|
+
* @param request - The EFT payment request with opportunityId, bank account details, and optional payLaterDate
|
|
149
|
+
* @returns Resolves on success; failures throw. The declared type is `boolean`
|
|
150
|
+
* for backward compatibility — at runtime the value is the API's per-field
|
|
151
|
+
* validation result object, which is truthy.
|
|
130
152
|
*/
|
|
131
153
|
async saveEftPayment(request) {
|
|
132
154
|
return this.gigdb.saveEftPayment(request);
|
|
@@ -230,9 +252,16 @@ class InstaBrainClient {
|
|
|
230
252
|
/**
|
|
231
253
|
* Start an IB Term application from a prior IB Term quote.
|
|
232
254
|
*
|
|
233
|
-
* `isDeclined: true` is a valid success response
|
|
255
|
+
* `isDeclined: true` is a valid success response, not an error. Read it together
|
|
256
|
+
* with `opportunityId`: an empty or all-zero id is a knockout — no application
|
|
257
|
+
* exists, so stop. A real id means the application exists but was declined —
|
|
258
|
+
* keep the id and any returned links.
|
|
234
259
|
* IB Term does NOT use `ApplicationLimitReached` (that applies to ADB/GIGDB only).
|
|
235
260
|
*
|
|
261
|
+
* Optionally opt in to application-status webhooks with
|
|
262
|
+
* `webhookRegistrationDetails`, and verify each delivery with
|
|
263
|
+
* `verifyWebhookSignature()`.
|
|
264
|
+
*
|
|
236
265
|
* @param request - The IB Term application request payload
|
|
237
266
|
* @returns Promise with opportunityId, isDeclined flag, and isQuoteChanged
|
|
238
267
|
*/
|
|
@@ -312,16 +341,23 @@ class InstaBrainClient {
|
|
|
312
341
|
/**
|
|
313
342
|
* Start a Pure Term application from a prior Pure Term quote.
|
|
314
343
|
*
|
|
315
|
-
* Dedicated endpoint — separate from the generic `startApplication()
|
|
316
|
-
*
|
|
344
|
+
* Dedicated endpoint — separate from the generic `startApplication()`. Do not
|
|
345
|
+
* substitute one for the other.
|
|
317
346
|
*
|
|
318
|
-
* `isDeclined: true` is a valid success response
|
|
347
|
+
* `isDeclined: true` is a valid success response, not an error. Read it together
|
|
348
|
+
* with `opportunityId`: an empty or all-zero id is a knockout — no application
|
|
349
|
+
* exists, so stop. A real id means the application exists but was declined —
|
|
350
|
+
* keep the id and any returned links.
|
|
319
351
|
* Pure Term does NOT use `ApplicationLimitReached` (ADB / GIGDB / Final Expense
|
|
320
352
|
* only). `childRiderInfo` must be sent only when the Dependent Child Rider was
|
|
321
353
|
* on the quote. After a non-declined start, hand off via the returned links —
|
|
322
354
|
* do not wire this `opportunityId` into SecureSign, `finalSubmit()`, or the
|
|
323
355
|
* credit-card iframe.
|
|
324
356
|
*
|
|
357
|
+
* Optionally opt in to application-status webhooks with
|
|
358
|
+
* `webhookRegistrationDetails`, and verify each delivery with
|
|
359
|
+
* `verifyWebhookSignature()`.
|
|
360
|
+
*
|
|
325
361
|
* @param request - The Pure Term application request payload
|
|
326
362
|
* @returns Promise with opportunityId, links, isDeclined flag, and isQuoteChanged
|
|
327
363
|
*/
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -14,12 +14,16 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.default = exports.InstaBrainClient = void 0;
|
|
17
|
+
exports.default = exports.WEBHOOK_HEADERS = exports.verifyWebhookSignature = exports.InstaBrainClient = void 0;
|
|
18
18
|
// Main exports
|
|
19
19
|
var instabrain_client_1 = require("./client/instabrain-client");
|
|
20
20
|
Object.defineProperty(exports, "InstaBrainClient", { enumerable: true, get: function () { return instabrain_client_1.InstaBrainClient; } });
|
|
21
21
|
// Type exports
|
|
22
22
|
__exportStar(require("./types"), exports);
|
|
23
|
+
// Webhook signature verification (receiving side of application-status webhooks)
|
|
24
|
+
var webhook_signature_1 = require("./utils/webhook-signature");
|
|
25
|
+
Object.defineProperty(exports, "verifyWebhookSignature", { enumerable: true, get: function () { return webhook_signature_1.verifyWebhookSignature; } });
|
|
26
|
+
Object.defineProperty(exports, "WEBHOOK_HEADERS", { enumerable: true, get: function () { return webhook_signature_1.WEBHOOK_HEADERS; } });
|
|
23
27
|
// Default export
|
|
24
28
|
var instabrain_client_2 = require("./client/instabrain-client");
|
|
25
29
|
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return instabrain_client_2.InstaBrainClient; } });
|
|
@@ -9,7 +9,7 @@ import { ThirdPartyAdbQuoteRequest, ThirdPartyAdbUpdateQuoteReq, ThirdPartyAdbAp
|
|
|
9
9
|
* Flow:
|
|
10
10
|
* 1. getQuote() → quoteResponseId
|
|
11
11
|
* 2. startApplication() → opportunityId (or isDeclined=true)
|
|
12
|
-
* 3. GigdbService.saveEftPayment() →
|
|
12
|
+
* 3. GigdbService.saveEftPayment() → resolves on success (shared endpoint — use via InstaBrainClient.saveEftPayment)
|
|
13
13
|
* 4. SecureSign flow → (shared — use SecureSignService)
|
|
14
14
|
* 5. Final Submit → (shared — use ApplicationService.finalSubmit)
|
|
15
15
|
*/
|
|
@@ -10,7 +10,7 @@ const base_service_1 = require("./base.service");
|
|
|
10
10
|
* Flow:
|
|
11
11
|
* 1. getQuote() → quoteResponseId
|
|
12
12
|
* 2. startApplication() → opportunityId (or isDeclined=true)
|
|
13
|
-
* 3. GigdbService.saveEftPayment() →
|
|
13
|
+
* 3. GigdbService.saveEftPayment() → resolves on success (shared endpoint — use via InstaBrainClient.saveEftPayment)
|
|
14
14
|
* 4. SecureSign flow → (shared — use SecureSignService)
|
|
15
15
|
* 5. Final Submit → (shared — use ApplicationService.finalSubmit)
|
|
16
16
|
*/
|
|
@@ -7,9 +7,16 @@ import { ThirdPartyStartApplicationReq, ThirdPartyStartAppResp, ThirdPartyFinalS
|
|
|
7
7
|
export declare class ApplicationService extends BaseService {
|
|
8
8
|
constructor(httpClient: HttpClient);
|
|
9
9
|
/**
|
|
10
|
-
* Start an
|
|
10
|
+
* Start an application via the generic
|
|
11
|
+
* `POST /api/ThirdPartyStartApp/start-application` endpoint.
|
|
12
|
+
*
|
|
13
|
+
* Accepts optional `webhookRegistrationDetails` to opt in to application-status
|
|
14
|
+
* webhooks. When sent, both `callbackUrl` (absolute HTTPS) and `secretKey` are
|
|
15
|
+
* required; invalid details fail with HTTP 400 `InvalidRequestFormat` and no
|
|
16
|
+
* application is created.
|
|
17
|
+
*
|
|
11
18
|
* @param applicationRequest - The application request parameters
|
|
12
|
-
* @returns Promise with the application
|
|
19
|
+
* @returns Promise with `opportunityId` and the application links
|
|
13
20
|
*/
|
|
14
21
|
startApplication(applicationRequest: ThirdPartyStartApplicationReq): Promise<ThirdPartyStartAppResp>;
|
|
15
22
|
/**
|
|
@@ -10,9 +10,16 @@ class ApplicationService extends base_service_1.BaseService {
|
|
|
10
10
|
super(httpClient);
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* Start an
|
|
13
|
+
* Start an application via the generic
|
|
14
|
+
* `POST /api/ThirdPartyStartApp/start-application` endpoint.
|
|
15
|
+
*
|
|
16
|
+
* Accepts optional `webhookRegistrationDetails` to opt in to application-status
|
|
17
|
+
* webhooks. When sent, both `callbackUrl` (absolute HTTPS) and `secretKey` are
|
|
18
|
+
* required; invalid details fail with HTTP 400 `InvalidRequestFormat` and no
|
|
19
|
+
* application is created.
|
|
20
|
+
*
|
|
14
21
|
* @param applicationRequest - The application request parameters
|
|
15
|
-
* @returns Promise with the application
|
|
22
|
+
* @returns Promise with `opportunityId` and the application links
|
|
16
23
|
*/
|
|
17
24
|
async startApplication(applicationRequest) {
|
|
18
25
|
return this.post('start application', '/api/ThirdPartyStartApp/start-application', applicationRequest);
|
|
@@ -8,7 +8,7 @@ import { ThirdPartyFinalExpenseQuoteReq, ThirdPartyFinalExpenseQuoteRes, ThirdPa
|
|
|
8
8
|
* Fidelity Life. Full flow (same as GIGDB / ADB):
|
|
9
9
|
* 1. getQuote() → quoteResponseId
|
|
10
10
|
* 2. startApplication() → opportunityId (or isDeclined=true)
|
|
11
|
-
* 3. InstaBrainClient.saveEftPayment() →
|
|
11
|
+
* 3. InstaBrainClient.saveEftPayment() → resolves on success (shared endpoint)
|
|
12
12
|
* 4. SecureSign flow → (shared — use SecureSignService)
|
|
13
13
|
* 5. InstaBrainClient.finalSubmit() → applicationStatus: 'InProgress' (async!)
|
|
14
14
|
* 6. pollUnderwritingStatus() → terminal status + policyNumber
|
|
@@ -22,7 +22,7 @@ const RATE_LIMIT_RETRY_MS = 2000;
|
|
|
22
22
|
* Fidelity Life. Full flow (same as GIGDB / ADB):
|
|
23
23
|
* 1. getQuote() → quoteResponseId
|
|
24
24
|
* 2. startApplication() → opportunityId (or isDeclined=true)
|
|
25
|
-
* 3. InstaBrainClient.saveEftPayment() →
|
|
25
|
+
* 3. InstaBrainClient.saveEftPayment() → resolves on success (shared endpoint)
|
|
26
26
|
* 4. SecureSign flow → (shared — use SecureSignService)
|
|
27
27
|
* 5. InstaBrainClient.finalSubmit() → applicationStatus: 'InProgress' (async!)
|
|
28
28
|
* 6. pollUnderwritingStatus() → terminal status + policyNumber
|
|
@@ -23,15 +23,24 @@ export declare class GigdbService extends BaseService {
|
|
|
23
23
|
/**
|
|
24
24
|
* Save bank-account (EFT) payment details for an in-progress application.
|
|
25
25
|
*
|
|
26
|
-
* Shared endpoint — used by
|
|
27
|
-
*
|
|
26
|
+
* Shared endpoint — used by every product. Call after Start Application and,
|
|
27
|
+
* for full-flow products, before `prepareDocsAndGetDeliveryChannels()`.
|
|
28
28
|
*
|
|
29
|
-
* Validation: `accountHolderName` is required,
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* `
|
|
29
|
+
* Validation: `accountHolderName` is required, at most 100 characters, and
|
|
30
|
+
* must pass the name format rules (in practice about 35 characters: letters,
|
|
31
|
+
* spaces, hyphens, apostrophes, and `*`; no consecutive special characters;
|
|
32
|
+
* must end with a letter); `routingNumber` is exactly 9 digits;
|
|
33
|
+
* `accountNumber` is 4–17 digits. Failures return `InvalidRequestFormat` with
|
|
34
|
+
* the field under `value.fields`.
|
|
33
35
|
*
|
|
34
36
|
* Business rules:
|
|
37
|
+
* - **Pay Later:** `payLaterDate` (`yyyy-MM-dd`, date only) schedules the
|
|
38
|
+
* draft; omit it to draft immediately. It must be after today (UTC) and no
|
|
39
|
+
* later than the earlier of the pay later window (30 days by default) and
|
|
40
|
+
* the applicant's next birthday, and is refused on the applicant's
|
|
41
|
+
* birthday (UTC date). Failures return
|
|
42
|
+
* `InvalidPaymentScheduledDate`; `PayLaterNotAvailable` means Pay Later is
|
|
43
|
+
* switched off on the platform. Both carry `value.fields.PayLaterDate`.
|
|
35
44
|
* - **EFT and credit card are mutually exclusive** per `opportunityId`.
|
|
36
45
|
* A successful payment that already exists (a prior EFT save, or a card
|
|
37
46
|
* that has already been charged) returns `PaymentAlreadyMade`. Afterwards,
|
|
@@ -44,8 +53,10 @@ export declare class GigdbService extends BaseService {
|
|
|
44
53
|
* `paymentNotMade` nor `LatestPaymentNotSuccessful` will be returned for
|
|
45
54
|
* payment reasons.
|
|
46
55
|
*
|
|
47
|
-
* @param request - The EFT payment request with opportunityId
|
|
48
|
-
* @returns
|
|
56
|
+
* @param request - The EFT payment request with opportunityId, bank account details, and optional payLaterDate
|
|
57
|
+
* @returns Resolves on success; failures throw. The declared type is `boolean`
|
|
58
|
+
* for backward compatibility — at runtime the value is the API's per-field
|
|
59
|
+
* validation result object, which is truthy.
|
|
49
60
|
*/
|
|
50
61
|
saveEftPayment(request: ThirdPartyEftPaymentReq): Promise<boolean>;
|
|
51
62
|
/**
|
|
@@ -30,15 +30,24 @@ class GigdbService extends base_service_1.BaseService {
|
|
|
30
30
|
/**
|
|
31
31
|
* Save bank-account (EFT) payment details for an in-progress application.
|
|
32
32
|
*
|
|
33
|
-
* Shared endpoint — used by
|
|
34
|
-
*
|
|
33
|
+
* Shared endpoint — used by every product. Call after Start Application and,
|
|
34
|
+
* for full-flow products, before `prepareDocsAndGetDeliveryChannels()`.
|
|
35
35
|
*
|
|
36
|
-
* Validation: `accountHolderName` is required,
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* `
|
|
36
|
+
* Validation: `accountHolderName` is required, at most 100 characters, and
|
|
37
|
+
* must pass the name format rules (in practice about 35 characters: letters,
|
|
38
|
+
* spaces, hyphens, apostrophes, and `*`; no consecutive special characters;
|
|
39
|
+
* must end with a letter); `routingNumber` is exactly 9 digits;
|
|
40
|
+
* `accountNumber` is 4–17 digits. Failures return `InvalidRequestFormat` with
|
|
41
|
+
* the field under `value.fields`.
|
|
40
42
|
*
|
|
41
43
|
* Business rules:
|
|
44
|
+
* - **Pay Later:** `payLaterDate` (`yyyy-MM-dd`, date only) schedules the
|
|
45
|
+
* draft; omit it to draft immediately. It must be after today (UTC) and no
|
|
46
|
+
* later than the earlier of the pay later window (30 days by default) and
|
|
47
|
+
* the applicant's next birthday, and is refused on the applicant's
|
|
48
|
+
* birthday (UTC date). Failures return
|
|
49
|
+
* `InvalidPaymentScheduledDate`; `PayLaterNotAvailable` means Pay Later is
|
|
50
|
+
* switched off on the platform. Both carry `value.fields.PayLaterDate`.
|
|
42
51
|
* - **EFT and credit card are mutually exclusive** per `opportunityId`.
|
|
43
52
|
* A successful payment that already exists (a prior EFT save, or a card
|
|
44
53
|
* that has already been charged) returns `PaymentAlreadyMade`. Afterwards,
|
|
@@ -51,11 +60,13 @@ class GigdbService extends base_service_1.BaseService {
|
|
|
51
60
|
* `paymentNotMade` nor `LatestPaymentNotSuccessful` will be returned for
|
|
52
61
|
* payment reasons.
|
|
53
62
|
*
|
|
54
|
-
* @param request - The EFT payment request with opportunityId
|
|
55
|
-
* @returns
|
|
63
|
+
* @param request - The EFT payment request with opportunityId, bank account details, and optional payLaterDate
|
|
64
|
+
* @returns Resolves on success; failures throw. The declared type is `boolean`
|
|
65
|
+
* for backward compatibility — at runtime the value is the API's per-field
|
|
66
|
+
* validation result object, which is truthy.
|
|
56
67
|
*/
|
|
57
68
|
async saveEftPayment(request) {
|
|
58
|
-
const result = await this.post('save EFT payment', '/api/ThirdPartyPayment/save-eft-payment', request, undefined, true // allowNullValue —
|
|
69
|
+
const result = await this.post('save EFT payment', '/api/ThirdPartyPayment/save-eft-payment', request, undefined, true // allowNullValue — value is the per-field validation object (typed boolean for back-compat); a null value resolves to true
|
|
59
70
|
);
|
|
60
71
|
return result !== null && result !== void 0 ? result : true;
|
|
61
72
|
}
|
|
@@ -10,10 +10,16 @@ import { ThirdPartyStartAppResp, ThirdPartyQuoteResp } from '../types';
|
|
|
10
10
|
* Flow:
|
|
11
11
|
* 1. (optional) getRiderDetails(stateCode, age, flagNicotineUse) → rider availability + codes
|
|
12
12
|
* 2. InstaBrainClient.getQuote() → quoteResponseId (uses ThirdPartyIbTermQuote/get via QuoteService)
|
|
13
|
-
* 3. startApplication() → opportunityId
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
13
|
+
* 3. startApplication() → opportunityId + links; isDeclined=true with an
|
|
14
|
+
* empty/all-zero id = knockout (stop), with a real
|
|
15
|
+
* id = declined (keep the id and links)
|
|
16
|
+
* 4. (optional) InstaBrainClient.saveEftPayment() → resolves on success (shared endpoint)
|
|
17
|
+
*
|
|
18
|
+
* After startApplication(), direct the agent or applicant to the returned link.
|
|
19
|
+
* All remaining steps (underwriting, payment, signing) complete inside the
|
|
20
|
+
* InstaBrain frontend. Do NOT wire an IB Term `opportunityId` into the shared
|
|
21
|
+
* SecureSign, finalSubmit(), or credit-card iframe clients. Shared EFT
|
|
22
|
+
* (`saveEftPayment()`, including Pay Later) is allowed.
|
|
17
23
|
*/
|
|
18
24
|
export declare class IBTermService extends BaseService {
|
|
19
25
|
constructor(httpClient: HttpClient);
|
|
@@ -36,11 +42,17 @@ export declare class IBTermService extends BaseService {
|
|
|
36
42
|
* Start an IB Term application from a prior IB Term quote.
|
|
37
43
|
*
|
|
38
44
|
* Notes:
|
|
39
|
-
* - `isDeclined: true` is a valid success response
|
|
45
|
+
* - `isDeclined: true` is a valid success response, not an error. An empty or
|
|
46
|
+
* all-zero `opportunityId` is a knockout (no application — stop); a real id
|
|
47
|
+
* means the application exists but was declined (keep it and any links).
|
|
40
48
|
* - IB Term does NOT use `ApplicationLimitReached` (that applies to ADB/GIGDB only).
|
|
41
49
|
* - When the Dependent Child Rider was selected on the quote, `childRiderInfo`
|
|
42
50
|
* becomes required. Setting any of the 4 child knockout questions to `true`
|
|
43
51
|
* declines the application.
|
|
52
|
+
* - Optional `webhookRegistrationDetails` opts in to application-status
|
|
53
|
+
* webhooks. When sent, both `callbackUrl` (absolute HTTPS) and `secretKey`
|
|
54
|
+
* are required; invalid details fail with HTTP 400 `InvalidRequestFormat`
|
|
55
|
+
* and no application is created.
|
|
44
56
|
*
|
|
45
57
|
* @param request - The IB Term application request payload.
|
|
46
58
|
* @returns Promise with opportunityId, isDeclined flag, and `isQuoteChanged`.
|
|
@@ -10,10 +10,16 @@ const base_service_1 = require("./base.service");
|
|
|
10
10
|
* Flow:
|
|
11
11
|
* 1. (optional) getRiderDetails(stateCode, age, flagNicotineUse) → rider availability + codes
|
|
12
12
|
* 2. InstaBrainClient.getQuote() → quoteResponseId (uses ThirdPartyIbTermQuote/get via QuoteService)
|
|
13
|
-
* 3. startApplication() → opportunityId
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
13
|
+
* 3. startApplication() → opportunityId + links; isDeclined=true with an
|
|
14
|
+
* empty/all-zero id = knockout (stop), with a real
|
|
15
|
+
* id = declined (keep the id and links)
|
|
16
|
+
* 4. (optional) InstaBrainClient.saveEftPayment() → resolves on success (shared endpoint)
|
|
17
|
+
*
|
|
18
|
+
* After startApplication(), direct the agent or applicant to the returned link.
|
|
19
|
+
* All remaining steps (underwriting, payment, signing) complete inside the
|
|
20
|
+
* InstaBrain frontend. Do NOT wire an IB Term `opportunityId` into the shared
|
|
21
|
+
* SecureSign, finalSubmit(), or credit-card iframe clients. Shared EFT
|
|
22
|
+
* (`saveEftPayment()`, including Pay Later) is allowed.
|
|
17
23
|
*/
|
|
18
24
|
class IBTermService extends base_service_1.BaseService {
|
|
19
25
|
constructor(httpClient) {
|
|
@@ -40,11 +46,17 @@ class IBTermService extends base_service_1.BaseService {
|
|
|
40
46
|
* Start an IB Term application from a prior IB Term quote.
|
|
41
47
|
*
|
|
42
48
|
* Notes:
|
|
43
|
-
* - `isDeclined: true` is a valid success response
|
|
49
|
+
* - `isDeclined: true` is a valid success response, not an error. An empty or
|
|
50
|
+
* all-zero `opportunityId` is a knockout (no application — stop); a real id
|
|
51
|
+
* means the application exists but was declined (keep it and any links).
|
|
44
52
|
* - IB Term does NOT use `ApplicationLimitReached` (that applies to ADB/GIGDB only).
|
|
45
53
|
* - When the Dependent Child Rider was selected on the quote, `childRiderInfo`
|
|
46
54
|
* becomes required. Setting any of the 4 child knockout questions to `true`
|
|
47
55
|
* declines the application.
|
|
56
|
+
* - Optional `webhookRegistrationDetails` opts in to application-status
|
|
57
|
+
* webhooks. When sent, both `callbackUrl` (absolute HTTPS) and `secretKey`
|
|
58
|
+
* are required; invalid details fail with HTTP 400 `InvalidRequestFormat`
|
|
59
|
+
* and no application is created.
|
|
48
60
|
*
|
|
49
61
|
* @param request - The IB Term application request payload.
|
|
50
62
|
* @returns Promise with opportunityId, isDeclined flag, and `isQuoteChanged`.
|
|
@@ -9,7 +9,9 @@ import { ThirdPartyQuoteResp, ThirdPartyStartAppResp } from '../types';
|
|
|
9
9
|
* Flow:
|
|
10
10
|
* 1. (optional) getRiderDetails(stateCode, age, flagNicotineUse) → rider availability + codes
|
|
11
11
|
* 2. getQuote() → quoteResponseId
|
|
12
|
-
* 3. startApplication() → opportunityId + links
|
|
12
|
+
* 3. startApplication() → opportunityId + links; isDeclined=true with an
|
|
13
|
+
* empty/all-zero id = knockout (stop), with a real
|
|
14
|
+
* id = declined (keep the id and links)
|
|
13
15
|
* 4. (optional) getExistingQuote(opportunityId) → re-fetch the stored quote
|
|
14
16
|
*
|
|
15
17
|
* After startApplication(), direct the agent or applicant to the returned link.
|
|
@@ -89,11 +91,13 @@ export declare class PureTermService extends BaseService {
|
|
|
89
91
|
* Start a Pure Term application from a prior Pure Term quote.
|
|
90
92
|
*
|
|
91
93
|
* This is a dedicated endpoint, separate from the generic
|
|
92
|
-
* `InstaBrainClient.startApplication()` (`/api/ThirdPartyStartApp/start-application`)
|
|
93
|
-
*
|
|
94
|
+
* `InstaBrainClient.startApplication()` (`/api/ThirdPartyStartApp/start-application`).
|
|
95
|
+
* Do not substitute one for the other.
|
|
94
96
|
*
|
|
95
97
|
* Notes:
|
|
96
|
-
* - `isDeclined: true` is a valid success response
|
|
98
|
+
* - `isDeclined: true` is a valid success response, not an error. An empty or
|
|
99
|
+
* all-zero `opportunityId` is a knockout (no application — stop); a real id
|
|
100
|
+
* means the application exists but was declined (keep it and any links).
|
|
97
101
|
* Knockouts: `isUsCitizenOrIsPermanentResident=false`,
|
|
98
102
|
* `isPayerAlsoOwnerAndInsured=false`, `isHoldingValidDriverLicense=false`,
|
|
99
103
|
* `areListedConditionsNotApplicable=false`, any of the four `childRiderInfo`
|
|
@@ -109,6 +113,10 @@ export declare class PureTermService extends BaseService {
|
|
|
109
113
|
* `dataNotFound` (quote response not found), or `internalServerError`.
|
|
110
114
|
* - After a successful, non-declined start, hand off via the returned links —
|
|
111
115
|
* do not continue into shared SecureSign / finalSubmit with this `opportunityId`.
|
|
116
|
+
* - Optional `webhookRegistrationDetails` opts in to application-status
|
|
117
|
+
* webhooks. When sent, both `callbackUrl` (absolute HTTPS) and `secretKey`
|
|
118
|
+
* are required; invalid details fail with HTTP 400 `InvalidRequestFormat`
|
|
119
|
+
* and no application is created.
|
|
112
120
|
*
|
|
113
121
|
* @param request - The Pure Term application request payload.
|
|
114
122
|
* @returns Promise with opportunityId, links, isDeclined flag, and `isQuoteChanged`.
|
|
@@ -9,7 +9,9 @@ const base_service_1 = require("./base.service");
|
|
|
9
9
|
* Flow:
|
|
10
10
|
* 1. (optional) getRiderDetails(stateCode, age, flagNicotineUse) → rider availability + codes
|
|
11
11
|
* 2. getQuote() → quoteResponseId
|
|
12
|
-
* 3. startApplication() → opportunityId + links
|
|
12
|
+
* 3. startApplication() → opportunityId + links; isDeclined=true with an
|
|
13
|
+
* empty/all-zero id = knockout (stop), with a real
|
|
14
|
+
* id = declined (keep the id and links)
|
|
13
15
|
* 4. (optional) getExistingQuote(opportunityId) → re-fetch the stored quote
|
|
14
16
|
*
|
|
15
17
|
* After startApplication(), direct the agent or applicant to the returned link.
|
|
@@ -97,11 +99,13 @@ class PureTermService extends base_service_1.BaseService {
|
|
|
97
99
|
* Start a Pure Term application from a prior Pure Term quote.
|
|
98
100
|
*
|
|
99
101
|
* This is a dedicated endpoint, separate from the generic
|
|
100
|
-
* `InstaBrainClient.startApplication()` (`/api/ThirdPartyStartApp/start-application`)
|
|
101
|
-
*
|
|
102
|
+
* `InstaBrainClient.startApplication()` (`/api/ThirdPartyStartApp/start-application`).
|
|
103
|
+
* Do not substitute one for the other.
|
|
102
104
|
*
|
|
103
105
|
* Notes:
|
|
104
|
-
* - `isDeclined: true` is a valid success response
|
|
106
|
+
* - `isDeclined: true` is a valid success response, not an error. An empty or
|
|
107
|
+
* all-zero `opportunityId` is a knockout (no application — stop); a real id
|
|
108
|
+
* means the application exists but was declined (keep it and any links).
|
|
105
109
|
* Knockouts: `isUsCitizenOrIsPermanentResident=false`,
|
|
106
110
|
* `isPayerAlsoOwnerAndInsured=false`, `isHoldingValidDriverLicense=false`,
|
|
107
111
|
* `areListedConditionsNotApplicable=false`, any of the four `childRiderInfo`
|
|
@@ -117,6 +121,10 @@ class PureTermService extends base_service_1.BaseService {
|
|
|
117
121
|
* `dataNotFound` (quote response not found), or `internalServerError`.
|
|
118
122
|
* - After a successful, non-declined start, hand off via the returned links —
|
|
119
123
|
* do not continue into shared SecureSign / finalSubmit with this `opportunityId`.
|
|
124
|
+
* - Optional `webhookRegistrationDetails` opts in to application-status
|
|
125
|
+
* webhooks. When sent, both `callbackUrl` (absolute HTTPS) and `secretKey`
|
|
126
|
+
* are required; invalid details fail with HTTP 400 `InvalidRequestFormat`
|
|
127
|
+
* and no application is created.
|
|
120
128
|
*
|
|
121
129
|
* @param request - The Pure Term application request payload.
|
|
122
130
|
* @returns Promise with opportunityId, links, isDeclined flag, and `isQuoteChanged`.
|