@proconnect-gouv/proconnect.identite 10.5.0 → 12.0.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/CHANGELOG.md +25 -0
- package/dist/connectors/index.d.ts +1 -1
- package/dist/connectors/index.d.ts.map +1 -1
- package/dist/connectors/index.js +2 -2
- package/dist/managers/certification/process-certification-dirigeant.d.ts +28 -1
- package/dist/managers/certification/process-certification-dirigeant.d.ts.map +1 -1
- package/dist/managers/certification/process-certification-dirigeant.js +17 -5
- package/dist/managers/organization/get-organization-info.d.ts +21 -1
- package/dist/managers/organization/get-organization-info.d.ts.map +1 -1
- package/dist/managers/organization/get-organization-info.js +44 -41
- package/dist/repositories/oidc-client/index.d.ts +1 -1
- package/dist/repositories/oidc-client/index.d.ts.map +1 -1
- package/dist/repositories/oidc-client/index.js +1 -1
- package/dist/repositories/oidc-client/upsert-authorization-request.d.ts +3 -0
- package/dist/repositories/oidc-client/upsert-authorization-request.d.ts.map +1 -0
- package/dist/repositories/oidc-client/upsert-authorization-request.js +30 -0
- package/dist/services/organization/get-member-ids-promoted-by-domain.d.ts +9 -0
- package/dist/services/organization/get-member-ids-promoted-by-domain.d.ts.map +1 -0
- package/dist/services/organization/get-member-ids-promoted-by-domain.js +11 -0
- package/dist/services/organization/index.d.ts +1 -0
- package/dist/services/organization/index.d.ts.map +1 -1
- package/dist/services/organization/index.js +1 -0
- package/dist/types/authorization-request.d.ts +20 -0
- package/dist/types/authorization-request.d.ts.map +1 -0
- package/dist/types/authorization-request.js +2 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -1
- package/package.json +1 -1
- package/src/connectors/index.ts +2 -2
- package/src/managers/certification/process-certification-dirigeant.test.ts +12 -1
- package/src/managers/certification/process-certification-dirigeant.ts +23 -4
- package/src/managers/organization/get-organization-info.test.ts +75 -4
- package/src/managers/organization/get-organization-info.test.ts.snapshot +104 -80
- package/src/managers/organization/get-organization-info.ts +63 -56
- package/src/repositories/oidc-client/index.ts +1 -1
- package/src/repositories/oidc-client/upsert-authorization-request.test.ts +95 -0
- package/src/repositories/oidc-client/upsert-authorization-request.ts +50 -0
- package/src/services/organization/get-member-ids-promoted-by-domain.test.ts +100 -0
- package/src/services/organization/get-member-ids-promoted-by-domain.ts +27 -0
- package/src/services/organization/index.ts +1 -0
- package/src/types/authorization-request.ts +23 -0
- package/src/types/index.ts +1 -1
- package/testing/index.ts +2 -0
- package/dist/repositories/oidc-client/add-connection.d.ts +0 -3
- package/dist/repositories/oidc-client/add-connection.d.ts.map +0 -1
- package/dist/repositories/oidc-client/add-connection.js +0 -22
- package/dist/types/connection.d.ts +0 -13
- package/dist/types/connection.d.ts.map +0 -1
- package/dist/types/connection.js +0 -2
- package/src/repositories/oidc-client/add-connection.test.ts +0 -43
- package/src/repositories/oidc-client/add-connection.ts +0 -36
- package/src/types/connection.ts +0 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @proconnect-gouv/proconnect.identite
|
|
2
2
|
|
|
3
|
+
## 12.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#2362](https://github.com/proconnect-gouv/proconnect-identite/pull/2362) [`da31f6d`](https://github.com/proconnect-gouv/proconnect-identite/commit/da31f6d036c7569c0184962bb9bc6d14d12f04a1) Thanks [@douglasduteil](https://github.com/douglasduteil)! - `getOrganizationInfo` et `processCertificationDirigeant` renvoient leurs issues au lieu d'écrire dans la console ou de lever des erreurs.
|
|
8
|
+
|
|
9
|
+
Migration :
|
|
10
|
+
- `getOrganizationInfo` renvoie un `OrganizationInfoLookup` : faites un `match` sur `kind` au lieu d'attraper `InvalidSiretError`, `NotFoundError` ou `ApiEntrepriseConnectionError`.
|
|
11
|
+
- `found` : les données sont dans `organization_info` ; `rne.kind` vaut `enriched`, ou `failed` avec l'`exception` du registre national des entreprises.
|
|
12
|
+
- `invalid_siret` : le SIRET ou SIREN est mal formé ou refusé par entreprise.api.gouv.fr ; `exception` est une `InvalidSiretError` dont la `cause` porte le refus d'entreprise.api.gouv.fr.
|
|
13
|
+
- `not_diffusible` : l'établissement n'est pas diffusible.
|
|
14
|
+
- `api_entreprise_failed` : entreprise.api.gouv.fr a échoué, avec l'`exception`.
|
|
15
|
+
- `processCertificationDirigeant` ajoute `details.source_selection` (`SourceSelection`) : `preferred`, ou `fallback` avec l'`exception` du registre national des entreprises quand les mandataires viennent d'entreprise.api.gouv.fr.
|
|
16
|
+
- Les erreurs `InvalidSiretError`, `NotFoundError` et `ApiEntrepriseConnectionError` restent exportées.
|
|
17
|
+
|
|
18
|
+
### Minor Changes
|
|
19
|
+
|
|
20
|
+
- [#2365](https://github.com/proconnect-gouv/proconnect-identite/pull/2365) [`e47d7dd`](https://github.com/proconnect-gouv/proconnect-identite/commit/e47d7dd69c76c7b8c8dc8094c8ec4ac574278e75) Thanks [@douglasduteil](https://github.com/douglasduteil)! - Ajoute `getMemberIdsPromotedByDomain` dans `services/organization` : à partir d'un domaine et des membres d'une organisation, renvoie les identifiants des membres à promouvoir au rattachement `domain`.
|
|
21
|
+
|
|
22
|
+
## 11.0.0
|
|
23
|
+
|
|
24
|
+
### Major Changes
|
|
25
|
+
|
|
26
|
+
- [#2345](https://github.com/proconnect-gouv/proconnect-identite/pull/2345) [`434653c`](https://github.com/proconnect-gouv/proconnect-identite/commit/434653cb36cc334edf2bdf81df47fe4904f4c6cc) Thanks [@douglasduteil](https://github.com/douglasduteil)! - ajout des colonnes interaction_cid et outcome à users_oidc_clients, avec un index unique partiel sur interaction_cid ; addConnection devient upsertAuthorizationRequest (met à jour la ligne d'une même interaction au lieu d'en ajouter une), les types Connection et BaseConnection deviennent AuthorizationRequest et BaseAuthorizationRequest avec interaction_cid et outcome obligatoires ; AuthorizationRequestOutcomeEnum (zod) partage les valeurs de outcome
|
|
27
|
+
|
|
3
28
|
## 10.5.0
|
|
4
29
|
|
|
5
30
|
### Minor Changes
|
|
@@ -518,8 +518,8 @@ export declare function createContext({ api_entreprise_client, api_insee_client,
|
|
|
518
518
|
}>;
|
|
519
519
|
};
|
|
520
520
|
oidc_clients: {
|
|
521
|
-
addConnection: ({ user_id, oidc_client_id, organization_id, sp_name, user_ip_address, }: import("../types/connection.js").BaseConnection) => Promise<import("../types/connection.js").Connection>;
|
|
522
521
|
findByClientId: (client_id: string) => Promise<import("../types/oidc-client.js").OidcClient | undefined>;
|
|
522
|
+
upsertAuthorizationRequest: ({ user_id, oidc_client_id, organization_id, sp_name, user_ip_address, interaction_cid, outcome, }: import("../types/authorization-request.js").BaseAuthorizationRequest) => Promise<import("../types/authorization-request.js").AuthorizationRequest>;
|
|
523
523
|
};
|
|
524
524
|
organizations: {
|
|
525
525
|
findById: (id: number) => Promise<import("../types/organization.js").Organization | undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/connectors/index.ts"],"names":[],"mappings":"AAsEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gDAAgD,CAAC;AAC1F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,KAAK,EAAE,oCAAoC,EAAE,MAAM,+DAA+D,CAAC;AAC1H,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,IAAI,CAAC;AAI/B,wBAAgB,aAAa,CAAC,EAC5B,qBAAqB,EACrB,gBAAgB,EAChB,wCAAwC,EACxC,EAAE,GACH,EAAE;IACD,qBAAqB,EAAE,mBAAmB,CAAC;IAC3C,gBAAgB,EAAE,cAAc,CAAC;IACjC,wCAAwC,EAAE,oCAAoC,CAAC;IAC/E,EAAE,EAAE,IAAI,CAAC;CACV;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/connectors/index.ts"],"names":[],"mappings":"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"}
|
package/dist/connectors/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { addDomainFactory, deleteEmailDomainsByVerificationTypesFactory, findEma
|
|
|
5
5
|
import { deleteFranceconnectUserinfoFactory, findFranceconnectUserinfoFactory, upsertFranceconnectUserinfoFactory, } from "#src/repositories/franceconnect_userinfo";
|
|
6
6
|
import { createModerationFactory, deleteModerationFactory, findModerationByIdFactory, findPendingModerationFactory, findRejectedModerationFactory, getModerationByIdFactory, reopenModerationFactory, } from "#src/repositories/moderation";
|
|
7
7
|
import { deleteOfficialContactEmailVerificationFactory, findOfficialContactEmailVerificationFactory, upsertOfficialContactEmailVerificationFactory, } from "#src/repositories/official-contact-email-verification";
|
|
8
|
-
import {
|
|
8
|
+
import { findByClientIdFactory, upsertAuthorizationRequestFactory, } from "#src/repositories/oidc-client";
|
|
9
9
|
import { findBySiretFactory, findByUserIdFactory, findByVerifiedEmailDomainFactory, findOrganizationByIdFactory, findPendingByUserIdFactory, findUsersByOrganizationFactory, getOrganizationByIdFactory, upsertFactory, } from "#src/repositories/organization";
|
|
10
10
|
import { createRecoveryWordsFactory, deleteRecoveryWordsByUserIdFactory, findRecoveryWordsByUserIdFactory, } from "#src/repositories/recovery-words";
|
|
11
11
|
import { createUserFactory, deleteUserFactory, findByEmailFactory, findByMagicLinkTokenFactory, findByResetPasswordTokenFactory, findByIdFactory as findUserByIdFactory, getByIdFactory, updateUserFactory, } from "#src/repositories/user";
|
|
@@ -50,8 +50,8 @@ export function createContext({ api_entreprise_client, api_insee_client, api_reg
|
|
|
50
50
|
upsert: upsertOfficialContactEmailVerificationFactory({ pg }),
|
|
51
51
|
},
|
|
52
52
|
oidc_clients: {
|
|
53
|
-
addConnection: addConnectionFactory({ pg }),
|
|
54
53
|
findByClientId: findByClientIdFactory({ pg }),
|
|
54
|
+
upsertAuthorizationRequest: upsertAuthorizationRequestFactory({ pg }),
|
|
55
55
|
},
|
|
56
56
|
organizations: {
|
|
57
57
|
findById: findOrganizationByIdFactory({ pg }),
|
|
@@ -8,6 +8,12 @@ export declare const CertificationDirigeantDataSource: z.ZodEnum<{
|
|
|
8
8
|
}>;
|
|
9
9
|
export type CertificationDirigeantDataSource = z.infer<typeof CertificationDirigeantDataSource>;
|
|
10
10
|
export declare function getCertificationDirigeantDataSourceLabels(dataSource: CertificationDirigeantDataSource): string;
|
|
11
|
+
export type SourceSelection = {
|
|
12
|
+
kind: "fallback";
|
|
13
|
+
exception: unknown;
|
|
14
|
+
} | {
|
|
15
|
+
kind: "preferred";
|
|
16
|
+
};
|
|
11
17
|
export declare function processCertificationDirigeantFactory(context: Context): (organization: Organization, franceconnect_userinfo: FranceConnectUserInfo) => Promise<{
|
|
12
18
|
details: {
|
|
13
19
|
dirigeant: null;
|
|
@@ -21,13 +27,15 @@ export declare function processCertificationDirigeantFactory(context: Context):
|
|
|
21
27
|
given_name: string | null;
|
|
22
28
|
};
|
|
23
29
|
source: null;
|
|
30
|
+
source_selection: {
|
|
31
|
+
kind: "preferred";
|
|
32
|
+
};
|
|
24
33
|
};
|
|
25
34
|
cause: "organisation_not_covered";
|
|
26
35
|
ok: boolean;
|
|
27
36
|
} | {
|
|
28
37
|
details: {
|
|
29
38
|
dirigeant: undefined;
|
|
30
|
-
matches: Set<unknown>;
|
|
31
39
|
identity: {
|
|
32
40
|
birthcountry: string | null;
|
|
33
41
|
birthdate: Date | null;
|
|
@@ -36,7 +44,17 @@ export declare function processCertificationDirigeantFactory(context: Context):
|
|
|
36
44
|
gender: "male" | "female" | null;
|
|
37
45
|
given_name: string | null;
|
|
38
46
|
};
|
|
47
|
+
matches: Set<unknown>;
|
|
39
48
|
source: "api.insee.fr/api-sirene/private" | "entreprise.api.gouv.fr/v3/infogreffe/rcs/unites_legales/{siren}/mandataires_sociaux" | "registre-national-entreprises.inpi.fr/api";
|
|
49
|
+
source_selection: {
|
|
50
|
+
kind: "preferred";
|
|
51
|
+
exception?: undefined;
|
|
52
|
+
} | {
|
|
53
|
+
exception: unknown;
|
|
54
|
+
kind: "fallback";
|
|
55
|
+
} | {
|
|
56
|
+
kind: "preferred";
|
|
57
|
+
};
|
|
40
58
|
};
|
|
41
59
|
cause: "no_candidates";
|
|
42
60
|
ok: boolean;
|
|
@@ -60,6 +78,15 @@ export declare function processCertificationDirigeantFactory(context: Context):
|
|
|
60
78
|
given_name: string | null;
|
|
61
79
|
};
|
|
62
80
|
source: "api.insee.fr/api-sirene/private" | "entreprise.api.gouv.fr/v3/infogreffe/rcs/unites_legales/{siren}/mandataires_sociaux" | "registre-national-entreprises.inpi.fr/api";
|
|
81
|
+
source_selection: {
|
|
82
|
+
kind: "preferred";
|
|
83
|
+
exception?: undefined;
|
|
84
|
+
} | {
|
|
85
|
+
exception: unknown;
|
|
86
|
+
kind: "fallback";
|
|
87
|
+
} | {
|
|
88
|
+
kind: "preferred";
|
|
89
|
+
};
|
|
63
90
|
};
|
|
64
91
|
cause: "exact_match" | "close_match" | "below_threshold";
|
|
65
92
|
ok: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-certification-dirigeant.d.ts","sourceRoot":"","sources":["../../../src/managers/certification/process-certification-dirigeant.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,YAAY,EAClB,MAAM,YAAY,CAAC;AAEpB,OAAO,CAAC,MAAM,QAAQ,CAAC;AASvB,eAAO,MAAM,gCAAgC;;;;EAI3C,CAAC;AAEH,MAAM,MAAM,gCAAgC,GAAG,CAAC,CAAC,KAAK,CACpD,OAAO,gCAAgC,CACxC,CAAC;AAWF,wBAAgB,yCAAyC,CACvD,UAAU,EAAE,gCAAgC,UAG7C;
|
|
1
|
+
{"version":3,"file":"process-certification-dirigeant.d.ts","sourceRoot":"","sources":["../../../src/managers/certification/process-certification-dirigeant.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,YAAY,EAClB,MAAM,YAAY,CAAC;AAEpB,OAAO,CAAC,MAAM,QAAQ,CAAC;AASvB,eAAO,MAAM,gCAAgC;;;;EAI3C,CAAC;AAEH,MAAM,MAAM,gCAAgC,GAAG,CAAC,CAAC,KAAK,CACpD,OAAO,gCAAgC,CACxC,CAAC;AAWF,wBAAgB,yCAAyC,CACvD,UAAU,EAAE,gCAAgC,UAG7C;AAID,MAAM,MAAM,eAAe,GACvB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,GACxC;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,CAAC;AAqC1B,wBAAgB,oCAAoC,CAAC,OAAO,EAAE,OAAO,IAMjE,cAAc,YAAY,EAC1B,wBAAwB,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4EhD"}
|
|
@@ -22,7 +22,6 @@ const CERTIFICATION_DIRIGEANT_DATA_SOURCE_LABELS = {
|
|
|
22
22
|
export function getCertificationDirigeantDataSourceLabels(dataSource) {
|
|
23
23
|
return CERTIFICATION_DIRIGEANT_DATA_SOURCE_LABELS[dataSource];
|
|
24
24
|
}
|
|
25
|
-
//
|
|
26
25
|
async function getMandatairesSociaux({ client: { api_entreprise, rne } }, siren) {
|
|
27
26
|
try {
|
|
28
27
|
const pouvoirs = await rne.findPouvoirsBySiren(siren);
|
|
@@ -30,15 +29,19 @@ async function getMandatairesSociaux({ client: { api_entreprise, rne } }, siren)
|
|
|
30
29
|
return {
|
|
31
30
|
dirigeants,
|
|
32
31
|
source: CertificationDirigeantDataSource.enum["registre-national-entreprises.inpi.fr/api"],
|
|
32
|
+
source_selection: { kind: "preferred" },
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
-
catch (
|
|
36
|
-
console.error(error);
|
|
35
|
+
catch (exception) {
|
|
37
36
|
const mandataires = await api_entreprise.findMandatairesSociauxBySiren(siren);
|
|
38
37
|
const dirigeants = mandataires.map(ApiEntreprise.toIdentityVector);
|
|
39
38
|
return {
|
|
40
39
|
dirigeants,
|
|
41
40
|
source: CertificationDirigeantDataSource.enum["entreprise.api.gouv.fr/v3/infogreffe/rcs/unites_legales/{siren}/mandataires_sociaux"],
|
|
41
|
+
source_selection: {
|
|
42
|
+
exception,
|
|
43
|
+
kind: "fallback",
|
|
44
|
+
},
|
|
42
45
|
};
|
|
43
46
|
}
|
|
44
47
|
}
|
|
@@ -52,6 +55,7 @@ export function processCertificationDirigeantFactory(context) {
|
|
|
52
55
|
matches: new Set(),
|
|
53
56
|
identity: NullIdentityVector,
|
|
54
57
|
source: null,
|
|
58
|
+
source_selection: { kind: "preferred" },
|
|
55
59
|
},
|
|
56
60
|
cause: "organisation_not_covered",
|
|
57
61
|
ok: false,
|
|
@@ -63,20 +67,27 @@ export function processCertificationDirigeantFactory(context) {
|
|
|
63
67
|
"Entrepreneur individuel"
|
|
64
68
|
? CertificationDirigeantDataSource.enum["api.insee.fr/api-sirene/private"]
|
|
65
69
|
: CertificationDirigeantDataSource.enum["registre-national-entreprises.inpi.fr/api"];
|
|
66
|
-
const { dirigeants, source } = await match(preferredDataSource)
|
|
70
|
+
const { dirigeants, source, source_selection } = await match(preferredDataSource)
|
|
67
71
|
.with("api.insee.fr/api-sirene/private", async () => ({
|
|
68
72
|
dirigeants: await insee
|
|
69
73
|
.findBySiren(siren)
|
|
70
74
|
.then(INSEE.toIdentityVector)
|
|
71
75
|
.then((vector) => [vector]),
|
|
72
76
|
source: CertificationDirigeantDataSource.enum["api.insee.fr/api-sirene/private"],
|
|
77
|
+
source_selection: { kind: "preferred" },
|
|
73
78
|
}))
|
|
74
79
|
.with("registre-national-entreprises.inpi.fr/api", () => getMandatairesSociaux(context, siren))
|
|
75
80
|
.exhaustive();
|
|
76
81
|
const result = match_identity_to_dirigeant(identity, dirigeants);
|
|
77
82
|
if (result.kind === "no_candidates") {
|
|
78
83
|
return {
|
|
79
|
-
details: {
|
|
84
|
+
details: {
|
|
85
|
+
dirigeant: undefined,
|
|
86
|
+
identity,
|
|
87
|
+
matches: new Set(),
|
|
88
|
+
source,
|
|
89
|
+
source_selection,
|
|
90
|
+
},
|
|
80
91
|
cause: result.kind,
|
|
81
92
|
ok: false,
|
|
82
93
|
};
|
|
@@ -87,6 +98,7 @@ export function processCertificationDirigeantFactory(context) {
|
|
|
87
98
|
matches: result.closest.matches,
|
|
88
99
|
identity,
|
|
89
100
|
source,
|
|
101
|
+
source_selection,
|
|
90
102
|
},
|
|
91
103
|
cause: result.kind,
|
|
92
104
|
ok: result.kind === "exact_match",
|
|
@@ -1,6 +1,26 @@
|
|
|
1
|
+
import { InvalidSiretError } from "#src/errors";
|
|
1
2
|
import { type OrganizationInfo } from "#src/types";
|
|
2
3
|
import type { ApiEntrepriseClient } from "@proconnect-gouv/proconnect.api_entreprise/api";
|
|
3
4
|
import type { ApiRegistreNationalEntreprisesClient } from "@proconnect-gouv/proconnect.registre_national_entreprises/api";
|
|
4
|
-
export
|
|
5
|
+
export type RneEnrichment = {
|
|
6
|
+
kind: "enriched";
|
|
7
|
+
} | {
|
|
8
|
+
kind: "failed";
|
|
9
|
+
exception: unknown;
|
|
10
|
+
};
|
|
11
|
+
export type OrganizationInfoLookup = {
|
|
12
|
+
kind: "api_entreprise_failed";
|
|
13
|
+
exception: unknown;
|
|
14
|
+
} | {
|
|
15
|
+
kind: "found";
|
|
16
|
+
organization_info: OrganizationInfo;
|
|
17
|
+
rne: RneEnrichment;
|
|
18
|
+
} | {
|
|
19
|
+
kind: "invalid_siret";
|
|
20
|
+
exception: InvalidSiretError;
|
|
21
|
+
} | {
|
|
22
|
+
kind: "not_diffusible";
|
|
23
|
+
};
|
|
24
|
+
export declare function getOrganizationInfoFactory(apiEntrepriseClient: ApiEntrepriseClient, apiRneClient: ApiRegistreNationalEntreprisesClient): (siretOrSiren: string) => Promise<OrganizationInfoLookup>;
|
|
5
25
|
export type GetOrganizationInfoHandler = ReturnType<typeof getOrganizationInfoFactory>;
|
|
6
26
|
//# sourceMappingURL=get-organization-info.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-organization-info.d.ts","sourceRoot":"","sources":["../../../src/managers/organization/get-organization-info.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-organization-info.d.ts","sourceRoot":"","sources":["../../../src/managers/organization/get-organization-info.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gDAAgD,CAAC;AAK1F,OAAO,KAAK,EAAE,oCAAoC,EAAE,MAAM,+DAA+D,CAAC;AAM1H,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GACpB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,CAAC;AAE3C,MAAM,MAAM,sBAAsB,GAC9B;IAAE,IAAI,EAAE,uBAAuB,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,GACrD;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,iBAAiB,EAAE,gBAAgB,CAAC;IAAC,GAAG,EAAE,aAAa,CAAA;CAAE,GAC1E;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,SAAS,EAAE,iBAAiB,CAAA;CAAE,GACvD;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,CAAC;AAE/B,wBAAgB,0BAA0B,CACxC,mBAAmB,EAAE,mBAAmB,EACxC,YAAY,EAAE,oCAAoC,IAShD,cAAc,MAAM,KACnB,OAAO,CAAC,sBAAsB,CAAC,CAoDnC;AAED,MAAM,MAAM,0BAA0B,GAAG,UAAU,CACjD,OAAO,0BAA0B,CAClC,CAAC"}
|
|
@@ -1,53 +1,56 @@
|
|
|
1
1
|
//
|
|
2
|
-
import { InvalidSiretError
|
|
2
|
+
import { InvalidSiretError } from "#src/errors";
|
|
3
3
|
import {} from "#src/types";
|
|
4
|
-
import {
|
|
4
|
+
import { ApiEntrepriseInvalidSiret, } from "@proconnect-gouv/proconnect.api_entreprise/types";
|
|
5
5
|
import * as ApiEntreprise from "./adapters/api_entreprise.js";
|
|
6
6
|
import * as ApiRne from "./adapters/rne.js";
|
|
7
|
-
//
|
|
8
7
|
export function getOrganizationInfoFactory(apiEntrepriseClient, apiRneClient) {
|
|
8
|
+
async function findApiEntrepriseData(siretOrSiren) {
|
|
9
|
+
if (/^\d{14}$/.test(siretOrSiren))
|
|
10
|
+
return apiEntrepriseClient.findBySiret(siretOrSiren);
|
|
11
|
+
return apiEntrepriseClient.findBySiren(siretOrSiren);
|
|
12
|
+
}
|
|
9
13
|
return async function getOrganizationInfo(siretOrSiren) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (siretOrSiren.match(/^\d{14}$/)) {
|
|
15
|
-
apiEntrepriseOrganizationInfo =
|
|
16
|
-
ApiEntreprise.toApiEntrepriseOrganizationInfo(await apiEntrepriseClient.findBySiret(siretOrSiren));
|
|
17
|
-
}
|
|
18
|
-
else if (siretOrSiren.match(/^\d{9}$/)) {
|
|
19
|
-
apiEntrepriseOrganizationInfo =
|
|
20
|
-
ApiEntreprise.toApiEntrepriseOrganizationInfo(await apiEntrepriseClient.findBySiren(siretOrSiren));
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
throw new InvalidSiretError();
|
|
24
|
-
}
|
|
25
|
-
const { statutDiffusion } = apiEntrepriseOrganizationInfo;
|
|
26
|
-
if (statutDiffusion === "non_diffusible") {
|
|
27
|
-
throw new NotFoundError();
|
|
28
|
-
}
|
|
29
|
-
organizationInfo = {
|
|
30
|
-
...apiEntrepriseOrganizationInfo,
|
|
31
|
-
denominationUsuelleEtablissementPrincipal: null,
|
|
14
|
+
if (!/^(\d{9}|\d{14})$/.test(siretOrSiren))
|
|
15
|
+
return {
|
|
16
|
+
exception: new InvalidSiretError("siret or siren must be 9 or 14 digits"),
|
|
17
|
+
kind: "invalid_siret",
|
|
32
18
|
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
19
|
+
let apiEntrepriseData;
|
|
20
|
+
try {
|
|
21
|
+
apiEntrepriseData = await findApiEntrepriseData(siretOrSiren);
|
|
22
|
+
}
|
|
23
|
+
catch (exception) {
|
|
24
|
+
if (ApiEntrepriseInvalidSiret.isInvalidSiret(exception))
|
|
25
|
+
return {
|
|
26
|
+
exception: new InvalidSiretError("rejected by entreprise.api.gouv.fr", { cause: exception }),
|
|
27
|
+
kind: "invalid_siret",
|
|
40
28
|
};
|
|
41
|
-
}
|
|
42
|
-
catch (error) {
|
|
43
|
-
console.error(`RNE data will be undefined for this organization (${siren}); an error occurred while fetching it`, error);
|
|
44
|
-
}
|
|
45
|
-
return organizationInfo;
|
|
29
|
+
return { exception, kind: "api_entreprise_failed" };
|
|
46
30
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
31
|
+
if (apiEntrepriseData.status_diffusion === "non_diffusible")
|
|
32
|
+
return { kind: "not_diffusible" };
|
|
33
|
+
const organizationInfo = {
|
|
34
|
+
...ApiEntreprise.toApiEntrepriseOrganizationInfo(apiEntrepriseData),
|
|
35
|
+
denominationUsuelleEtablissementPrincipal: null,
|
|
36
|
+
};
|
|
37
|
+
try {
|
|
38
|
+
const apiRneData = await apiRneClient.findCompanyBySiren(siretOrSiren.slice(0, 9));
|
|
39
|
+
return {
|
|
40
|
+
kind: "found",
|
|
41
|
+
organization_info: {
|
|
42
|
+
...organizationInfo,
|
|
43
|
+
...ApiRne.toApiRneOrganizationInfo(apiRneData),
|
|
44
|
+
},
|
|
45
|
+
rne: { kind: "enriched" },
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
catch (exception) {
|
|
49
|
+
return {
|
|
50
|
+
kind: "found",
|
|
51
|
+
organization_info: organizationInfo,
|
|
52
|
+
rne: { exception, kind: "failed" },
|
|
53
|
+
};
|
|
51
54
|
}
|
|
52
55
|
};
|
|
53
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/repositories/oidc-client/index.ts"],"names":[],"mappings":"AAEA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/repositories/oidc-client/index.ts"],"names":[],"mappings":"AAEA,cAAc,wBAAwB,CAAC;AACvC,cAAc,mCAAmC,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { AuthorizationRequest, BaseAuthorizationRequest, DatabaseContext } from "#src/types";
|
|
2
|
+
export declare function upsertAuthorizationRequestFactory({ pg }: DatabaseContext): ({ user_id, oidc_client_id, organization_id, sp_name, user_ip_address, interaction_cid, outcome, }: BaseAuthorizationRequest) => Promise<AuthorizationRequest>;
|
|
3
|
+
//# sourceMappingURL=upsert-authorization-request.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upsert-authorization-request.d.ts","sourceRoot":"","sources":["../../../src/repositories/oidc-client/upsert-authorization-request.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,oBAAoB,EACpB,wBAAwB,EACxB,eAAe,EAChB,MAAM,YAAY,CAAC;AAKpB,wBAAgB,iCAAiC,CAAC,EAAE,EAAE,EAAE,EAAE,eAAe,IACtB,mGAQ9C,wBAAwB,mCA6B5B"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//
|
|
2
|
+
import {} from "pg";
|
|
3
|
+
//
|
|
4
|
+
export function upsertAuthorizationRequestFactory({ pg }) {
|
|
5
|
+
return async function upsertAuthorizationRequest({ user_id, oidc_client_id, organization_id, sp_name, user_ip_address, interaction_cid, outcome, }) {
|
|
6
|
+
const { rows } = await pg.query(`
|
|
7
|
+
INSERT INTO users_oidc_clients
|
|
8
|
+
(user_id, oidc_client_id, organization_id, sp_name, user_ip_address, created_at, updated_at, interaction_cid, outcome)
|
|
9
|
+
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)
|
|
10
|
+
ON CONFLICT (interaction_cid) WHERE interaction_cid IS NOT NULL
|
|
11
|
+
DO UPDATE SET
|
|
12
|
+
organization_id = EXCLUDED.organization_id,
|
|
13
|
+
outcome = EXCLUDED.outcome,
|
|
14
|
+
updated_at = EXCLUDED.updated_at,
|
|
15
|
+
user_id = EXCLUDED.user_id
|
|
16
|
+
RETURNING user_id, oidc_client_id, organization_id, sp_name, user_ip_address, created_at, updated_at, id, interaction_cid, outcome;
|
|
17
|
+
`, [
|
|
18
|
+
user_id,
|
|
19
|
+
oidc_client_id,
|
|
20
|
+
organization_id,
|
|
21
|
+
sp_name,
|
|
22
|
+
user_ip_address,
|
|
23
|
+
new Date(),
|
|
24
|
+
new Date(),
|
|
25
|
+
interaction_cid,
|
|
26
|
+
outcome,
|
|
27
|
+
]);
|
|
28
|
+
return rows.shift();
|
|
29
|
+
};
|
|
30
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function getMemberIdsPromotedByDomain({ domain, members, }: {
|
|
2
|
+
domain: string;
|
|
3
|
+
members: ReadonlyArray<{
|
|
4
|
+
email: string;
|
|
5
|
+
id: number;
|
|
6
|
+
verification_type: string;
|
|
7
|
+
}>;
|
|
8
|
+
}): number[];
|
|
9
|
+
//# sourceMappingURL=get-member-ids-promoted-by-domain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-member-ids-promoted-by-domain.d.ts","sourceRoot":"","sources":["../../../src/services/organization/get-member-ids-promoted-by-domain.ts"],"names":[],"mappings":"AAOA,wBAAgB,4BAA4B,CAAC,EAC3C,MAAM,EACN,OAAO,GACR,EAAE;IACD,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,aAAa,CAAC;QACrB,KAAK,EAAE,MAAM,CAAC;QACd,EAAE,EAAE,MAAM,CAAC;QACX,iBAAiB,EAAE,MAAM,CAAC;KAC3B,CAAC,CAAC;CACJ,YASA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//
|
|
2
|
+
import { SuperWeakLinkEnum, UnverifiedLinkEnum } from "#src/types";
|
|
3
|
+
import { getEmailDomain } from "@proconnect-gouv/proconnect.core/services/email";
|
|
4
|
+
//
|
|
5
|
+
export function getMemberIdsPromotedByDomain({ domain, members, }) {
|
|
6
|
+
return members
|
|
7
|
+
.filter(({ email, verification_type }) => getEmailDomain(email) === domain &&
|
|
8
|
+
(UnverifiedLinkEnum.safeParse(verification_type).success ||
|
|
9
|
+
SuperWeakLinkEnum.safeParse(verification_type).success))
|
|
10
|
+
.map(({ id }) => id);
|
|
11
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from "./compute-service-public-info.js";
|
|
2
|
+
export * from "./get-member-ids-promoted-by-domain.js";
|
|
2
3
|
export * from "./is-domain-allowed-for-organization.js";
|
|
3
4
|
export * from "./is-entreprise-unipersonnelle.js";
|
|
4
5
|
export * from "./is-organization-covered-by-certification-dirigeant.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/organization/index.ts"],"names":[],"mappings":"AAEA,cAAc,kCAAkC,CAAC;AACjD,cAAc,yCAAyC,CAAC;AACxD,cAAc,mCAAmC,CAAC;AAClD,cAAc,yDAAyD,CAAC;AACxE,cAAc,oCAAoC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/organization/index.ts"],"names":[],"mappings":"AAEA,cAAc,kCAAkC,CAAC;AACjD,cAAc,wCAAwC,CAAC;AACvD,cAAc,yCAAyC,CAAC;AACxD,cAAc,mCAAmC,CAAC;AAClD,cAAc,yDAAyD,CAAC;AACxE,cAAc,oCAAoC,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
//
|
|
2
2
|
export * from "./compute-service-public-info.js";
|
|
3
|
+
export * from "./get-member-ids-promoted-by-domain.js";
|
|
3
4
|
export * from "./is-domain-allowed-for-organization.js";
|
|
4
5
|
export * from "./is-entreprise-unipersonnelle.js";
|
|
5
6
|
export * from "./is-organization-covered-by-certification-dirigeant.js";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const AuthorizationRequestOutcomeEnum: z.ZodEnum<{
|
|
3
|
+
succeeded: "succeeded";
|
|
4
|
+
}>;
|
|
5
|
+
export type AuthorizationRequestOutcome = z.output<typeof AuthorizationRequestOutcomeEnum>;
|
|
6
|
+
export interface BaseAuthorizationRequest {
|
|
7
|
+
user_id: number;
|
|
8
|
+
oidc_client_id: number;
|
|
9
|
+
organization_id: number | null;
|
|
10
|
+
sp_name: string | null;
|
|
11
|
+
user_ip_address: string | null;
|
|
12
|
+
interaction_cid: string | null;
|
|
13
|
+
outcome: AuthorizationRequestOutcome | null;
|
|
14
|
+
}
|
|
15
|
+
export interface AuthorizationRequest extends BaseAuthorizationRequest {
|
|
16
|
+
id: number;
|
|
17
|
+
created_at: Date;
|
|
18
|
+
updated_at: Date;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=authorization-request.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorization-request.d.ts","sourceRoot":"","sources":["../../src/types/authorization-request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,+BAA+B;;EAAwB,CAAC;AAErE,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAChD,OAAO,+BAA+B,CACvC,CAAC;AAEF,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,OAAO,EAAE,2BAA2B,GAAG,IAAI,CAAC;CAC7C;AAED,MAAM,WAAW,oBAAqB,SAAQ,wBAAwB;IACpE,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,IAAI,CAAC;IACjB,UAAU,EAAE,IAAI,CAAC;CAClB"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAEA,cAAc,oBAAoB,CAAC;AACnC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAEA,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,0CAA0C,CAAC;AACzD,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,WAAW,CAAC"}
|
package/dist/types/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@proconnect-gouv/proconnect.identite",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.0",
|
|
4
4
|
"homepage": "https://github.com/proconnect-gouv/proconnect-identite/tree/main/packages/identite#readme",
|
|
5
5
|
"bugs": "https://github.com/proconnect-gouv/proconnect-identite/issues",
|
|
6
6
|
"repository": {
|
package/src/connectors/index.ts
CHANGED
|
@@ -33,8 +33,8 @@ import {
|
|
|
33
33
|
upsertOfficialContactEmailVerificationFactory,
|
|
34
34
|
} from "#src/repositories/official-contact-email-verification";
|
|
35
35
|
import {
|
|
36
|
-
addConnectionFactory,
|
|
37
36
|
findByClientIdFactory,
|
|
37
|
+
upsertAuthorizationRequestFactory,
|
|
38
38
|
} from "#src/repositories/oidc-client";
|
|
39
39
|
import {
|
|
40
40
|
findBySiretFactory,
|
|
@@ -126,8 +126,8 @@ export function createContext({
|
|
|
126
126
|
upsert: upsertOfficialContactEmailVerificationFactory({ pg }),
|
|
127
127
|
},
|
|
128
128
|
oidc_clients: {
|
|
129
|
-
addConnection: addConnectionFactory({ pg }),
|
|
130
129
|
findByClientId: findByClientIdFactory({ pg }),
|
|
130
|
+
upsertAuthorizationRequest: upsertAuthorizationRequestFactory({ pg }),
|
|
131
131
|
},
|
|
132
132
|
organizations: {
|
|
133
133
|
findById: findOrganizationByIdFactory({ pg }),
|
|
@@ -65,6 +65,7 @@ describe("processCertificationDirigeantFactory", () => {
|
|
|
65
65
|
]),
|
|
66
66
|
identity: IdentityVectorSchema.parse(LiElJonsonFranceConnectUserInfo),
|
|
67
67
|
source: "api.insee.fr/api-sirene/private",
|
|
68
|
+
source_selection: { kind: "preferred" },
|
|
68
69
|
},
|
|
69
70
|
ok: true,
|
|
70
71
|
});
|
|
@@ -92,6 +93,7 @@ describe("processCertificationDirigeantFactory", () => {
|
|
|
92
93
|
]),
|
|
93
94
|
identity: IdentityVectorSchema.parse(RogalDornFranceConnectUserInfo),
|
|
94
95
|
source: "api.insee.fr/api-sirene/private",
|
|
96
|
+
source_selection: { kind: "preferred" },
|
|
95
97
|
},
|
|
96
98
|
ok: true,
|
|
97
99
|
});
|
|
@@ -114,6 +116,7 @@ describe("processCertificationDirigeantFactory", () => {
|
|
|
114
116
|
matches: new Set(["gender", "birth_country"]),
|
|
115
117
|
identity: IdentityVectorSchema.parse(RogalDornFranceConnectUserInfo),
|
|
116
118
|
source: "api.insee.fr/api-sirene/private",
|
|
119
|
+
source_selection: { kind: "preferred" },
|
|
117
120
|
},
|
|
118
121
|
ok: false,
|
|
119
122
|
});
|
|
@@ -142,6 +145,7 @@ describe("processCertificationDirigeantFactory", () => {
|
|
|
142
145
|
]),
|
|
143
146
|
identity: IdentityVectorSchema.parse(RogalDornFranceConnectUserInfo),
|
|
144
147
|
source: "registre-national-entreprises.inpi.fr/api",
|
|
148
|
+
source_selection: { kind: "preferred" },
|
|
145
149
|
},
|
|
146
150
|
ok: true,
|
|
147
151
|
});
|
|
@@ -170,12 +174,17 @@ describe("processCertificationDirigeantFactory", () => {
|
|
|
170
174
|
]),
|
|
171
175
|
identity: IdentityVectorSchema.parse(AmberleyVailFranceConnectUserInfo),
|
|
172
176
|
source: "registre-national-entreprises.inpi.fr/api",
|
|
177
|
+
source_selection: { kind: "preferred" },
|
|
173
178
|
},
|
|
174
179
|
ok: true,
|
|
175
180
|
});
|
|
176
181
|
});
|
|
177
182
|
|
|
178
|
-
it("should match Rogal Dorn
|
|
183
|
+
it("should match Rogal Dorn in Infogreffe when RNE fails", async () => {
|
|
184
|
+
const exception = new Error("RNE unavailable");
|
|
185
|
+
api_registre_national_entreprises_mock_client.findPouvoirsBySiren.mock.mockImplementationOnce(
|
|
186
|
+
() => Promise.reject(exception),
|
|
187
|
+
);
|
|
179
188
|
api_entreprise_mock_client.findMandatairesSociauxBySiren.mock.mockImplementationOnce(
|
|
180
189
|
() => Promise.resolve([UlysseToriMandataire, RogalDornMandataire]),
|
|
181
190
|
);
|
|
@@ -199,6 +208,7 @@ describe("processCertificationDirigeantFactory", () => {
|
|
|
199
208
|
identity: IdentityVectorSchema.parse(RogalDornFranceConnectUserInfo),
|
|
200
209
|
source:
|
|
201
210
|
"entreprise.api.gouv.fr/v3/infogreffe/rcs/unites_legales/{siren}/mandataires_sociaux",
|
|
211
|
+
source_selection: { exception, kind: "fallback" },
|
|
202
212
|
},
|
|
203
213
|
ok: true,
|
|
204
214
|
});
|
|
@@ -221,6 +231,7 @@ describe("processCertificationDirigeantFactory", () => {
|
|
|
221
231
|
identity: IdentityVectorSchema.parse(LiElJonsonFranceConnectUserInfo),
|
|
222
232
|
matches: new Set(),
|
|
223
233
|
source: "registre-national-entreprises.inpi.fr/api",
|
|
234
|
+
source_selection: { kind: "preferred" },
|
|
224
235
|
},
|
|
225
236
|
ok: false,
|
|
226
237
|
});
|