Skip to content

Commit

Permalink
feat(be:FSADT1-1324): Changes in email templates
Browse files Browse the repository at this point in the history
  • Loading branch information
mamartinezmejia committed Jun 27, 2024
1 parent 12625c6 commit ad31d62
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 161 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import ca.bc.gov.app.dto.client.ClientContactDto;
import ca.bc.gov.app.dto.client.ClientListSubmissionDto;
import ca.bc.gov.app.dto.client.ClientSubmissionDto;
import ca.bc.gov.app.dto.client.DistrictDto;
import ca.bc.gov.app.dto.submissions.SubmissionAddressDto;
import ca.bc.gov.app.dto.submissions.SubmissionApproveRejectDto;
import ca.bc.gov.app.dto.submissions.SubmissionBusinessDto;
Expand Down Expand Up @@ -42,6 +43,7 @@
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -145,8 +147,15 @@ private Mono<String> getDistrictFullDescByCode(String districtCode) {
+ districtCodeEntity.getDescription())
.defaultIfEmpty("");
}



private Mono<DistrictDto> getDistrictByCode(String districtCode) {
return Mono.justOrEmpty(districtCode).flatMap(districtCodeRepository::findByCode)
.map(districtCodeEntity -> new DistrictDto(
districtCodeEntity.getCode(),
districtCodeEntity.getDescription(),
districtCodeEntity.getEmailAddress()));
}

/**
* Submits a new client submission and returns a Mono of the submission ID.
*
Expand Down Expand Up @@ -445,15 +454,34 @@ private Mono<Integer> sendEmail(
String email,
String userName
) {
return chesService.sendEmail(
"registration",
email,
"Client number application received",
clientSubmissionDto.description(userName),
null)
.thenReturn(submissionId);
return getDistrictByCode(clientSubmissionDto.businessInformation().district())
.flatMap(district -> {
Map<String, Object> params = registrationParameters(
clientSubmissionDto.description(userName),
district.description(),
district.emails()
);
return chesService.sendEmail(
"registration",
email,
"Client number application received",
params,
null)
.thenReturn(submissionId);
});
}

private Map<String, Object> registrationParameters(
Map<String, Object> clientSubmission,
String districtName,
String districtEmail
) {
Map<String, Object> descMap = new HashMap<>();
descMap.putAll(clientSubmission);
descMap.put("districtName", StringUtils.defaultString(districtName));
descMap.put("districtEmail", StringUtils.defaultString(districtEmail));
return descMap;
}


private Mono<Map<String, String>> getClientTypes() {
return template
Expand Down
6 changes: 6 additions & 0 deletions backend/src/main/resources/templates/approval.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
The client number is ${business.clientNumber}. Be sure to keep it for your records.
</p>
<div>&nbsp;</div>

<p>
If you need to contact us before then please contact the ${business.districtName}
<a href="mailto:${business.districtEmail}">${business.districtEmail}.</a>
</p>
<div>&nbsp;</div>

<p>Thank you,</p>
<p>The Forests Client Management System</p>
Expand Down
4 changes: 2 additions & 2 deletions backend/src/main/resources/templates/registration.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
<div>&nbsp;</div>

<p>
If you need to contact us before then, email <a
href="mailto:FORHVAP.CLIADMIN@gov.bc.ca">FORHVAP.CLIADMIN@gov.bc.ca.</a>
If you need to contact us before then please contact the ${districtName}
<a href="mailto:${districtEmail}">${districtEmail}.</a>
</p>
<div>&nbsp;</div>

Expand Down
4 changes: 2 additions & 2 deletions backend/src/main/resources/templates/rejection.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
<div>&nbsp;</div>

<p>
If you need to contact us, email <a
href="mailto:FORHVAP.CLIADMIN@gov.bc.ca">FORHVAP.CLIADMIN@gov.bc.ca.</a>
If you need to contact us before then please contact the ${business.districtName}
<a href="mailto:${business.districtEmail}">${business.districtEmail}.</a>
</p>
<div>&nbsp;</div>

Expand Down
69 changes: 39 additions & 30 deletions backend/src/test/resources/db/migration/R__Test_Data.sql
Original file line number Diff line number Diff line change
@@ -1,39 +1,48 @@
insert into nrfc.submission_status_code (submission_status_code, description, effective_date, create_user) values ('P', 'In Progress', current_timestamp, 'mariamar') ON CONFLICT (submission_status_code) DO NOTHING;
insert into nrfc.submission_status_code (submission_status_code, description, effective_date, create_user) values ('A', 'Approved', current_timestamp, 'mariamar') ON CONFLICT (submission_status_code) DO NOTHING;
insert into nrfc.submission_status_code (submission_status_code, description, effective_date, create_user) values ('R', 'Rejected', current_timestamp, 'mariamar') ON CONFLICT (submission_status_code) DO NOTHING;
insert into nrfc.submission_status_code (submission_status_code, description, effective_date, create_user) values ('D', 'Deleted', current_timestamp, 'mariamar') ON CONFLICT (submission_status_code) DO NOTHING;
insert into nrfc.submission_status_code (submission_status_code, description, effective_date, create_user) values ('S', 'Submitted', current_timestamp, 'mariamar') ON CONFLICT (submission_status_code) DO NOTHING;
insert into nrfc.submission_status_code (submission_status_code, description, effective_date, create_user) values ('P', 'In Progress', current_timestamp, 'mariamar') on conflict (submission_status_code) do nothing;
insert into nrfc.submission_status_code (submission_status_code, description, effective_date, create_user) values ('A', 'Approved', current_timestamp, 'mariamar') on conflict (submission_status_code) do nothing;
insert into nrfc.submission_status_code (submission_status_code, description, effective_date, create_user) values ('R', 'Rejected', current_timestamp, 'mariamar') on conflict (submission_status_code) do nothing;
insert into nrfc.submission_status_code (submission_status_code, description, effective_date, create_user) values ('D', 'Deleted', current_timestamp, 'mariamar') on conflict (submission_status_code) do nothing;
insert into nrfc.submission_status_code (submission_status_code, description, effective_date, create_user) values ('S', 'Submitted', current_timestamp, 'mariamar') on conflict (submission_status_code) do nothing;

insert into nrfc.client_type_code (client_type_code, description, effective_date, create_user) values ('A', 'Association', current_timestamp, 'mariamar') ON CONFLICT (client_type_code) DO NOTHING;
insert into nrfc.client_type_code (client_type_code, description, effective_date, create_user) values ('B', 'First Nation Band', current_timestamp, 'mariamar') ON CONFLICT (client_type_code) DO NOTHING;
insert into nrfc.client_type_code (client_type_code, description, effective_date, create_user) values ('C', 'Corporation', current_timestamp, 'mariamar') ON CONFLICT (client_type_code) DO NOTHING;
insert into nrfc.client_type_code (client_type_code, description, effective_date, create_user) values ('F', 'Ministry of Forests and Range', current_timestamp, 'mariamar') ON CONFLICT (client_type_code) DO NOTHING;
insert into nrfc.client_type_code (client_type_code, description, effective_date, create_user) values ('G', 'Government', current_timestamp, 'mariamar') ON CONFLICT (client_type_code) DO NOTHING;
insert into nrfc.client_type_code (client_type_code, description, effective_date, create_user) values ('I', 'Individual', current_timestamp, 'mariamar') ON CONFLICT (client_type_code) DO NOTHING;
insert into nrfc.client_type_code (client_type_code, description, effective_date, create_user) values ('L', 'Limited Partnership', current_timestamp, 'mariamar') ON CONFLICT (client_type_code) DO NOTHING;
insert into nrfc.client_type_code (client_type_code, description, effective_date, create_user) values ('P', 'General Partnership', current_timestamp, 'mariamar') ON CONFLICT (client_type_code) DO NOTHING;
insert into nrfc.client_type_code (client_type_code, description, effective_date, create_user) values ('R', 'First Nation Group', current_timestamp, 'mariamar') ON CONFLICT (client_type_code) DO NOTHING;
insert into nrfc.client_type_code (client_type_code, description, effective_date, create_user) values ('S', 'Society', current_timestamp, 'mariamar') ON CONFLICT (client_type_code) DO NOTHING;
insert into nrfc.client_type_code (client_type_code, description, effective_date, create_user) values ('T', 'First Nation Tribal Council', current_timestamp, 'mariamar') ON CONFLICT (client_type_code) DO NOTHING;
insert into nrfc.client_type_code (client_type_code, description, effective_date, create_user) values ('U', 'Unregistered Company', current_timestamp, 'mariamar') ON CONFLICT (client_type_code) DO NOTHING;
insert into nrfc.client_type_code (client_type_code, description, effective_date, create_user) values ('A', 'Association', current_timestamp, 'mariamar') on conflict (client_type_code) do nothing;
insert into nrfc.client_type_code (client_type_code, description, effective_date, create_user) values ('B', 'First Nation Band', current_timestamp, 'mariamar') on conflict (client_type_code) do nothing;
insert into nrfc.client_type_code (client_type_code, description, effective_date, create_user) values ('C', 'Corporation', current_timestamp, 'mariamar') on conflict (client_type_code) do nothing;
insert into nrfc.client_type_code (client_type_code, description, effective_date, create_user) values ('F', 'Ministry of Forests and Range', current_timestamp, 'mariamar') on conflict (client_type_code) do nothing;
insert into nrfc.client_type_code (client_type_code, description, effective_date, create_user) values ('G', 'Government', current_timestamp, 'mariamar') on conflict (client_type_code) do nothing;
insert into nrfc.client_type_code (client_type_code, description, effective_date, create_user) values ('I', 'Individual', current_timestamp, 'mariamar') on conflict (client_type_code) do nothing;
insert into nrfc.client_type_code (client_type_code, description, effective_date, create_user) values ('L', 'Limited Partnership', current_timestamp, 'mariamar') on conflict (client_type_code) do nothing;
insert into nrfc.client_type_code (client_type_code, description, effective_date, create_user) values ('P', 'General Partnership', current_timestamp, 'mariamar') on conflict (client_type_code) do nothing;
insert into nrfc.client_type_code (client_type_code, description, effective_date, create_user) values ('R', 'First Nation Group', current_timestamp, 'mariamar') on conflict (client_type_code) do nothing;
insert into nrfc.client_type_code (client_type_code, description, effective_date, create_user) values ('S', 'Society', current_timestamp, 'mariamar') on conflict (client_type_code) do nothing;
insert into nrfc.client_type_code (client_type_code, description, effective_date, create_user) values ('T', 'First Nation Tribal Council', current_timestamp, 'mariamar') on conflict (client_type_code) do nothing;
insert into nrfc.client_type_code (client_type_code, description, effective_date, create_user) values ('U', 'Unregistered Company', current_timestamp, 'mariamar') on conflict (client_type_code) do nothing;

update nrfc.client_type_code set effective_date = '1970-01-01 00:00:00.000';

-- Test case data Review new client submission

INSERT INTO nrfc.submission VALUES (365, 'R', 'RNC', current_timestamp, current_timestamp, 'BCEIDBUSINESS\\UAT', ' BCEIDBUSINESS\\UAT') ON CONFLICT DO NOTHING;
INSERT INTO nrfc.submission_contact VALUES (365, 365, 'DI', 'Load', 'NRS', '(777) 777-7777', 'uattestingmail@uat.testing.lo', 'BCEIDBUSINESS\\UAT') ON CONFLICT DO NOTHING;
INSERT INTO nrfc.submission_detail VALUES (365, 365, NULL, 'R', 'BC0000006', 'HYPERION CORP', 'C', 'Y', NULL, 'DCR') ON CONFLICT DO NOTHING;
INSERT INTO nrfc.submission_location VALUES (365, 365, '712 Canyon View Dr', 'US', 'KS', 'Lansing', '66043-6271', 'Mailing address') ON CONFLICT DO NOTHING;
INSERT INTO nrfc.submission_location_contact_xref VALUES (365, 365) ON CONFLICT DO NOTHING;
INSERT INTO nrfc.submission_matching_detail VALUES (365, 365, '{"contact": "00000000,00000000,00000001,00000001,00000001", "registrationNumber": "00000002,00000002"}', 'N', ' already has one. The number is: tyututu. Be sure to keep it for your records.', '2024-04-16 16:00:06.678395', 'idir\\ottomated', true) ON CONFLICT DO NOTHING;
insert into nrfc.submission values (365, 'R', 'RNC', current_timestamp, current_timestamp, 'BCEIDBUSINESS\\UAT', ' BCEIDBUSINESS\\UAT') on conflict do nothing;
insert into nrfc.submission_contact
(submission_contact_id, submission_id, contact_type_code, first_name, last_name, business_phone_number, email_address, idp_user_id) values
(365, 365, 'DI', 'Load', 'NRS', '(777) 777-7777', 'uattestingmail@uat.testing.lo', 'BCEIDBUSINESS\\UAT') on conflict do nothing;
insert into nrfc.submission_detail values (365, 365, NULL, 'R', 'BC0000006', 'HYPERION CORP', 'C', 'Y', NULL, 'DCR') on conflict do nothing;
insert into nrfc.submission_location
(submission_location_id, submission_id, street_address, country_code, province_code, city_name, postal_code, location_name) values
(365, 365, '712 Canyon View Dr', 'US', 'KS', 'Lansing', '66043-6271', 'Mailing address') on conflict do nothing;
insert into nrfc.submission_location_contact_xref values (365, 365) on conflict do nothing;
insert into nrfc.submission_matching_detail values (365, 365, '{"contact": "00000000,00000000,00000001,00000001,00000001", "registrationNumber": "00000002,00000002"}', 'N', ' already has one. The number is: tyututu. Be sure to keep it for your records.', '2024-04-16 16:00:06.678395', 'idir\\ottomated', true) on conflict do nothing;

-- Test case data Staff submitted data - Individual

INSERT INTO nrfc.submission VALUES (364, 'A', 'SSD', current_timestamp, current_timestamp, 'BCEIDBUSINESS\\UAT', ' BCEIDBUSINESS\\UAT') ON CONFLICT DO NOTHING;
INSERT INTO nrfc.submission_contact VALUES (364, 364, 'DI', 'Jhon', 'Wick', '(999) 888-7766', 'jhonwick@uat.testing.lo', 'BCEIDBUSINESS\\UAT') ON CONFLICT DO NOTHING;
INSERT INTO nrfc.submission_detail (submission_detail_id, submission_id, client_number, business_type_code, incorporation_number, organization_name, client_type_code, good_standing_ind, birthdate, district_code, work_safe_bc_number, doing_business_as, client_acronym, first_name, middle_name, last_name, notes, identification_type_code, client_identification, identification_country_code, identification_province_code)
VALUES (364, 364, NULL, 'U', NULL, 'ROLAND SOLDIER', 'I', 'Y', '1972-12-04', 'DCR', NULL, NULL, NULL,'ROLAND', NULL,'SOLDIER','GOOD AT SUPPORT','CDDL','9999911','CA','BC') ON CONFLICT DO NOTHING;
INSERT INTO nrfc.submission_location VALUES (364, 364, '999 Canyon View Dr', 'US', 'CO', 'Denver', '66043-6271', 'Mailing address') ON CONFLICT DO NOTHING;
INSERT INTO nrfc.submission_location_contact_xref VALUES (364, 364) ON CONFLICT DO NOTHING;
INSERT INTO nrfc.submission_matching_detail VALUES (364, 364, '{}', 'N', NULL, '2024-04-16 16:00:06.678395', 'idir\\ottomated', true) ON CONFLICT DO NOTHING;
insert into nrfc.submission values (364, 'A', 'SSD', current_timestamp, current_timestamp, 'BCEIDBUSINESS\\UAT', ' BCEIDBUSINESS\\UAT') on conflict do nothing;
insert into nrfc.submission_contact
(submission_contact_id, submission_id, contact_type_code, first_name, last_name, business_phone_number, email_address, idp_user_id) values
(364, 364, 'DI', 'Jhon', 'Wick', '(999) 888-7766', 'jhonwick@uat.testing.lo', 'BCEIDBUSINESS\\UAT') on conflict do nothing;
insert into nrfc.submission_detail
(submission_detail_id, submission_id, client_number, business_type_code, incorporation_number, organization_name, client_type_code, good_standing_ind, birthdate, district_code, work_safe_bc_number, doing_business_as, client_acronym, first_name, middle_name, last_name, notes, identification_type_code, client_identification, identification_country_code, identification_province_code) values
(364, 364, NULL, 'U', NULL, 'ROLAND SOLDIER', 'I', 'Y', '1972-12-04', 'DCR', NULL, NULL, NULL,'ROLAND', NULL,'SOLDIER','GOOD AT SUPPORT','CDDL','9999911','CA','BC') on conflict do nothing;
insert into nrfc.submission_location
(submission_location_id, submission_id, street_address, country_code, province_code, city_name, postal_code, location_name) values
(364, 364, '999 Canyon View Dr', 'US', 'CO', 'Denver', '66043-6271', 'Mailing address') on conflict do nothing;
insert into nrfc.submission_location_contact_xref values (364, 364) on conflict do nothing;
insert into nrfc.submission_matching_detail values (364, 364, '{}', 'N', NULL, '2024-04-16 16:00:06.678395', 'idir\\ottomated', true) on conflict do nothing;
2 changes: 1 addition & 1 deletion frontend/components.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
export {}

/* prettier-ignore */
declare module 'vue' {
export interface GlobalComponents {
AddressGroupComponent: typeof import('./src/components/grouping/AddressGroupComponent.vue')['default']
Expand Down
Loading

0 comments on commit ad31d62

Please sign in to comment.