pull/572/head
Pete Matsyburka 3 months ago
parent 6ca75c53ef
commit f5cbcb3d24

@ -469,7 +469,6 @@
v-else-if="currentField.type === 'kba'" v-else-if="currentField.type === 'kba'"
ref="currentStep" ref="currentStep"
:key="currentField.uuid" :key="currentField.uuid"
:locale="language?.toLowerCase() || browserLanguage"
:submitter="submitter" :submitter="submitter"
:empty-value-required-step="emptyValueRequiredStep" :empty-value-required-step="emptyValueRequiredStep"
:field="currentField" :field="currentField"

@ -22,6 +22,12 @@
> >
<MarkdownContent :string="field.description" /> <MarkdownContent :string="field.description" />
</div> </div>
<div
v-if="isRequiredFieldEmpty"
class="px-1 field-description-text"
>
{{ t('complete_all_required_fields_to_proceed_with_identity_verification') }}
</div>
<div <div
v-if="error" v-if="error"
class="mb-4 text-center" class="mb-4 text-center"
@ -52,14 +58,14 @@
<div class="space-y-3.5 mx-auto"> <div class="space-y-3.5 mx-auto">
<div <div
v-for="(answer, index) in currentQuestion.answers" v-for="(answer, index) in currentQuestion.answers"
:key="answer.text" :key="`${currentQuestion.id}_${index}`"
> >
<label <label
:for="`${currentQuestion.id}_${answer.text}`" :for="`${currentQuestion.id}_${index}`"
class="flex items-center space-x-3 radio-label" class="flex items-center space-x-3 radio-label"
> >
<input <input
:id="`${currentQuestion.id}_${answer.text}`" :id="`${currentQuestion.id}_${index}`"
v-model="answers[currentQuestion.id]" v-model="answers[currentQuestion.id]"
type="radio" type="radio"
:name="currentQuestion.id" :name="currentQuestion.id"
@ -94,7 +100,7 @@
</div> </div>
</form> </form>
</div> </div>
<div v-else-if="!error"> <div v-else-if="!error && !isRequiredFieldEmpty">
<form @submit.prevent="startKba"> <form @submit.prevent="startKba">
<div class="grid grid-cols-6 gap-x-2 md:gap-x-4 md:gap-y-2 mb-4"> <div class="grid grid-cols-6 gap-x-2 md:gap-x-4 md:gap-y-2 mb-4">
<div class="col-span-3"> <div class="col-span-3">
@ -281,10 +287,19 @@ export default {
type: Object, type: Object,
required: true required: true
}, },
submitter: {
type: Object,
required: true
},
submitterSlug: { submitterSlug: {
type: String, type: String,
required: true required: true
}, },
emptyValueRequiredStep: {
type: Object,
required: false,
default: null
},
values: { values: {
type: Object, type: Object,
required: true required: true
@ -298,6 +313,7 @@ export default {
questions: null, questions: null,
currentQuestionIndex: 0, currentQuestionIndex: 0,
token: null, token: null,
reference: null,
answers: {}, answers: {},
error: null, error: null,
form: { form: {
@ -318,6 +334,9 @@ export default {
currentQuestion () { currentQuestion () {
return this.questions ? this.questions[this.currentQuestionIndex] : null return this.questions ? this.questions[this.currentQuestionIndex] : null
}, },
isRequiredFieldEmpty () {
return this.emptyValueRequiredStep && this.emptyValueRequiredStep[0] !== this.field
},
states () { states () {
return [ return [
{ code: 'AL', name: 'Alabama' }, { code: 'AL', name: 'Alabama' },
@ -388,6 +407,7 @@ export default {
restartKba () { restartKba () {
this.questions = null this.questions = null
this.token = null this.token = null
this.reference = null
this.answers = {} this.answers = {}
this.currentQuestionIndex = 0 this.currentQuestionIndex = 0
this.error = null this.error = null
@ -432,6 +452,7 @@ export default {
if (data.output && data.output.questions && data.output.questions.questions) { if (data.output && data.output.questions && data.output.questions.questions) {
this.questions = data.output.questions.questions this.questions = data.output.questions.questions
this.token = data.continuations.questions.template.token this.token = data.continuations.questions.template.token
this.reference = data.meta.reference
this.questions.forEach(q => { this.questions.forEach(q => {
this.answers[q.id] = null this.answers[q.id] = null
@ -461,6 +482,7 @@ export default {
body: JSON.stringify({ body: JSON.stringify({
token: this.token, token: this.token,
answers: formattedAnswers, answers: formattedAnswers,
reference: this.reference,
submitter_slug: this.submitterSlug submitter_slug: this.submitterSlug
}), }),
headers: { 'Content-Type': 'application/json' } headers: { 'Content-Type': 'application/json' }

@ -39,7 +39,7 @@ class ProcessSubmitterCompletionJob
submission = submitter.submission submission = submitter.submission
complete_verification_events, sms_events = complete_verification_events, sms_events =
submitter.submission_events.where(event_type: %i[send_sms send_2fa_sms complete_verification]) submitter.submission_events.where(event_type: %i[send_sms send_2fa_sms complete_verification complete_kba])
.partition { |e| e.event_type == 'complete_verification' || e.event_type == 'complete_kba' } .partition { |e| e.event_type == 'complete_verification' || e.event_type == 'complete_kba' }
complete_verification_event = complete_verification_events.first complete_verification_event = complete_verification_events.first

Loading…
Cancel
Save