opf-validator-beta 0.0.16 → 0.0.17
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/dist/consent/index.d.ts +4 -4
- package/dist/consent/index.d.ts.map +1 -1
- package/dist/consent/index.js +2 -2
- package/dist/consent/index.js.map +1 -1
- package/dist/consent/interfaces/createConsent.d.ts +23 -0
- package/dist/consent/interfaces/createConsent.d.ts.map +1 -0
- package/dist/consent/interfaces/createConsent.js +3 -0
- package/dist/consent/interfaces/createConsent.js.map +1 -0
- package/dist/consent/interfaces/createConsentExtensions.d.ts +23 -0
- package/dist/consent/interfaces/createConsentExtensions.d.ts.map +1 -0
- package/dist/consent/interfaces/createConsentExtensions.js +3 -0
- package/dist/consent/interfaces/createConsentExtensions.js.map +1 -0
- package/dist/consent/{successResponses/index.d.ts → interfaces/successResponses.d.ts} +1 -1
- package/dist/consent/interfaces/successResponses.d.ts.map +1 -0
- package/dist/consent/{successResponses/index.js → interfaces/successResponses.js} +1 -1
- package/dist/consent/interfaces/successResponses.js.map +1 -0
- package/dist/consent/validators/createConsent.d.ts +2 -24
- package/dist/consent/validators/createConsent.d.ts.map +1 -1
- package/dist/consent/validators/createConsent.js +15 -137
- package/dist/consent/validators/createConsent.js.map +1 -1
- package/dist/consent/validators/createConsentExtensions.d.ts +2 -24
- package/dist/consent/validators/createConsentExtensions.d.ts.map +1 -1
- package/dist/consent/validators/createConsentExtensions.js +17 -165
- package/dist/consent/validators/createConsentExtensions.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +50 -52
- package/dist/index.js.map +1 -7
- package/dist/payments/index.d.ts +7 -6
- package/dist/payments/index.d.ts.map +1 -1
- package/dist/payments/index.js +9 -9
- package/dist/payments/index.js.map +1 -1
- package/dist/payments/interfaces/createPaymentConsent.d.ts +56 -0
- package/dist/payments/interfaces/createPaymentConsent.d.ts.map +1 -0
- package/dist/payments/interfaces/createPaymentConsent.js +3 -0
- package/dist/payments/interfaces/createPaymentConsent.js.map +1 -0
- package/dist/payments/interfaces/createPixPayment.d.ts +25 -0
- package/dist/payments/interfaces/createPixPayment.d.ts.map +1 -0
- package/dist/payments/interfaces/createPixPayment.js +3 -0
- package/dist/payments/interfaces/createPixPayment.js.map +1 -0
- package/dist/payments/interfaces/patchPixPayment.d.ts +18 -0
- package/dist/payments/interfaces/patchPixPayment.d.ts.map +1 -0
- package/dist/payments/interfaces/patchPixPayment.js +3 -0
- package/dist/payments/interfaces/patchPixPayment.js.map +1 -0
- package/dist/payments/{successResponses/index.d.ts → interfaces/successResponses.d.ts} +1 -1
- package/dist/payments/interfaces/successResponses.d.ts.map +1 -0
- package/dist/payments/{successResponses/index.js → interfaces/successResponses.js} +1 -1
- package/dist/payments/interfaces/successResponses.js.map +1 -0
- package/dist/payments/validators/createPaymentConsent.d.ts +2 -57
- package/dist/payments/validators/createPaymentConsent.d.ts.map +1 -1
- package/dist/payments/validators/createPaymentConsent.js +82 -369
- package/dist/payments/validators/createPaymentConsent.js.map +1 -1
- package/dist/payments/validators/createPixPayment.d.ts +2 -26
- package/dist/payments/validators/createPixPayment.d.ts.map +1 -1
- package/dist/payments/validators/createPixPayment.js +199 -198
- package/dist/payments/validators/createPixPayment.js.map +1 -1
- package/dist/payments/validators/patchPixPayment.d.ts +2 -19
- package/dist/payments/validators/patchPixPayment.d.ts.map +1 -1
- package/dist/payments/validators/patchPixPayment.js +30 -52
- package/dist/payments/validators/patchPixPayment.js.map +1 -1
- package/dist/payments/validators/validateConsentAgainstPayment.d.ts +32 -0
- package/dist/payments/validators/validateConsentAgainstPayment.d.ts.map +1 -0
- package/dist/payments/validators/validateConsentAgainstPayment.js +174 -0
- package/dist/payments/validators/validateConsentAgainstPayment.js.map +1 -0
- package/dist/recurring-payments/index.d.ts +8 -7
- package/dist/recurring-payments/index.d.ts.map +1 -1
- package/dist/recurring-payments/index.js +9 -6
- package/dist/recurring-payments/index.js.map +1 -1
- package/dist/recurring-payments/interfaces/createRecurringConsent.d.ts +86 -0
- package/dist/recurring-payments/interfaces/createRecurringConsent.d.ts.map +1 -0
- package/dist/recurring-payments/interfaces/createRecurringConsent.js +3 -0
- package/dist/recurring-payments/interfaces/createRecurringConsent.js.map +1 -0
- package/dist/recurring-payments/interfaces/createRecurringRetryPixPayment.d.ts +10 -0
- package/dist/recurring-payments/interfaces/createRecurringRetryPixPayment.d.ts.map +1 -0
- package/dist/recurring-payments/interfaces/createRecurringRetryPixPayment.js +3 -0
- package/dist/recurring-payments/interfaces/createRecurringRetryPixPayment.js.map +1 -0
- package/dist/recurring-payments/{validators → interfaces}/patchPixPayment.d.ts +12 -10
- package/dist/recurring-payments/interfaces/patchPixPayment.d.ts.map +1 -0
- package/dist/recurring-payments/interfaces/patchPixPayment.js +3 -0
- package/dist/recurring-payments/interfaces/patchPixPayment.js.map +1 -0
- package/dist/recurring-payments/interfaces/patchRecurringConsent.d.ts +72 -0
- package/dist/recurring-payments/interfaces/patchRecurringConsent.d.ts.map +1 -0
- package/dist/recurring-payments/interfaces/patchRecurringConsent.js +3 -0
- package/dist/recurring-payments/interfaces/patchRecurringConsent.js.map +1 -0
- package/dist/recurring-payments/{successResponses/index.d.ts → interfaces/successResponses.d.ts} +1 -1
- package/dist/recurring-payments/interfaces/successResponses.d.ts.map +1 -0
- package/dist/recurring-payments/{successResponses/index.js → interfaces/successResponses.js} +1 -1
- package/dist/recurring-payments/interfaces/successResponses.js.map +1 -0
- package/dist/recurring-payments/validators/createRecurringConsent.d.ts +2 -87
- package/dist/recurring-payments/validators/createRecurringConsent.d.ts.map +1 -1
- package/dist/recurring-payments/validators/createRecurringConsent.js +88 -400
- package/dist/recurring-payments/validators/createRecurringConsent.js.map +1 -1
- package/dist/recurring-payments/validators/createRecurringRetryPixPayment.d.ts +2 -11
- package/dist/recurring-payments/validators/createRecurringRetryPixPayment.d.ts.map +1 -1
- package/dist/recurring-payments/validators/createRecurringRetryPixPayment.js.map +1 -1
- package/dist/recurring-payments/validators/patchRecurringConsent.d.ts +3 -73
- package/dist/recurring-payments/validators/patchRecurringConsent.d.ts.map +1 -1
- package/dist/recurring-payments/validators/patchRecurringConsent.js +36 -267
- package/dist/recurring-payments/validators/patchRecurringConsent.js.map +1 -1
- package/dist/recurring-payments/validators/patchRecurringPixPayment.d.ts +7 -0
- package/dist/recurring-payments/validators/patchRecurringPixPayment.d.ts.map +1 -0
- package/dist/recurring-payments/validators/{patchPixPayment.js → patchRecurringPixPayment.js} +32 -15
- package/dist/recurring-payments/validators/patchRecurringPixPayment.js.map +1 -0
- package/dist/recurring-payments/validators/validateRecurringConsentAgainstPayment.d.ts +36 -0
- package/dist/recurring-payments/validators/validateRecurringConsentAgainstPayment.d.ts.map +1 -0
- package/dist/recurring-payments/validators/validateRecurringConsentAgainstPayment.js +349 -0
- package/dist/recurring-payments/validators/validateRecurringConsentAgainstPayment.js.map +1 -0
- package/dist/utils/openFinanceErrors.d.ts +9 -1
- package/dist/utils/openFinanceErrors.d.ts.map +1 -1
- package/dist/utils/openFinanceErrors.js +29 -5
- package/dist/utils/openFinanceErrors.js.map +1 -1
- package/dist/utils/paymentErrors.d.ts +4 -0
- package/dist/utils/paymentErrors.d.ts.map +1 -1
- package/dist/utils/paymentErrors.js +4 -0
- package/dist/utils/paymentErrors.js.map +1 -1
- package/dist/utils/types/types.consent.d.ts +25 -0
- package/dist/utils/types/types.consent.d.ts.map +1 -0
- package/dist/utils/types/types.consent.js +78 -0
- package/dist/utils/types/types.consent.js.map +1 -0
- package/dist/utils/types/types.d.ts +8 -0
- package/dist/utils/types/types.d.ts.map +1 -0
- package/dist/utils/types/types.js +11 -0
- package/dist/utils/types/types.js.map +1 -0
- package/dist/utils/types/types.payment.d.ts +32 -0
- package/dist/utils/types/types.payment.d.ts.map +1 -0
- package/dist/utils/types/types.payment.js +46 -0
- package/dist/utils/types/types.payment.js.map +1 -0
- package/dist/utils/types/types.recurring.d.ts +37 -0
- package/dist/utils/types/types.recurring.d.ts.map +1 -0
- package/dist/utils/types/types.recurring.js +56 -0
- package/dist/utils/types/types.recurring.js.map +1 -0
- package/dist/utils/validateHeaderParameters.d.ts +6 -2
- package/dist/utils/validateHeaderParameters.d.ts.map +1 -1
- package/dist/utils/validateHeaderParameters.js +19 -57
- package/dist/utils/validateHeaderParameters.js.map +1 -1
- package/dist/utils/validationHelpers.d.ts +4 -85
- package/dist/utils/validationHelpers.d.ts.map +1 -1
- package/dist/utils/validationHelpers.js +20 -370
- package/dist/utils/validationHelpers.js.map +1 -1
- package/dist/utils/validators/accountValidators.d.ts +48 -0
- package/dist/utils/validators/accountValidators.d.ts.map +1 -0
- package/dist/utils/validators/accountValidators.js +244 -0
- package/dist/utils/validators/accountValidators.js.map +1 -0
- package/dist/utils/validators/amountValidators.d.ts +14 -0
- package/dist/utils/validators/amountValidators.d.ts.map +1 -0
- package/dist/utils/validators/amountValidators.js +48 -0
- package/dist/utils/validators/amountValidators.js.map +1 -0
- package/dist/utils/validators/consentValidationHelpers.d.ts +32 -0
- package/dist/utils/validators/consentValidationHelpers.d.ts.map +1 -0
- package/dist/utils/validators/consentValidationHelpers.js +51 -0
- package/dist/utils/validators/consentValidationHelpers.js.map +1 -0
- package/dist/utils/validators/credentialsValidators.d.ts +22 -0
- package/dist/utils/validators/credentialsValidators.d.ts.map +1 -0
- package/dist/utils/validators/credentialsValidators.js +177 -0
- package/dist/utils/validators/credentialsValidators.js.map +1 -0
- package/dist/utils/validators/dateTimeValidators.d.ts +18 -0
- package/dist/utils/validators/dateTimeValidators.d.ts.map +1 -0
- package/dist/utils/validators/dateTimeValidators.js +68 -0
- package/dist/utils/validators/dateTimeValidators.js.map +1 -0
- package/dist/utils/validators/documentValidators.d.ts +27 -0
- package/dist/utils/validators/documentValidators.d.ts.map +1 -0
- package/dist/utils/validators/documentValidators.js +114 -0
- package/dist/utils/validators/documentValidators.js.map +1 -0
- package/dist/utils/validators/index.d.ts +33 -0
- package/dist/utils/validators/index.d.ts.map +1 -0
- package/dist/utils/validators/index.js +49 -0
- package/dist/utils/validators/index.js.map +1 -0
- package/dist/utils/validators/locationValidators.d.ts +7 -0
- package/dist/utils/validators/locationValidators.d.ts.map +1 -0
- package/dist/utils/validators/locationValidators.js +22 -0
- package/dist/utils/validators/locationValidators.js.map +1 -0
- package/dist/utils/validators/stringValidators.d.ts +35 -0
- package/dist/utils/validators/stringValidators.d.ts.map +1 -0
- package/dist/utils/validators/stringValidators.js +167 -0
- package/dist/utils/validators/stringValidators.js.map +1 -0
- package/package.json +2 -4
- package/dist/consent/package.json +0 -6
- package/dist/consent/successResponses/index.d.ts.map +0 -1
- package/dist/consent/successResponses/index.js.map +0 -1
- package/dist/payments/package.json +0 -6
- package/dist/payments/successResponses/index.d.ts.map +0 -1
- package/dist/payments/successResponses/index.js.map +0 -1
- package/dist/recurring-payments/package.json +0 -6
- package/dist/recurring-payments/successResponses/index.d.ts.map +0 -1
- package/dist/recurring-payments/successResponses/index.js.map +0 -1
- package/dist/recurring-payments/validators/patchPixPayment.d.ts.map +0 -1
- package/dist/recurring-payments/validators/patchPixPayment.js.map +0 -1
- package/dist/utils/package.json +0 -6
package/dist/consent/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Consent Module - Exports
|
|
2
|
+
* Consent Module - Exports validators
|
|
3
3
|
*/
|
|
4
4
|
export { validateCreateConsent } from "./validators/createConsent";
|
|
5
|
-
export type { CreateConsentPayload, CreateConsentData } from "./
|
|
5
|
+
export type { CreateConsentPayload, CreateConsentData } from "./interfaces/createConsent";
|
|
6
6
|
export { validateCreateConsentExtensions } from "./validators/createConsentExtensions";
|
|
7
|
-
export type { CreateConsentExtensionsPayload,
|
|
8
|
-
export type {
|
|
7
|
+
export type { CreateConsentExtensionsPayload, } from "./interfaces/createConsentExtensions";
|
|
8
|
+
export type { GetConsentSuccessResponse, } from "./interfaces/successResponses";
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/consent/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,YAAY,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE1F,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AACvF,YAAY,EACV,8BAA8B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/consent/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,YAAY,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE1F,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AACvF,YAAY,EACV,8BAA8B,GAC/B,MAAM,sCAAsC,CAAC;AAG9C,YAAY,EACV,yBAAyB,GAC1B,MAAM,+BAA+B,CAAC"}
|
package/dist/consent/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Consent Module - Exports
|
|
3
|
+
* Consent Module - Exports validators
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.validateCreateConsentExtensions = exports.validateCreateConsent = void 0;
|
|
7
|
-
// Validators
|
|
7
|
+
// Main Validators
|
|
8
8
|
var createConsent_1 = require("./validators/createConsent");
|
|
9
9
|
Object.defineProperty(exports, "validateCreateConsent", { enumerable: true, get: function () { return createConsent_1.validateCreateConsent; } });
|
|
10
10
|
var createConsentExtensions_1 = require("./validators/createConsentExtensions");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/consent/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/consent/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,kBAAkB;AAClB,4DAAmE;AAA1D,sHAAA,qBAAqB,OAAA;AAG9B,gFAAuF;AAA9E,0IAAA,+BAA+B,OAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface LoggedUser {
|
|
2
|
+
document: {
|
|
3
|
+
identification: string;
|
|
4
|
+
rel: string;
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
export interface BusinessEntity {
|
|
8
|
+
document: {
|
|
9
|
+
identification: string;
|
|
10
|
+
rel: string;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export interface CreateConsentData {
|
|
14
|
+
permissions: string[];
|
|
15
|
+
loggedUser: LoggedUser;
|
|
16
|
+
businessEntity?: BusinessEntity;
|
|
17
|
+
expirationDateTime?: string;
|
|
18
|
+
isLinked?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface CreateConsentPayload {
|
|
21
|
+
data: CreateConsentData;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=createConsent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createConsent.d.ts","sourceRoot":"","sources":["../../../src/consent/interfaces/createConsent.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE;QACR,cAAc,EAAE,MAAM,CAAC;QACvB,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;CACH;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE;QACR,cAAc,EAAE,MAAM,CAAC;QACvB,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;CACH;AAED,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,UAAU,EAAE,UAAU,CAAC;IACvB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,iBAAiB,CAAC;CACzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createConsent.js","sourceRoot":"","sources":["../../../src/consent/interfaces/createConsent.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface LoggedUserDocumentExtensions {
|
|
2
|
+
identification: string;
|
|
3
|
+
rel: string;
|
|
4
|
+
}
|
|
5
|
+
export interface LoggedUserExtensions {
|
|
6
|
+
document: LoggedUserDocumentExtensions;
|
|
7
|
+
}
|
|
8
|
+
export interface BusinessEntityDocumentExtensions {
|
|
9
|
+
identification: string;
|
|
10
|
+
rel: string;
|
|
11
|
+
}
|
|
12
|
+
export interface BusinessEntityExtensions {
|
|
13
|
+
document: BusinessEntityDocumentExtensions;
|
|
14
|
+
}
|
|
15
|
+
export interface CreateConsentExtensionsData {
|
|
16
|
+
expirationDateTime?: string;
|
|
17
|
+
loggedUser: LoggedUserExtensions;
|
|
18
|
+
businessEntity?: BusinessEntityExtensions;
|
|
19
|
+
}
|
|
20
|
+
export interface CreateConsentExtensionsPayload {
|
|
21
|
+
data: CreateConsentExtensionsData;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=createConsentExtensions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createConsentExtensions.d.ts","sourceRoot":"","sources":["../../../src/consent/interfaces/createConsentExtensions.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,4BAA4B;IAC3C,cAAc,EAAE,MAAM,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,4BAA4B,CAAC;CACxC;AAED,MAAM,WAAW,gCAAgC;IAC/C,cAAc,EAAE,MAAM,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,gCAAgC,CAAC;CAC5C;AAED,MAAM,WAAW,2BAA2B;IAC1C,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,UAAU,EAAE,oBAAoB,CAAC;IACjC,cAAc,CAAC,EAAE,wBAAwB,CAAC;CAC3C;AAED,MAAM,WAAW,8BAA8B;IAC7C,IAAI,EAAE,2BAA2B,CAAC;CACnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createConsentExtensions.js","sourceRoot":"","sources":["../../../src/consent/interfaces/createConsentExtensions.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"successResponses.d.ts","sourceRoot":"","sources":["../../../src/consent/interfaces/successResponses.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE;QACJ,SAAS,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE,MAAM,CAAC;QACf,oBAAoB,EAAE,MAAM,CAAC;QAC7B,WAAW,EAAE,MAAM,EAAE,CAAC;QACtB,kBAAkB,EAAE,MAAM,CAAC;QAC3B,UAAU,CAAC,EAAE;YACX,QAAQ,EAAE;gBACR,cAAc,EAAE,MAAM,CAAC;gBACvB,GAAG,EAAE,MAAM,CAAC;aACb,CAAC;SACH,CAAC;KACH,CAAC;IACF,KAAK,CAAC,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IACF,IAAI,CAAC,EAAE;QACL,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,eAAe,EAAE,MAAM,CAAC;KACzB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE;QACJ,SAAS,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE,MAAM,CAAC;QACf,oBAAoB,EAAE,MAAM,CAAC;QAC7B,WAAW,EAAE,MAAM,EAAE,CAAC;QACtB,kBAAkB,EAAE,MAAM,CAAC;QAC3B,gBAAgB,EAAE,MAAM,CAAC;QACzB,UAAU,CAAC,EAAE;YACX,QAAQ,EAAE;gBACR,cAAc,EAAE,MAAM,CAAC;gBACvB,GAAG,EAAE,MAAM,CAAC;aACb,CAAC;SACH,CAAC;KACH,CAAC;IACF,KAAK,CAAC,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,IAAI,CAAC,EAAE;QACL,eAAe,EAAE,MAAM,CAAC;KACzB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,sCAAsC;IACrD,IAAI,EAAE;QACJ,SAAS,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE,MAAM,CAAC;QACf,oBAAoB,EAAE,MAAM,CAAC;QAC7B,WAAW,EAAE,MAAM,EAAE,CAAC;QACtB,kBAAkB,EAAE,MAAM,CAAC;QAC3B,UAAU,CAAC,EAAE;YACX,QAAQ,EAAE;gBACR,cAAc,EAAE,MAAM,CAAC;gBACvB,GAAG,EAAE,MAAM,CAAC;aACb,CAAC;SACH,CAAC;QACF,cAAc,CAAC,EAAE;YACf,QAAQ,EAAE;gBACR,cAAc,EAAE,MAAM,CAAC;gBACvB,GAAG,EAAE,MAAM,CAAC;aACb,CAAC;SACH,CAAC;KACH,CAAC;IACF,KAAK,CAAC,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,IAAI,CAAC,EAAE;QACL,eAAe,EAAE,MAAM,CAAC;KACzB,CAAC;CACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"successResponses.js","sourceRoot":"","sources":["../../../src/consent/interfaces/successResponses.ts"],"names":[],"mappings":";AAAA;;GAEG"}
|
|
@@ -3,31 +3,9 @@
|
|
|
3
3
|
* Segue as regras especificadas no Open Finance Brasil
|
|
4
4
|
*/
|
|
5
5
|
import { ValidationResult } from "../../utils/openFinanceErrors";
|
|
6
|
-
|
|
7
|
-
document: {
|
|
8
|
-
identification: string;
|
|
9
|
-
rel: string;
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
type BusinessEntity = {
|
|
13
|
-
document: {
|
|
14
|
-
identification: string;
|
|
15
|
-
rel: string;
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
type CreateConsentData = {
|
|
19
|
-
permissions: string[];
|
|
20
|
-
loggedUser: LoggedUser;
|
|
21
|
-
businessEntity?: BusinessEntity;
|
|
22
|
-
expirationDateTime?: string;
|
|
23
|
-
isLinked?: boolean;
|
|
24
|
-
};
|
|
25
|
-
type CreateConsentPayload = {
|
|
26
|
-
data: CreateConsentData;
|
|
27
|
-
};
|
|
6
|
+
import { CreateConsentPayload } from "../interfaces/createConsent";
|
|
28
7
|
/**
|
|
29
8
|
* Valida o payload de criação de consentimento
|
|
30
9
|
*/
|
|
31
|
-
export declare function validateCreateConsent(payload:
|
|
32
|
-
export { CreateConsentPayload, CreateConsentData };
|
|
10
|
+
export declare function validateCreateConsent(payload: CreateConsentPayload): ValidationResult;
|
|
33
11
|
//# sourceMappingURL=createConsent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createConsent.d.ts","sourceRoot":"","sources":["../../../src/consent/validators/createConsent.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEL,gBAAgB,
|
|
1
|
+
{"version":3,"file":"createConsent.d.ts","sourceRoot":"","sources":["../../../src/consent/validators/createConsent.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEL,gBAAgB,EAGjB,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,oBAAoB,GAAG,gBAAgB,CA2DrF"}
|
|
@@ -6,44 +6,8 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.validateCreateConsent = validateCreateConsent;
|
|
8
8
|
const openFinanceErrors_1 = require("../../utils/openFinanceErrors");
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
"ACCOUNTS_BALANCES_READ",
|
|
12
|
-
"ACCOUNTS_TRANSACTIONS_READ",
|
|
13
|
-
"ACCOUNTS_OVERDRAFT_LIMITS_READ",
|
|
14
|
-
"CREDIT_CARDS_ACCOUNTS_READ",
|
|
15
|
-
"CREDIT_CARDS_ACCOUNTS_BILLS_READ",
|
|
16
|
-
"CREDIT_CARDS_ACCOUNTS_BILLS_TRANSACTIONS_READ",
|
|
17
|
-
"CREDIT_CARDS_ACCOUNTS_LIMITS_READ",
|
|
18
|
-
"CREDIT_CARDS_ACCOUNTS_TRANSACTIONS_READ",
|
|
19
|
-
"CUSTOMERS_PERSONAL_IDENTIFICATIONS_READ",
|
|
20
|
-
"CUSTOMERS_PERSONAL_ADITTIONALINFO_READ",
|
|
21
|
-
"CUSTOMERS_BUSINESS_IDENTIFICATIONS_READ",
|
|
22
|
-
"CUSTOMERS_BUSINESS_ADITTIONALINFO_READ",
|
|
23
|
-
"FINANCINGS_READ",
|
|
24
|
-
"FINANCINGS_SCHEDULED_INSTALMENTS_READ",
|
|
25
|
-
"FINANCINGS_PAYMENTS_READ",
|
|
26
|
-
"FINANCINGS_WARRANTIES_READ",
|
|
27
|
-
"INVOICE_FINANCINGS_READ",
|
|
28
|
-
"INVOICE_FINANCINGS_SCHEDULED_INSTALMENTS_READ",
|
|
29
|
-
"INVOICE_FINANCINGS_PAYMENTS_READ",
|
|
30
|
-
"INVOICE_FINANCINGS_WARRANTIES_READ",
|
|
31
|
-
"LOANS_READ",
|
|
32
|
-
"LOANS_SCHEDULED_INSTALMENTS_READ",
|
|
33
|
-
"LOANS_PAYMENTS_READ",
|
|
34
|
-
"LOANS_WARRANTIES_READ",
|
|
35
|
-
"UNARRANGED_ACCOUNTS_OVERDRAFT_READ",
|
|
36
|
-
"UNARRANGED_ACCOUNTS_OVERDRAFT_SCHEDULED_INSTALMENTS_READ",
|
|
37
|
-
"UNARRANGED_ACCOUNTS_OVERDRAFT_PAYMENTS_READ",
|
|
38
|
-
"UNARRANGED_ACCOUNTS_OVERDRAFT_WARRANTIES_READ",
|
|
39
|
-
"RESOURCES_READ",
|
|
40
|
-
"BANK_FIXED_INCOMES_READ",
|
|
41
|
-
"CREDIT_FIXED_INCOMES_READ",
|
|
42
|
-
"FUNDS_READ",
|
|
43
|
-
"VARIABLE_INCOMES_READ",
|
|
44
|
-
"TREASURE_TITLES_READ",
|
|
45
|
-
"EXCHANGES_READ",
|
|
46
|
-
];
|
|
9
|
+
const types_consent_1 = require("../../utils/types/types.consent");
|
|
10
|
+
const validationHelpers_1 = require("../../utils/validationHelpers");
|
|
47
11
|
/**
|
|
48
12
|
* Valida o payload de criação de consentimento
|
|
49
13
|
*/
|
|
@@ -63,28 +27,29 @@ function validateCreateConsent(payload) {
|
|
|
63
27
|
const permissionErrors = validatePermissions(data.permissions);
|
|
64
28
|
errors.push(...permissionErrors);
|
|
65
29
|
}
|
|
66
|
-
// Validação: loggedUser
|
|
67
|
-
if (!data.loggedUser) {
|
|
68
|
-
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_NAO_INFORMADO("loggedUser"));
|
|
30
|
+
// Validação: loggedUser ou businessEntity (pelo menos um obrigatório)
|
|
31
|
+
if (!data.loggedUser && !data.businessEntity) {
|
|
32
|
+
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_NAO_INFORMADO("loggedUser or businessEntity"));
|
|
69
33
|
}
|
|
70
34
|
else {
|
|
71
|
-
|
|
72
|
-
|
|
35
|
+
if (data.loggedUser) {
|
|
36
|
+
const loggedUserErrors = (0, validationHelpers_1.validateLoggedUser)(data.loggedUser);
|
|
37
|
+
errors.push(...loggedUserErrors);
|
|
38
|
+
}
|
|
39
|
+
if (data.businessEntity) {
|
|
40
|
+
const businessEntityErrors = (0, validationHelpers_1.validateBusinessEntity)(data.businessEntity);
|
|
41
|
+
errors.push(...businessEntityErrors);
|
|
42
|
+
}
|
|
73
43
|
}
|
|
74
44
|
// Validação: expirationDateTime (regulatory-required)
|
|
75
45
|
if (data.expirationDateTime) {
|
|
76
|
-
const expirationErrors =
|
|
46
|
+
const expirationErrors = (0, validationHelpers_1.validateRfc3339DateTime)(data.expirationDateTime);
|
|
77
47
|
errors.push(...expirationErrors);
|
|
78
48
|
}
|
|
79
49
|
// Validação: isLinked
|
|
80
50
|
if (data.isLinked !== undefined && typeof data.isLinked !== "boolean") {
|
|
81
51
|
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_INVALIDO("isLinked", "Deve ser um valor booleano"));
|
|
82
52
|
}
|
|
83
|
-
// Validação: businessEntity (opcional)
|
|
84
|
-
if (data.businessEntity) {
|
|
85
|
-
const businessEntityErrors = validateBusinessEntity(data.businessEntity);
|
|
86
|
-
errors.push(...businessEntityErrors);
|
|
87
|
-
}
|
|
88
53
|
return {
|
|
89
54
|
isValid: errors.length === 0,
|
|
90
55
|
statusCode: (0, openFinanceErrors_1.getStatusCode)(errors),
|
|
@@ -110,97 +75,10 @@ function validatePermissions(permissions) {
|
|
|
110
75
|
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_INVALIDO("permissions", "Array não deve ter duplicidade de itens"));
|
|
111
76
|
}
|
|
112
77
|
// Validar permissões conhecidas
|
|
113
|
-
const invalidPermissions = permissions.filter((permission) => !VALID_PERMISSIONS.includes(permission));
|
|
78
|
+
const invalidPermissions = permissions.filter((permission) => !types_consent_1.VALID_PERMISSIONS.includes(permission));
|
|
114
79
|
if (invalidPermissions.length > 0) {
|
|
115
80
|
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_INVALIDO("permissions", `Permissões inválidas encontradas: ${invalidPermissions.join(", ")}`));
|
|
116
81
|
}
|
|
117
82
|
return errors;
|
|
118
83
|
}
|
|
119
|
-
/**
|
|
120
|
-
* Valida LoggedUser
|
|
121
|
-
*/
|
|
122
|
-
function validateLoggedUser(loggedUser) {
|
|
123
|
-
const errors = [];
|
|
124
|
-
if (typeof loggedUser !== "object" || loggedUser === null) {
|
|
125
|
-
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_INVALIDO("loggedUser", "Deve ser um objeto"));
|
|
126
|
-
return errors;
|
|
127
|
-
}
|
|
128
|
-
// document é obrigatório
|
|
129
|
-
if (!loggedUser.document) {
|
|
130
|
-
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_NAO_INFORMADO("loggedUser.document"));
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
const documentErrors = validateDocument(loggedUser.document);
|
|
134
|
-
errors.push(...documentErrors);
|
|
135
|
-
}
|
|
136
|
-
return errors;
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* Valida expirationDateTime
|
|
140
|
-
* RFC-3339 format: YYYY-MM-DDTHH:mm:ssZ
|
|
141
|
-
* maxLength: 20
|
|
142
|
-
*/
|
|
143
|
-
function validateExpirationDateTime(expirationDateTime) {
|
|
144
|
-
const errors = [];
|
|
145
|
-
if (typeof expirationDateTime !== "string") {
|
|
146
|
-
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_INVALIDO("expirationDateTime", "Deve ser uma string em formato RFC-3339"));
|
|
147
|
-
return errors;
|
|
148
|
-
}
|
|
149
|
-
if (expirationDateTime.length > 20) {
|
|
150
|
-
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_INVALIDO("expirationDateTime", "Deve ter no máximo 20 caracteres"));
|
|
151
|
-
}
|
|
152
|
-
// Validar formato RFC-3339 (UTC)
|
|
153
|
-
const rfc3339Pattern = /^(\d{4})-(1[0-2]|0?[1-9])-(3[01]|[12][0-9]|0?[1-9])T(?:[01]\d|2[0123]):(?:[012345]\d):(?:[012345]\d)Z$/;
|
|
154
|
-
if (!rfc3339Pattern.test(expirationDateTime)) {
|
|
155
|
-
errors.push((0, openFinanceErrors_1.createError)("DATA_EXPIRACAO_INVALIDA", "Nova data para expiração do consentimento é inválida.", "A data de expiração deve estar no formato RFC-3339 com timezone UTC (YYYY-MM-DDTHH:mm:ssZ)"));
|
|
156
|
-
}
|
|
157
|
-
return errors;
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Valida BusinessEntity
|
|
161
|
-
*/
|
|
162
|
-
function validateBusinessEntity(businessEntity) {
|
|
163
|
-
const errors = [];
|
|
164
|
-
if (typeof businessEntity !== "object" || businessEntity === null) {
|
|
165
|
-
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_INVALIDO("businessEntity", "Deve ser um objeto"));
|
|
166
|
-
return errors;
|
|
167
|
-
}
|
|
168
|
-
if (!businessEntity.document) {
|
|
169
|
-
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_NAO_INFORMADO("businessEntity.document"));
|
|
170
|
-
}
|
|
171
|
-
else {
|
|
172
|
-
const documentErrors = validateDocument(businessEntity.document);
|
|
173
|
-
errors.push(...documentErrors);
|
|
174
|
-
}
|
|
175
|
-
return errors;
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* Valida Document
|
|
179
|
-
*/
|
|
180
|
-
function validateDocument(document) {
|
|
181
|
-
const errors = [];
|
|
182
|
-
if (typeof document !== "object" || document === null) {
|
|
183
|
-
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_INVALIDO("document", "Deve ser um objeto"));
|
|
184
|
-
return errors;
|
|
185
|
-
}
|
|
186
|
-
if (!document.identification) {
|
|
187
|
-
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_NAO_INFORMADO("document.identification"));
|
|
188
|
-
}
|
|
189
|
-
else if (typeof document.identification !== "string") {
|
|
190
|
-
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_INVALIDO("document.identification", "Deve ser uma string"));
|
|
191
|
-
}
|
|
192
|
-
else if (!/^(\d{11}|\d{14})$/.test(document.identification)) {
|
|
193
|
-
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_INVALIDO("document.identification", "Deve conter exatamente 11 dígitos (CPF) ou 14 dígitos (CNPJ)"));
|
|
194
|
-
}
|
|
195
|
-
if (!document.rel) {
|
|
196
|
-
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_NAO_INFORMADO("document.rel"));
|
|
197
|
-
}
|
|
198
|
-
else if (typeof document.rel !== "string") {
|
|
199
|
-
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_INVALIDO("document.rel", "Deve ser uma string"));
|
|
200
|
-
}
|
|
201
|
-
else if (!/^[A-Z]{3,4}$/.test(document.rel)) {
|
|
202
|
-
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_INVALIDO("document.rel", "Deve conter entre 3 e 4 letras maiúsculas (exemplo: CPF ou CNPJ)"));
|
|
203
|
-
}
|
|
204
|
-
return errors;
|
|
205
|
-
}
|
|
206
84
|
//# sourceMappingURL=createConsent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createConsent.js","sourceRoot":"","sources":["../../../src/consent/validators/createConsent.ts"],"names":[],"mappings":";AAAA;;;GAGG;;
|
|
1
|
+
{"version":3,"file":"createConsent.js","sourceRoot":"","sources":["../../../src/consent/validators/createConsent.ts"],"names":[],"mappings":"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"}
|
|
@@ -3,31 +3,9 @@
|
|
|
3
3
|
* Segue as regras especificadas no Open Finance Brasil para renovação de consentimento
|
|
4
4
|
*/
|
|
5
5
|
import { ValidationResult } from "../../utils/openFinanceErrors";
|
|
6
|
-
|
|
7
|
-
identification: string;
|
|
8
|
-
rel: string;
|
|
9
|
-
}
|
|
10
|
-
interface LoggedUserExtensions {
|
|
11
|
-
document: LoggedUserDocumentExtensions;
|
|
12
|
-
}
|
|
13
|
-
interface BusinessEntityDocumentExtensions {
|
|
14
|
-
identification: string;
|
|
15
|
-
rel: string;
|
|
16
|
-
}
|
|
17
|
-
interface BusinessEntityExtensions {
|
|
18
|
-
document: BusinessEntityDocumentExtensions;
|
|
19
|
-
}
|
|
20
|
-
interface CreateConsentExtensionsData {
|
|
21
|
-
expirationDateTime?: string;
|
|
22
|
-
loggedUser: LoggedUserExtensions;
|
|
23
|
-
businessEntity?: BusinessEntityExtensions;
|
|
24
|
-
}
|
|
25
|
-
interface CreateConsentExtensionsPayload {
|
|
26
|
-
data: CreateConsentExtensionsData;
|
|
27
|
-
}
|
|
6
|
+
import { CreateConsentExtensionsPayload } from "../interfaces/createConsentExtensions";
|
|
28
7
|
/**
|
|
29
8
|
* Valida o payload de renovação de consentimento
|
|
30
9
|
*/
|
|
31
|
-
export declare function validateCreateConsentExtensions(payload:
|
|
32
|
-
export { CreateConsentExtensionsPayload, CreateConsentExtensionsData, LoggedUserExtensions, BusinessEntityExtensions, };
|
|
10
|
+
export declare function validateCreateConsentExtensions(payload: CreateConsentExtensionsPayload): ValidationResult;
|
|
33
11
|
//# sourceMappingURL=createConsentExtensions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createConsentExtensions.d.ts","sourceRoot":"","sources":["../../../src/consent/validators/createConsentExtensions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEL,gBAAgB,
|
|
1
|
+
{"version":3,"file":"createConsentExtensions.d.ts","sourceRoot":"","sources":["../../../src/consent/validators/createConsentExtensions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEL,gBAAgB,EAGjB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,8BAA8B,EAAE,MAAM,uCAAuC,CAAC;AAGvF;;GAEG;AACH,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,8BAA8B,GAAG,gBAAgB,CAyCzG"}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.validateCreateConsentExtensions = validateCreateConsentExtensions;
|
|
8
8
|
const openFinanceErrors_1 = require("../../utils/openFinanceErrors");
|
|
9
|
+
const validationHelpers_1 = require("../../utils/validationHelpers");
|
|
9
10
|
/**
|
|
10
11
|
* Valida o payload de renovação de consentimento
|
|
11
12
|
*/
|
|
@@ -17,23 +18,24 @@ function validateCreateConsentExtensions(payload) {
|
|
|
17
18
|
return { isValid: false, statusCode: (0, openFinanceErrors_1.getStatusCode)(errors), errors };
|
|
18
19
|
}
|
|
19
20
|
const data = payload.data;
|
|
20
|
-
// Validação: loggedUser
|
|
21
|
-
if (!data.loggedUser) {
|
|
22
|
-
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_NAO_INFORMADO("loggedUser"));
|
|
21
|
+
// Validação: loggedUser ou businessEntity (pelo menos um obrigatório)
|
|
22
|
+
if (!data.loggedUser && !data.businessEntity) {
|
|
23
|
+
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_NAO_INFORMADO("loggedUser or businessEntity"));
|
|
23
24
|
}
|
|
24
25
|
else {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
26
|
+
if (data.loggedUser) {
|
|
27
|
+
const loggedUserErrors = (0, validationHelpers_1.validateLoggedUser)(data.loggedUser);
|
|
28
|
+
errors.push(...loggedUserErrors);
|
|
29
|
+
}
|
|
30
|
+
// Validação: expirationDateTime (opcional)
|
|
31
|
+
if (data.expirationDateTime) {
|
|
32
|
+
const expirationErrors = (0, validationHelpers_1.validateRfc3339DateTime)(data.expirationDateTime);
|
|
33
|
+
errors.push(...expirationErrors);
|
|
34
|
+
}
|
|
35
|
+
if (data.businessEntity) {
|
|
36
|
+
const businessEntityErrors = (0, validationHelpers_1.validateBusinessEntity)(data.businessEntity);
|
|
37
|
+
errors.push(...businessEntityErrors);
|
|
38
|
+
}
|
|
37
39
|
}
|
|
38
40
|
return {
|
|
39
41
|
isValid: errors.length === 0,
|
|
@@ -41,154 +43,4 @@ function validateCreateConsentExtensions(payload) {
|
|
|
41
43
|
errors,
|
|
42
44
|
};
|
|
43
45
|
}
|
|
44
|
-
/**
|
|
45
|
-
* Valida LoggedUserExtensions
|
|
46
|
-
* Estrutura alterada: usa 'document' em vez de 'documentType' e 'documentNumber'
|
|
47
|
-
*/
|
|
48
|
-
function validateLoggedUserExtensions(loggedUser) {
|
|
49
|
-
const errors = [];
|
|
50
|
-
if (typeof loggedUser !== "object" || loggedUser === null) {
|
|
51
|
-
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_INVALIDO("loggedUser", "Deve ser um objeto"));
|
|
52
|
-
return errors;
|
|
53
|
-
}
|
|
54
|
-
// document é obrigatório
|
|
55
|
-
if (!loggedUser.document) {
|
|
56
|
-
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_NAO_INFORMADO("loggedUser.document"));
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
const documentErrors = validateLoggedUserDocumentExtensions(loggedUser.document);
|
|
60
|
-
errors.push(...documentErrors);
|
|
61
|
-
}
|
|
62
|
-
return errors;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Valida LoggedUserDocumentExtensions
|
|
66
|
-
*/
|
|
67
|
-
function validateLoggedUserDocumentExtensions(document) {
|
|
68
|
-
const errors = [];
|
|
69
|
-
if (typeof document !== "object" || document === null) {
|
|
70
|
-
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_INVALIDO("loggedUser.document", "Deve ser um objeto"));
|
|
71
|
-
return errors;
|
|
72
|
-
}
|
|
73
|
-
// identification é obrigatório
|
|
74
|
-
if (!document.identification) {
|
|
75
|
-
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_NAO_INFORMADO("loggedUser.document.identification"));
|
|
76
|
-
}
|
|
77
|
-
else if (typeof document.identification !== "string") {
|
|
78
|
-
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_INVALIDO("loggedUser.document.identification", "Deve ser uma string"));
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
// Validar maxLength: 11
|
|
82
|
-
if (document.identification.length > 11) {
|
|
83
|
-
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_INVALIDO("loggedUser.document.identification", "Deve ter no máximo 11 caracteres"));
|
|
84
|
-
}
|
|
85
|
-
// Validar padrão: ^\d{11}$ (apenas dígitos)
|
|
86
|
-
if (!/^\d{11}$/.test(document.identification)) {
|
|
87
|
-
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_INVALIDO("loggedUser.document.identification", "Deve conter apenas 11 dígitos"));
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
// rel é obrigatório
|
|
91
|
-
if (!document.rel) {
|
|
92
|
-
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_NAO_INFORMADO("loggedUser.document.rel"));
|
|
93
|
-
}
|
|
94
|
-
else if (typeof document.rel !== "string") {
|
|
95
|
-
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_INVALIDO("loggedUser.document.rel", "Deve ser uma string"));
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
// Validar maxLength: 3
|
|
99
|
-
if (document.rel.length > 3) {
|
|
100
|
-
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_INVALIDO("loggedUser.document.rel", "Deve ter no máximo 3 caracteres"));
|
|
101
|
-
}
|
|
102
|
-
// Validar padrão: ^[A-Z]{3}$ (3 letras maiúsculas)
|
|
103
|
-
if (!/^[A-Z]{3}$/.test(document.rel)) {
|
|
104
|
-
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_INVALIDO("loggedUser.document.rel", "Deve conter 3 letras maiúsculas (ex: CPF)"));
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
return errors;
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Valida expirationDateTime
|
|
111
|
-
* RFC-3339 format: YYYY-MM-DDTHH:mm:ssZ
|
|
112
|
-
* maxLength: 20
|
|
113
|
-
*/
|
|
114
|
-
function validateExpirationDateTime(expirationDateTime) {
|
|
115
|
-
const errors = [];
|
|
116
|
-
if (typeof expirationDateTime !== "string") {
|
|
117
|
-
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_INVALIDO("expirationDateTime", "Deve ser uma string em formato RFC-3339"));
|
|
118
|
-
return errors;
|
|
119
|
-
}
|
|
120
|
-
if (expirationDateTime.length > 20) {
|
|
121
|
-
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_INVALIDO("expirationDateTime", "Deve ter no máximo 20 caracteres"));
|
|
122
|
-
}
|
|
123
|
-
// Validar formato RFC-3339 (UTC)
|
|
124
|
-
const rfc3339Pattern = /^(\d{4})-(1[0-2]|0?[1-9])-(3[01]|[12][0-9]|0?[1-9])T(?:[01]\d|2[0123]):(?:[012345]\d):(?:[012345]\d)Z$/;
|
|
125
|
-
if (!rfc3339Pattern.test(expirationDateTime)) {
|
|
126
|
-
errors.push((0, openFinanceErrors_1.createError)("DATA_EXPIRACAO_INVALIDA", "Nova data para expiração do consentimento é inválida.", "A data de expiração deve estar no formato RFC-3339 com timezone UTC (YYYY-MM-DDTHH:mm:ssZ)"));
|
|
127
|
-
}
|
|
128
|
-
return errors;
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Valida BusinessEntityExtensions
|
|
132
|
-
*/
|
|
133
|
-
function validateBusinessEntityExtensions(businessEntity) {
|
|
134
|
-
const errors = [];
|
|
135
|
-
if (typeof businessEntity !== "object" || businessEntity === null) {
|
|
136
|
-
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_INVALIDO("businessEntity", "Deve ser um objeto"));
|
|
137
|
-
return errors;
|
|
138
|
-
}
|
|
139
|
-
if (!businessEntity.document) {
|
|
140
|
-
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_NAO_INFORMADO("businessEntity.document"));
|
|
141
|
-
}
|
|
142
|
-
else {
|
|
143
|
-
const documentErrors = validateBusinessEntityDocumentExtensions(businessEntity.document);
|
|
144
|
-
errors.push(...documentErrors);
|
|
145
|
-
}
|
|
146
|
-
return errors;
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Valida BusinessEntityDocumentExtensions
|
|
150
|
-
* Formato esperado para CNPJ: ^[0-9A-Z]{12}[0-9]{2}$
|
|
151
|
-
*/
|
|
152
|
-
function validateBusinessEntityDocumentExtensions(document) {
|
|
153
|
-
const errors = [];
|
|
154
|
-
if (typeof document !== "object" || document === null) {
|
|
155
|
-
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_INVALIDO("businessEntity.document", "Deve ser um objeto"));
|
|
156
|
-
return errors;
|
|
157
|
-
}
|
|
158
|
-
// identification é obrigatório
|
|
159
|
-
if (!document.identification) {
|
|
160
|
-
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_NAO_INFORMADO("businessEntity.document.identification"));
|
|
161
|
-
}
|
|
162
|
-
else if (typeof document.identification !== "string") {
|
|
163
|
-
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_INVALIDO("businessEntity.document.identification", "Deve ser uma string"));
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
166
|
-
// Validar maxLength: 14
|
|
167
|
-
if (document.identification.length > 14) {
|
|
168
|
-
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_INVALIDO("businessEntity.document.identification", "Deve ter no máximo 14 caracteres"));
|
|
169
|
-
}
|
|
170
|
-
// Validar padrão: ^[0-9A-Z]{12}[0-9]{2}$
|
|
171
|
-
if (!/^[0-9A-Z]{12}[0-9]{2}$/.test(document.identification)) {
|
|
172
|
-
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_INVALIDO("businessEntity.document.identification", "Deve estar no formato CNPJ válido"));
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
// rel é obrigatório
|
|
176
|
-
if (!document.rel) {
|
|
177
|
-
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_NAO_INFORMADO("businessEntity.document.rel"));
|
|
178
|
-
}
|
|
179
|
-
else if (typeof document.rel !== "string") {
|
|
180
|
-
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_INVALIDO("businessEntity.document.rel", "Deve ser uma string"));
|
|
181
|
-
}
|
|
182
|
-
else {
|
|
183
|
-
// Validar maxLength: 4
|
|
184
|
-
if (document.rel.length > 4) {
|
|
185
|
-
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_INVALIDO("businessEntity.document.rel", "Deve ter no máximo 4 caracteres"));
|
|
186
|
-
}
|
|
187
|
-
// Validar padrão: ^[A-Z]{4}$ (4 letras maiúsculas)
|
|
188
|
-
if (!/^[A-Z]{4}$/.test(document.rel)) {
|
|
189
|
-
errors.push(openFinanceErrors_1.CommonErrors.PARAMETRO_INVALIDO("businessEntity.document.rel", "Deve conter 4 letras maiúsculas (ex: CNPJ)"));
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
return errors;
|
|
193
|
-
}
|
|
194
46
|
//# sourceMappingURL=createConsentExtensions.js.map
|