commit
8b6071270a
4 changed files with 21 additions and 19 deletions
|
|
@ -1,6 +1,5 @@
|
|||
import Grid from '@material-ui/core/Grid'
|
||||
import { makeStyles } from '@material-ui/core/styles'
|
||||
import { parse, format } from 'date-fns/fp'
|
||||
import * as R from 'ramda'
|
||||
import { useState, React } from 'react'
|
||||
import * as Yup from 'yup'
|
||||
|
|
@ -30,6 +29,7 @@ import {
|
|||
customerDataElements,
|
||||
customerDataSchemas,
|
||||
formatDates,
|
||||
tryFormatDate,
|
||||
getFormattedPhone
|
||||
} from './helper.js'
|
||||
|
||||
|
|
@ -113,18 +113,10 @@ const CustomerData = ({
|
|||
firstName: R.path(['firstName'])(idData) ?? '',
|
||||
lastName: R.path(['lastName'])(idData) ?? '',
|
||||
documentNumber: R.path(['documentNumber'])(idData) ?? '',
|
||||
dateOfBirth:
|
||||
(rawDob &&
|
||||
format('yyyy-MM-dd')(parse(new Date(), 'yyyyMMdd', rawDob))) ??
|
||||
'',
|
||||
dateOfBirth: tryFormatDate(rawDob),
|
||||
gender: R.path(['gender'])(idData) ?? '',
|
||||
country: R.path(['country'])(idData) ?? '',
|
||||
expirationDate:
|
||||
(rawExpirationDate &&
|
||||
format('yyyy-MM-dd')(
|
||||
parse(new Date(), 'yyyyMMdd', rawExpirationDate)
|
||||
)) ??
|
||||
''
|
||||
expirationDate: tryFormatDate(rawExpirationDate)
|
||||
},
|
||||
usSsn: {
|
||||
usSsn: customer.usSsn ?? ''
|
||||
|
|
|
|||
|
|
@ -528,13 +528,22 @@ const requirementElements = {
|
|||
}
|
||||
}
|
||||
|
||||
const tryFormatDate = rawDate => {
|
||||
try {
|
||||
return (
|
||||
(rawDate &&
|
||||
format('yyyy-MM-dd')(parse(new Date(), 'yyyyMMdd', rawDate))) ??
|
||||
''
|
||||
)
|
||||
} catch (err) {
|
||||
return ''
|
||||
}
|
||||
}
|
||||
|
||||
const formatDates = values => {
|
||||
R.map(
|
||||
elem =>
|
||||
(values[elem] = format('yyyyMMdd')(
|
||||
parse(new Date(), 'yyyy-MM-dd', values[elem])
|
||||
))
|
||||
)(['dateOfBirth', 'expirationDate'])
|
||||
R.forEach(elem => {
|
||||
values[elem] = tryFormatDate(values[elem])
|
||||
})(['dateOfBirth', 'expirationDate'])
|
||||
return values
|
||||
}
|
||||
|
||||
|
|
@ -579,6 +588,7 @@ export {
|
|||
customerDataElements,
|
||||
customerDataSchemas,
|
||||
formatDates,
|
||||
tryFormatDate,
|
||||
REQUIREMENT,
|
||||
CUSTOM,
|
||||
ID_CARD_DATA
|
||||
|
|
|
|||
2
package-lock.json
generated
2
package-lock.json
generated
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "lamassu-server",
|
||||
"version": "10.0.3-beta.3",
|
||||
"version": "10.0.3",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"name": "lamassu-server",
|
||||
"description": "bitcoin atm client server protocol module",
|
||||
"keywords": [],
|
||||
"version": "10.0.3-beta.3",
|
||||
"version": "10.0.3",
|
||||
"license": "./LICENSE",
|
||||
"author": "Lamassu (https://lamassu.is)",
|
||||
"dependencies": {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue