composeMessage (inputTextFieldValue, screenExecutorNumber) { const messageType = inputTextFieldValue === '' ? 'required' : 'invalid'; const errorMessage = FieldError('executorName', messageType, resourcePath); const displayExecutor = i18next.t(`${resourcePath}.executor`); errorMessage.msg.summary = `${displayExecutor} ${screenExecutorNumber}: ${errorMessage.msg.summary}`; return {'error': true, 'errorMessage': errorMessage.msg}; }
* handlePost(ctx, errors) { if (!emailValidator.validate(ctx.email)) { errors.push(FieldError('email', 'invalid', this.resourcePath, this.generateContent())); } if (!this.validatePhoneNumber(ctx.mobile)) { errors.push(FieldError('mobile', 'invalid', this.resourcePath, this.generateContent())); } ctx.list[ctx.index].email = ctx.email; ctx.list[ctx.index].mobile = ctx.mobile; if (ctx.list[ctx.index].emailSent) { const data = {}; data.phoneNumber = ctx.list[ctx.index].mobile; yield services.updatePhoneNumber(ctx.inviteId, data) .then(result => { if (result.name === 'Error') { throw new ReferenceError('Error updating executor\'s phone number'); } }); } return [ctx, errors]; }
* handlePost(ctx, errors, formdata, session) { if (parseInt(session.pin) !== parseInt(ctx.pin)) { errors.push(FieldError('pin', 'incorrect', this.resourcePath, this.generateContent())); } else { yield services.loadFormData(session.formdataId) .then(result => { if (result.name === 'Error') { throw new ReferenceError('Error getting the co-applicant\'s data'); } else { delete result.formdata.declaration.declarationCheckbox; session.form = result.formdata; } }); } return [ctx, errors]; }