fromJson method
Future<Map<String, dynamic>>
fromJson(
- Map<String, dynamic> userData,
- Map<String, dynamic> idData,
- String frontImage,
- String backImage,
- String sideImage,
- String faceImage,
- String apiKey,
- String verificationSessionId,
- String accessToken,
)
Implementation
Future<Map<String, dynamic>> fromJson(
Map<String, dynamic> userData,
Map<String, dynamic> idData,
String frontImage,
String backImage,
String sideImage,
String faceImage,
String apiKey,
String verificationSessionId,
String accessToken,
) async {
var transaltedNationality = await translate(
checkNull(idData["nationalityFull"]), apiKey, accessToken);
var data = <String, dynamic>{
"code": "1",
"message": "success",
"data": {
"frontImages": frontImage,
"backImages": backImage,
"sideImages": sideImage,
"selfieImages": faceImage,
"faceMatch": idData["faceMatch"],
"document": idData['document'],
"nationality": idData['nationality'],
"documentNumber": idData["documentNumber"],
"firstName": idData['firstName'],
"middleName": idData['middleName'],
"lastName": idData['lastName'],
"fullName": idData['fullName'],
"dob": idData['dob'],
"dob_day": idData['dob_day'],
"dob_month": idData['dob_month'],
"dob_year": idData['dob_year'],
"expiry": checkNull(idData['expiry'].toString()),
"expiry_day": checkNull(idData['expiry_day'].toString()),
"expiry_month": checkNull(idData['expiry_month'].toString()),
"expiry_year": checkNull(idData['expiry_year'].toString()),
"address1": idData['address1'],
"addressEn": userData["addressEn"],
"addressJa": userData["addressJa"],
"address1Ja": userData["address1Ja"],
"address2Ja": userData["address2Ja"],
"address3Ja": userData["address3Ja"],
"address1En": userData["address1En"],
"address2En": userData["address2En"],
"address3En": userData["address3En"],
"postalCode": userData["postalCode"],
"visaStatus": userData["visaStatus"],
"gender": userData["gender"],
"permission_to_stay":
checkNull(userData["permission_to_stay"].toString()),
"pts_day": checkNull(userData["pts_day"].toString()),
"pts_month": checkNull(userData["pts_month"].toString()),
"pts_year": checkNull(userData["pts_year"].toString()),
"permission_to_land":
checkNull(userData["permission_to_land"].toString()),
"ptl_day": checkNull(userData["ptl_day"].toString()),
"ptl_month": checkNull(userData["ptl_month"].toString()),
"ptl_year": checkNull(userData["ptl_year"].toString()),
"age": checkNull(idData["age"].toString()),
"documentType": checkNull(idData["documentType"]),
"documentSide": checkNull(idData["documentSide"]),
"issueAuthority": checkNull(idData["issueAuthority"]),
"issuerOrg_full": checkNull(idData["issuerOrgFull"]),
"issuerOrg_iso2": checkNull(idData["issuerOrgIso2"]),
"issuerOrg_iso3": checkNull(idData["issuerOrgIso3"]),
"nationality_full": transaltedNationality,
"nationality_iso2": checkNull(idData["nationalityIso2"]),
"nationality_iso3": checkNull(idData["nationalityIso3"]),
"internalId": checkNull(idData["internalId"]),
"issued": checkNull(idData["issued"].toString()),
"issued_day": checkNull(idData["issuedDay"].toString()),
"issued_month": checkNull(idData["issuedMonth"].toString()),
"issued_year": checkNull(idData["issuedYear"].toString()),
"daysFromIssue": checkNull(idData["daysFromIssue"].toString()),
"documentIdentificationId": verificationSessionId,
}
};
if (kDebugMode) {
print(data);
}
return data;
}