@instabrain-sdks/api-client 2.3.1 → 2.3.2
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 +1770 -1766
- package/dist/services/ibterm.service.d.ts +1 -1
- package/dist/services/ibterm.service.js +1 -1
- package/dist/types/enums.d.ts +45 -41
- package/dist/types/enums.js +51 -42
- package/dist/types/errors.d.ts +4 -1
- package/dist/types/errors.js +19 -18
- package/package.json +1 -1
|
@@ -57,7 +57,7 @@ export declare class IBTermService extends BaseService {
|
|
|
57
57
|
* - missing / empty / non-GUID `opportunityId` → `InvalidRequestFormat`
|
|
58
58
|
* - opportunity belongs to a different product → `OpportunityIdDoesNotMatchProduct`
|
|
59
59
|
* (field-level message under `InvalidRequestFormat`)
|
|
60
|
-
* - opportunity exists but has no stored quote → `QuoteNotFound`
|
|
60
|
+
* - opportunity exists but has no stored quote → `QuoteNotFound` (top-level, `value: null`)
|
|
61
61
|
*
|
|
62
62
|
* @param opportunityId - UUID from a prior IB Term application/quote flow.
|
|
63
63
|
* @returns Promise with the current quote response.
|
|
@@ -63,7 +63,7 @@ class IBTermService extends base_service_1.BaseService {
|
|
|
63
63
|
* - missing / empty / non-GUID `opportunityId` → `InvalidRequestFormat`
|
|
64
64
|
* - opportunity belongs to a different product → `OpportunityIdDoesNotMatchProduct`
|
|
65
65
|
* (field-level message under `InvalidRequestFormat`)
|
|
66
|
-
* - opportunity exists but has no stored quote → `QuoteNotFound`
|
|
66
|
+
* - opportunity exists but has no stored quote → `QuoteNotFound` (top-level, `value: null`)
|
|
67
67
|
*
|
|
68
68
|
* @param opportunityId - UUID from a prior IB Term application/quote flow.
|
|
69
69
|
* @returns Promise with the current quote response.
|
package/dist/types/enums.d.ts
CHANGED
|
@@ -434,18 +434,14 @@ export declare enum AdbRiderType {
|
|
|
434
434
|
InflationBenefit = "InflationBenefit"
|
|
435
435
|
}
|
|
436
436
|
/**
|
|
437
|
-
* API Error codes returned in the top-level `error` field
|
|
437
|
+
* API Error codes returned in the top-level `error` / `errorCode` field when `flagStatus` is false.
|
|
438
438
|
*
|
|
439
|
-
*
|
|
440
|
-
*
|
|
441
|
-
*
|
|
439
|
+
* Many validation failures use `InvalidRequestFormat` with per-field details in `value.fields`.
|
|
440
|
+
* Quote business rules, Start Application limits, Secure Sign, and Final Submit also use
|
|
441
|
+
* dedicated top-level codes listed below.
|
|
442
442
|
*
|
|
443
|
-
*
|
|
444
|
-
*
|
|
445
|
-
* for backward-compatibility with existing integrations and will be removed in a
|
|
446
|
-
* future major version. Detect the equivalent failures via field-level messages
|
|
447
|
-
* under `InvalidRequestFormat` — see the README "Field-Level Error Messages"
|
|
448
|
-
* section.
|
|
443
|
+
* Members marked `@deprecated` remain for backward compatibility but are not documented as
|
|
444
|
+
* active in the README; prefer `InvalidRequestFormat` field messages where applicable.
|
|
449
445
|
*/
|
|
450
446
|
export declare enum APIErrorCode {
|
|
451
447
|
/** Top-level code for every FluentValidation failure across all products. Inspect `value.fields` for field-level details. */
|
|
@@ -468,10 +464,6 @@ export declare enum APIErrorCode {
|
|
|
468
464
|
BenefitPeriodNotAvailable = "BenefitPeriodNotAvailable",
|
|
469
465
|
/** IB Term Quote only — height + weight fall outside the carrier's acceptable build chart. */
|
|
470
466
|
OutsideBuildChart = "outsideBuildChart",
|
|
471
|
-
/** IB Term Quote only — `Height` / `WeightInLbs` value or combination is invalid. */
|
|
472
|
-
HeightNotValid = "HeightNotValid",
|
|
473
|
-
/** Returned by ADB / GIGDB / IB Term `get-existing-quote` when no saved quote exists for the opportunity. */
|
|
474
|
-
QuoteNotFound = "QuoteNotFound",
|
|
475
467
|
/** ADB / GIGDB Start Application only — same SSN, email, or phone already has a policy generated within the last 30 days. IB Term does NOT use this code. */
|
|
476
468
|
ApplicationLimitReached = "ApplicationLimitReached",
|
|
477
469
|
/** Quote state and `Address.State` on Start Application refer to different US states (case-insensitive compare). Returned only after request validation passes. */
|
|
@@ -480,41 +472,53 @@ export declare enum APIErrorCode {
|
|
|
480
472
|
AgentNotFound = "agentNotFound",
|
|
481
473
|
/** Unexpected backend failure while processing a Start Application request. */
|
|
482
474
|
InternalServerError = "internalServerError",
|
|
475
|
+
/** Update quote or save EFT when payment is already recorded for the opportunity. */
|
|
476
|
+
PaymentAlreadyMade = "PaymentAlreadyMade",
|
|
477
|
+
/** Generic Secure Sign failure. */
|
|
478
|
+
SecureSignRelatedError = "SecureSignRelatedError",
|
|
479
|
+
/** Signing package missing — call `prepareDocsAndGetDeliveryChannels()` first. */
|
|
480
|
+
SigningPackageNotCreated = "SigningPackageNotCreated",
|
|
481
|
+
/** Wrong PIN on `verifyPin()` (also returns `isVerified: false` without throwing). */
|
|
482
|
+
SecureSignPinMismatch = "SecureSignPinMismatch",
|
|
483
|
+
/** PIN expired — call `resendPin()`. */
|
|
484
|
+
PinExpired = "PinExpired",
|
|
485
|
+
/** Documents already signed for this opportunity. */
|
|
486
|
+
DocumentsAlreadySigned = "DocumentsAlreadySigned",
|
|
487
|
+
/** Phone number invalid for SMS on Send PIN / Resend PIN. */
|
|
488
|
+
InvalidPhoneNumber = "InvalidPhoneNumber",
|
|
489
|
+
/** Email delivery failed on Send PIN / Resend PIN. */
|
|
490
|
+
EmailDeliveryFailed = "EmailDeliveryFailed",
|
|
491
|
+
/** SMS delivery failed on Send PIN / Resend PIN. */
|
|
492
|
+
MessageNotDelivered = "MessageNotDelivered",
|
|
493
|
+
/** EFT payment not saved — call `saveEftPayment()` before `finalSubmit()`. */
|
|
494
|
+
PaymentNotMade = "paymentNotMade",
|
|
495
|
+
/** Fidelity carrier rejected or failed to process final submit. */
|
|
496
|
+
FidelityFinalSubmitError = "FidelityFinalSubmitError",
|
|
483
497
|
AgentLogout = "AgentLogout",
|
|
484
|
-
/**
|
|
498
|
+
/** Top-level code returned by `getExistingIBTermQuote()` / `getExistingGigdbQuote()` / `getExistingAdbQuote()` when no quote is on file for the opportunityId. HTTP 400, `value: null`. */
|
|
499
|
+
QuoteNotFound = "QuoteNotFound",
|
|
500
|
+
/** Returned by IB Term Quote when `height.feet` or `height.inches` values are out-of-range (feet 1–8, inches 0–11). Distinct from `OutsideBuildChart` which fires when height+weight fail the carrier build chart lookup. */
|
|
501
|
+
HeightNotValid = "HeightNotValid",
|
|
502
|
+
/** Applicant has not viewed all documents before attempting PIN verification. Returned by `verifyPin()`. */
|
|
503
|
+
DocumentsNotViewed = "DocumentsNotViewed",
|
|
504
|
+
/** @deprecated Prefer `InvalidRequestFormat` on `BirthJurisdiction.Country`. */
|
|
485
505
|
InvalidBirthCountry = "InvalidBirthCountry",
|
|
486
|
-
/** @deprecated
|
|
506
|
+
/** @deprecated Prefer `InvalidRequestFormat` on `BirthJurisdiction.State`. */
|
|
487
507
|
InvalidBirthState = "InvalidBirthState",
|
|
488
|
-
/** @deprecated
|
|
508
|
+
/** @deprecated Prefer `InvalidRequestFormat` on `Address.State`. */
|
|
489
509
|
InvalidResidenceState = "InvalidResidenceState",
|
|
490
|
-
/** @deprecated No longer returned
|
|
510
|
+
/** @deprecated No longer returned as a top-level code. */
|
|
491
511
|
OneOfTheExistingCoveragesQuestionsNotFound = "OneOfTheExistingCoveragesQuestionsNotFound",
|
|
492
|
-
/** @deprecated
|
|
493
|
-
PaymentAlreadyMade = "PaymentAlreadyMade",
|
|
494
|
-
/** @deprecated Returned as a field-level message under `InvalidRequestFormat`. */
|
|
512
|
+
/** @deprecated Prefer `InvalidRequestFormat` on EFT fields. */
|
|
495
513
|
ErrorInSaveEftPaymentDetails = "ErrorInSaveEftPaymentDetails",
|
|
496
|
-
/** @deprecated
|
|
514
|
+
/** @deprecated Prefer `InvalidRequestFormat` on EFT fields. */
|
|
497
515
|
InvalidPaymentScheduledDate = "InvalidPaymentScheduledDate",
|
|
498
|
-
/** @deprecated
|
|
516
|
+
/** @deprecated Legacy get-existing-quote code; prefer `InvalidRequestFormat`. */
|
|
499
517
|
ThirdPartyQuoteError = "ThirdPartyQuoteError",
|
|
500
|
-
/** @deprecated
|
|
518
|
+
/** @deprecated No longer returned as a top-level code. */
|
|
501
519
|
InvalidQuoteParameters = "InvalidQuoteParameters",
|
|
502
|
-
/** @deprecated
|
|
520
|
+
/** @deprecated Prefer `InvalidRequestFormat` on `Address.State` (ADB). */
|
|
503
521
|
InvalidStateCode = "InvalidStateCode",
|
|
504
|
-
/** @deprecated
|
|
505
|
-
InvalidAdbAgeRange = "InvalidAdbAgeRange"
|
|
506
|
-
/** @deprecated Final Submit now returns "Application has already been final submitted." on `opportunityId` under `InvalidRequestFormat`. */
|
|
507
|
-
PaymentNotMade = "paymentNotMade",
|
|
508
|
-
/** @deprecated Secure Sign endpoints now return field-level messages under `InvalidRequestFormat`. */
|
|
509
|
-
SecureSignRelatedError = "SecureSignRelatedError",
|
|
510
|
-
/** @deprecated Secure Sign endpoints now return field-level messages under `InvalidRequestFormat`. */
|
|
511
|
-
SigningPackageNotCreated = "SigningPackageNotCreated",
|
|
512
|
-
/** @deprecated Secure Sign endpoints now return field-level messages under `InvalidRequestFormat`. */
|
|
513
|
-
SecureSignPinMismatch = "SecureSignPinMismatch",
|
|
514
|
-
/** @deprecated Secure Sign endpoints now return field-level messages under `InvalidRequestFormat`. */
|
|
515
|
-
PinExpired = "PinExpired",
|
|
516
|
-
/** @deprecated Secure Sign endpoints now return field-level messages under `InvalidRequestFormat`. */
|
|
517
|
-
DocumentsNotViewed = "DocumentsNotViewed",
|
|
518
|
-
/** @deprecated Secure Sign endpoints now return "Documents are already signed." on `OpportunityId` under `InvalidRequestFormat`. */
|
|
519
|
-
DocumentsAlreadySigned = "DocumentsAlreadySigned"
|
|
522
|
+
/** @deprecated Prefer `InvalidRequestFormat` on `DateOfBirth` (ADB age 20–59). */
|
|
523
|
+
InvalidAdbAgeRange = "InvalidAdbAgeRange"
|
|
520
524
|
}
|
package/dist/types/enums.js
CHANGED
|
@@ -463,18 +463,14 @@ var AdbRiderType;
|
|
|
463
463
|
AdbRiderType["InflationBenefit"] = "InflationBenefit";
|
|
464
464
|
})(AdbRiderType || (exports.AdbRiderType = AdbRiderType = {}));
|
|
465
465
|
/**
|
|
466
|
-
* API Error codes returned in the top-level `error` field
|
|
466
|
+
* API Error codes returned in the top-level `error` / `errorCode` field when `flagStatus` is false.
|
|
467
467
|
*
|
|
468
|
-
*
|
|
469
|
-
*
|
|
470
|
-
*
|
|
468
|
+
* Many validation failures use `InvalidRequestFormat` with per-field details in `value.fields`.
|
|
469
|
+
* Quote business rules, Start Application limits, Secure Sign, and Final Submit also use
|
|
470
|
+
* dedicated top-level codes listed below.
|
|
471
471
|
*
|
|
472
|
-
*
|
|
473
|
-
*
|
|
474
|
-
* for backward-compatibility with existing integrations and will be removed in a
|
|
475
|
-
* future major version. Detect the equivalent failures via field-level messages
|
|
476
|
-
* under `InvalidRequestFormat` — see the README "Field-Level Error Messages"
|
|
477
|
-
* section.
|
|
472
|
+
* Members marked `@deprecated` remain for backward compatibility but are not documented as
|
|
473
|
+
* active in the README; prefer `InvalidRequestFormat` field messages where applicable.
|
|
478
474
|
*/
|
|
479
475
|
var APIErrorCode;
|
|
480
476
|
(function (APIErrorCode) {
|
|
@@ -501,11 +497,6 @@ var APIErrorCode;
|
|
|
501
497
|
APIErrorCode["BenefitPeriodNotAvailable"] = "BenefitPeriodNotAvailable";
|
|
502
498
|
/** IB Term Quote only — height + weight fall outside the carrier's acceptable build chart. */
|
|
503
499
|
APIErrorCode["OutsideBuildChart"] = "outsideBuildChart";
|
|
504
|
-
/** IB Term Quote only — `Height` / `WeightInLbs` value or combination is invalid. */
|
|
505
|
-
APIErrorCode["HeightNotValid"] = "HeightNotValid";
|
|
506
|
-
// ─── Get-Existing-Quote business error ────────────────────────────────────
|
|
507
|
-
/** Returned by ADB / GIGDB / IB Term `get-existing-quote` when no saved quote exists for the opportunity. */
|
|
508
|
-
APIErrorCode["QuoteNotFound"] = "QuoteNotFound";
|
|
509
500
|
// ─── Start Application — duplicate-detection limit ───────────────────────
|
|
510
501
|
/** ADB / GIGDB Start Application only — same SSN, email, or phone already has a policy generated within the last 30 days. IB Term does NOT use this code. */
|
|
511
502
|
APIErrorCode["ApplicationLimitReached"] = "ApplicationLimitReached";
|
|
@@ -516,43 +507,61 @@ var APIErrorCode;
|
|
|
516
507
|
APIErrorCode["AgentNotFound"] = "agentNotFound";
|
|
517
508
|
/** Unexpected backend failure while processing a Start Application request. */
|
|
518
509
|
APIErrorCode["InternalServerError"] = "internalServerError";
|
|
510
|
+
// ─── Payment & quote update (after Start Application) ─────────────────────
|
|
511
|
+
/** Update quote or save EFT when payment is already recorded for the opportunity. */
|
|
512
|
+
APIErrorCode["PaymentAlreadyMade"] = "PaymentAlreadyMade";
|
|
513
|
+
// ─── Secure Sign ───────────────────────────────────────────────────────────
|
|
514
|
+
/** Generic Secure Sign failure. */
|
|
515
|
+
APIErrorCode["SecureSignRelatedError"] = "SecureSignRelatedError";
|
|
516
|
+
/** Signing package missing — call `prepareDocsAndGetDeliveryChannels()` first. */
|
|
517
|
+
APIErrorCode["SigningPackageNotCreated"] = "SigningPackageNotCreated";
|
|
518
|
+
/** Wrong PIN on `verifyPin()` (also returns `isVerified: false` without throwing). */
|
|
519
|
+
APIErrorCode["SecureSignPinMismatch"] = "SecureSignPinMismatch";
|
|
520
|
+
/** PIN expired — call `resendPin()`. */
|
|
521
|
+
APIErrorCode["PinExpired"] = "PinExpired";
|
|
522
|
+
/** Documents already signed for this opportunity. */
|
|
523
|
+
APIErrorCode["DocumentsAlreadySigned"] = "DocumentsAlreadySigned";
|
|
524
|
+
/** Phone number invalid for SMS on Send PIN / Resend PIN. */
|
|
525
|
+
APIErrorCode["InvalidPhoneNumber"] = "InvalidPhoneNumber";
|
|
526
|
+
/** Email delivery failed on Send PIN / Resend PIN. */
|
|
527
|
+
APIErrorCode["EmailDeliveryFailed"] = "EmailDeliveryFailed";
|
|
528
|
+
/** SMS delivery failed on Send PIN / Resend PIN. */
|
|
529
|
+
APIErrorCode["MessageNotDelivered"] = "MessageNotDelivered";
|
|
530
|
+
// ─── Final Submit ──────────────────────────────────────────────────────────
|
|
531
|
+
/** EFT payment not saved — call `saveEftPayment()` before `finalSubmit()`. */
|
|
532
|
+
APIErrorCode["PaymentNotMade"] = "paymentNotMade";
|
|
533
|
+
/** Fidelity carrier rejected or failed to process final submit. */
|
|
534
|
+
APIErrorCode["FidelityFinalSubmitError"] = "FidelityFinalSubmitError";
|
|
519
535
|
// ─── Session ─────────────────────────────────────────────────────────────
|
|
520
536
|
APIErrorCode["AgentLogout"] = "AgentLogout";
|
|
521
|
-
// ───
|
|
522
|
-
/**
|
|
537
|
+
// ─── Get Existing Quote ──────────────────────────────────────────────────
|
|
538
|
+
/** Top-level code returned by `getExistingIBTermQuote()` / `getExistingGigdbQuote()` / `getExistingAdbQuote()` when no quote is on file for the opportunityId. HTTP 400, `value: null`. */
|
|
539
|
+
APIErrorCode["QuoteNotFound"] = "QuoteNotFound";
|
|
540
|
+
// ─── IB Term Quote — height validation ───────────────────────────────────
|
|
541
|
+
/** Returned by IB Term Quote when `height.feet` or `height.inches` values are out-of-range (feet 1–8, inches 0–11). Distinct from `OutsideBuildChart` which fires when height+weight fail the carrier build chart lookup. */
|
|
542
|
+
APIErrorCode["HeightNotValid"] = "HeightNotValid";
|
|
543
|
+
// ─── Secure Sign (continued) ─────────────────────────────────────────────
|
|
544
|
+
/** Applicant has not viewed all documents before attempting PIN verification. Returned by `verifyPin()`. */
|
|
545
|
+
APIErrorCode["DocumentsNotViewed"] = "DocumentsNotViewed";
|
|
546
|
+
// ─── Deprecated — not in active README; kept for backward compatibility ───
|
|
547
|
+
/** @deprecated Prefer `InvalidRequestFormat` on `BirthJurisdiction.Country`. */
|
|
523
548
|
APIErrorCode["InvalidBirthCountry"] = "InvalidBirthCountry";
|
|
524
|
-
/** @deprecated
|
|
549
|
+
/** @deprecated Prefer `InvalidRequestFormat` on `BirthJurisdiction.State`. */
|
|
525
550
|
APIErrorCode["InvalidBirthState"] = "InvalidBirthState";
|
|
526
|
-
/** @deprecated
|
|
551
|
+
/** @deprecated Prefer `InvalidRequestFormat` on `Address.State`. */
|
|
527
552
|
APIErrorCode["InvalidResidenceState"] = "InvalidResidenceState";
|
|
528
|
-
/** @deprecated No longer returned
|
|
553
|
+
/** @deprecated No longer returned as a top-level code. */
|
|
529
554
|
APIErrorCode["OneOfTheExistingCoveragesQuestionsNotFound"] = "OneOfTheExistingCoveragesQuestionsNotFound";
|
|
530
|
-
/** @deprecated
|
|
531
|
-
APIErrorCode["PaymentAlreadyMade"] = "PaymentAlreadyMade";
|
|
532
|
-
/** @deprecated Returned as a field-level message under `InvalidRequestFormat`. */
|
|
555
|
+
/** @deprecated Prefer `InvalidRequestFormat` on EFT fields. */
|
|
533
556
|
APIErrorCode["ErrorInSaveEftPaymentDetails"] = "ErrorInSaveEftPaymentDetails";
|
|
534
|
-
/** @deprecated
|
|
557
|
+
/** @deprecated Prefer `InvalidRequestFormat` on EFT fields. */
|
|
535
558
|
APIErrorCode["InvalidPaymentScheduledDate"] = "InvalidPaymentScheduledDate";
|
|
536
|
-
/** @deprecated
|
|
559
|
+
/** @deprecated Legacy get-existing-quote code; prefer `InvalidRequestFormat`. */
|
|
537
560
|
APIErrorCode["ThirdPartyQuoteError"] = "ThirdPartyQuoteError";
|
|
538
|
-
/** @deprecated
|
|
561
|
+
/** @deprecated No longer returned as a top-level code. */
|
|
539
562
|
APIErrorCode["InvalidQuoteParameters"] = "InvalidQuoteParameters";
|
|
540
|
-
/** @deprecated
|
|
563
|
+
/** @deprecated Prefer `InvalidRequestFormat` on `Address.State` (ADB). */
|
|
541
564
|
APIErrorCode["InvalidStateCode"] = "InvalidStateCode";
|
|
542
|
-
/** @deprecated
|
|
565
|
+
/** @deprecated Prefer `InvalidRequestFormat` on `DateOfBirth` (ADB age 20–59). */
|
|
543
566
|
APIErrorCode["InvalidAdbAgeRange"] = "InvalidAdbAgeRange";
|
|
544
|
-
/** @deprecated Final Submit now returns "Application has already been final submitted." on `opportunityId` under `InvalidRequestFormat`. */
|
|
545
|
-
APIErrorCode["PaymentNotMade"] = "paymentNotMade";
|
|
546
|
-
/** @deprecated Secure Sign endpoints now return field-level messages under `InvalidRequestFormat`. */
|
|
547
|
-
APIErrorCode["SecureSignRelatedError"] = "SecureSignRelatedError";
|
|
548
|
-
/** @deprecated Secure Sign endpoints now return field-level messages under `InvalidRequestFormat`. */
|
|
549
|
-
APIErrorCode["SigningPackageNotCreated"] = "SigningPackageNotCreated";
|
|
550
|
-
/** @deprecated Secure Sign endpoints now return field-level messages under `InvalidRequestFormat`. */
|
|
551
|
-
APIErrorCode["SecureSignPinMismatch"] = "SecureSignPinMismatch";
|
|
552
|
-
/** @deprecated Secure Sign endpoints now return field-level messages under `InvalidRequestFormat`. */
|
|
553
|
-
APIErrorCode["PinExpired"] = "PinExpired";
|
|
554
|
-
/** @deprecated Secure Sign endpoints now return field-level messages under `InvalidRequestFormat`. */
|
|
555
|
-
APIErrorCode["DocumentsNotViewed"] = "DocumentsNotViewed";
|
|
556
|
-
/** @deprecated Secure Sign endpoints now return "Documents are already signed." on `OpportunityId` under `InvalidRequestFormat`. */
|
|
557
|
-
APIErrorCode["DocumentsAlreadySigned"] = "DocumentsAlreadySigned";
|
|
558
567
|
})(APIErrorCode || (exports.APIErrorCode = APIErrorCode = {}));
|
package/dist/types/errors.d.ts
CHANGED
|
@@ -23,7 +23,10 @@ export declare class APIValidationError extends InstaBrainError {
|
|
|
23
23
|
*/
|
|
24
24
|
isErrorType(errorCode: string): boolean;
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* Returns a human-readable message for a given API error code.
|
|
27
|
+
* Includes mappings for both active and deprecated error codes.
|
|
28
|
+
* Deprecated codes retain their mappings here for backward compatibility
|
|
29
|
+
* with integrations that may still receive legacy responses.
|
|
27
30
|
*/
|
|
28
31
|
getUserFriendlyMessage(): string;
|
|
29
32
|
}
|
package/dist/types/errors.js
CHANGED
|
@@ -44,7 +44,10 @@ class APIValidationError extends InstaBrainError {
|
|
|
44
44
|
return this.errorCode === errorCode;
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
|
-
*
|
|
47
|
+
* Returns a human-readable message for a given API error code.
|
|
48
|
+
* Includes mappings for both active and deprecated error codes.
|
|
49
|
+
* Deprecated codes retain their mappings here for backward compatibility
|
|
50
|
+
* with integrations that may still receive legacy responses.
|
|
48
51
|
*/
|
|
49
52
|
getUserFriendlyMessage() {
|
|
50
53
|
const errorMessages = {
|
|
@@ -64,9 +67,20 @@ class APIValidationError extends InstaBrainError {
|
|
|
64
67
|
'StateMismatchIdentified': 'Quote state and Start Application Address.State refer to different US states. Re-quote with the correct residence state.',
|
|
65
68
|
'agentNotFound': 'The quote cannot be linked to an agent account. Please verify the agent token and try again.',
|
|
66
69
|
'internalServerError': 'An unexpected error occurred while processing the application. Please retry; if the issue persists, contact InstaBrain support.',
|
|
67
|
-
|
|
70
|
+
'InvalidRequestFormat': 'The request format is invalid. Inspect value.fields for per-field details.',
|
|
71
|
+
'QuoteNotFound': 'No previous quote found for this opportunity. Please create a quote first.',
|
|
72
|
+
'ApplicationLimitReached': 'An application with the same SSN, email, or phone already has a policy generated within the last 30 days.',
|
|
73
|
+
'SecureSignRelatedError': 'A signing-related error occurred. Please try again.',
|
|
74
|
+
'SigningPackageNotCreated': 'No signing package exists for this application. Call prepareDocsAndGetDeliveryChannels() first.',
|
|
75
|
+
'SecureSignPinMismatch': 'The PIN entered is incorrect. Please try again.',
|
|
76
|
+
'PinExpired': 'The PIN has expired. Please request a new one.',
|
|
77
|
+
'DocumentsNotViewed': 'All documents must be viewed before verifying the PIN.',
|
|
78
|
+
'DocumentsAlreadySigned': 'The documents have already been signed for this application.',
|
|
79
|
+
'InvalidPhoneNumber': 'The phone number is invalid for SMS delivery.',
|
|
80
|
+
'EmailDeliveryFailed': 'Email delivery failed. Retry or switch to SMS.',
|
|
81
|
+
'MessageNotDelivered': 'SMS delivery failed. Retry or switch to email.',
|
|
82
|
+
'FidelityFinalSubmitError': 'Fidelity carrier rejected or failed to process the submission. Contact support with the opportunityId.',
|
|
68
83
|
'AgentLogout': 'Agent session has expired. Please re-authenticate.',
|
|
69
|
-
// ── DEPRECATED — surfaced as field-level messages under InvalidRequestFormat ──
|
|
70
84
|
'InvalidBirthCountry': 'The birth country provided is not valid.',
|
|
71
85
|
'InvalidBirthState': 'The birth state provided is not valid.',
|
|
72
86
|
'InvalidResidenceState': 'The residence state provided is not valid.',
|
|
@@ -74,24 +88,11 @@ class APIValidationError extends InstaBrainError {
|
|
|
74
88
|
'PaymentAlreadyMade': 'Payment has already been made for this application.',
|
|
75
89
|
'ErrorInSaveEftPaymentDetails': 'Failed to save EFT payment details. Please verify account information.',
|
|
76
90
|
'InvalidPaymentScheduledDate': 'The scheduled payment date is not valid.',
|
|
77
|
-
'ThirdPartyQuoteError': 'An error occurred while
|
|
91
|
+
'ThirdPartyQuoteError': 'An error occurred while retrieving the quote.',
|
|
78
92
|
'InvalidQuoteParameters': 'The quote parameters provided are not valid.',
|
|
79
|
-
'InvalidRequestFormat': 'The request format is invalid. Inspect value.fields for per-field details.',
|
|
80
|
-
'QuoteNotFound': 'No previous quote found for this opportunity. Please create a quote first.',
|
|
81
|
-
// ADB-specific (deprecated — now surfaced as field-level messages under InvalidRequestFormat)
|
|
82
93
|
'InvalidStateCode': 'State not supported for ADB (MA, NH, AK unavailable; CA coming next release).',
|
|
83
94
|
'InvalidAdbAgeRange': 'Age must be between 20 and 59 for ADB.',
|
|
84
|
-
|
|
85
|
-
'ApplicationLimitReached': 'An application with the same SSN, email, or phone already has a policy generated within the last 30 days.',
|
|
86
|
-
// Final Submit error messages
|
|
87
|
-
'paymentNotMade': 'EFT payment must be completed before submitting the application.',
|
|
88
|
-
// Secure Sign error messages
|
|
89
|
-
'SecureSignRelatedError': 'A signing-related error occurred. Please try again.',
|
|
90
|
-
'SigningPackageNotCreated': 'No signing package exists for this application. Complete previous steps first.',
|
|
91
|
-
'SecureSignPinMismatch': 'The PIN entered is incorrect. Please try again.',
|
|
92
|
-
'PinExpired': 'The PIN has expired. Please request a new one.',
|
|
93
|
-
'DocumentsNotViewed': 'All documents must be viewed before verifying the PIN.',
|
|
94
|
-
'DocumentsAlreadySigned': 'The documents have already been signed for this application.'
|
|
95
|
+
'paymentNotMade': 'EFT payment must be completed before submitting the application.'
|
|
95
96
|
};
|
|
96
97
|
return errorMessages[this.errorCode] || this.message;
|
|
97
98
|
}
|
package/package.json
CHANGED