Skip to content

Commit fcd9d0c

Browse files
[SELC-7162] feat: remove institutionType from root level (#108)
1 parent fe3ef72 commit fcd9d0c

File tree

37 files changed

+224
-235
lines changed

37 files changed

+224
-235
lines changed

apps/institution-ms/app/src/main/docs/openapi.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2901,9 +2901,6 @@
29012901
"id" : {
29022902
"type" : "string"
29032903
},
2904-
"institutionType" : {
2905-
"type" : "string"
2906-
},
29072904
"origin" : {
29082905
"type" : "string"
29092906
},

apps/institution-ms/app/src/test/java/it/pagopa/selfcare/mscore/integration_test/steps/DelegationSteps.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ public void createPairOfMockInstitutionWithId(String id1, String id2, String tax
6464
entity1.setCreatedAt(OffsetDateTime.now());
6565
entity1.setUpdatedAt(OffsetDateTime.now());
6666
entity1.setTaxCode(taxCode1);
67-
entity1.setInstitutionType(InstitutionType.PA);
6867
entity1.setSubunitCode(subCode1);
6968
entity1.setOnboarding(List.of(onboardingEntity));
7069
final InstitutionEntity savedEntity1 = institutionRepository.save(entity1);
@@ -76,7 +75,6 @@ public void createPairOfMockInstitutionWithId(String id1, String id2, String tax
7675
entity2.setCreatedAt(OffsetDateTime.now());
7776
entity2.setUpdatedAt(OffsetDateTime.now());
7877
entity2.setTaxCode(taxCode2);
79-
entity2.setInstitutionType(InstitutionType.GSP);
8078
entity2.setSubunitCode(subCode2);
8179
entity2.setOnboarding(List.of(onboardingEntity));
8280
final InstitutionEntity savedEntity2 = institutionRepository.save(entity2);
@@ -96,8 +94,8 @@ public void createMockDelegation(String delegationId, DelegationType delegationT
9694
delegation.setInstitutionToName("To Institution");
9795
delegation.setFromTaxCode(fromInstitution.getTaxCode());
9896
delegation.setToTaxCode(toInstitution.getTaxCode());
99-
delegation.setFromType(fromInstitution.getOnboarding().stream().filter(onb -> productId.equals(onb.getProductId())).map(onb -> onb.getInstitutionType().name()).findFirst().orElse(fromInstitution.getInstitutionType().name()));
100-
delegation.setToType(toInstitution.getOnboarding().stream().filter(onb -> productId.equals(onb.getProductId())).map(onb -> onb.getInstitutionType().name()).findFirst().orElse(toInstitution.getInstitutionType().name()));
97+
delegation.setFromType(fromInstitution.getOnboarding().stream().filter(onb -> productId.equals(onb.getProductId())).map(onb -> onb.getInstitutionType().name()).findFirst().orElse(null));
98+
delegation.setToType(toInstitution.getOnboarding().stream().filter(onb -> productId.equals(onb.getProductId())).map(onb -> onb.getInstitutionType().name()).findFirst().orElse(null));
10199
delegation.setProductId(productId);
102100
delegation.setStatus(status);
103101
delegation.setType(delegationType);

apps/institution-ms/app/src/test/java/it/pagopa/selfcare/mscore/integration_test/steps/InstitutionSteps.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ public void createMockInstitutionWithId(String id) {
9696
public void createMockInstitutionWithoutActiveOnboardings(String id) {
9797
final InstitutionEntity entity = new InstitutionEntity();
9898
entity.setId(id);
99-
entity.setInstitutionType(InstitutionType.PA);
10099
entity.setOrigin(Origin.MOCK);
101100
entity.setOriginId("x1");
102101
entity.setCreatedAt(OffsetDateTime.now());

apps/institution-ms/app/src/test/resources/db/institution.json

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"origin": "IPA",
66
"originId": "c_c067",
77
"description": "Comune di Castelbuono",
8-
"institutionType": "PA",
98
"digitalAddress": "comune.castelbuono@pec.it",
109
"address": "Via Sant' Anna, 25",
1110
"zipCode": "90013",
@@ -105,7 +104,6 @@
105104
"origin": "IPA",
106105
"originId": "c_d277",
107106
"description": "Comune di Agrigento",
108-
"institutionType": "PA",
109107
"digitalAddress": "protocollo@pec.comune.dernice.al.it",
110108
"address": "Via Roma N.17",
111109
"zipCode": "15056",
@@ -205,7 +203,6 @@
205203
"origin": "SELC",
206204
"originId": "PSP_15555555555",
207205
"description": "Comune di Castel Test",
208-
"institutionType": "PSP",
209206
"digitalAddress": "test@t.it",
210207
"address": "Via Giacomo Matteotti",
211208
"zipCode": "11111",
@@ -445,7 +442,6 @@
445442
"origin": "IPA",
446443
"originId": "c_d277",
447444
"description": "comune di dernice",
448-
"institutionType": "PT",
449445
"digitalAddress": "protocollo@pec.comune.dernice.al.it",
450446
"address": "Via Roma N.17",
451447
"zipCode": "15056",
@@ -549,7 +545,6 @@
549545
"origin": "IPA",
550546
"originId": "isticom",
551547
"description": "3 Istituto Comprensivo Nocera Inferiore",
552-
"institutionType": "PA",
553548
"digitalAddress": "saic8bu00x@pec.istruzione.it",
554549
"address": "Via San Pietro, 10",
555550
"zipCode": "84014",
@@ -614,7 +609,6 @@
614609
"origin": "IPA",
615610
"originId": "isticom",
616611
"description": "Comune di Assisi",
617-
"institutionType": "PA",
618612
"digitalAddress": "test@test.com",
619613
"address": "Via Roma, 1",
620614
"zipCode": "00000",
@@ -666,7 +660,6 @@
666660
"origin": "IPA",
667661
"originId": "isticom",
668662
"description": "NTT Data",
669-
"institutionType": "PT",
670663
"digitalAddress": "test@test.com",
671664
"address": "Via Roma, 1",
672665
"zipCode": "00000",

apps/institution-ms/app/src/test/resources/features/external.feature

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ Feature: External
1111
Then The status code is 200
1212
And The response body contains the list "" of size 3
1313
And The response body contains at path "" the following list of objects in any order:
14-
| id | externalId | origin | originId | description | institutionType | digitalAddress | address | zipCode | taxCode | imported | supportEmail | delegation | subunitCode | subunitType |
15-
| b4705659-3a01-430a-a19b-7bdb4e340223 | 94076720658#UF5D7W | IPA | UF5D7W | Uff_eFatturaPA | | saic8bu00x@pec.istruzione.it | Via San Pietro, 10 | 84014 | 94076720658 | false | | false | UF5D7W | UO |
16-
| c9a50656-f345-4c81-84be-5b2474470544 | 00310810825 | IPA | c_c067 | Comune di Castelbuono | PA | comune.castelbuono@pec.it | Via Sant' Anna, 25 | 90013 | 00310810825 | false | a@l.it | false | | |
17-
| fc5466e5-df00-4800-9ad5-aa2e7d9344f9 | 94076720658 | IPA | isticom | 3 Istituto Comprensivo Nocera Inferiore | PA | saic8bu00x@pec.istruzione.it | Via San Pietro, 10 | 84014 | 94076720658 | false | | false | | |
14+
| id | externalId | origin | originId | description | digitalAddress | address | zipCode | taxCode | imported | supportEmail | delegation | subunitCode | subunitType |
15+
| b4705659-3a01-430a-a19b-7bdb4e340223 | 94076720658#UF5D7W | IPA | UF5D7W | Uff_eFatturaPA | saic8bu00x@pec.istruzione.it | Via San Pietro, 10 | 84014 | 94076720658 | false | | false | UF5D7W | UO |
16+
| c9a50656-f345-4c81-84be-5b2474470544 | 00310810825 | IPA | c_c067 | Comune di Castelbuono | comune.castelbuono@pec.it | Via Sant' Anna, 25 | 90013 | 00310810825 | false | a@l.it | false | | |
17+
| fc5466e5-df00-4800-9ad5-aa2e7d9344f9 | 94076720658 | IPA | isticom | 3 Istituto Comprensivo Nocera Inferiore | saic8bu00x@pec.istruzione.it | Via San Pietro, 10 | 84014 | 94076720658 | false | | false | | |
1818

1919
Scenario: Successfully retrieve institutions onboarding data by ids
2020
Given User login with username "j.doe" and password "test"

apps/institution-ms/app/src/test/resources/features/institution.feature

Lines changed: 34 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@ Feature: Institution
193193
| taxCode | 00297110389 |
194194
| origin | IPA |
195195
| originId | c_d548 |
196-
| institutionType | PA |
197196
| istatCode | 038008 |
198197
| digitalAddress | comune.ferrara@cert.comune.fe.it |
199198
| zipCode | 44121 |
@@ -238,7 +237,6 @@ Feature: Institution
238237
| taxCode | 00297110389 |
239238
| origin | IPA |
240239
| originId | c_d548 |
241-
| institutionType | PA |
242240
| istatCode | 038008 |
243241
| digitalAddress | comune.ferrara@cert.comune.fe.it |
244242
| zipCode | 44121 |
@@ -292,7 +290,6 @@ Feature: Institution
292290
| taxCode | 00297110389 |
293291
| origin | IPA |
294292
| originId | A46A529 |
295-
| institutionType | PA |
296293
| istatCode | 038008 |
297294
| digitalAddress | comune.ferrara@cert.comune.fe.it |
298295
| zipCode | 44121 |
@@ -327,7 +324,6 @@ Feature: Institution
327324
"desc": "second geo"
328325
}
329326
],
330-
"institutionType": "PA",
331327
"subunitCode": "A46A529",
332328
"subunitType": "AOO",
333329
"supportEmail": "updatedsupportmail@test.com",
@@ -343,7 +339,6 @@ Feature: Institution
343339
| taxCode | 00297110389 |
344340
| origin | IPA |
345341
| originId | A46A529 |
346-
| institutionType | PA |
347342
| istatCode | 038008 |
348343
| digitalAddress | comune.ferrara@cert.comune.fe.it |
349344
| zipCode | 44121 |
@@ -385,7 +380,6 @@ Feature: Institution
385380
"desc": "second geo"
386381
}
387382
],
388-
"institutionType": "PA",
389383
"subunitCode": "3QOOYF",
390384
"subunitType": "UO",
391385
"supportEmail": "supportmail@test.com",
@@ -401,7 +395,6 @@ Feature: Institution
401395
| taxCode | 00297110389 |
402396
| origin | IPA |
403397
| originId | 3QOOYF |
404-
| institutionType | PA |
405398
| istatCode | 038008 |
406399
| digitalAddress | personale@cert.comune.fe.it |
407400
| zipCode | 44121 |
@@ -452,7 +445,6 @@ Feature: Institution
452445
| taxCode | 00297110389 |
453446
| origin | IPA |
454447
| originId | 3QOOYF |
455-
| institutionType | PA |
456448
| istatCode | 038008 |
457449
| digitalAddress | personale@cert.comune.fe.it |
458450
| zipCode | 44121 |
@@ -690,7 +682,6 @@ Feature: Institution
690682
| taxCode | 123456789 |
691683
| origin | IPA |
692684
| originId | c_d548 |
693-
| institutionType | PA |
694685
And The response body contains field "id"
695686

696687
@RemoveInstitutionIdAfterScenario
@@ -712,7 +703,6 @@ Feature: Institution
712703
| istatCode | 06068501219 |
713704
| origin | INFOCAMERE |
714705
| originId | 01501320442 |
715-
| institutionType | PG |
716706
And The response body contains field "id"
717707

718708
Scenario: Not found while creating institution from pda
@@ -948,7 +938,6 @@ Feature: Institution
948938
| istatCode | 06068501219 |
949939
| origin | ADE |
950940
| originId | 0987654321 |
951-
| institutionType | PG |
952941
| description | Test PG Institution |
953942
And The response body contains field "id"
954943

@@ -971,7 +960,6 @@ Feature: Institution
971960
| istatCode | 06068501219 |
972961
| origin | INFOCAMERE |
973962
| originId | 01501320442 |
974-
| institutionType | PG |
975963
| zipCode | 00121 |
976964
| description | test0 |
977965
And The response body contains field "id"
@@ -1013,7 +1001,6 @@ Feature: Institution
10131001
Then The status code is 201
10141002
And The response body contains:
10151003
| externalId | 00310810825 |
1016-
| institutionType | PA |
10171004
| origin | IPA |
10181005
| taxCode | 00310810825 |
10191006

@@ -1256,7 +1243,10 @@ Feature: Institution
12561243
"tokenId": "123456789",
12571244
"contractPath": "testContractPath",
12581245
"activatedAt": "2025-02-28T15:00:00Z",
1259-
"isAggregator": false
1246+
"isAggregator": false,
1247+
"institutionType": "PA",
1248+
"origin": "MOCK",
1249+
"originId": "x1"
12601250
}
12611251
"""
12621252
When I send a POST request to "/institutions/{id}/onboarding"
@@ -1280,12 +1270,12 @@ Feature: Institution
12801270
And The following request body:
12811271
"""
12821272
{
1283-
"productId": "prod-pn",
1273+
"productId": "prod-io",
12841274
"tokenId": "123456789",
12851275
"contractPath": "testContractPath",
12861276
"activatedAt": "2025-02-28T15:00:00Z",
12871277
"isAggregator": false,
1288-
"institutionType": "PT",
1278+
"institutionType": "PA",
12891279
"origin": "SELC",
12901280
"originId": "xxx"
12911281
}
@@ -1303,7 +1293,7 @@ Feature: Institution
13031293
| prod-pagopa | ACTIVE |
13041294
| prod-idpay | DELETED |
13051295
| prod-pn | SUSPENDED |
1306-
And Onboarding for institutionId "123" and productId "prod-pn" was saved to db successfully with token "MOCK_TOKEN" contract "MOCK_CONTRACT", a module of 10, institutionType "PA", origin "MOCK" and originId "123x"
1296+
And Onboarding for institutionId "123" and productId "prod-io" was saved to db successfully with token "MOCK_TOKEN" contract "MOCK_CONTRACT", a module of 10, institutionType "PA", origin "MOCK" and originId "123x"
13071297

13081298
Scenario: Do not persist PecNotification with PT institution type
13091299
Given User login with username "j.doe" and password "test"
@@ -1312,7 +1302,8 @@ Feature: Institution
13121302
And The following request body:
13131303
"""
13141304
{
1315-
"productId": "prod-io"
1305+
"productId": "prod-io",
1306+
"institutionType": "PT"
13161307
}
13171308
"""
13181309
When I send a POST request to "/institutions/{id}/onboarding"
@@ -1325,6 +1316,30 @@ Feature: Institution
13251316
And The response body contains field "id"
13261317
And Count of MailNotification with institutionId "067327d3-bdd6-408d-8655-87e8f1960046" is 0
13271318

1319+
@RemoveMockInstitutionAfterScenario
1320+
Scenario: Attempt to persistOnboarding with existing productId but different institutionType
1321+
Given User login with username "j.doe" and password "test"
1322+
And A mock institution with id "123"
1323+
And The following path params:
1324+
| id | 123 |
1325+
And The following request body:
1326+
"""
1327+
{
1328+
"productId": "prod-pn",
1329+
"tokenId": "123456789",
1330+
"contractPath": "testContractPath",
1331+
"activatedAt": "2025-02-28T15:00:00Z",
1332+
"isAggregator": false,
1333+
"institutionType": "PT",
1334+
"origin": "SELC",
1335+
"originId": "xxx"
1336+
}
1337+
"""
1338+
When I send a POST request to "/institutions/{id}/onboarding"
1339+
And The response body contains:
1340+
| status | 500 |
1341+
| detail | Conflicting institutionType for product prod-pn: existing=PA, new=PT |
1342+
13281343
Scenario: Not found institution while persistOnboarding
13291344
Given User login with username "j.doe" and password "test"
13301345
And The following path params:
@@ -1475,7 +1490,6 @@ Feature: Institution
14751490
| logo | test-logo-url/c9a50656-f345-4c81-84be-5b2474470544/logo.png |
14761491
| origin | IPA |
14771492
| originId | c_c067 |
1478-
| institutionType | PA |
14791493
| description | Comune di Castelbuono |
14801494
| taxCode | 00310810825 |
14811495
| digitalAddress | comune.castelbuono@pec.it |
@@ -1515,7 +1529,6 @@ Feature: Institution
15151529
| logo | test-logo-url/c9a50656-f345-4c81-84be-5b2474470544/logo.png |
15161530
| origin | IPA |
15171531
| originId | c_c067 |
1518-
| institutionType | PA |
15191532
| description | Comune di Castelbuono |
15201533
| taxCode | 00310810825 |
15211534
| digitalAddress | comune.castelbuono@pec.it |
@@ -1712,12 +1725,10 @@ Feature: Institution
17121725
| institutionType | PA |
17131726
When I send a GET request to "/institutions/{productId}/brokers/{institutionType}"
17141727
Then The status code is 200
1715-
And The response body contains the list "" of size 4
1728+
And The response body contains the list "" of size 2
17161729
And The response body contains at path "taxCode" the following list of values in any order:
17171730
| 85000870064 |
17181731
| 00310810825 |
1719-
| 94076720658 |
1720-
| 00313820540 |
17211732

17221733
Scenario: Get institutions brokers with bad productId
17231734
Given User login with username "j.doe" and password "test"

apps/institution-ms/app/src/test/resources/features/management.feature

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ Feature: Management
1818
Then The status code is 200
1919
And The response body contains the list "found" of size 2
2020
And The response body contains at path "found" the following list of objects in any order:
21-
| id | externalId | origin | originId | institutionType | description |
22-
| 067327d3-bdd6-408d-8655-87e8f1960046 | 99000870064 | IPA | c_d277 | PT | comune di dernice |
23-
| 0b56686d-3e25-4851-86c8-b9ba0d4fe301 | 15555555555 | SELC | PSP_15555555555 | PSP | Comune di Castel Test |
21+
| id | externalId | origin | originId | description |
22+
| 067327d3-bdd6-408d-8655-87e8f1960046 | 99000870064 | IPA | c_d277 | comune di dernice |
23+
| 0b56686d-3e25-4851-86c8-b9ba0d4fe301 | 15555555555 | SELC | PSP_15555555555 | Comune di Castel Test |
2424
And The response body contains at path "found" the following list of objects in any order:
2525
| products.prod-io.product | products.prod-io.status | products.prod-io.origin | products.prod-io.originId | products.prod-io.institutionType |
2626
| prod-io | ACTIVE | IPA | c_d277 | PT |

apps/institution-ms/connector-api/src/main/java/it/pagopa/selfcare/mscore/api/InstitutionConnector.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ public interface InstitutionConnector {
2020

2121
void findAndDeleteOnboarding(String institutionId, String productId);
2222

23-
List<Institution> findByTaxCodeSubunitCodeAndOrigin(String taxtCode, String subunitCode, String origin, String originId);
24-
2523
Boolean existsByTaxCodeAndSubunitCodeAndProductAndStatusList(String taxtCode, String subunitCode, Optional<String> productId, List<RelationshipState> validRelationshipStates);
2624

2725
Optional<Institution> findByExternalId(String externalId);

0 commit comments

Comments
 (0)