Skip to content

Commit

Permalink
Add nationality check option for identity proof (#73)
Browse files Browse the repository at this point in the history
add nationality check option for identity proof
  • Loading branch information
lukachi authored Oct 4, 2024
1 parent 3cca432 commit 239fba1
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/pages/ProofRequestsDemo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,15 @@ enum FieldNames {
Uniqueness = 'uniqueness',
MinimumAge = 'minimumAge',
Nationality = 'nationality',
NationalityCheck = 'nationalityCheck',
EventId = 'eventId',
}

const DEFAULT_VALUES = {
[FieldNames.Uniqueness]: true,
[FieldNames.MinimumAge]: '18',
[FieldNames.Nationality]: 'UKR',
[FieldNames.NationalityCheck]: false,
[FieldNames.EventId]: '12345678900987654321',
}

Expand All @@ -208,6 +210,7 @@ function ProofAttributesStep({
uniqueness?: boolean
nationality?: string
event_id?: string
nationality_check?: boolean
}) => {
const { data } = await apiClient.post<{
id: string
Expand All @@ -224,6 +227,7 @@ function ProofAttributesStep({
uniqueness: attrs.uniqueness,
nationality: attrs.nationality,
event_id: attrs.event_id,
...(attrs.nationality_check && { nationality_check: true }),
},
},
},
Expand Down Expand Up @@ -301,6 +305,7 @@ function ProofAttributesStep({
uniqueness: Boolean(formData[FieldNames.Uniqueness]),
nationality: nationality ? nationality : undefined,
event_id: formData[FieldNames.EventId],
nationality_check: formData[FieldNames.NationalityCheck],
})
} catch (error) {
ErrorHandler.process(error)
Expand Down Expand Up @@ -349,6 +354,22 @@ function ProofAttributesStep({
</FormControl>
)}
/>
{!isLightVerification && (
<Controller
name={FieldNames.NationalityCheck}
control={control}
render={({ field }) => (
<FormControl>
<UiSwitch
{...field}
checked={field.value}
label='Nationality Check'
disabled={isFormDisabled}
/>
</FormControl>
)}
/>
)}

<Stack direction='row' spacing={4}>
<Controller
Expand Down

0 comments on commit 239fba1

Please sign in to comment.