-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CB2-10316: Generate Welsh Certificate (#97)
* feat(vta-1618): duplicated appropriate templates ready for welsh conversion (#87) feat(vta-1618): added failWelsh template feat(vta-1618): added passNoSeatbeltFieldsWelsh template feat(vta-1618): added passWelsh template feat(vta-1618): added VTG30Welsh template * VTA-1574: Generate Welsh Certificate HGV Pass (#88) * feat(vta-1574): added models and updated logic to use vtg5 bilingual * feat(vta-1574): updated naming convention so it makes more sense * feat(vta-1574): added html verification test for vtg5 * feat(vta-1574): added tests for VTG5W * feat(vta-1574): added tests for hgv pass bilingual * feat(vta-1574): updated unit tests * feat(vta-1574): refactored naming convention for statics * feat(vta-1574): added welsh crest logo to passNoSeatbelts hbs * feat(vta-1574): refactored unit tests, added welsh mileage translation * feat(vta-1574): applied welsh miles logic to odometer history * feat(vta-1574): refactored static * VTA-1575: Generate Welsh certificate Trailer - Pass (#90) * feat(vta-1575): welsh certificate for trailer pass * feat(vta-1575): corrected data model on welsh trailer cert * feat(vta-1575): identification number not registration number * feat(vta-1575): regid or heading welsh * feat(vta-1575): corrected regid or heading in bilingual model * VTA-1576: Generate Welsh Certificate PSV Pass (#92) * feat(vta-1576): added new models, updated enums and configs * feat(vta-1576): corrected typo * feat(vta-1576): added new tests * feat(vta-1576): corrected formatting * feat(cb2-9560): rebased against develop and removed loggers * feat(cb2-9560): added logger for debug * feat(cb2-9560): removed loggers used for debug * CB2-9558: updated no data available, km and mi translations (#94) * feat(cb2-9558): updated no data available, km and mi translations * feat(cb2-9558): corrected typo on statics * feat(cb2-9558): updated translation as per feedback --------- Co-authored-by: Melanie Coslett <50204104+m-coslett@users.noreply.github.com>
- Loading branch information
Showing
27 changed files
with
3,200 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/main/java/uk/gov/dvsa/model/cvs/CvsHgvPassBilingual.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package uk.gov.dvsa.model.cvs; | ||
|
||
public class CvsHgvPassBilingual extends VTG5W { | ||
|
||
public String getTestType() { | ||
return "HGV"; | ||
} | ||
|
||
public String getPresentedDocumentNamePass() { | ||
return "VTG5"; | ||
} | ||
|
||
public String getPresentedDocumentNamePassWelsh() { | ||
return "VTG5W"; | ||
} | ||
|
||
public String getVersionNumberPass() { | ||
return "1.0"; | ||
} | ||
|
||
public String getVersionNumberPassWelsh() { | ||
return "1.0"; | ||
} | ||
|
||
public String getRegOrIdHeading() { | ||
return "Registration number"; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/main/java/uk/gov/dvsa/model/cvs/CvsPsvPassBilingual.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package uk.gov.dvsa.model.cvs; | ||
|
||
public class CvsPsvPassBilingual extends VTP20W { | ||
|
||
public String getTestType() { | ||
return "PSV"; | ||
} | ||
|
||
public String getPresentedDocumentNamePass() { | ||
return "VTP20"; | ||
} | ||
|
||
public String getPresentedDocumentNamePassWelsh() { | ||
return "VTP20W"; | ||
} | ||
|
||
public String getVersionNumberPass() { | ||
return "1.0"; | ||
} | ||
|
||
public String getVersionNumberPassWelsh() { | ||
return "1.0"; | ||
} | ||
|
||
public String getRegOrIdHeading() { | ||
return "Registration number"; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/main/java/uk/gov/dvsa/model/cvs/CvsTrlPassBilingual.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package uk.gov.dvsa.model.cvs; | ||
|
||
public class CvsTrlPassBilingual extends VTG5AW { | ||
|
||
public String getTestType() { | ||
return "Trailer"; | ||
} | ||
|
||
public String getPresentedDocumentNamePass() { | ||
return "VTG5A"; | ||
} | ||
|
||
public String getPresentedDocumentNamePassWelsh() { | ||
return "VTG5AW"; | ||
} | ||
|
||
public String getVersionNumberPass() { | ||
return "1.0"; | ||
} | ||
|
||
public String getVersionNumberPassWelsh() { | ||
return "1.0"; | ||
} | ||
|
||
public String getRegOrIdHeading() { | ||
return "Identification number"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package uk.gov.dvsa.model.cvs; | ||
|
||
import uk.gov.dvsa.model.Document; | ||
import uk.gov.dvsa.model.cvs.certificateData.CvsMotCertificateData; | ||
import uk.gov.dvsa.model.cvs.certificateData.CvsMotCertificateDataWelsh; | ||
|
||
public class VTG5AW extends CvsMotCertificate { | ||
|
||
public Document setData(CvsMotCertificateDataWelsh data) { | ||
this.data = data; | ||
return this; | ||
} | ||
|
||
public String getTestType() { | ||
return "Trailer"; | ||
} | ||
|
||
public String getPresentedDocumentNamePass() { | ||
return "VTG5AW"; | ||
} | ||
|
||
public String getVersionNumberPass() { | ||
return "1.0"; | ||
} | ||
|
||
public String getRegOrIdHeadingWelsh() { return "Rhif adnabod"; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package uk.gov.dvsa.model.cvs; | ||
|
||
import uk.gov.dvsa.model.Document; | ||
import uk.gov.dvsa.model.cvs.certificateData.CvsMotCertificateDataWelsh; | ||
|
||
public class VTG5W extends CvsMotCertificate { | ||
|
||
public Document setData(CvsMotCertificateDataWelsh data) { | ||
this.data = data; | ||
return this; | ||
} | ||
|
||
public String getTestType() { | ||
return "HGV"; | ||
} | ||
|
||
public String getPresentedDocumentNamePass() { | ||
return "VTG5W"; | ||
} | ||
|
||
public String getVersionNumberPass() { | ||
return "1.0"; | ||
} | ||
|
||
public String getRegOrIdHeadingWelsh() { | ||
return "Rhif cofrestru"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package uk.gov.dvsa.model.cvs; | ||
|
||
import uk.gov.dvsa.model.Document; | ||
import uk.gov.dvsa.model.cvs.certificateData.CvsMotCertificateDataWelsh; | ||
|
||
public class VTP20W extends CvsMotCertificate { | ||
|
||
public Document setData(CvsMotCertificateDataWelsh data) { | ||
this.data = data; | ||
return this; | ||
} | ||
|
||
public String getTestType() { | ||
return "PSV"; | ||
} | ||
|
||
public String getPresentedDocumentNamePass() { | ||
return "VTP20W"; | ||
} | ||
|
||
public String getVersionNumberPass() { | ||
return "1.0"; | ||
} | ||
|
||
public String getRegOrIdHeadingWelsh() { | ||
return "Rhif cofrestru"; | ||
} | ||
} |
87 changes: 87 additions & 0 deletions
87
src/main/java/uk/gov/dvsa/model/cvs/certificateData/CvsMotCertificateDataWelsh.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
package uk.gov.dvsa.model.cvs.certificateData; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import uk.gov.dvsa.model.mot.certificateData.FormattedOdometerReading; | ||
import uk.gov.dvsa.model.mot.results.DefectsList; | ||
import uk.gov.dvsa.model.mot.results.Summary; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
public class CvsMotCertificateDataWelsh extends CvsMotCertificateData { | ||
|
||
public static final String EU_NUMBER_FOR_DEFECTS = "6"; | ||
public static final String ADVISORIES_HEADER_WELSH = "Monitro a thrwsio os oes angen (cynghorol)"; | ||
public static final String MINOR_DEFECTS_HEADER_WELSH = "Atgyweiriwch cyn gynted â phosibl (ddiffygion bach)"; | ||
public static final String PASS_SUMMARY_HEADER_WELSH = "Llwyddo"; | ||
public static final String PASS_WITH_DEFECTS_HEADER_WELSH = "Llwyddo gyda diffygion"; | ||
public static final String TESTING_ORGANISATION_WELSH = "ASIANTAETH SAFONAU GYRWYR A CHERBYDAU"; | ||
|
||
@JsonProperty("AdvisoryDefectsWelsh") | ||
private List<String> advisoryDefectsWelsh; | ||
|
||
@JsonProperty("MinorDefectsWelsh") | ||
private List<String> minorDefectsWelsh; | ||
|
||
public Summary getSummaryWelsh() { | ||
return new Summary(buildSummaryTitleWelsh()); | ||
} | ||
|
||
private String buildSummaryTitleWelsh() { | ||
if (!hasMinorDefects(minorDefectsWelsh)) { | ||
return PASS_SUMMARY_HEADER_WELSH; | ||
} else { | ||
return PASS_WITH_DEFECTS_HEADER_WELSH; | ||
} | ||
} | ||
|
||
public List<String> getAdvisoryDefectsWelsh() { | ||
return advisoryDefectsWelsh; | ||
} | ||
|
||
public CvsMotCertificateDataWelsh setAdvisoryDefectsWelsh(List<String> advisoryDefectsWelsh) { | ||
this.advisoryDefectsWelsh = advisoryDefectsWelsh; | ||
return this; | ||
} | ||
|
||
public List<String> getMinorDefectsWelsh() { | ||
return minorDefectsWelsh; | ||
} | ||
|
||
public CvsMotCertificateDataWelsh setMinorDefectsWelsh(List<String> minorDefectsWelsh) { | ||
this.minorDefectsWelsh = minorDefectsWelsh; | ||
return this; | ||
} | ||
|
||
public DefectsList getAdvisoryWelsh() { | ||
return new DefectsList(ADVISORIES_HEADER_WELSH, this.advisoryDefectsWelsh); | ||
} | ||
|
||
public DefectsList getMinorWelsh() { | ||
return new DefectsList(MINOR_DEFECTS_HEADER_WELSH, this.minorDefectsWelsh, EU_NUMBER_FOR_DEFECTS); | ||
} | ||
|
||
public String getTestingOrganisationWelsh() { | ||
return TESTING_ORGANISATION_WELSH; | ||
} | ||
|
||
public String getFormattedCurrentOdometerWelsh() { | ||
return ODOMETER_FORMATTER.formatWelshValue(getCurrentOdometer()); | ||
} | ||
|
||
public List<FormattedOdometerReading> getMileageHistoryWelsh() { | ||
if (null != getOdometerHistoryList()) { | ||
return getOdometerHistoryList().stream() | ||
.map( | ||
entry -> new FormattedOdometerReading( | ||
ODOMETER_FORMATTER.formatWelshValue(entry), | ||
entry.getDate() | ||
) | ||
) | ||
.collect(Collectors.toList()); | ||
} else { | ||
return Collections.emptyList(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.