Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions packages/gafl-webapp-service/src/locales/cy.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,15 @@
"cancel_rp_identify_body": "Ni fydd canslo eich cytundeb taliad cerdyn rheolaidd yn canslo nac yn ad-dalu eich trwydded gyfredol. Gallwch barhau i bysgota tan fydd eich trwydded gyfredol yn dod i ben ond ni fydd eich trwydded yn adnewyddu'n awtomatig.",
"cancel_rp_identify_ref_number": "Chwe nodyn olaf eich trwydded",
"cancel_rp_identify_ref_number_hint": "Er enghraifft, F4A315",
"cancel_rp_identify_ref_number_error": "Enter the last 6 characters of your licence number",
"cancel_rp_identify_ref_pattern": "The last six characters of your licence number don’t look right. Check and enter again",
"cancel_rp_identify_ref_number_error": "Rhowch chwe nodyn olaf eich trwydded",
"cancel_rp_identify_ref_pattern": "Nid yw chwe nodyn olaf eich trwydded yn edrych yn gywir. Gwiriwch a rhowch gynnig arall arni",
"cancel_rp_identify_dob": "Dyddiad geni",
"cancel_rp_identify_dob_hint": "Er enghraifft, 31 3 1980",
"cancel_rp_identify_postcode": "Cod post",
"cancel_rp_identify_postcode_hint": "Er enghraifft, WA4 1AB",
"cancel_rp_identify_postcode_error": "Enter a postcode",
"cancel_rp_identify_postcode_pattern": "Your postcode doesn’t look right. Check and enter again",
"cancel_rp_identify_postcode_error": "Nodwch god post",
"cancel_rp_identify_postcode_error_empty": "Nid ydych wedi nodi cod post",
"cancel_rp_identify_postcode_pattern": "Nid yw’r cod post yn edrych yn gywir. Gwiriwch a rhowch gynnig arall arni",
"change_licence_details_you": "Adolygu neu newid manylion eich trwydded",
"change_licence_details_other": "Adolygu neu newid manylion y drwydded",
"change_licence_number": "Newid rhif y drwydded",
Expand Down Expand Up @@ -350,7 +351,7 @@
"identify_error_missing_month": "Mae’n rhaid i’r dyddiad geni gynnwys mis",
"identify_error_missing_year": "Mae’n rhaid i’r dyddiad geni gynnwys blwyddyn",
"identify_error_non_numeric": "Rhowch rifau yn unig",
"identify_error_pattern_postcode": "Your postcode doesn’t look right. Check and enter again",
"identify_error_pattern_postcode": "Nid yw’r cod post yn edrych yn gywir. Gwiriwch a rhowch gynnig arall arni",
"identify_error_pattern": "Nid yw chwe nodyn olaf eich trwydded yn edrych yn gywir. Gwiriwch a rhowch gynnig arall arni",
"identify_error_year_min": "Mae’r dyddiad geni yn rhy bell yn ôl",
"identify_error_year_max": "Mae'n rhaid i’r dyddiad geni fod yn y gorffennol",
Expand Down
1 change: 1 addition & 0 deletions packages/gafl-webapp-service/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@
"cancel_rp_identify_postcode": "Postcode",
"cancel_rp_identify_postcode_hint": "For example, WA4 1AB",
"cancel_rp_identify_postcode_error": "Enter a postcode",
"cancel_rp_identify_postcode_error_empty": "You did not enter a postcode",
"cancel_rp_identify_postcode_pattern": "Your postcode doesn’t look right. Check and enter again",
"change_licence_details_you": "Review or change the licence details",
"change_licence_details_other": "Review or change the licence details",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
'string.pattern.base': { text: mssgs.cancel_rp_identify_ref_pattern, ref: '#ref' }
},
'postcode': {
'string.empty': { ref: '#postcode', text: mssgs.cancel_rp_identify_postcode_error },
'string.empty': { ref: '#postcode', text: mssgs.cancel_rp_identify_postcode_error_empty },
'string.pattern.base': { ref: '#postcode', text: mssgs.cancel_rp_identify_postcode_pattern }
},
'full-date': {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { validation } from '@defra-fish/business-rules-lib'
import { addLanguageCodeToUri } from '../../../../processors/uri-helper.js'
import GetDataRedirect from '../../../../handlers/get-data-redirect.js'
import { dateOfBirthValidator, getDateErrorFlags } from '../../../../schema/validators/validators.js'
import { runValidators } from '../../../../utils/validators.js'

export const getData = async request => {
const permission = await request.cache().helpers.transaction.getCurrentPermission()
Expand Down Expand Up @@ -35,17 +36,22 @@ export const getData = async request => {
}

export const validator = payload => {
dateOfBirthValidator(payload)

Joi.assert(
{
postcode: payload.postcode,
referenceNumber: payload.referenceNumber
},
Joi.object({
referenceNumber: validation.permission.permissionNumberUniqueComponentValidator(Joi),
postcode: validation.contact.createOverseasPostcodeValidator(Joi)
}).options({ abortEarly: false })
runValidators(
[
p =>
Joi.assert(
{
postcode: p.postcode,
referenceNumber: p.referenceNumber
},
Joi.object({
referenceNumber: validation.permission.permissionNumberUniqueComponentValidator(Joi),
postcode: validation.contact.createOverseasPostcodeValidator(Joi)
}).options({ abortEarly: false })
),
dateOfBirthValidator
],
payload
)
}

Expand Down
Loading