assentify-sdk-react-native 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +3 -0
- package/README.md +65 -0
- package/android/build.gradle +111 -0
- package/android/gradle.properties +9 -0
- package/android/src/main/AndroidManifest.xml +55 -0
- package/android/src/main/java/com/assentifysdk/AndroidProgressBarModule.kt +33 -0
- package/android/src/main/java/com/assentifysdk/AssentifySdkBaseModule.kt +39 -0
- package/android/src/main/java/com/assentifysdk/AssentifySdkModule.kt +432 -0
- package/android/src/main/java/com/assentifysdk/AssentifySdkPackage.kt +19 -0
- package/android/src/main/java/com/assentifysdk/FaceMatchActivity.kt +309 -0
- package/android/src/main/java/com/assentifysdk/ImageToBase64Converter.kt +40 -0
- package/android/src/main/java/com/assentifysdk/ReactApplicationContextObject.kt +14 -0
- package/android/src/main/java/com/assentifysdk/ScanIDActivity.kt +431 -0
- package/android/src/main/java/com/assentifysdk/ScanOtherActivity.kt +328 -0
- package/android/src/main/java/com/assentifysdk/ScanPassportActivity.kt +364 -0
- package/android/src/main/java/com/assentifysdk/StepsKeys.kt +91 -0
- package/android/src/main/res/drawable/back_icon.png +0 -0
- package/android/src/main/res/drawable/button_rounded_background.xml +6 -0
- package/android/src/main/res/drawable/card.gif +0 -0
- package/android/src/main/res/drawable/expire.png +0 -0
- package/android/src/main/res/drawable/id.gif +0 -0
- package/android/src/main/res/drawable/id_warning.png +0 -0
- package/android/src/main/res/drawable/info_icon.png +0 -0
- package/android/src/main/res/drawable/info_rounded_background.xml +6 -0
- package/android/src/main/res/drawable/passport.gif +0 -0
- package/android/src/main/res/drawable/rounded_background.xml +3 -0
- package/android/src/main/res/drawable/sending.png +0 -0
- package/android/src/main/res/drawable/warning.png +0 -0
- package/android/src/main/res/drawable/zoom_in.png +0 -0
- package/android/src/main/res/drawable/zoom_out.png +0 -0
- package/android/src/main/res/layout/activity_face_scan.xml +242 -0
- package/android/src/main/res/layout/activity_scan.xml +297 -0
- package/android/src/main/res/raw/sending_video.MP4 +0 -0
- package/android/src/main/res/values/colors.xml +8 -0
- package/android/src/main/res/values/strings.xml +3 -0
- package/android/src/main/res/values/styles.xml +4 -0
- package/assentify-sdk.podspec +43 -0
- package/ios/AssentifySdkBaseModule.swift +15 -0
- package/ios/Info.plist +27 -0
- package/ios/NativeAssentifySdk-Bridging-Header.h +3 -0
- package/ios/NativeAssentifySdk.mm +45 -0
- package/ios/NativeAssentifySdk.swift +460 -0
- package/ios/Resources/card.gif +0 -0
- package/ios/Resources/expire.png +0 -0
- package/ios/Resources/id.gif +0 -0
- package/ios/Resources/id_warning.png +0 -0
- package/ios/Resources/info_icon.png +0 -0
- package/ios/Resources/passport.gif +0 -0
- package/ios/Resources/sending.png +0 -0
- package/ios/Resources/warning.png +0 -0
- package/ios/Resources/zoom_in.png +0 -0
- package/ios/Resources/zoom_out.png +0 -0
- package/ios/UIComponents/RNIOSProgressBar.h +4 -0
- package/ios/UIComponents/RNIOSProgressBar.m +34 -0
- package/ios/UIComponents/RNPassportScanner.m +26 -0
- package/ios/UIComponents/RNPassportScanner.swift +245 -0
- package/ios/UIComponents/RNTMapManager.h +4 -0
- package/ios/UIComponents/RNTMapManager.m +19 -0
- package/ios/View/DataDecoder.swift +469 -0
- package/ios/View/FaceMatchController.swift +258 -0
- package/ios/View/IDCardController.swift +360 -0
- package/ios/View/OtherController.swift +283 -0
- package/ios/View/PassportController.swift +302 -0
- package/ios/View/UI.swift +298 -0
- package/lib/commonjs/AssentifyProvider.js +202 -0
- package/lib/commonjs/AssentifyProvider.js.map +1 -0
- package/lib/commonjs/AssentifyWrapper.js +76 -0
- package/lib/commonjs/AssentifyWrapper.js.map +1 -0
- package/lib/commonjs/Language.js +27 -0
- package/lib/commonjs/Language.js.map +1 -0
- package/lib/commonjs/helpers/index.js +2 -0
- package/lib/commonjs/helpers/index.js.map +1 -0
- package/lib/commonjs/helpers/parsers/FaceMatchParser.js +27 -0
- package/lib/commonjs/helpers/parsers/FaceMatchParser.js.map +1 -0
- package/lib/commonjs/helpers/parsers/IDCardParser.js +25 -0
- package/lib/commonjs/helpers/parsers/IDCardParser.js.map +1 -0
- package/lib/commonjs/helpers/parsers/OtherIDParser.js +29 -0
- package/lib/commonjs/helpers/parsers/OtherIDParser.js.map +1 -0
- package/lib/commonjs/helpers/parsers/PassportParser.js +25 -0
- package/lib/commonjs/helpers/parsers/PassportParser.js.map +1 -0
- package/lib/commonjs/index.js +49 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/types.js +42 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/module/AssentifyProvider.js +193 -0
- package/lib/module/AssentifyProvider.js.map +1 -0
- package/lib/module/AssentifyWrapper.js +70 -0
- package/lib/module/AssentifyWrapper.js.map +1 -0
- package/lib/module/Language.js +21 -0
- package/lib/module/Language.js.map +1 -0
- package/lib/module/helpers/index.js +2 -0
- package/lib/module/helpers/index.js.map +1 -0
- package/lib/module/helpers/parsers/FaceMatchParser.js +21 -0
- package/lib/module/helpers/parsers/FaceMatchParser.js.map +1 -0
- package/lib/module/helpers/parsers/IDCardParser.js +19 -0
- package/lib/module/helpers/parsers/IDCardParser.js.map +1 -0
- package/lib/module/helpers/parsers/OtherIDParser.js +23 -0
- package/lib/module/helpers/parsers/OtherIDParser.js.map +1 -0
- package/lib/module/helpers/parsers/PassportParser.js +19 -0
- package/lib/module/helpers/parsers/PassportParser.js.map +1 -0
- package/lib/module/index.js +6 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/types.js +36 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/babel.config.d.ts +3 -0
- package/lib/typescript/babel.config.d.ts.map +1 -0
- package/lib/typescript/commitlint.config.d.ts +7 -0
- package/lib/typescript/commitlint.config.d.ts.map +1 -0
- package/lib/typescript/example/babel.config.d.ts +8 -0
- package/lib/typescript/example/babel.config.d.ts.map +1 -0
- package/lib/typescript/example/index.d.ts +2 -0
- package/lib/typescript/example/index.d.ts.map +1 -0
- package/lib/typescript/example/jest.config.d.ts +2 -0
- package/lib/typescript/example/jest.config.d.ts.map +1 -0
- package/lib/typescript/example/metro.config.d.ts +3 -0
- package/lib/typescript/example/metro.config.d.ts.map +1 -0
- package/lib/typescript/example/react-native.config.d.ts +6 -0
- package/lib/typescript/example/react-native.config.d.ts.map +1 -0
- package/lib/typescript/example/src/App.d.ts +3 -0
- package/lib/typescript/example/src/App.d.ts.map +1 -0
- package/lib/typescript/example/src/Home.d.ts +4 -0
- package/lib/typescript/example/src/Home.d.ts.map +1 -0
- package/lib/typescript/example/src/navigator.d.ts +4 -0
- package/lib/typescript/example/src/navigator.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/AssentifyProvider.d.ts +3 -0
- package/lib/typescript/lib/commonjs/AssentifyProvider.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/AssentifyWrapper.d.ts +11 -0
- package/lib/typescript/lib/commonjs/AssentifyWrapper.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Language.d.ts +22 -0
- package/lib/typescript/lib/commonjs/Language.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/helpers/index.d.ts +1 -0
- package/lib/typescript/lib/commonjs/helpers/index.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/helpers/parsers/FaceMatchParser.d.ts +12 -0
- package/lib/typescript/lib/commonjs/helpers/parsers/FaceMatchParser.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/helpers/parsers/IDCardParser.d.ts +11 -0
- package/lib/typescript/lib/commonjs/helpers/parsers/IDCardParser.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/helpers/parsers/OtherIDParser.d.ts +13 -0
- package/lib/typescript/lib/commonjs/helpers/parsers/OtherIDParser.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/helpers/parsers/PassportParser.d.ts +11 -0
- package/lib/typescript/lib/commonjs/helpers/parsers/PassportParser.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/index.d.ts +2 -0
- package/lib/typescript/lib/commonjs/index.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/types.d.ts +18 -0
- package/lib/typescript/lib/commonjs/types.d.ts.map +1 -0
- package/lib/typescript/lib/module/AssentifyProvider.d.ts +3 -0
- package/lib/typescript/lib/module/AssentifyProvider.d.ts.map +1 -0
- package/lib/typescript/lib/module/AssentifyWrapper.d.ts +10 -0
- package/lib/typescript/lib/module/AssentifyWrapper.d.ts.map +1 -0
- package/lib/typescript/lib/module/Language.d.ts +21 -0
- package/lib/typescript/lib/module/Language.d.ts.map +1 -0
- package/lib/typescript/lib/module/helpers/index.d.ts +1 -0
- package/lib/typescript/lib/module/helpers/index.d.ts.map +1 -0
- package/lib/typescript/lib/module/helpers/parsers/FaceMatchParser.d.ts +11 -0
- package/lib/typescript/lib/module/helpers/parsers/FaceMatchParser.d.ts.map +1 -0
- package/lib/typescript/lib/module/helpers/parsers/IDCardParser.d.ts +10 -0
- package/lib/typescript/lib/module/helpers/parsers/IDCardParser.d.ts.map +1 -0
- package/lib/typescript/lib/module/helpers/parsers/OtherIDParser.d.ts +12 -0
- package/lib/typescript/lib/module/helpers/parsers/OtherIDParser.d.ts.map +1 -0
- package/lib/typescript/lib/module/helpers/parsers/PassportParser.d.ts +10 -0
- package/lib/typescript/lib/module/helpers/parsers/PassportParser.d.ts.map +1 -0
- package/lib/typescript/lib/module/index.d.ts +12 -0
- package/lib/typescript/lib/module/index.d.ts.map +1 -0
- package/lib/typescript/lib/module/types.d.ts +17 -0
- package/lib/typescript/lib/module/types.d.ts.map +1 -0
- package/lib/typescript/src/AssentifyProvider.d.ts +4 -0
- package/lib/typescript/src/AssentifyProvider.d.ts.map +1 -0
- package/lib/typescript/src/AssentifyWrapper.d.ts +12 -0
- package/lib/typescript/src/AssentifyWrapper.d.ts.map +1 -0
- package/lib/typescript/src/Language.d.ts +22 -0
- package/lib/typescript/src/Language.d.ts.map +1 -0
- package/lib/typescript/src/helpers/index.d.ts +1 -0
- package/lib/typescript/src/helpers/index.d.ts.map +1 -0
- package/lib/typescript/src/helpers/parsers/FaceMatchParser.d.ts +4 -0
- package/lib/typescript/src/helpers/parsers/FaceMatchParser.d.ts.map +1 -0
- package/lib/typescript/src/helpers/parsers/IDCardParser.d.ts +4 -0
- package/lib/typescript/src/helpers/parsers/IDCardParser.d.ts.map +1 -0
- package/lib/typescript/src/helpers/parsers/OtherIDParser.d.ts +4 -0
- package/lib/typescript/src/helpers/parsers/OtherIDParser.d.ts.map +1 -0
- package/lib/typescript/src/helpers/parsers/PassportParser.d.ts +4 -0
- package/lib/typescript/src/helpers/parsers/PassportParser.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +12 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +308 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/package.json +201 -0
- package/src/AssentifyProvider.tsx +189 -0
- package/src/AssentifyWrapper.ts +142 -0
- package/src/Language.ts +22 -0
- package/src/helpers/index.ts +1 -0
- package/src/helpers/parsers/FaceMatchParser.ts +28 -0
- package/src/helpers/parsers/IDCardParser.ts +27 -0
- package/src/helpers/parsers/OtherIDParser.ts +31 -0
- package/src/helpers/parsers/PassportParser.ts +27 -0
- package/src/index.ts +6 -0
- package/src/types.ts +373 -0
|
@@ -0,0 +1,469 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import AssentifySdk
|
|
3
|
+
|
|
4
|
+
enum IDType{
|
|
5
|
+
case PASSPORT
|
|
6
|
+
case CARD
|
|
7
|
+
case OTHER
|
|
8
|
+
case FACEMATCH
|
|
9
|
+
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
struct StepsName {
|
|
17
|
+
static let DocumentCapture = "IdentificationDocumentCapture"
|
|
18
|
+
static let FaceMatch = "FaceImageAcquisition"
|
|
19
|
+
static let ContextAwareSigning = "ContextAwareSigning"
|
|
20
|
+
static let WrapUp = "WrapUp"
|
|
21
|
+
static let BlockLoader = "BlockLoader"
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
struct WrapUpKeys {
|
|
27
|
+
static let TimeEnded = "OnBoardMe_WrapUp_TimeEnded"
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
struct BlockLoaderKeys {
|
|
32
|
+
static let DeviceName = "OnBoardMe_BlockLoader_DeviceName"
|
|
33
|
+
static let FlowName = "OnBoardMe_BlockLoader_FlowName"
|
|
34
|
+
static let TimeStarted = "OnBoardMe_BlockLoader_TimeStarted"
|
|
35
|
+
static let Application = "OnBoardMe_BlockLoader_Application"
|
|
36
|
+
static let UserAgent = "OnBoardMe_BlockLoader_UserAgent"
|
|
37
|
+
static let InstanceHash = "OnBoardMe_BlockLoader_InstanceHash"
|
|
38
|
+
static let interactionID = "OnBoardMe_BlockLoader_Interaction"
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
func getBirthDate(date: String) -> String {
|
|
48
|
+
var data = date
|
|
49
|
+
if !date.isEmpty {
|
|
50
|
+
if !data.contains("-") && !data.contains("/") {
|
|
51
|
+
var yearNum = String(data.prefix(2))
|
|
52
|
+
let currentYear = String(Int64(Date().timeIntervalSince1970) / 100).prefix(2)
|
|
53
|
+
if Int(yearNum)! < Int(currentYear)! {
|
|
54
|
+
yearNum = "20\(yearNum)"
|
|
55
|
+
} else {
|
|
56
|
+
yearNum = "19\(yearNum)"
|
|
57
|
+
}
|
|
58
|
+
let day = String(data.prefix(6).suffix(2))
|
|
59
|
+
let month = String(data.prefix(4).suffix(2))
|
|
60
|
+
data = "\(day)/\(month)/\(yearNum)"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return data
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
func getExpiryDate(date: String) -> String {
|
|
67
|
+
var data = date
|
|
68
|
+
if !date.isEmpty {
|
|
69
|
+
let yearNum = "20\(String(data.prefix(2)))"
|
|
70
|
+
let day = String(data.prefix(6).suffix(2))
|
|
71
|
+
let month = String(data.prefix(4).suffix(2))
|
|
72
|
+
data = "\(day)/\(month)/\(yearNum)"
|
|
73
|
+
}
|
|
74
|
+
return data
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
func passportModelToJsonString(dataModel: PassportExtractedModel?) -> String? {
|
|
80
|
+
guard let dataModel = dataModel else { return nil }
|
|
81
|
+
|
|
82
|
+
var jsonDict: [String: Any] = [:]
|
|
83
|
+
|
|
84
|
+
jsonDict["outputProperties"] = dataModel.outputProperties
|
|
85
|
+
jsonDict["transformedProperties"] = dataModel.transformedProperties
|
|
86
|
+
jsonDict["extractedData"] = dataModel.extractedData
|
|
87
|
+
jsonDict["imageUrl"] = dataModel.imageUrl
|
|
88
|
+
jsonDict["faces"] = dataModel.faces
|
|
89
|
+
|
|
90
|
+
if let identificationDocumentCapture = dataModel.identificationDocumentCapture {
|
|
91
|
+
var idCaptureDict: [String: Any] = [:]
|
|
92
|
+
|
|
93
|
+
idCaptureDict["name"] = identificationDocumentCapture.name
|
|
94
|
+
idCaptureDict["surname"] = identificationDocumentCapture.surname
|
|
95
|
+
idCaptureDict["documentType"] = identificationDocumentCapture.Document_Type
|
|
96
|
+
idCaptureDict["birthDate"] = identificationDocumentCapture.Birth_Date
|
|
97
|
+
idCaptureDict["documentNumber"] = identificationDocumentCapture.Document_Number
|
|
98
|
+
idCaptureDict["sex"] = identificationDocumentCapture.Sex
|
|
99
|
+
idCaptureDict["expiryDate"] = identificationDocumentCapture.Expiry_Date
|
|
100
|
+
idCaptureDict["country"] = identificationDocumentCapture.Country
|
|
101
|
+
idCaptureDict["nationality"] = identificationDocumentCapture.Nationality
|
|
102
|
+
idCaptureDict["idType"] = identificationDocumentCapture.IDType
|
|
103
|
+
idCaptureDict["faceCapture"] = identificationDocumentCapture.FaceCapture
|
|
104
|
+
idCaptureDict["image"] = identificationDocumentCapture.Image
|
|
105
|
+
idCaptureDict["isSkippedAfterNFails"] = identificationDocumentCapture.IsSkippedAfterNFails
|
|
106
|
+
idCaptureDict["isFailedFront"] = identificationDocumentCapture.IsFailedFront
|
|
107
|
+
idCaptureDict["isFailedBack"] = identificationDocumentCapture.IsFailedBack
|
|
108
|
+
idCaptureDict["skippedStatus"] = identificationDocumentCapture.SkippedStatus
|
|
109
|
+
idCaptureDict["capturedVideoFront"] = identificationDocumentCapture.CapturedVideoFront
|
|
110
|
+
idCaptureDict["capturedVideoBack"] = identificationDocumentCapture.CapturedVideoBack
|
|
111
|
+
idCaptureDict["livenessStatus"] = identificationDocumentCapture.LivenessStatus
|
|
112
|
+
idCaptureDict["isFrontAuth"] = identificationDocumentCapture.IsFrontAuth
|
|
113
|
+
idCaptureDict["isBackAuth"] = identificationDocumentCapture.IsBackAuth
|
|
114
|
+
idCaptureDict["isExpired"] = identificationDocumentCapture.IsExpired
|
|
115
|
+
idCaptureDict["isTampering"] = identificationDocumentCapture.IsTampering
|
|
116
|
+
idCaptureDict["tamperHeatMap"] = identificationDocumentCapture.TamperHeatMap
|
|
117
|
+
idCaptureDict["isBackTampering"] = identificationDocumentCapture.IsBackTampering
|
|
118
|
+
idCaptureDict["backTamperHeatmap"] = identificationDocumentCapture.BackTamperHeatmap
|
|
119
|
+
idCaptureDict["originalFrontImage"] = identificationDocumentCapture.OriginalFrontImage
|
|
120
|
+
idCaptureDict["originalBackImage"] = identificationDocumentCapture.OriginalBackImage
|
|
121
|
+
idCaptureDict["ghostImage"] = identificationDocumentCapture.GhostImage
|
|
122
|
+
idCaptureDict["idMaritalStatus"] = identificationDocumentCapture.ID_MaritalStatus
|
|
123
|
+
idCaptureDict["idDateOfIssuance"] = identificationDocumentCapture.ID_DateOfIssuance
|
|
124
|
+
idCaptureDict["idCivilRegisterNumber"] = identificationDocumentCapture.ID_CivilRegisterNumber
|
|
125
|
+
idCaptureDict["idPlaceOfResidence"] = identificationDocumentCapture.ID_PlaceOfResidence
|
|
126
|
+
idCaptureDict["idProvince"] = identificationDocumentCapture.ID_Province
|
|
127
|
+
idCaptureDict["idGovernorate"] = identificationDocumentCapture.ID_Governorate
|
|
128
|
+
idCaptureDict["idMothersName"] = identificationDocumentCapture.ID_MothersName
|
|
129
|
+
idCaptureDict["idFathersName"] = identificationDocumentCapture.ID_FathersName
|
|
130
|
+
idCaptureDict["idPlaceOfBirth"] = identificationDocumentCapture.ID_PlaceOfBirth
|
|
131
|
+
idCaptureDict["idBackImage"] = identificationDocumentCapture.ID_BackImage
|
|
132
|
+
idCaptureDict["idBloodType"] = identificationDocumentCapture.ID_BloodType
|
|
133
|
+
idCaptureDict["idDrivingCategory"] = identificationDocumentCapture.ID_DrivingCategory
|
|
134
|
+
idCaptureDict["idIssuanceAuthority"] = identificationDocumentCapture.ID_IssuanceAuthority
|
|
135
|
+
idCaptureDict["idArmyStatus"] = identificationDocumentCapture.ID_ArmyStatus
|
|
136
|
+
idCaptureDict["idProfession"] = identificationDocumentCapture.ID_Profession
|
|
137
|
+
idCaptureDict["idUniqueNumber"] = identificationDocumentCapture.ID_UniqueNumber
|
|
138
|
+
idCaptureDict["idDocumentTypeNumber"] = identificationDocumentCapture.ID_DocumentTypeNumber
|
|
139
|
+
idCaptureDict["idFees"] = identificationDocumentCapture.ID_Fees
|
|
140
|
+
idCaptureDict["idReference"] = identificationDocumentCapture.ID_Reference
|
|
141
|
+
idCaptureDict["idRegion"] = identificationDocumentCapture.ID_Region
|
|
142
|
+
idCaptureDict["idRegistrationLocation"] = identificationDocumentCapture.ID_RegistrationLocation
|
|
143
|
+
idCaptureDict["idFaceColor"] = identificationDocumentCapture.ID_FaceColor
|
|
144
|
+
idCaptureDict["idEyeColor"] = identificationDocumentCapture.ID_EyeColor
|
|
145
|
+
idCaptureDict["idSpecialMarks"] = identificationDocumentCapture.ID_SpecialMarks
|
|
146
|
+
idCaptureDict["idCountryOfStay"] = identificationDocumentCapture.ID_CountryOfStay
|
|
147
|
+
idCaptureDict["idIdentityNumber"] = identificationDocumentCapture.ID_IdentityNumber
|
|
148
|
+
idCaptureDict["idPresentAddress"] = identificationDocumentCapture.ID_PresentAddress
|
|
149
|
+
idCaptureDict["idPermanentAddress"] = identificationDocumentCapture.ID_PermanentAddress
|
|
150
|
+
idCaptureDict["idFamilyNumber"] = identificationDocumentCapture.ID_FamilyNumber
|
|
151
|
+
idCaptureDict["identityNumberBack"] = identificationDocumentCapture.ID_IdentityNumberBack
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
jsonDict["identificationDocumentCapture"] = idCaptureDict
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if let jsonData = try? JSONSerialization.data(withJSONObject: jsonDict, options: .prettyPrinted) {
|
|
158
|
+
return String(data: jsonData, encoding: .utf8)
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return nil
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
func faceModelToJsonString(dataModel: FaceExtractedModel?) -> String? {
|
|
165
|
+
guard let dataModel = dataModel else { return nil }
|
|
166
|
+
|
|
167
|
+
var jsonDict: [String: Any] = [:]
|
|
168
|
+
|
|
169
|
+
jsonDict["outputProperties"] = dataModel.outputProperties
|
|
170
|
+
jsonDict["extractedData"] = dataModel.extractedData
|
|
171
|
+
jsonDict["baseImageFace"] = dataModel.baseImageFace
|
|
172
|
+
jsonDict["secondImageFace"] = dataModel.secondImageFace
|
|
173
|
+
jsonDict["isLive"] = dataModel.isLive
|
|
174
|
+
jsonDict["percentageMatch"] = dataModel.percentageMatch
|
|
175
|
+
|
|
176
|
+
if let identificationDocumentCapture = dataModel.identificationDocumentCapture {
|
|
177
|
+
var idCaptureDict: [String: Any] = [:]
|
|
178
|
+
|
|
179
|
+
idCaptureDict["name"] = identificationDocumentCapture.name
|
|
180
|
+
idCaptureDict["surname"] = identificationDocumentCapture.surname
|
|
181
|
+
idCaptureDict["documentType"] = identificationDocumentCapture.Document_Type
|
|
182
|
+
idCaptureDict["birthDate"] = identificationDocumentCapture.Birth_Date
|
|
183
|
+
idCaptureDict["documentNumber"] = identificationDocumentCapture.Document_Number
|
|
184
|
+
idCaptureDict["sex"] = identificationDocumentCapture.Sex
|
|
185
|
+
idCaptureDict["expiryDate"] = identificationDocumentCapture.Expiry_Date
|
|
186
|
+
idCaptureDict["country"] = identificationDocumentCapture.Country
|
|
187
|
+
idCaptureDict["nationality"] = identificationDocumentCapture.Nationality
|
|
188
|
+
idCaptureDict["idType"] = identificationDocumentCapture.IDType
|
|
189
|
+
idCaptureDict["faceCapture"] = identificationDocumentCapture.FaceCapture
|
|
190
|
+
idCaptureDict["image"] = identificationDocumentCapture.Image
|
|
191
|
+
idCaptureDict["isSkippedAfterNFails"] = identificationDocumentCapture.IsSkippedAfterNFails
|
|
192
|
+
idCaptureDict["isFailedFront"] = identificationDocumentCapture.IsFailedFront
|
|
193
|
+
idCaptureDict["isFailedBack"] = identificationDocumentCapture.IsFailedBack
|
|
194
|
+
idCaptureDict["skippedStatus"] = identificationDocumentCapture.SkippedStatus
|
|
195
|
+
idCaptureDict["capturedVideoFront"] = identificationDocumentCapture.CapturedVideoFront
|
|
196
|
+
idCaptureDict["capturedVideoBack"] = identificationDocumentCapture.CapturedVideoBack
|
|
197
|
+
idCaptureDict["livenessStatus"] = identificationDocumentCapture.LivenessStatus
|
|
198
|
+
idCaptureDict["isFrontAuth"] = identificationDocumentCapture.IsFrontAuth
|
|
199
|
+
idCaptureDict["isBackAuth"] = identificationDocumentCapture.IsBackAuth
|
|
200
|
+
idCaptureDict["isExpired"] = identificationDocumentCapture.IsExpired
|
|
201
|
+
idCaptureDict["isTampering"] = identificationDocumentCapture.IsTampering
|
|
202
|
+
idCaptureDict["tamperHeatMap"] = identificationDocumentCapture.TamperHeatMap
|
|
203
|
+
idCaptureDict["isBackTampering"] = identificationDocumentCapture.IsBackTampering
|
|
204
|
+
idCaptureDict["backTamperHeatmap"] = identificationDocumentCapture.BackTamperHeatmap
|
|
205
|
+
idCaptureDict["originalFrontImage"] = identificationDocumentCapture.OriginalFrontImage
|
|
206
|
+
idCaptureDict["originalBackImage"] = identificationDocumentCapture.OriginalBackImage
|
|
207
|
+
idCaptureDict["ghostImage"] = identificationDocumentCapture.GhostImage
|
|
208
|
+
idCaptureDict["idMaritalStatus"] = identificationDocumentCapture.ID_MaritalStatus
|
|
209
|
+
idCaptureDict["idDateOfIssuance"] = identificationDocumentCapture.ID_DateOfIssuance
|
|
210
|
+
idCaptureDict["idCivilRegisterNumber"] = identificationDocumentCapture.ID_CivilRegisterNumber
|
|
211
|
+
idCaptureDict["idPlaceOfResidence"] = identificationDocumentCapture.ID_PlaceOfResidence
|
|
212
|
+
idCaptureDict["idProvince"] = identificationDocumentCapture.ID_Province
|
|
213
|
+
idCaptureDict["idGovernorate"] = identificationDocumentCapture.ID_Governorate
|
|
214
|
+
idCaptureDict["idMothersName"] = identificationDocumentCapture.ID_MothersName
|
|
215
|
+
idCaptureDict["idFathersName"] = identificationDocumentCapture.ID_FathersName
|
|
216
|
+
idCaptureDict["idPlaceOfBirth"] = identificationDocumentCapture.ID_PlaceOfBirth
|
|
217
|
+
idCaptureDict["idBackImage"] = identificationDocumentCapture.ID_BackImage
|
|
218
|
+
idCaptureDict["idBloodType"] = identificationDocumentCapture.ID_BloodType
|
|
219
|
+
idCaptureDict["idDrivingCategory"] = identificationDocumentCapture.ID_DrivingCategory
|
|
220
|
+
idCaptureDict["idIssuanceAuthority"] = identificationDocumentCapture.ID_IssuanceAuthority
|
|
221
|
+
idCaptureDict["idArmyStatus"] = identificationDocumentCapture.ID_ArmyStatus
|
|
222
|
+
idCaptureDict["idProfession"] = identificationDocumentCapture.ID_Profession
|
|
223
|
+
idCaptureDict["idUniqueNumber"] = identificationDocumentCapture.ID_UniqueNumber
|
|
224
|
+
idCaptureDict["idDocumentTypeNumber"] = identificationDocumentCapture.ID_DocumentTypeNumber
|
|
225
|
+
idCaptureDict["idFees"] = identificationDocumentCapture.ID_Fees
|
|
226
|
+
idCaptureDict["idReference"] = identificationDocumentCapture.ID_Reference
|
|
227
|
+
idCaptureDict["idRegion"] = identificationDocumentCapture.ID_Region
|
|
228
|
+
idCaptureDict["idRegistrationLocation"] = identificationDocumentCapture.ID_RegistrationLocation
|
|
229
|
+
idCaptureDict["idFaceColor"] = identificationDocumentCapture.ID_FaceColor
|
|
230
|
+
idCaptureDict["idEyeColor"] = identificationDocumentCapture.ID_EyeColor
|
|
231
|
+
idCaptureDict["idSpecialMarks"] = identificationDocumentCapture.ID_SpecialMarks
|
|
232
|
+
idCaptureDict["idCountryOfStay"] = identificationDocumentCapture.ID_CountryOfStay
|
|
233
|
+
idCaptureDict["idIdentityNumber"] = identificationDocumentCapture.ID_IdentityNumber
|
|
234
|
+
idCaptureDict["idPresentAddress"] = identificationDocumentCapture.ID_PresentAddress
|
|
235
|
+
idCaptureDict["idPermanentAddress"] = identificationDocumentCapture.ID_PermanentAddress
|
|
236
|
+
idCaptureDict["idFamilyNumber"] = identificationDocumentCapture.ID_FamilyNumber
|
|
237
|
+
idCaptureDict["identityNumberBack"] = identificationDocumentCapture.ID_IdentityNumberBack
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
jsonDict["identificationDocumentCapture"] = idCaptureDict
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
if let jsonData = try? JSONSerialization.data(withJSONObject: jsonDict, options: .prettyPrinted) {
|
|
244
|
+
return String(data: jsonData, encoding: .utf8)
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
return nil
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
func iDModelToJsonString(dataModel: IDExtractedModel?) -> String? {
|
|
251
|
+
guard let dataModel = dataModel else { return nil }
|
|
252
|
+
|
|
253
|
+
var jsonDict: [String: Any] = [:]
|
|
254
|
+
|
|
255
|
+
jsonDict["outputProperties"] = dataModel.outputProperties
|
|
256
|
+
jsonDict["transformedProperties"] = dataModel.transformedProperties
|
|
257
|
+
jsonDict["extractedData"] = dataModel.extractedData
|
|
258
|
+
jsonDict["imageUrl"] = dataModel.imageUrl
|
|
259
|
+
jsonDict["faces"] = dataModel.faces
|
|
260
|
+
|
|
261
|
+
if let identificationDocumentCapture = dataModel.identificationDocumentCapture {
|
|
262
|
+
var idCaptureDict: [String: Any] = [:]
|
|
263
|
+
|
|
264
|
+
idCaptureDict["name"] = identificationDocumentCapture.name
|
|
265
|
+
idCaptureDict["surname"] = identificationDocumentCapture.surname
|
|
266
|
+
idCaptureDict["documentType"] = identificationDocumentCapture.Document_Type
|
|
267
|
+
idCaptureDict["birthDate"] = identificationDocumentCapture.Birth_Date
|
|
268
|
+
idCaptureDict["documentNumber"] = identificationDocumentCapture.Document_Number
|
|
269
|
+
idCaptureDict["sex"] = identificationDocumentCapture.Sex
|
|
270
|
+
idCaptureDict["expiryDate"] = identificationDocumentCapture.Expiry_Date
|
|
271
|
+
idCaptureDict["country"] = identificationDocumentCapture.Country
|
|
272
|
+
idCaptureDict["nationality"] = identificationDocumentCapture.Nationality
|
|
273
|
+
idCaptureDict["idType"] = identificationDocumentCapture.IDType
|
|
274
|
+
idCaptureDict["faceCapture"] = identificationDocumentCapture.FaceCapture
|
|
275
|
+
idCaptureDict["image"] = identificationDocumentCapture.Image
|
|
276
|
+
idCaptureDict["isSkippedAfterNFails"] = identificationDocumentCapture.IsSkippedAfterNFails
|
|
277
|
+
idCaptureDict["isFailedFront"] = identificationDocumentCapture.IsFailedFront
|
|
278
|
+
idCaptureDict["isFailedBack"] = identificationDocumentCapture.IsFailedBack
|
|
279
|
+
idCaptureDict["skippedStatus"] = identificationDocumentCapture.SkippedStatus
|
|
280
|
+
idCaptureDict["capturedVideoFront"] = identificationDocumentCapture.CapturedVideoFront
|
|
281
|
+
idCaptureDict["capturedVideoBack"] = identificationDocumentCapture.CapturedVideoBack
|
|
282
|
+
idCaptureDict["livenessStatus"] = identificationDocumentCapture.LivenessStatus
|
|
283
|
+
idCaptureDict["isFrontAuth"] = identificationDocumentCapture.IsFrontAuth
|
|
284
|
+
idCaptureDict["isBackAuth"] = identificationDocumentCapture.IsBackAuth
|
|
285
|
+
idCaptureDict["isExpired"] = identificationDocumentCapture.IsExpired
|
|
286
|
+
idCaptureDict["isTampering"] = identificationDocumentCapture.IsTampering
|
|
287
|
+
idCaptureDict["tamperHeatMap"] = identificationDocumentCapture.TamperHeatMap
|
|
288
|
+
idCaptureDict["isBackTampering"] = identificationDocumentCapture.IsBackTampering
|
|
289
|
+
idCaptureDict["backTamperHeatmap"] = identificationDocumentCapture.BackTamperHeatmap
|
|
290
|
+
idCaptureDict["originalFrontImage"] = identificationDocumentCapture.OriginalFrontImage
|
|
291
|
+
idCaptureDict["originalBackImage"] = identificationDocumentCapture.OriginalBackImage
|
|
292
|
+
idCaptureDict["ghostImage"] = identificationDocumentCapture.GhostImage
|
|
293
|
+
idCaptureDict["idMaritalStatus"] = identificationDocumentCapture.ID_MaritalStatus
|
|
294
|
+
idCaptureDict["idDateOfIssuance"] = identificationDocumentCapture.ID_DateOfIssuance
|
|
295
|
+
idCaptureDict["idCivilRegisterNumber"] = identificationDocumentCapture.ID_CivilRegisterNumber
|
|
296
|
+
idCaptureDict["idPlaceOfResidence"] = identificationDocumentCapture.ID_PlaceOfResidence
|
|
297
|
+
idCaptureDict["idProvince"] = identificationDocumentCapture.ID_Province
|
|
298
|
+
idCaptureDict["idGovernorate"] = identificationDocumentCapture.ID_Governorate
|
|
299
|
+
idCaptureDict["idMothersName"] = identificationDocumentCapture.ID_MothersName
|
|
300
|
+
idCaptureDict["idFathersName"] = identificationDocumentCapture.ID_FathersName
|
|
301
|
+
idCaptureDict["idPlaceOfBirth"] = identificationDocumentCapture.ID_PlaceOfBirth
|
|
302
|
+
idCaptureDict["idBackImage"] = identificationDocumentCapture.ID_BackImage
|
|
303
|
+
idCaptureDict["idBloodType"] = identificationDocumentCapture.ID_BloodType
|
|
304
|
+
idCaptureDict["idDrivingCategory"] = identificationDocumentCapture.ID_DrivingCategory
|
|
305
|
+
idCaptureDict["idIssuanceAuthority"] = identificationDocumentCapture.ID_IssuanceAuthority
|
|
306
|
+
idCaptureDict["idArmyStatus"] = identificationDocumentCapture.ID_ArmyStatus
|
|
307
|
+
idCaptureDict["idProfession"] = identificationDocumentCapture.ID_Profession
|
|
308
|
+
idCaptureDict["idUniqueNumber"] = identificationDocumentCapture.ID_UniqueNumber
|
|
309
|
+
idCaptureDict["idDocumentTypeNumber"] = identificationDocumentCapture.ID_DocumentTypeNumber
|
|
310
|
+
idCaptureDict["idFees"] = identificationDocumentCapture.ID_Fees
|
|
311
|
+
idCaptureDict["idReference"] = identificationDocumentCapture.ID_Reference
|
|
312
|
+
idCaptureDict["idRegion"] = identificationDocumentCapture.ID_Region
|
|
313
|
+
idCaptureDict["idRegistrationLocation"] = identificationDocumentCapture.ID_RegistrationLocation
|
|
314
|
+
idCaptureDict["idFaceColor"] = identificationDocumentCapture.ID_FaceColor
|
|
315
|
+
idCaptureDict["idEyeColor"] = identificationDocumentCapture.ID_EyeColor
|
|
316
|
+
idCaptureDict["idSpecialMarks"] = identificationDocumentCapture.ID_SpecialMarks
|
|
317
|
+
idCaptureDict["idCountryOfStay"] = identificationDocumentCapture.ID_CountryOfStay
|
|
318
|
+
idCaptureDict["idIdentityNumber"] = identificationDocumentCapture.ID_IdentityNumber
|
|
319
|
+
idCaptureDict["idPresentAddress"] = identificationDocumentCapture.ID_PresentAddress
|
|
320
|
+
idCaptureDict["idPermanentAddress"] = identificationDocumentCapture.ID_PermanentAddress
|
|
321
|
+
idCaptureDict["idFamilyNumber"] = identificationDocumentCapture.ID_FamilyNumber
|
|
322
|
+
idCaptureDict["identityNumberBack"] = identificationDocumentCapture.ID_IdentityNumberBack
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
jsonDict["identificationDocumentCapture"] = idCaptureDict
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
if let jsonData = try? JSONSerialization.data(withJSONObject: jsonDict, options: .prettyPrinted) {
|
|
329
|
+
return String(data: jsonData, encoding: .utf8)
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
return nil
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
func otherModelToJsonString(dataModel: OtherExtractedModel?) -> String? {
|
|
337
|
+
guard let dataModel = dataModel else { return nil }
|
|
338
|
+
|
|
339
|
+
var jsonDict: [String: Any] = [:]
|
|
340
|
+
|
|
341
|
+
jsonDict["outputProperties"] = dataModel.outputProperties
|
|
342
|
+
jsonDict["transformedProperties"] = dataModel.transformedProperties
|
|
343
|
+
jsonDict["extractedData"] = dataModel.extractedData
|
|
344
|
+
jsonDict["additionalDetails"] = dataModel.additionalDetails
|
|
345
|
+
jsonDict["transformedDetails"] = dataModel.transformedDetails
|
|
346
|
+
jsonDict["imageUrl"] = dataModel.imageUrl
|
|
347
|
+
jsonDict["faces"] = dataModel.faces
|
|
348
|
+
|
|
349
|
+
if let identificationDocumentCapture = dataModel.identificationDocumentCapture {
|
|
350
|
+
var idCaptureDict: [String: Any] = [:]
|
|
351
|
+
|
|
352
|
+
idCaptureDict["name"] = identificationDocumentCapture.name
|
|
353
|
+
idCaptureDict["surname"] = identificationDocumentCapture.surname
|
|
354
|
+
idCaptureDict["documentType"] = identificationDocumentCapture.Document_Type
|
|
355
|
+
idCaptureDict["birthDate"] = identificationDocumentCapture.Birth_Date
|
|
356
|
+
idCaptureDict["documentNumber"] = identificationDocumentCapture.Document_Number
|
|
357
|
+
idCaptureDict["sex"] = identificationDocumentCapture.Sex
|
|
358
|
+
idCaptureDict["expiryDate"] = identificationDocumentCapture.Expiry_Date
|
|
359
|
+
idCaptureDict["country"] = identificationDocumentCapture.Country
|
|
360
|
+
idCaptureDict["nationality"] = identificationDocumentCapture.Nationality
|
|
361
|
+
idCaptureDict["idType"] = identificationDocumentCapture.IDType
|
|
362
|
+
idCaptureDict["faceCapture"] = identificationDocumentCapture.FaceCapture
|
|
363
|
+
idCaptureDict["image"] = identificationDocumentCapture.Image
|
|
364
|
+
idCaptureDict["isSkippedAfterNFails"] = identificationDocumentCapture.IsSkippedAfterNFails
|
|
365
|
+
idCaptureDict["isFailedFront"] = identificationDocumentCapture.IsFailedFront
|
|
366
|
+
idCaptureDict["isFailedBack"] = identificationDocumentCapture.IsFailedBack
|
|
367
|
+
idCaptureDict["skippedStatus"] = identificationDocumentCapture.SkippedStatus
|
|
368
|
+
idCaptureDict["capturedVideoFront"] = identificationDocumentCapture.CapturedVideoFront
|
|
369
|
+
idCaptureDict["capturedVideoBack"] = identificationDocumentCapture.CapturedVideoBack
|
|
370
|
+
idCaptureDict["livenessStatus"] = identificationDocumentCapture.LivenessStatus
|
|
371
|
+
idCaptureDict["isFrontAuth"] = identificationDocumentCapture.IsFrontAuth
|
|
372
|
+
idCaptureDict["isBackAuth"] = identificationDocumentCapture.IsBackAuth
|
|
373
|
+
idCaptureDict["isExpired"] = identificationDocumentCapture.IsExpired
|
|
374
|
+
idCaptureDict["isTampering"] = identificationDocumentCapture.IsTampering
|
|
375
|
+
idCaptureDict["tamperHeatMap"] = identificationDocumentCapture.TamperHeatMap
|
|
376
|
+
idCaptureDict["isBackTampering"] = identificationDocumentCapture.IsBackTampering
|
|
377
|
+
idCaptureDict["backTamperHeatmap"] = identificationDocumentCapture.BackTamperHeatmap
|
|
378
|
+
idCaptureDict["originalFrontImage"] = identificationDocumentCapture.OriginalFrontImage
|
|
379
|
+
idCaptureDict["originalBackImage"] = identificationDocumentCapture.OriginalBackImage
|
|
380
|
+
idCaptureDict["ghostImage"] = identificationDocumentCapture.GhostImage
|
|
381
|
+
idCaptureDict["idMaritalStatus"] = identificationDocumentCapture.ID_MaritalStatus
|
|
382
|
+
idCaptureDict["idDateOfIssuance"] = identificationDocumentCapture.ID_DateOfIssuance
|
|
383
|
+
idCaptureDict["idCivilRegisterNumber"] = identificationDocumentCapture.ID_CivilRegisterNumber
|
|
384
|
+
idCaptureDict["idPlaceOfResidence"] = identificationDocumentCapture.ID_PlaceOfResidence
|
|
385
|
+
idCaptureDict["idProvince"] = identificationDocumentCapture.ID_Province
|
|
386
|
+
idCaptureDict["idGovernorate"] = identificationDocumentCapture.ID_Governorate
|
|
387
|
+
idCaptureDict["idMothersName"] = identificationDocumentCapture.ID_MothersName
|
|
388
|
+
idCaptureDict["idFathersName"] = identificationDocumentCapture.ID_FathersName
|
|
389
|
+
idCaptureDict["idPlaceOfBirth"] = identificationDocumentCapture.ID_PlaceOfBirth
|
|
390
|
+
idCaptureDict["idBackImage"] = identificationDocumentCapture.ID_BackImage
|
|
391
|
+
idCaptureDict["idBloodType"] = identificationDocumentCapture.ID_BloodType
|
|
392
|
+
idCaptureDict["idDrivingCategory"] = identificationDocumentCapture.ID_DrivingCategory
|
|
393
|
+
idCaptureDict["idIssuanceAuthority"] = identificationDocumentCapture.ID_IssuanceAuthority
|
|
394
|
+
idCaptureDict["idArmyStatus"] = identificationDocumentCapture.ID_ArmyStatus
|
|
395
|
+
idCaptureDict["idProfession"] = identificationDocumentCapture.ID_Profession
|
|
396
|
+
idCaptureDict["idUniqueNumber"] = identificationDocumentCapture.ID_UniqueNumber
|
|
397
|
+
idCaptureDict["idDocumentTypeNumber"] = identificationDocumentCapture.ID_DocumentTypeNumber
|
|
398
|
+
idCaptureDict["idFees"] = identificationDocumentCapture.ID_Fees
|
|
399
|
+
idCaptureDict["idReference"] = identificationDocumentCapture.ID_Reference
|
|
400
|
+
idCaptureDict["idRegion"] = identificationDocumentCapture.ID_Region
|
|
401
|
+
idCaptureDict["idRegistrationLocation"] = identificationDocumentCapture.ID_RegistrationLocation
|
|
402
|
+
idCaptureDict["idFaceColor"] = identificationDocumentCapture.ID_FaceColor
|
|
403
|
+
idCaptureDict["idEyeColor"] = identificationDocumentCapture.ID_EyeColor
|
|
404
|
+
idCaptureDict["idSpecialMarks"] = identificationDocumentCapture.ID_SpecialMarks
|
|
405
|
+
idCaptureDict["idCountryOfStay"] = identificationDocumentCapture.ID_CountryOfStay
|
|
406
|
+
idCaptureDict["idIdentityNumber"] = identificationDocumentCapture.ID_IdentityNumber
|
|
407
|
+
idCaptureDict["idPresentAddress"] = identificationDocumentCapture.ID_PresentAddress
|
|
408
|
+
idCaptureDict["idPermanentAddress"] = identificationDocumentCapture.ID_PermanentAddress
|
|
409
|
+
idCaptureDict["idFamilyNumber"] = identificationDocumentCapture.ID_FamilyNumber
|
|
410
|
+
idCaptureDict["identityNumberBack"] = identificationDocumentCapture.ID_IdentityNumberBack
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
jsonDict["identificationDocumentCapture"] = idCaptureDict
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
if let jsonData = try? JSONSerialization.data(withJSONObject: jsonDict, options: .prettyPrinted) {
|
|
417
|
+
return String(data: jsonData, encoding: .utf8)
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
return nil
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
func parseSubmitRequestModelList(jsonString: String) -> [SubmitRequestModel]? {
|
|
425
|
+
guard let data = jsonString.data(using: .utf8) else { return nil }
|
|
426
|
+
|
|
427
|
+
do {
|
|
428
|
+
if let jsonArray = try JSONSerialization.jsonObject(with: data, options: []) as? [[String: Any]] {
|
|
429
|
+
var submitRequestList = [SubmitRequestModel]()
|
|
430
|
+
|
|
431
|
+
for jsonObject in jsonArray {
|
|
432
|
+
if let stepId = jsonObject["stepId"] as? Int,
|
|
433
|
+
let stepDefinition = jsonObject["stepDefinition"] as? String,
|
|
434
|
+
let extractedInformation = jsonObject["extractedInformation"] as? [String: Any] {
|
|
435
|
+
let submitRequestModel = SubmitRequestModel(stepId: stepId, stepDefinition: stepDefinition, extractedInformation: convertAnyDictToStringDict(dict: extractedInformation))
|
|
436
|
+
submitRequestList.append(submitRequestModel)
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
return submitRequestList
|
|
440
|
+
}
|
|
441
|
+
} catch {
|
|
442
|
+
print("Error parsing JSON: \(error.localizedDescription)")
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
return nil
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
func convertAnyDictToStringDict(dict: [String: Any]) -> [String: String] {
|
|
449
|
+
var stringDict: [String: String] = [:]
|
|
450
|
+
for (key, value) in dict {
|
|
451
|
+
if(value is NSNull ){
|
|
452
|
+
continue
|
|
453
|
+
}else{
|
|
454
|
+
if let stringValue = value as? String {
|
|
455
|
+
if(!stringValue.isEmpty){
|
|
456
|
+
stringDict[key] = stringValue
|
|
457
|
+
}
|
|
458
|
+
} else {
|
|
459
|
+
if(!"\(value)".isEmpty){
|
|
460
|
+
stringDict[key] = "\(value)"
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
return stringDict
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
|