@benup/bensdk 1.11.4 → 1.11.12

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.
@@ -1,4 +1,5 @@
1
1
  import z from 'zod';
2
+ import { EmploymentContracts } from '@benup-dev/benup-api';
2
3
  import { AxiosInstance } from 'axios';
3
4
  import { BenefitDefinitionSchema } from '../schemas/benefit-definition.schema';
4
5
  import { TokenHelper } from './lib/token-helper.lib.type';
@@ -6,6 +7,7 @@ import { StateHandlerCtx, WebhookRequest, WebhookResponse } from './state-handle
6
7
  type Base = z.infer<typeof BenefitDefinitionSchema>;
7
8
  export type AuthHandlerCtx = {
8
9
  tokenHelper: TokenHelper;
10
+ employmentContract: z.infer<typeof EmploymentContracts.default.collection.default>;
9
11
  };
10
12
  export type AuthHandlerResult = {
11
13
  outcome: 'FAILED';
@@ -0,0 +1,9 @@
1
+ import { AxiosResponse } from 'axios';
2
+ export type SendIssueParameters = {
3
+ title: string;
4
+ description: string;
5
+ fieldPath?: string;
6
+ };
7
+ export interface IssuesHelper {
8
+ sendIssue: (sendIssueParameters: SendIssueParameters) => Promise<AxiosResponse>;
9
+ }
@@ -8,6 +8,7 @@ import { DataPoint, DataPointContext } from './../../shared/lib/consumer/datapoi
8
8
  import { BenefitDefinition } from './benefit-definition.types';
9
9
  import { ActionHelper } from './lib/action-helper.lib.type.js';
10
10
  import { DeductionFileIngestionHelper } from './lib/deduction-file-ingestion.lib.type.js';
11
+ import { IssuesHelper } from './lib/issues-helper.lib.type';
11
12
  export type MessageBody = z.infer<typeof ActionConsumerMessageSchema>;
12
13
  export interface StateHandlerResponse<TLogs, TCtx> {
13
14
  handlerResponse: HandlerResponse;
@@ -75,6 +76,11 @@ export interface StateHandlerCtx {
75
76
  * actionHelper
76
77
  */
77
78
  actionHelper?: ActionHelper;
79
+ /**
80
+ * Issues Helper
81
+ * Used to send addressable issues for the company (e.g.: missing required property that comes from the payroll)
82
+ */
83
+ issuesHelper?: IssuesHelper;
78
84
  /**
79
85
  * send message to a queue
80
86
  */
@@ -33,6 +33,7 @@ export default {
33
33
  country: ''
34
34
  },
35
35
  email: '',
36
+ companyEmail: '',
36
37
  sex: 'M',
37
38
  maritalStatus: 'NONE',
38
39
  documents: {
@@ -44,13 +45,25 @@ export default {
44
45
  }
45
46
  },
46
47
  createdAt: '',
47
- updatedAt: ''
48
+ updatedAt: '',
49
+ isInconsistent: false,
50
+ inconsistentReason: {
51
+ errorType: 'VALIDATION',
52
+ validationErrors: [],
53
+ businessError: ''
54
+ }
48
55
  },
49
56
  employmentContract: {
50
57
  status: 'ADMITTED',
51
58
  _id: '',
52
59
  fingerprint: '',
53
60
  createdAt: '',
61
+ isInconsistent: false,
62
+ inconsistentReason: {
63
+ errorType: 'VALIDATION',
64
+ validationErrors: [],
65
+ businessError: ''
66
+ },
54
67
  lastSeenAtExecutionID: '',
55
68
  companyID: '',
56
69
  customerID: '',
@@ -62,6 +75,10 @@ export default {
62
75
  code: 0,
63
76
  description: ''
64
77
  },
78
+ occupation: {
79
+ code: 0,
80
+ description: ''
81
+ },
65
82
  establishment: {
66
83
  code: 0,
67
84
  description: '',
@@ -82,6 +99,9 @@ export default {
82
99
  externalCompanyID: ''
83
100
  },
84
101
  transferredAt: new Date('2025-05-29T15:05:10.431+0000')
102
+ },
103
+ dismissal: {
104
+ externalReasonID: ''
85
105
  }
86
106
  },
87
107
  dependents: [],
@@ -94,6 +114,17 @@ export default {
94
114
  description: ''
95
115
  },
96
116
  businessUnit: {
117
+ address: {
118
+ street: 'Endereço destinado à entregas',
119
+ number: '666',
120
+ complement: 'A',
121
+ neighborhood: '1st Layer',
122
+ city: 'City',
123
+ state: 'State',
124
+ zipCode: '666-66',
125
+ country: 'Hell',
126
+ extraField: 'Extra data'
127
+ },
97
128
  code: '',
98
129
  description: ''
99
130
  },
@@ -115,13 +146,15 @@ export default {
115
146
  externalEstablishmentName: ''
116
147
  },
117
148
  originExecutionID: '',
149
+ avaliableDocuments: [],
118
150
  benefits: {
119
151
  DUMMY: {
120
152
  options: {},
121
153
  status: 'ENABLED',
122
154
  value: false,
123
155
  isEligible: false,
124
- statusOriginID: ''
156
+ statusOriginID: '',
157
+ lastUpdatedStatusAt: new Date('2025-05-29T15:05:10.431+0000')
125
158
  }
126
159
  }
127
160
  },
@@ -154,7 +187,8 @@ export default {
154
187
  productToggle: {
155
188
  isOrchestratorActive: true,
156
189
  isManualExecutionActive: true,
157
- isIntegratorActive: true
190
+ isIntegratorActive: true,
191
+ isDocumentImportActive: true
158
192
  },
159
193
  payrollReferenceCutoffDay: 20,
160
194
  modifiedContractsWindowInDays: 15,
@@ -221,7 +255,8 @@ export default {
221
255
  deduction: [],
222
256
  situation: [],
223
257
  events: [],
224
- rechargeTemplate: []
258
+ rechargeTemplate: [],
259
+ documents: []
225
260
  },
226
261
  version: 3,
227
262
  isDeleted: false,
@@ -241,7 +276,8 @@ export default {
241
276
  status: 'ENABLED',
242
277
  value: false,
243
278
  isEligible: false,
244
- statusOriginID: ''
279
+ statusOriginID: '',
280
+ lastUpdatedStatusAt: new Date('2025-05-29T15:05:10.431+0000')
245
281
  }
246
282
  },
247
283
  isDeleted: false,
@@ -249,7 +285,8 @@ export default {
249
285
  externalDependentID: '',
250
286
  externalDependentCode: '',
251
287
  birthDate: '',
252
- relationshipType: 'OTHER'
288
+ relationshipType: 'OTHER',
289
+ avaliableDocuments: []
253
290
  }
254
291
  },
255
292
  eligibilityOptions: {
@@ -269,6 +306,9 @@ export default {
269
306
  createdAt: new Date('2025-05-29T15:05:10.431+0000'),
270
307
  updatedAt: new Date('2025-05-29T20:30:03.720+0000'),
271
308
  deductionInput: {
309
+ externalEventID: '123',
310
+ externalPayrollID: '1',
311
+ referenceMonthOffset: 'CURRENT',
272
312
  value: 0,
273
313
  date: '',
274
314
  isAccumulative: false
@@ -33,6 +33,7 @@ export default {
33
33
  country: ''
34
34
  },
35
35
  email: '',
36
+ companyEmail: '',
36
37
  sex: 'M',
37
38
  maritalStatus: 'NONE',
38
39
  documents: {
@@ -44,13 +45,25 @@ export default {
44
45
  }
45
46
  },
46
47
  createdAt: '',
47
- updatedAt: ''
48
+ updatedAt: '',
49
+ isInconsistent: false,
50
+ inconsistentReason: {
51
+ errorType: 'VALIDATION',
52
+ validationErrors: [],
53
+ businessError: ''
54
+ }
48
55
  },
49
56
  employmentContract: {
50
57
  status: 'ADMITTED',
51
58
  _id: '',
52
59
  fingerprint: '',
53
60
  createdAt: '',
61
+ isInconsistent: false,
62
+ inconsistentReason: {
63
+ errorType: 'VALIDATION',
64
+ validationErrors: [],
65
+ businessError: ''
66
+ },
54
67
  companyID: '',
55
68
  lastSeenAtExecutionID: '',
56
69
  customerID: '',
@@ -62,6 +75,10 @@ export default {
62
75
  code: 0,
63
76
  description: ''
64
77
  },
78
+ occupation: {
79
+ code: 0,
80
+ description: ''
81
+ },
65
82
  establishment: {
66
83
  code: 0,
67
84
  description: '',
@@ -82,6 +99,9 @@ export default {
82
99
  externalCompanyID: ''
83
100
  },
84
101
  transferredAt: new Date('2025-05-29T15:05:10.431+0000')
102
+ },
103
+ dismissal: {
104
+ externalReasonID: ''
85
105
  }
86
106
  },
87
107
  dependents: [],
@@ -94,6 +114,17 @@ export default {
94
114
  description: ''
95
115
  },
96
116
  businessUnit: {
117
+ address: {
118
+ street: 'Endereço destinado à entregas',
119
+ number: '666',
120
+ complement: 'A',
121
+ neighborhood: '1st Layer',
122
+ city: 'City',
123
+ state: 'State',
124
+ zipCode: '666-66',
125
+ country: 'Hell',
126
+ extraField: 'Extra data'
127
+ },
97
128
  code: '',
98
129
  description: ''
99
130
  },
@@ -115,13 +146,15 @@ export default {
115
146
  externalEstablishmentName: ''
116
147
  },
117
148
  originExecutionID: '',
149
+ avaliableDocuments: [],
118
150
  benefits: {
119
151
  DUMMY: {
120
152
  options: {},
121
153
  status: 'ENABLED',
122
154
  value: false,
123
155
  isEligible: false,
124
- statusOriginID: ''
156
+ statusOriginID: '',
157
+ lastUpdatedStatusAt: new Date('2025-05-29T15:05:10.431+0000')
125
158
  }
126
159
  }
127
160
  },
@@ -154,7 +187,8 @@ export default {
154
187
  productToggle: {
155
188
  isOrchestratorActive: true,
156
189
  isManualExecutionActive: true,
157
- isIntegratorActive: true
190
+ isIntegratorActive: true,
191
+ isDocumentImportActive: true
158
192
  },
159
193
  payrollReferenceCutoffDay: 20,
160
194
  modifiedContractsWindowInDays: 15,
@@ -221,7 +255,8 @@ export default {
221
255
  deduction: [],
222
256
  situation: [],
223
257
  events: [],
224
- rechargeTemplate: []
258
+ rechargeTemplate: [],
259
+ documents: []
225
260
  },
226
261
  version: 3,
227
262
  isDeleted: false,
@@ -241,7 +276,8 @@ export default {
241
276
  status: 'ENABLED',
242
277
  value: false,
243
278
  isEligible: false,
244
- statusOriginID: ''
279
+ statusOriginID: '',
280
+ lastUpdatedStatusAt: new Date('2025-05-29T15:05:10.431+0000')
245
281
  }
246
282
  },
247
283
  isDeleted: false,
@@ -249,7 +285,8 @@ export default {
249
285
  externalDependentID: '',
250
286
  externalDependentCode: '',
251
287
  birthDate: '',
252
- relationshipType: 'OTHER'
288
+ relationshipType: 'OTHER',
289
+ avaliableDocuments: []
253
290
  }
254
291
  },
255
292
  eligibilityOptions: {
@@ -33,6 +33,7 @@ export default {
33
33
  country: ''
34
34
  },
35
35
  email: '',
36
+ companyEmail: '',
36
37
  sex: 'M',
37
38
  maritalStatus: 'NONE',
38
39
  documents: {
@@ -44,12 +45,24 @@ export default {
44
45
  }
45
46
  },
46
47
  createdAt: '',
47
- updatedAt: ''
48
+ updatedAt: '',
49
+ isInconsistent: false,
50
+ inconsistentReason: {
51
+ errorType: 'VALIDATION',
52
+ validationErrors: [],
53
+ businessError: ''
54
+ }
48
55
  },
49
56
  employmentContract: {
50
57
  status: 'ADMITTED',
51
58
  _id: '',
52
59
  fingerprint: '',
60
+ isInconsistent: false,
61
+ inconsistentReason: {
62
+ errorType: 'VALIDATION',
63
+ validationErrors: [],
64
+ businessError: ''
65
+ },
53
66
  lastSeenAtExecutionID: '',
54
67
  createdAt: '',
55
68
  companyID: '',
@@ -62,6 +75,10 @@ export default {
62
75
  code: 0,
63
76
  description: ''
64
77
  },
78
+ occupation: {
79
+ code: 0,
80
+ description: ''
81
+ },
65
82
  establishment: {
66
83
  code: 0,
67
84
  description: '',
@@ -82,6 +99,9 @@ export default {
82
99
  externalCompanyID: ''
83
100
  },
84
101
  transferredAt: new Date('2025-05-29T15:05:10.431+0000')
102
+ },
103
+ dismissal: {
104
+ externalReasonID: ''
85
105
  }
86
106
  },
87
107
  dependents: [],
@@ -94,6 +114,17 @@ export default {
94
114
  description: ''
95
115
  },
96
116
  businessUnit: {
117
+ address: {
118
+ street: 'Endereço destinado à entregas',
119
+ number: '666',
120
+ complement: 'A',
121
+ neighborhood: '1st Layer',
122
+ city: 'City',
123
+ state: 'State',
124
+ zipCode: '666-66',
125
+ country: 'Hell',
126
+ extraField: 'Extra data'
127
+ },
97
128
  code: '',
98
129
  description: ''
99
130
  },
@@ -115,13 +146,15 @@ export default {
115
146
  externalEstablishmentName: ''
116
147
  },
117
148
  originExecutionID: '',
149
+ avaliableDocuments: [],
118
150
  benefits: {
119
151
  DUMMY: {
120
152
  options: {},
121
153
  status: 'ENABLED',
122
154
  value: false,
123
155
  isEligible: false,
124
- statusOriginID: ''
156
+ statusOriginID: '',
157
+ lastUpdatedStatusAt: new Date('2025-05-29T15:05:10.431+0000')
125
158
  }
126
159
  }
127
160
  },
@@ -154,7 +187,8 @@ export default {
154
187
  productToggle: {
155
188
  isOrchestratorActive: true,
156
189
  isManualExecutionActive: true,
157
- isIntegratorActive: true
190
+ isIntegratorActive: true,
191
+ isDocumentImportActive: true
158
192
  },
159
193
  payrollReferenceCutoffDay: 20,
160
194
  modifiedContractsWindowInDays: 15,
@@ -163,7 +197,8 @@ export default {
163
197
  deduction: [],
164
198
  situation: [],
165
199
  events: [],
166
- rechargeTemplate: []
200
+ rechargeTemplate: [],
201
+ documents: []
167
202
  },
168
203
  version: 3,
169
204
  isDeleted: false,
@@ -183,9 +218,11 @@ export default {
183
218
  status: 'ENABLED',
184
219
  value: false,
185
220
  isEligible: false,
186
- statusOriginID: ''
221
+ statusOriginID: '',
222
+ lastUpdatedStatusAt: new Date('2025-05-29T15:05:10.431+0000')
187
223
  }
188
224
  },
225
+ avaliableDocuments: [],
189
226
  isDeleted: false,
190
227
  mothersName: '',
191
228
  externalDependentID: '',
@@ -216,6 +253,9 @@ export default {
216
253
  productID: '',
217
254
  ticketCode: 0,
218
255
  quantity: 0,
219
- tariffValue: 0
256
+ tariffValue: 0,
257
+ rechargeOptions: {
258
+ contractNumber: '123456'
259
+ }
220
260
  }
221
261
  } satisfies DeepRequired<z.infer<typeof RechargeActionSchema>>;
@@ -33,6 +33,7 @@ export default {
33
33
  country: ''
34
34
  },
35
35
  email: '',
36
+ companyEmail: '',
36
37
  sex: 'M',
37
38
  maritalStatus: 'NONE',
38
39
  documents: {
@@ -44,13 +45,25 @@ export default {
44
45
  }
45
46
  },
46
47
  createdAt: '',
47
- updatedAt: ''
48
+ updatedAt: '',
49
+ isInconsistent: false,
50
+ inconsistentReason: {
51
+ errorType: 'VALIDATION',
52
+ validationErrors: [],
53
+ businessError: ''
54
+ }
48
55
  },
49
56
  employmentContract: {
50
57
  status: 'ADMITTED',
51
58
  _id: '',
52
59
  fingerprint: '',
53
60
  createdAt: '',
61
+ isInconsistent: false,
62
+ inconsistentReason: {
63
+ errorType: 'VALIDATION',
64
+ validationErrors: [],
65
+ businessError: ''
66
+ },
54
67
  lastSeenAtExecutionID: '',
55
68
  companyID: '',
56
69
  customerID: '',
@@ -62,6 +75,10 @@ export default {
62
75
  code: 0,
63
76
  description: ''
64
77
  },
78
+ occupation: {
79
+ code: 0,
80
+ description: ''
81
+ },
65
82
  establishment: {
66
83
  code: 0,
67
84
  description: '',
@@ -82,6 +99,9 @@ export default {
82
99
  externalCompanyID: ''
83
100
  },
84
101
  transferredAt: new Date('2025-05-29T15:05:10.431+0000')
102
+ },
103
+ dismissal: {
104
+ externalReasonID: ''
85
105
  }
86
106
  },
87
107
  dependents: [],
@@ -94,6 +114,17 @@ export default {
94
114
  description: ''
95
115
  },
96
116
  businessUnit: {
117
+ address: {
118
+ street: 'Endereço destinado à entregas',
119
+ number: '666',
120
+ complement: 'A',
121
+ neighborhood: '1st Layer',
122
+ city: 'City',
123
+ state: 'State',
124
+ zipCode: '666-66',
125
+ country: 'Hell',
126
+ extraField: 'Extra data'
127
+ },
97
128
  code: '',
98
129
  description: ''
99
130
  },
@@ -114,6 +145,7 @@ export default {
114
145
  externalEstablishmentCNPJ: '',
115
146
  externalEstablishmentName: ''
116
147
  },
148
+ avaliableDocuments: [],
117
149
  originExecutionID: '',
118
150
  benefits: {
119
151
  DUMMY: {
@@ -121,7 +153,8 @@ export default {
121
153
  status: 'ENABLED',
122
154
  value: false,
123
155
  isEligible: false,
124
- statusOriginID: ''
156
+ statusOriginID: '',
157
+ lastUpdatedStatusAt: new Date('2025-05-29T15:05:10.431+0000')
125
158
  }
126
159
  }
127
160
  },
@@ -154,7 +187,8 @@ export default {
154
187
  productToggle: {
155
188
  isOrchestratorActive: true,
156
189
  isManualExecutionActive: true,
157
- isIntegratorActive: true
190
+ isIntegratorActive: true,
191
+ isDocumentImportActive: true
158
192
  },
159
193
  payrollReferenceCutoffDay: 20,
160
194
  modifiedContractsWindowInDays: 15,
@@ -221,7 +255,8 @@ export default {
221
255
  deduction: [],
222
256
  situation: [],
223
257
  events: [],
224
- rechargeTemplate: []
258
+ rechargeTemplate: [],
259
+ documents: []
225
260
  },
226
261
  version: 3,
227
262
  isDeleted: false,
@@ -241,7 +276,8 @@ export default {
241
276
  status: 'ENABLED',
242
277
  value: false,
243
278
  isEligible: false,
244
- statusOriginID: ''
279
+ statusOriginID: '',
280
+ lastUpdatedStatusAt: new Date('2025-05-29T15:05:10.431+0000')
245
281
  }
246
282
  },
247
283
  isDeleted: false,
@@ -249,7 +285,8 @@ export default {
249
285
  externalDependentID: '',
250
286
  externalDependentCode: '',
251
287
  birthDate: '',
252
- relationshipType: 'OTHER'
288
+ relationshipType: 'OTHER',
289
+ avaliableDocuments: []
253
290
  }
254
291
  },
255
292
  eligibilityOptions: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@benup/bensdk",
3
- "version": "1.11.4",
3
+ "version": "1.11.12",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "scripts": {