Skip to content

Commit

Permalink
Merge branch 'master' into feature/dynamic-file-name
Browse files Browse the repository at this point in the history
  • Loading branch information
AlokDatta authored Feb 7, 2024
2 parents c603fc5 + 7a7f71a commit 3689afd
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 5 deletions.
2 changes: 1 addition & 1 deletion charts/prl-dgs/values.preview.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ java:
MANAGEMENT_ENDPOINT_HEALTH_CACHE_TIMETOLIVE: "30000"
DOCMOSIS_SERVICE_DEV_MODE_FLAG: "true"
PDF_TEST_ENABLED: "true"
CCD_CASE_DOCS_AM_API: http://prl-ccd-definitions-pr-1730-cdam
CCD_CASE_DOCS_AM_API: http://prl-ccd-definitions-pr-1839-cdam
AUTH_PROVIDER_SERVICE_CLIENT_BASEURL: "http://rpe-service-auth-provider-{{ .Values.global.environment }}.service.core-compute-{{ .Values.global.environment }}.internal"
IDAM_S2S_URL: "http://rpe-service-auth-provider-{{ .Values.global.environment }}.service.core-compute-{{ .Values.global.environment }}.internal"
DOCMOSIS_SERVICE_BASE_URL: "https://docmosis.aat.platform.hmcts.net"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ public class TemplateConstants {
public static final String CCD_DATE_FORMAT = "yyyy-MM-dd";
public static final String CCD_DATE_TIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS";
public static final String LETTER_DATE_FORMAT = "dd MMMM yyyy";
public static final String TEMP_PARTY_NAMES_KEY = "tempPartyNamesForDocGen";
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import static uk.gov.hmcts.reform.prl.documentgenerator.domain.TemplateConstants.CCD_DATE_FORMAT;
import static uk.gov.hmcts.reform.prl.documentgenerator.domain.TemplateConstants.CCD_DATE_TIME_FORMAT;
import static uk.gov.hmcts.reform.prl.documentgenerator.domain.TemplateConstants.LETTER_DATE_FORMAT;
import static uk.gov.hmcts.reform.prl.documentgenerator.domain.TemplateConstants.TEMP_PARTY_NAMES_KEY;

@Component
public class TemplateDataMapper {
Expand All @@ -32,6 +33,10 @@ public Map<String, Object> map(Map<String, Object> placeholders) {
if (caseDetails.containsKey(CASE_DATA)) {
data = (Map<String, Object>) caseDetails.get(CASE_DATA);
}
//EXUI -1144 - party names
if (placeholders.containsKey(TEMP_PARTY_NAMES_KEY)) {
data.putAll((Map<String, Object>) placeholders.get(TEMP_PARTY_NAMES_KEY));
}
} else {
data.putAll(placeholders);
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -187,16 +187,16 @@ document:
filename: occupation_order_FL404_final.pdf
document-generator: docmosis
- templateName: PRL-GOR-ENG-FL404B-Common-Draft.docx
filename: amended_discharged_or_varied_order_fl404b_draft.pdf
filename: fl404b_draft.pdf
document-generator: docmosis
- templateName: PRL-GOR-WEL-FL404B-Common-Draft.docx
filename: welsh_amended_discharged_or_varied_order_fl404b_draft.pdf
filename: welsh_fl404b_draft.pdf
document-generator: docmosis
- templateName: FL-PRL-GOR-ENG-FL404B-Common-Final.docx
filename: amended_discharged_or_varied_order_fl404b_final.pdf
filename: fl404b_final.pdf
document-generator: docmosis
- templateName: PRL-GOR-WEL-FL404B-Common-Final.docx
filename: welsh_amended_discharged_or_varied_order_fl404b_final.pdf
filename: welsh_fl404b_final.pdf
document-generator: docmosis
- templateName: FL-PRL-GOR-ENG-C45A-Parental-Responsibility-Order-Final.docx
filename: Parental_Responsibility_Order_C45A.pdf
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import static org.mockito.Mockito.when;
import static uk.gov.hmcts.reform.prl.documentgenerator.domain.TemplateConstants.CASE_DATA;
import static uk.gov.hmcts.reform.prl.documentgenerator.domain.TemplateConstants.CASE_DETAILS;
import static uk.gov.hmcts.reform.prl.documentgenerator.domain.TemplateConstants.TEMP_PARTY_NAMES_KEY;

@RunWith(MockitoJUnitRunner.class)
public class TemplateDataMapperTest {
Expand Down Expand Up @@ -81,6 +82,19 @@ public void putAllDataInmMap() {
assertEquals(expectedData, actual);
}

@Test
public void putAllPartyNamesInMap() {
Map<String, Object> caseData = new HashMap<>();
Map<String, Object> partyNamesMap = new HashMap<>();
Map<String, Object> requestData = new HashMap<>();
requestData.put(CASE_DETAILS, Collections.singletonMap(CASE_DATA, caseData));
requestData.put(TEMP_PARTY_NAMES_KEY, partyNamesMap);

Map<String, Object> actual = templateDataMapper.map(requestData);

assertEquals(expectedData, actual);
}

@Test
public void formatDateFromCCD_exception() {
String ccdDate = "15-03-2022";
Expand Down

0 comments on commit 3689afd

Please sign in to comment.