Skip to content

Commit 5524f50

Browse files
[SELC-7878] feat: removed updatedAt when creating a delegation for createDelegation and createDelegationFromInstitutionsTaxCode API (#131)
1 parent 84102ab commit 5524f50

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Feature: Delegation
3535
| brokerType | PT |
3636
And The response body contains field "id"
3737
And The response body contains field "createdAt"
38-
And The response body contains field "updatedAt"
38+
And The response body doesn't contain field "updatedAt"
3939
And The response body contains field "isTest"
4040
And The delegation flag for institution "123" is false on db
4141
And The delegation flag for institution "456" is true on db
@@ -291,7 +291,7 @@ Feature: Delegation
291291
| status | ACTIVE |
292292
And The response body contains field "id"
293293
And The response body contains field "createdAt"
294-
And The response body contains field "updatedAt"
294+
And The response body doesn't contain field "updatedAt"
295295
And The response body contains field "isTest"
296296
And The delegation flag for institution "123" is false on db
297297
And The delegation flag for institution "456" is true on db
@@ -327,7 +327,7 @@ Feature: Delegation
327327
| status | ACTIVE |
328328
And The response body contains field "id"
329329
And The response body contains field "createdAt"
330-
And The response body contains field "updatedAt"
330+
And The response body doesn't contain field "updatedAt"
331331
And The response body contains field "isTest"
332332
And The delegation flag for institution "123" is false on db
333333
And The delegation flag for institution "456" is true on db

apps/institution-ms/core/src/main/java/it/pagopa/selfcare/mscore/core/DelegationServiceImpl.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ private Delegation checkIfExistsAndSaveDelegation(Delegation delegation) {
7575
savedDelegation = delegationConnector.findAndActivate(delegation.getFrom(), delegation.getTo(), delegation.getProductId(), delegation.getIsTest());
7676
} else {
7777
delegation.setCreatedAt(OffsetDateTime.now());
78-
delegation.setUpdatedAt(OffsetDateTime.now());
7978
delegation.setStatus(DelegationState.ACTIVE);
8079
savedDelegation = delegationConnector.save(delegation);
8180
}

apps/institution-ms/core/src/test/java/it/pagopa/selfcare/mscore/core/DelegationServiceImplTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ void testCreateDelegationWithProductProdIo() {
108108
assertEquals(institutionFrom.getTaxCode(), response.getFromTaxCode());
109109
assertEquals(institutionTo.getOnboarding().get(0).getInstitutionType(), response.getBrokerType());
110110
assertEquals(institutionFrom.getOnboarding().get(0).getInstitutionType(), response.getInstitutionType());
111+
assertNull(response.getUpdatedAt());
112+
assertNotNull(response.getCreatedAt());
111113
}
112114

113115
@Test
@@ -140,6 +142,8 @@ void testCreateDelegationWithParent() {
140142
assertEquals(institutionTo.getOnboarding().get(0).getInstitutionType(), response.getBrokerType());
141143
assertEquals(institutionFrom.getOnboarding().get(0).getInstitutionType(), response.getInstitutionType());
142144
assertEquals("test parent", response.getInstitutionFromRootName());
145+
assertNull(response.getUpdatedAt());
146+
assertNotNull(response.getCreatedAt());
143147
}
144148

145149
/**
@@ -173,6 +177,8 @@ void testCreateDelegationEA() {
173177
assertEquals(institutionFrom.getTaxCode(), response.getFromTaxCode());
174178
assertEquals(institutionTo.getOnboarding().get(0).getInstitutionType(), response.getBrokerType());
175179
assertEquals(institutionFrom.getOnboarding().get(0).getInstitutionType(), response.getInstitutionType());
180+
assertNull(response.getUpdatedAt());
181+
assertNotNull(response.getCreatedAt());
176182
}
177183

178184
/**
@@ -344,6 +350,8 @@ void testCreateDelegationFromTaxCode() {
344350
assertEquals(institutionFrom.getTaxCode(), response.getFromTaxCode());
345351
assertEquals(onboarding.getInstitutionType(), response.getInstitutionType());
346352
assertEquals(onboarding.getInstitutionType(), response.getBrokerType());
353+
assertNull(response.getUpdatedAt());
354+
assertNotNull(response.getCreatedAt());
347355
}
348356

349357
@Test

0 commit comments

Comments
 (0)