@instabrain-sdks/api-client 2.0.0 → 2.1.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 +1228 -348
- package/dist/client/instabrain-client.d.ts +34 -2
- package/dist/client/instabrain-client.js +42 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/services/adb.service.d.ts +48 -0
- package/dist/services/adb.service.js +64 -0
- package/dist/services/application.service.d.ts +2 -3
- package/dist/services/application.service.js +5 -52
- package/dist/services/auth.service.d.ts +0 -1
- package/dist/services/auth.service.js +0 -1
- package/dist/services/base.service.d.ts +45 -0
- package/dist/services/base.service.js +92 -0
- package/dist/services/gigdb.service.d.ts +2 -3
- package/dist/services/gigdb.service.js +12 -133
- package/dist/services/quote.service.d.ts +2 -3
- package/dist/services/quote.service.js +4 -35
- package/dist/services/reports.service.d.ts +2 -3
- package/dist/services/reports.service.js +6 -86
- package/dist/services/secure-sign.service.d.ts +2 -3
- package/dist/services/secure-sign.service.js +7 -109
- package/dist/types/adb.types.d.ts +119 -0
- package/dist/types/adb.types.js +2 -0
- package/dist/types/application.types.d.ts +0 -1
- package/dist/types/application.types.js +0 -1
- package/dist/types/auth.types.d.ts +0 -1
- package/dist/types/auth.types.js +0 -1
- package/dist/types/beneficiary.types.d.ts +54 -0
- package/dist/types/beneficiary.types.js +2 -0
- package/dist/types/constants.d.ts +0 -1
- package/dist/types/constants.js +0 -1
- package/dist/types/enums.d.ts +379 -5
- package/dist/types/enums.js +392 -8
- package/dist/types/errors.d.ts +0 -1
- package/dist/types/errors.js +0 -1
- package/dist/types/gigdb.types.d.ts +3 -17
- package/dist/types/gigdb.types.js +0 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.js +2 -1
- package/dist/types/quote.types.d.ts +0 -1
- package/dist/types/quote.types.js +0 -1
- package/dist/types/reports.types.d.ts +0 -1
- package/dist/types/reports.types.js +0 -1
- package/dist/types/secure-sign.types.d.ts +0 -1
- package/dist/types/secure-sign.types.js +0 -1
- package/dist/utils/error-utils.d.ts +0 -1
- package/dist/utils/error-utils.js +0 -1
- package/dist/utils/http-client.d.ts +0 -1
- package/dist/utils/http-client.js +0 -4
- package/package.json +2 -2
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GigdbService = void 0;
|
|
4
|
-
const
|
|
5
|
-
const types_1 = require("../types");
|
|
4
|
+
const base_service_1 = require("./base.service");
|
|
6
5
|
/**
|
|
7
6
|
* GIGDB (Guaranteed Issue Group Decreasing Benefit) service
|
|
8
7
|
* Handles quote, application, and EFT payment for the GIGDB product (ages 50-85, $5k-$25k)
|
|
9
8
|
*/
|
|
10
|
-
class GigdbService {
|
|
9
|
+
class GigdbService extends base_service_1.BaseService {
|
|
11
10
|
constructor(httpClient) {
|
|
12
|
-
|
|
11
|
+
super(httpClient);
|
|
13
12
|
}
|
|
14
13
|
/**
|
|
15
14
|
* Get a GIGDB insurance quote
|
|
@@ -17,32 +16,7 @@ class GigdbService {
|
|
|
17
16
|
* @returns Promise with the quote response
|
|
18
17
|
*/
|
|
19
18
|
async getQuote(request) {
|
|
20
|
-
|
|
21
|
-
throw new types_1.AuthenticationError('Must be authenticated to get GIGDB quote. Call authenticate() first.');
|
|
22
|
-
}
|
|
23
|
-
try {
|
|
24
|
-
const response = await this.httpClient.post('/api/ThirdPartyIbGigdbQuote/get', request);
|
|
25
|
-
if (!response.flagStatus) {
|
|
26
|
-
const errorMessage = response.error || 'Failed to get GIGDB quote';
|
|
27
|
-
const errorCode = (0, error_utils_1.extractErrorCode)(response);
|
|
28
|
-
if (errorCode) {
|
|
29
|
-
throw new types_1.APIValidationError(errorMessage, errorCode, response);
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
throw new types_1.InstaBrainError(errorMessage, 400, response);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
if (!response.value) {
|
|
36
|
-
throw new types_1.InstaBrainError('No GIGDB quote data received from server');
|
|
37
|
-
}
|
|
38
|
-
return response.value;
|
|
39
|
-
}
|
|
40
|
-
catch (error) {
|
|
41
|
-
if (error instanceof types_1.InstaBrainError) {
|
|
42
|
-
throw error;
|
|
43
|
-
}
|
|
44
|
-
throw new types_1.InstaBrainError('Failed to get GIGDB quote: ' + error.message);
|
|
45
|
-
}
|
|
19
|
+
return this.post('get GIGDB quote', '/api/ThirdPartyIbGigdbQuote/get', request);
|
|
46
20
|
}
|
|
47
21
|
/**
|
|
48
22
|
* Start a GIGDB application from a quote
|
|
@@ -51,32 +25,7 @@ class GigdbService {
|
|
|
51
25
|
* @returns Promise with the application response
|
|
52
26
|
*/
|
|
53
27
|
async startApplication(request) {
|
|
54
|
-
|
|
55
|
-
throw new types_1.AuthenticationError('Must be authenticated to start GIGDB application. Call authenticate() first.');
|
|
56
|
-
}
|
|
57
|
-
try {
|
|
58
|
-
const response = await this.httpClient.post('/api/ThirdPartyGigdbApplication/start-application', request);
|
|
59
|
-
if (!response.flagStatus) {
|
|
60
|
-
const errorMessage = response.error || 'Failed to start GIGDB application';
|
|
61
|
-
const errorCode = (0, error_utils_1.extractErrorCode)(response);
|
|
62
|
-
if (errorCode) {
|
|
63
|
-
throw new types_1.APIValidationError(errorMessage, errorCode, response);
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
throw new types_1.InstaBrainError(errorMessage, 400, response);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
if (!response.value) {
|
|
70
|
-
throw new types_1.InstaBrainError('No GIGDB application data received from server');
|
|
71
|
-
}
|
|
72
|
-
return response.value;
|
|
73
|
-
}
|
|
74
|
-
catch (error) {
|
|
75
|
-
if (error instanceof types_1.InstaBrainError) {
|
|
76
|
-
throw error;
|
|
77
|
-
}
|
|
78
|
-
throw new types_1.InstaBrainError('Failed to start GIGDB application: ' + error.message);
|
|
79
|
-
}
|
|
28
|
+
return this.post('start GIGDB application', '/api/ThirdPartyGigdbApplication/start-application', request);
|
|
80
29
|
}
|
|
81
30
|
/**
|
|
82
31
|
* Save EFT payment details for a GIGDB application
|
|
@@ -84,30 +33,9 @@ class GigdbService {
|
|
|
84
33
|
* @returns Promise with payment validation response
|
|
85
34
|
*/
|
|
86
35
|
async saveEftPayment(request) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
try {
|
|
92
|
-
const response = await this.httpClient.post('/api/ThirdPartyPayment/save-eft-payment', request);
|
|
93
|
-
if (!response.flagStatus) {
|
|
94
|
-
const errorMessage = response.error || 'Failed to save EFT payment';
|
|
95
|
-
const errorCode = (0, error_utils_1.extractErrorCode)(response);
|
|
96
|
-
if (errorCode) {
|
|
97
|
-
throw new types_1.APIValidationError(errorMessage, errorCode, response);
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
throw new types_1.InstaBrainError(errorMessage, 400, response);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
return (_a = response.value) !== null && _a !== void 0 ? _a : true;
|
|
104
|
-
}
|
|
105
|
-
catch (error) {
|
|
106
|
-
if (error instanceof types_1.InstaBrainError) {
|
|
107
|
-
throw error;
|
|
108
|
-
}
|
|
109
|
-
throw new types_1.InstaBrainError('Failed to save EFT payment: ' + error.message);
|
|
110
|
-
}
|
|
36
|
+
const result = await this.post('save EFT payment', '/api/ThirdPartyPayment/save-eft-payment', request, undefined, true // allowNullValue — API returns BaseResponse<boolean>
|
|
37
|
+
);
|
|
38
|
+
return result !== null && result !== void 0 ? result : true;
|
|
111
39
|
}
|
|
112
40
|
/**
|
|
113
41
|
* Update a GIGDB quote with a different face amount or payment frequency
|
|
@@ -116,32 +44,7 @@ class GigdbService {
|
|
|
116
44
|
* @returns Promise with the updated quote response
|
|
117
45
|
*/
|
|
118
46
|
async updateQuote(request) {
|
|
119
|
-
|
|
120
|
-
throw new types_1.AuthenticationError('Must be authenticated to update GIGDB quote. Call authenticate() first.');
|
|
121
|
-
}
|
|
122
|
-
try {
|
|
123
|
-
const response = await this.httpClient.post('/api/ThirdPartyIbGigdbQuote/update', request);
|
|
124
|
-
if (!response.flagStatus) {
|
|
125
|
-
const errorMessage = response.error || 'Failed to update GIGDB quote';
|
|
126
|
-
const errorCode = (0, error_utils_1.extractErrorCode)(response);
|
|
127
|
-
if (errorCode) {
|
|
128
|
-
throw new types_1.APIValidationError(errorMessage, errorCode, response);
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
throw new types_1.InstaBrainError(errorMessage, 400, response);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
if (!response.value) {
|
|
135
|
-
throw new types_1.InstaBrainError('No GIGDB quote data received from server');
|
|
136
|
-
}
|
|
137
|
-
return response.value;
|
|
138
|
-
}
|
|
139
|
-
catch (error) {
|
|
140
|
-
if (error instanceof types_1.InstaBrainError) {
|
|
141
|
-
throw error;
|
|
142
|
-
}
|
|
143
|
-
throw new types_1.InstaBrainError('Failed to update GIGDB quote: ' + error.message);
|
|
144
|
-
}
|
|
47
|
+
return this.post('update GIGDB quote', '/api/ThirdPartyIbGigdbQuote/update', request);
|
|
145
48
|
}
|
|
146
49
|
/**
|
|
147
50
|
* Get the existing quote for a GIGDB opportunity
|
|
@@ -150,33 +53,9 @@ class GigdbService {
|
|
|
150
53
|
* @returns Promise with the current quote response
|
|
151
54
|
*/
|
|
152
55
|
async getExistingQuote(opportunityId) {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
}
|
|
156
|
-
try {
|
|
157
|
-
const response = await this.httpClient.get('/api/ThirdPartyIbGigdbQuote/get-existing-quote', { params: { opportunityId } });
|
|
158
|
-
if (!response.flagStatus) {
|
|
159
|
-
const errorMessage = response.error || 'Failed to get existing GIGDB quote';
|
|
160
|
-
const errorCode = (0, error_utils_1.extractErrorCode)(response);
|
|
161
|
-
if (errorCode) {
|
|
162
|
-
throw new types_1.APIValidationError(errorMessage, errorCode, response);
|
|
163
|
-
}
|
|
164
|
-
else {
|
|
165
|
-
throw new types_1.InstaBrainError(errorMessage, 400, response);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
if (!response.value) {
|
|
169
|
-
throw new types_1.InstaBrainError('No GIGDB quote data received from server');
|
|
170
|
-
}
|
|
171
|
-
return response.value;
|
|
172
|
-
}
|
|
173
|
-
catch (error) {
|
|
174
|
-
if (error instanceof types_1.InstaBrainError) {
|
|
175
|
-
throw error;
|
|
176
|
-
}
|
|
177
|
-
throw new types_1.InstaBrainError('Failed to get existing GIGDB quote: ' + error.message);
|
|
178
|
-
}
|
|
56
|
+
return this.get('get existing GIGDB quote', '/api/ThirdPartyIbGigdbQuote/get-existing-quote', {
|
|
57
|
+
params: { opportunityId },
|
|
58
|
+
});
|
|
179
59
|
}
|
|
180
60
|
}
|
|
181
61
|
exports.GigdbService = GigdbService;
|
|
182
|
-
//# sourceMappingURL=gigdb.service.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { HttpClient } from '../utils/http-client';
|
|
2
|
+
import { BaseService } from './base.service';
|
|
2
3
|
import { ThirdPartyQuoteReq, ThirdPartyQuoteResp } from '../types';
|
|
3
4
|
/**
|
|
4
5
|
* Quote service for getting insurance quotes from the InstaBrain API
|
|
5
6
|
*/
|
|
6
|
-
export declare class QuoteService {
|
|
7
|
-
private readonly httpClient;
|
|
7
|
+
export declare class QuoteService extends BaseService {
|
|
8
8
|
constructor(httpClient: HttpClient);
|
|
9
9
|
/**
|
|
10
10
|
* Get an insurance quote based on the provided parameters
|
|
@@ -23,4 +23,3 @@ export declare class QuoteService {
|
|
|
23
23
|
*/
|
|
24
24
|
getQuote(quoteRequest: ThirdPartyQuoteReq): Promise<ThirdPartyQuoteResp>;
|
|
25
25
|
}
|
|
26
|
-
//# sourceMappingURL=quote.service.d.ts.map
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.QuoteService = void 0;
|
|
4
|
-
const
|
|
5
|
-
const types_1 = require("../types");
|
|
4
|
+
const base_service_1 = require("./base.service");
|
|
6
5
|
/**
|
|
7
6
|
* Quote service for getting insurance quotes from the InstaBrain API
|
|
8
7
|
*/
|
|
9
|
-
class QuoteService {
|
|
8
|
+
class QuoteService extends base_service_1.BaseService {
|
|
10
9
|
constructor(httpClient) {
|
|
11
|
-
|
|
10
|
+
super(httpClient);
|
|
12
11
|
}
|
|
13
12
|
/**
|
|
14
13
|
* Get an insurance quote based on the provided parameters
|
|
@@ -26,37 +25,7 @@ class QuoteService {
|
|
|
26
25
|
* @returns Promise with the quote response
|
|
27
26
|
*/
|
|
28
27
|
async getQuote(quoteRequest) {
|
|
29
|
-
|
|
30
|
-
if (!this.httpClient.isAuthenticated()) {
|
|
31
|
-
throw new types_1.AuthenticationError('Must be authenticated to get quotes. Call authenticate() first.');
|
|
32
|
-
}
|
|
33
|
-
try {
|
|
34
|
-
const response = await this.httpClient.post('/api/ThirdPartyIbTermQuote/get', quoteRequest);
|
|
35
|
-
// Check if the response was successful
|
|
36
|
-
if (!response.flagStatus) {
|
|
37
|
-
// Handle API validation errors with specific error codes
|
|
38
|
-
const errorMessage = response.error || 'Failed to get quote';
|
|
39
|
-
// Try to extract error code from response
|
|
40
|
-
const errorCode = (0, error_utils_1.extractErrorCode)(response);
|
|
41
|
-
if (errorCode) {
|
|
42
|
-
throw new types_1.APIValidationError(errorMessage, errorCode, response);
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
throw new types_1.InstaBrainError(errorMessage, 400, response);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
if (!response.value) {
|
|
49
|
-
throw new types_1.InstaBrainError('No quote data received from server');
|
|
50
|
-
}
|
|
51
|
-
return response.value;
|
|
52
|
-
}
|
|
53
|
-
catch (error) {
|
|
54
|
-
if (error instanceof types_1.InstaBrainError) {
|
|
55
|
-
throw error;
|
|
56
|
-
}
|
|
57
|
-
throw new types_1.InstaBrainError('Failed to get quote: ' + error.message);
|
|
58
|
-
}
|
|
28
|
+
return this.post('get quote', '/api/ThirdPartyIbTermQuote/get', quoteRequest);
|
|
59
29
|
}
|
|
60
30
|
}
|
|
61
31
|
exports.QuoteService = QuoteService;
|
|
62
|
-
//# sourceMappingURL=quote.service.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { HttpClient } from '../utils/http-client';
|
|
2
|
+
import { BaseService } from './base.service';
|
|
2
3
|
import { AgentPortalReq, ThirdPartyProspectsResp, ThirdPartySalesReportRes, ThirdPartyApplicationReportRes } from '../types';
|
|
3
4
|
/**
|
|
4
5
|
* Reports service for getting prospects, sales, and applications data from InstaBrain API
|
|
5
6
|
* These APIs provide dashboard-ready data for agent portals and reporting systems
|
|
6
7
|
*/
|
|
7
|
-
export declare class ReportsService {
|
|
8
|
-
private readonly httpClient;
|
|
8
|
+
export declare class ReportsService extends BaseService {
|
|
9
9
|
constructor(httpClient: HttpClient);
|
|
10
10
|
/**
|
|
11
11
|
* Get prospects data - quotes that haven't been converted to applications yet
|
|
@@ -55,4 +55,3 @@ export declare class ReportsService {
|
|
|
55
55
|
*/
|
|
56
56
|
getApplications(request: AgentPortalReq): Promise<ThirdPartyApplicationReportRes>;
|
|
57
57
|
}
|
|
58
|
-
//# sourceMappingURL=reports.service.d.ts.map
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ReportsService = void 0;
|
|
4
|
-
const
|
|
5
|
-
const types_1 = require("../types");
|
|
4
|
+
const base_service_1 = require("./base.service");
|
|
6
5
|
/**
|
|
7
6
|
* Reports service for getting prospects, sales, and applications data from InstaBrain API
|
|
8
7
|
* These APIs provide dashboard-ready data for agent portals and reporting systems
|
|
9
8
|
*/
|
|
10
|
-
class ReportsService {
|
|
9
|
+
class ReportsService extends base_service_1.BaseService {
|
|
11
10
|
constructor(httpClient) {
|
|
12
|
-
|
|
11
|
+
super(httpClient);
|
|
13
12
|
}
|
|
14
13
|
/**
|
|
15
14
|
* Get prospects data - quotes that haven't been converted to applications yet
|
|
@@ -25,33 +24,7 @@ class ReportsService {
|
|
|
25
24
|
* @returns Promise with prospects data including count and details
|
|
26
25
|
*/
|
|
27
26
|
async getProspects(request) {
|
|
28
|
-
|
|
29
|
-
if (!this.httpClient.isAuthenticated()) {
|
|
30
|
-
throw new types_1.AuthenticationError('Must be authenticated to get prospects. Call authenticate() first.');
|
|
31
|
-
}
|
|
32
|
-
try {
|
|
33
|
-
const response = await this.httpClient.post('/api/ThirdParty/get-prospects', request);
|
|
34
|
-
if (!response.flagStatus) {
|
|
35
|
-
const errorMessage = response.error || 'Failed to get prospects';
|
|
36
|
-
const errorCode = (0, error_utils_1.extractErrorCode)(response);
|
|
37
|
-
if (errorCode) {
|
|
38
|
-
throw new types_1.APIValidationError(errorMessage, errorCode, response);
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
throw new types_1.InstaBrainError(errorMessage, 400, response);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
if (!response.value) {
|
|
45
|
-
throw new types_1.InstaBrainError('No prospects data received from server');
|
|
46
|
-
}
|
|
47
|
-
return response.value;
|
|
48
|
-
}
|
|
49
|
-
catch (error) {
|
|
50
|
-
if (error instanceof types_1.InstaBrainError) {
|
|
51
|
-
throw error;
|
|
52
|
-
}
|
|
53
|
-
throw new types_1.InstaBrainError('Failed to get prospects: ' + error.message);
|
|
54
|
-
}
|
|
27
|
+
return this.post('get prospects', '/api/ThirdParty/get-prospects', request);
|
|
55
28
|
}
|
|
56
29
|
/**
|
|
57
30
|
* Get sales data - completed/sold policies
|
|
@@ -69,33 +42,7 @@ class ReportsService {
|
|
|
69
42
|
* @returns Promise with sales data including total premium amount
|
|
70
43
|
*/
|
|
71
44
|
async getSales(request) {
|
|
72
|
-
|
|
73
|
-
if (!this.httpClient.isAuthenticated()) {
|
|
74
|
-
throw new types_1.AuthenticationError('Must be authenticated to get sales. Call authenticate() first.');
|
|
75
|
-
}
|
|
76
|
-
try {
|
|
77
|
-
const response = await this.httpClient.post('/api/ThirdParty/get-sales', request);
|
|
78
|
-
if (!response.flagStatus) {
|
|
79
|
-
const errorMessage = response.error || 'Failed to get sales';
|
|
80
|
-
const errorCode = (0, error_utils_1.extractErrorCode)(response);
|
|
81
|
-
if (errorCode) {
|
|
82
|
-
throw new types_1.APIValidationError(errorMessage, errorCode, response);
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
throw new types_1.InstaBrainError(errorMessage, 400, response);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
if (!response.value) {
|
|
89
|
-
throw new types_1.InstaBrainError('No sales data received from server');
|
|
90
|
-
}
|
|
91
|
-
return response.value;
|
|
92
|
-
}
|
|
93
|
-
catch (error) {
|
|
94
|
-
if (error instanceof types_1.InstaBrainError) {
|
|
95
|
-
throw error;
|
|
96
|
-
}
|
|
97
|
-
throw new types_1.InstaBrainError('Failed to get sales: ' + error.message);
|
|
98
|
-
}
|
|
45
|
+
return this.post('get sales', '/api/ThirdParty/get-sales', request);
|
|
99
46
|
}
|
|
100
47
|
/**
|
|
101
48
|
* Get applications data - applications in progress
|
|
@@ -114,34 +61,7 @@ class ReportsService {
|
|
|
114
61
|
* @returns Promise with applications data including status and completion info
|
|
115
62
|
*/
|
|
116
63
|
async getApplications(request) {
|
|
117
|
-
|
|
118
|
-
if (!this.httpClient.isAuthenticated()) {
|
|
119
|
-
throw new types_1.AuthenticationError('Must be authenticated to get applications. Call authenticate() first.');
|
|
120
|
-
}
|
|
121
|
-
try {
|
|
122
|
-
const response = await this.httpClient.post('/api/ThirdParty/get-application', request);
|
|
123
|
-
if (!response.flagStatus) {
|
|
124
|
-
const errorMessage = response.error || 'Failed to get applications';
|
|
125
|
-
const errorCode = (0, error_utils_1.extractErrorCode)(response);
|
|
126
|
-
if (errorCode) {
|
|
127
|
-
throw new types_1.APIValidationError(errorMessage, errorCode, response);
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
throw new types_1.InstaBrainError(errorMessage, 400, response);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
if (!response.value) {
|
|
134
|
-
throw new types_1.InstaBrainError('No applications data received from server');
|
|
135
|
-
}
|
|
136
|
-
return response.value;
|
|
137
|
-
}
|
|
138
|
-
catch (error) {
|
|
139
|
-
if (error instanceof types_1.InstaBrainError) {
|
|
140
|
-
throw error;
|
|
141
|
-
}
|
|
142
|
-
throw new types_1.InstaBrainError('Failed to get applications: ' + error.message);
|
|
143
|
-
}
|
|
64
|
+
return this.post('get applications', '/api/ThirdParty/get-application', request);
|
|
144
65
|
}
|
|
145
66
|
}
|
|
146
67
|
exports.ReportsService = ReportsService;
|
|
147
|
-
//# sourceMappingURL=reports.service.js.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { HttpClient } from '../utils/http-client';
|
|
2
|
+
import { BaseService } from './base.service';
|
|
2
3
|
import { ThirdPartySendPinReq, ThirdPartyResendPinReq, ThirdPartyVerifyPinReq, ThirdPartyPrepareDocsResp, ThirdPartySendPinResp, ThirdPartyResendPinResp, ThirdPartyVerifyPinResp } from '../types';
|
|
3
4
|
/**
|
|
4
5
|
* Secure Sign service for document signing flow
|
|
@@ -11,8 +12,7 @@ import { ThirdPartySendPinReq, ThirdPartyResendPinReq, ThirdPartyVerifyPinReq, T
|
|
|
11
12
|
* 3. resendPin() (optional) — resend if signer didn't receive PIN
|
|
12
13
|
* 4. verifyPin() — verify PIN to complete signing
|
|
13
14
|
*/
|
|
14
|
-
export declare class SecureSignService {
|
|
15
|
-
private readonly httpClient;
|
|
15
|
+
export declare class SecureSignService extends BaseService {
|
|
16
16
|
constructor(httpClient: HttpClient);
|
|
17
17
|
/**
|
|
18
18
|
* Prepare the signing package and check available delivery channels
|
|
@@ -45,4 +45,3 @@ export declare class SecureSignService {
|
|
|
45
45
|
*/
|
|
46
46
|
verifyPin(request: ThirdPartyVerifyPinReq): Promise<ThirdPartyVerifyPinResp>;
|
|
47
47
|
}
|
|
48
|
-
//# sourceMappingURL=secure-sign.service.d.ts.map
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SecureSignService = void 0;
|
|
4
|
-
const
|
|
5
|
-
const types_1 = require("../types");
|
|
4
|
+
const base_service_1 = require("./base.service");
|
|
6
5
|
/**
|
|
7
6
|
* Secure Sign service for document signing flow
|
|
8
7
|
* Shared across all third-party products — not specific to GIGDB.
|
|
@@ -14,9 +13,9 @@ const types_1 = require("../types");
|
|
|
14
13
|
* 3. resendPin() (optional) — resend if signer didn't receive PIN
|
|
15
14
|
* 4. verifyPin() — verify PIN to complete signing
|
|
16
15
|
*/
|
|
17
|
-
class SecureSignService {
|
|
16
|
+
class SecureSignService extends base_service_1.BaseService {
|
|
18
17
|
constructor(httpClient) {
|
|
19
|
-
|
|
18
|
+
super(httpClient);
|
|
20
19
|
}
|
|
21
20
|
/**
|
|
22
21
|
* Prepare the signing package and check available delivery channels
|
|
@@ -26,32 +25,7 @@ class SecureSignService {
|
|
|
26
25
|
* @returns Promise with delivery channels and sign completion status
|
|
27
26
|
*/
|
|
28
27
|
async prepareDocsAndGetDeliveryChannels(opportunityId) {
|
|
29
|
-
|
|
30
|
-
throw new types_1.AuthenticationError('Must be authenticated to prepare documents. Call authenticate() first.');
|
|
31
|
-
}
|
|
32
|
-
try {
|
|
33
|
-
const response = await this.httpClient.get('/api/ThirdPartySecureSign/get-delivery-channels-and-prepare-docs', { params: { opportunityId } });
|
|
34
|
-
if (!response.flagStatus) {
|
|
35
|
-
const errorMessage = response.error || 'Failed to prepare documents and get delivery channels';
|
|
36
|
-
const errorCode = (0, error_utils_1.extractErrorCode)(response);
|
|
37
|
-
if (errorCode) {
|
|
38
|
-
throw new types_1.APIValidationError(errorMessage, errorCode, response);
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
throw new types_1.InstaBrainError(errorMessage, 400, response);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
if (!response.value) {
|
|
45
|
-
throw new types_1.InstaBrainError('No document preparation data received from server');
|
|
46
|
-
}
|
|
47
|
-
return response.value;
|
|
48
|
-
}
|
|
49
|
-
catch (error) {
|
|
50
|
-
if (error instanceof types_1.InstaBrainError) {
|
|
51
|
-
throw error;
|
|
52
|
-
}
|
|
53
|
-
throw new types_1.InstaBrainError('Failed to prepare documents and get delivery channels: ' + error.message);
|
|
54
|
-
}
|
|
28
|
+
return this.get('prepare documents', '/api/ThirdPartySecureSign/get-delivery-channels-and-prepare-docs', { params: { opportunityId } });
|
|
55
29
|
}
|
|
56
30
|
/**
|
|
57
31
|
* Send a verification PIN via SMS and/or Email and receive the documents link
|
|
@@ -61,32 +35,7 @@ class SecureSignService {
|
|
|
61
35
|
* @returns Promise with documents link and disclosure script
|
|
62
36
|
*/
|
|
63
37
|
async sendPinAndGetDocumentsLink(request) {
|
|
64
|
-
|
|
65
|
-
throw new types_1.AuthenticationError('Must be authenticated to send PIN. Call authenticate() first.');
|
|
66
|
-
}
|
|
67
|
-
try {
|
|
68
|
-
const response = await this.httpClient.post('/api/ThirdPartySecureSign/send-pin-and-get-documents-link', request);
|
|
69
|
-
if (!response.flagStatus) {
|
|
70
|
-
const errorMessage = response.error || 'Failed to send PIN and get documents link';
|
|
71
|
-
const errorCode = (0, error_utils_1.extractErrorCode)(response);
|
|
72
|
-
if (errorCode) {
|
|
73
|
-
throw new types_1.APIValidationError(errorMessage, errorCode, response);
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
throw new types_1.InstaBrainError(errorMessage, 400, response);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
if (!response.value) {
|
|
80
|
-
throw new types_1.InstaBrainError('No PIN/documents data received from server');
|
|
81
|
-
}
|
|
82
|
-
return response.value;
|
|
83
|
-
}
|
|
84
|
-
catch (error) {
|
|
85
|
-
if (error instanceof types_1.InstaBrainError) {
|
|
86
|
-
throw error;
|
|
87
|
-
}
|
|
88
|
-
throw new types_1.InstaBrainError('Failed to send PIN and get documents link: ' + error.message);
|
|
89
|
-
}
|
|
38
|
+
return this.post('send PIN', '/api/ThirdPartySecureSign/send-pin-and-get-documents-link', request);
|
|
90
39
|
}
|
|
91
40
|
/**
|
|
92
41
|
* Resend the verification PIN if the signer did not receive it
|
|
@@ -95,32 +44,7 @@ class SecureSignService {
|
|
|
95
44
|
* @returns Promise with PIN sent confirmation
|
|
96
45
|
*/
|
|
97
46
|
async resendPin(request) {
|
|
98
|
-
|
|
99
|
-
throw new types_1.AuthenticationError('Must be authenticated to resend PIN. Call authenticate() first.');
|
|
100
|
-
}
|
|
101
|
-
try {
|
|
102
|
-
const response = await this.httpClient.post('/api/ThirdPartySecureSign/resend-pin', request);
|
|
103
|
-
if (!response.flagStatus) {
|
|
104
|
-
const errorMessage = response.error || 'Failed to resend PIN';
|
|
105
|
-
const errorCode = (0, error_utils_1.extractErrorCode)(response);
|
|
106
|
-
if (errorCode) {
|
|
107
|
-
throw new types_1.APIValidationError(errorMessage, errorCode, response);
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
throw new types_1.InstaBrainError(errorMessage, 400, response);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
if (!response.value) {
|
|
114
|
-
throw new types_1.InstaBrainError('No resend PIN data received from server');
|
|
115
|
-
}
|
|
116
|
-
return response.value;
|
|
117
|
-
}
|
|
118
|
-
catch (error) {
|
|
119
|
-
if (error instanceof types_1.InstaBrainError) {
|
|
120
|
-
throw error;
|
|
121
|
-
}
|
|
122
|
-
throw new types_1.InstaBrainError('Failed to resend PIN: ' + error.message);
|
|
123
|
-
}
|
|
47
|
+
return this.post('resend PIN', '/api/ThirdPartySecureSign/resend-pin', request);
|
|
124
48
|
}
|
|
125
49
|
/**
|
|
126
50
|
* Verify the PIN entered by the signer to complete document signing
|
|
@@ -129,33 +53,7 @@ class SecureSignService {
|
|
|
129
53
|
* @returns Promise with verification result
|
|
130
54
|
*/
|
|
131
55
|
async verifyPin(request) {
|
|
132
|
-
|
|
133
|
-
throw new types_1.AuthenticationError('Must be authenticated to verify PIN. Call authenticate() first.');
|
|
134
|
-
}
|
|
135
|
-
try {
|
|
136
|
-
const response = await this.httpClient.post('/api/ThirdPartySecureSign/verify-pin', request);
|
|
137
|
-
if (!response.flagStatus) {
|
|
138
|
-
const errorMessage = response.error || 'Failed to verify PIN';
|
|
139
|
-
const errorCode = (0, error_utils_1.extractErrorCode)(response);
|
|
140
|
-
if (errorCode) {
|
|
141
|
-
throw new types_1.APIValidationError(errorMessage, errorCode, response);
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
throw new types_1.InstaBrainError(errorMessage, 400, response);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
if (!response.value) {
|
|
148
|
-
throw new types_1.InstaBrainError('No PIN verification data received from server');
|
|
149
|
-
}
|
|
150
|
-
return response.value;
|
|
151
|
-
}
|
|
152
|
-
catch (error) {
|
|
153
|
-
if (error instanceof types_1.InstaBrainError) {
|
|
154
|
-
throw error;
|
|
155
|
-
}
|
|
156
|
-
throw new types_1.InstaBrainError('Failed to verify PIN: ' + error.message);
|
|
157
|
-
}
|
|
56
|
+
return this.post('verify PIN', '/api/ThirdPartySecureSign/verify-pin', request);
|
|
158
57
|
}
|
|
159
58
|
}
|
|
160
59
|
exports.SecureSignService = SecureSignService;
|
|
161
|
-
//# sourceMappingURL=secure-sign.service.js.map
|