Skip to content

Commit 248c7c2

Browse files
authored
Merge pull request #1333 from hmcts/revert-1322-DTSPB-4896_change_getCase_to-DB_call
Revert "DTSPB-4896 change getCase to getCaseByCaseId"
2 parents dc9f32f + 278e8c0 commit 248c7c2

File tree

4 files changed

+34
-33
lines changed

4 files changed

+34
-33
lines changed

src/main/java/uk/gov/hmcts/probate/core/service/BusinessServiceImpl.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import uk.gov.hmcts.probate.core.service.mapper.ExecutorApplyingToInvitationMapper;
99
import uk.gov.hmcts.probate.service.BusinessService;
1010
import uk.gov.hmcts.reform.probate.model.PhonePin;
11+
import uk.gov.hmcts.reform.probate.model.ProbateType;
1112
import uk.gov.hmcts.reform.probate.model.cases.CaseType;
1213
import uk.gov.hmcts.reform.probate.model.cases.CollectionMember;
1314
import uk.gov.hmcts.reform.probate.model.cases.ProbateCaseDetails;
@@ -330,10 +331,10 @@ public String getPinNumber(PhonePin phonePin, String sessionId, Boolean isBiling
330331
}
331332

332333
private ProbateCaseDetails getProbateCaseDetails(String caseId) {
333-
log.info("BusinessServiceImpl.getProbateCaseDetails id: {}", caseId);
334334
String serviceAuthorisation = securityUtils.getServiceAuthorisation();
335335
String authorisation = securityUtils.getAuthorisation();
336-
return submitServiceApi.getCaseById(authorisation, serviceAuthorisation, caseId);
336+
return submitServiceApi.getCase(authorisation, serviceAuthorisation,
337+
caseId, ProbateType.PA.getCaseType().name());
337338
}
338339

339340
private void updateCaseData(ProbateCaseDetails probateCaseDetails, String formdataId) {

src/main/java/uk/gov/hmcts/probate/core/service/SubmitServiceImpl.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,9 @@ public Form submit(String identifier, Form form) {
182182
public Form update(String identifier, ProbateType probateType, PaymentDto paymentDto) {
183183
String authorisation = securityUtils.getAuthorisation();
184184
String serviceAuthorisation = securityUtils.getServiceAuthorisation();
185-
log.info("Get existing case from submit service identifier {} ", identifier);
186-
ProbateCaseDetails existingCase = submitServiceApi.getCaseById(authorisation,
187-
serviceAuthorisation, identifier);
185+
log.info("Get existing case from submit service");
186+
ProbateCaseDetails existingCase = submitServiceApi.getCase(authorisation,
187+
serviceAuthorisation, identifier, probateType.getCaseType().name());
188188

189189
log.info("Got existing case now set payment on this case");
190190
CasePayment casePayment = paymentDtoMapper.toCasePayment(paymentDto);
@@ -233,9 +233,9 @@ public Form updatePayments(String identifier, Form form) {
233233
"Cannot update case with no payments, there needs to be at least one payment");
234234
String authorisation = securityUtils.getAuthorisation();
235235
String serviceAuthorisation = securityUtils.getServiceAuthorisation();
236-
log.info("Get existing case from submit service identifier {} ", identifier);
237-
ProbateCaseDetails existingCase = submitServiceApi.getCaseById(authorisation,
238-
serviceAuthorisation, identifier);
236+
log.info("Get existing case from submit service");
237+
ProbateCaseDetails existingCase = submitServiceApi.getCase(authorisation,
238+
serviceAuthorisation, identifier, form.getType().getCaseType().name());
239239
log.info("Got existing case now set payment on this case");
240240
FormMapper formMapper = mappers.get(form.getType());
241241
CaseData caseData = formMapper.toCaseData(form);

src/test/java/uk/gov/hmcts/probate/core/service/BusinessServiceImplTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import uk.gov.hmcts.probate.client.submit.SubmitServiceApi;
1414
import uk.gov.hmcts.probate.core.service.mapper.ExecutorApplyingToInvitationMapper;
1515
import uk.gov.hmcts.reform.probate.model.PhonePin;
16+
import uk.gov.hmcts.reform.probate.model.ProbateType;
1617
import uk.gov.hmcts.reform.probate.model.cases.CaseInfo;
1718
import uk.gov.hmcts.reform.probate.model.cases.CaseType;
1819
import uk.gov.hmcts.reform.probate.model.cases.CollectionMember;
@@ -87,8 +88,8 @@ public void setUp() throws Exception {
8788
when(securityUtils.getAuthorisation()).thenReturn(AUTHORIZATION);
8889
when(securityUtils.getServiceAuthorisation()).thenReturn(SERVICE_AUTHORIZATION);
8990

90-
when(submitServiceApi.getCaseById(AUTHORIZATION, SERVICE_AUTHORIZATION,
91-
formdataId)).thenReturn(mockProbateCaseDetails);
91+
when(submitServiceApi.getCase(AUTHORIZATION, SERVICE_AUTHORIZATION,
92+
formdataId, ProbateType.PA.getCaseType().name())).thenReturn(mockProbateCaseDetails);
9293
when(mockProbateCaseDetails.getCaseData()).thenReturn(mockGrantOfRepresentationData);
9394
when(mockProbateCaseDetails.getCaseInfo()).thenReturn(mockCaseInfo);
9495
when(mockCaseInfo.getCaseId()).thenReturn("123456789101112");
@@ -593,9 +594,8 @@ public void shouldGetAllInviteData() {
593594
}
594595

595596
private void verifyGetCaseCalls() {
596-
597-
verify(submitServiceApi).getCaseById(AUTHORIZATION, SERVICE_AUTHORIZATION,
598-
formdataId);
597+
verify(submitServiceApi).getCase(AUTHORIZATION, SERVICE_AUTHORIZATION,
598+
formdataId, ProbateType.PA.getCaseType().name());
599599
verify(mockProbateCaseDetails).getCaseData();
600600
}
601601

src/test/java/uk/gov/hmcts/probate/core/service/SubmitServiceImplTest.java

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -295,22 +295,22 @@ public void shouldSubmitCaveatForm() {
295295

296296
@Test
297297
public void shouldUpdateForm() {
298-
when(submitServiceApi.getCaseById(AUTHORIZATION, SERVICE_AUTHORIZATION,
299-
CASE_ID)).thenReturn(intestacyCaseDetails);
298+
when(submitServiceApi.getCase(AUTHORIZATION, SERVICE_AUTHORIZATION,
299+
EMAIL_ADDRESS, CaseType.GRANT_OF_REPRESENTATION.name())).thenReturn(intestacyCaseDetails);
300300
when(submitServiceApi.createCase(eq(AUTHORIZATION), eq(SERVICE_AUTHORIZATION),
301-
eq(CASE_ID), any(ProbateCaseDetails.class))).thenReturn(intestacyCaseDetails);
301+
eq(EMAIL_ADDRESS), any(ProbateCaseDetails.class))).thenReturn(intestacyCaseDetails);
302302

303303
CasePayment casePayment = CasePayment.builder().build();
304304
when(paymentDtoMapper.toCasePayment(paymentDto)).thenReturn(casePayment);
305305

306-
Form formResponse = submitService.update(CASE_ID, ProbateType.INTESTACY, paymentDto);
306+
Form formResponse = submitService.update(EMAIL_ADDRESS, ProbateType.INTESTACY, paymentDto);
307307

308308
assertThat(formResponse, is(intestacyForm));
309-
verify(submitServiceApi, times(1)).getCaseById(AUTHORIZATION, SERVICE_AUTHORIZATION,
310-
CASE_ID);
309+
verify(submitServiceApi, times(1)).getCase(AUTHORIZATION, SERVICE_AUTHORIZATION,
310+
EMAIL_ADDRESS, CaseType.GRANT_OF_REPRESENTATION.name());
311311
verify(submitServiceApi, times(1)).createCase(eq(AUTHORIZATION),
312312
eq(SERVICE_AUTHORIZATION),
313-
eq(CASE_ID), any(ProbateCaseDetails.class));
313+
eq(EMAIL_ADDRESS), any(ProbateCaseDetails.class));
314314
verify(securityUtils, times(1)).getAuthorisation();
315315
verify(securityUtils, times(1)).getServiceAuthorisation();
316316
}
@@ -327,17 +327,17 @@ public void shouldThrowErrorOnSubmitIfEmailAddressDoesNotMatchForm() {
327327

328328
@Test
329329
public void shouldUpdateIntestacyPayments() {
330-
when(submitServiceApi.getCaseById(anyString(), anyString(),
331-
anyString())).thenReturn(caveatCaseDetails);
330+
when(submitServiceApi.getCase(anyString(), anyString(),
331+
anyString(), anyString())).thenReturn(caveatCaseDetails);
332332

333333
shouldUpdatePayments(intestacyForm, intestacyCaseDetails);
334334
verify(backOfficeService, never()).sendNotification(intestacyCaseDetails);
335335
}
336336

337337
@Test
338338
public void shouldUpdateCaveatPaymentsAndSendNotification() {
339-
when(submitServiceApi.getCaseById(anyString(), anyString(),
340-
anyString())).thenReturn(caveatCaseDetails);
339+
when(submitServiceApi.getCase(anyString(), anyString(),
340+
anyString(), anyString())).thenReturn(caveatCaseDetails);
341341

342342
caveatCaseDetails.getCaseInfo().setState(CaseState.CAVEAT_RAISED);
343343
shouldUpdatePayments(caveatForm, caveatCaseDetails);
@@ -346,8 +346,8 @@ public void shouldUpdateCaveatPaymentsAndSendNotification() {
346346

347347
@Test
348348
public void shouldUpdateCaveatPaymentsAndNotSendNotification() {
349-
when(submitServiceApi.getCaseById(anyString(), anyString(),
350-
anyString())).thenReturn(caveatCaseDetails);
349+
when(submitServiceApi.getCase(anyString(), anyString(),
350+
anyString(), anyString())).thenReturn(caveatCaseDetails);
351351

352352
caveatCaseDetails.getCaseData().getPayments().get(0).getValue().setStatus(PaymentStatus.FAILED);
353353
shouldUpdatePayments(caveatForm, caveatCaseDetails);
@@ -358,8 +358,8 @@ public void shouldUpdateCaveatPaymentsAndNotSendNotification() {
358358

359359
@Test
360360
public void shouldUpdateIntestacyPaymentsAndSendNotification() {
361-
when(submitServiceApi.getCaseById(anyString(), anyString(),
362-
anyString())).thenReturn(intestacyCaseDetails);
361+
when(submitServiceApi.getCase(anyString(), anyString(),
362+
anyString(), anyString())).thenReturn(intestacyCaseDetails);
363363

364364
intestacyCaseDetails.getCaseData().getPayments().get(0).getValue().setStatus(PaymentStatus.SUCCESS);
365365

@@ -370,8 +370,8 @@ public void shouldUpdateIntestacyPaymentsAndSendNotification() {
370370

371371
@Test
372372
public void shouldUpdateIntestacyPaymentsAndNotSendNotification() {
373-
when(submitServiceApi.getCaseById(anyString(), anyString(),
374-
anyString())).thenReturn(intestacyCaseDetails);
373+
when(submitServiceApi.getCase(anyString(), anyString(),
374+
anyString(), anyString())).thenReturn(intestacyCaseDetails);
375375

376376
intestacyCaseDetails.getCaseData().getPayments().get(0).getValue().setStatus(PaymentStatus.FAILED);
377377

@@ -382,14 +382,14 @@ public void shouldUpdateIntestacyPaymentsAndNotSendNotification() {
382382

383383
private void shouldUpdatePayments(Form form, ProbateCaseDetails caseDetails) {
384384
when(submitServiceApi.createCase(eq(AUTHORIZATION), eq(SERVICE_AUTHORIZATION),
385-
eq(CASE_ID), any(ProbateCaseDetails.class))).thenReturn(caseDetails);
385+
eq(EMAIL_ADDRESS), any(ProbateCaseDetails.class))).thenReturn(caseDetails);
386386

387-
Form formResponse = submitService.updatePayments(CASE_ID, form);
387+
Form formResponse = submitService.updatePayments(EMAIL_ADDRESS, form);
388388

389389
assertThat(formResponse, is(form));
390390
verify(submitServiceApi, times(1)).createCase(eq(AUTHORIZATION),
391391
eq(SERVICE_AUTHORIZATION),
392-
eq(CASE_ID), any(ProbateCaseDetails.class));
392+
eq(EMAIL_ADDRESS), any(ProbateCaseDetails.class));
393393
verify(securityUtils, times(1)).getAuthorisation();
394394
verify(securityUtils, times(1)).getServiceAuthorisation();
395395
}

0 commit comments

Comments
 (0)