@regulaforensics/cordova-plugin-document-reader-api 6.9.1 → 7.1.0

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.
@@ -0,0 +1,1325 @@
1
+ //
2
+ // RGLWConfig.m
3
+ // DocumentReader
4
+ //
5
+ // Created by Pavel Masiuk on 21.09.2023.
6
+ // Copyright © 2023 Regula. All rights reserved.
7
+ //
8
+
9
+ #import <Foundation/Foundation.h>
10
+ #import "RGLWConfig.h"
11
+
12
+ @implementation RGLWConfig
13
+
14
+ +(void)setFunctionality:(NSDictionary*)options :(RGLFunctionality*)functionality {
15
+ // Boolean
16
+ if([options valueForKey:@"showTorchButton"] != nil)
17
+ functionality.showTorchButton = [[options valueForKey:@"showTorchButton"] boolValue];
18
+ if([options valueForKey:@"showCloseButton"] != nil)
19
+ functionality.showCloseButton = [[options valueForKey:@"showCloseButton"] boolValue];
20
+ if([options valueForKey:@"videoCaptureMotionControl"] != nil)
21
+ functionality.videoCaptureMotionControl = [[options valueForKey:@"videoCaptureMotionControl"] boolValue];
22
+ if([options valueForKey:@"showCaptureButton"] != nil)
23
+ functionality.showCaptureButton = [[options valueForKey:@"showCaptureButton"] boolValue];
24
+ if([options valueForKey:@"showChangeFrameButton"] != nil)
25
+ functionality.showChangeFrameButton = [[options valueForKey:@"showChangeFrameButton"] boolValue];
26
+ if([options valueForKey:@"showSkipNextPageButton"] != nil)
27
+ functionality.showSkipNextPageButton = [[options valueForKey:@"showSkipNextPageButton"] boolValue];
28
+ if([options valueForKey:@"useAuthenticator"] != nil)
29
+ functionality.useAuthenticator = [[options valueForKey:@"useAuthenticator"] boolValue];
30
+ if([options valueForKey:@"skipFocusingFrames"] != nil)
31
+ functionality.skipFocusingFrames = [[options valueForKey:@"skipFocusingFrames"] boolValue];
32
+ if([options valueForKey:@"showCameraSwitchButton"] != nil)
33
+ functionality.showCameraSwitchButton = [[options valueForKey:@"showCameraSwitchButton"] boolValue];
34
+ if([options valueForKey:@"displayMetadata"] != nil)
35
+ functionality.showMetadataInfo = [[options valueForKey:@"displayMetadata"] boolValue];
36
+ if([options valueForKey:@"isZoomEnabled"] != nil)
37
+ functionality.isZoomEnabled = [[options valueForKey:@"isZoomEnabled"] boolValue];
38
+ if([options valueForKey:@"recordScanningProcess"] != nil)
39
+ functionality.recordScanningProcess = [[options valueForKey:@"recordScanningProcess"] boolValue];
40
+ if([options valueForKey:@"manualMultipageMode"] != nil)
41
+ functionality.manualMultipageMode = [[options valueForKey:@"manualMultipageMode"] boolValue];
42
+ if([options valueForKey:@"singleResult"] != nil)
43
+ functionality.singleResult = [[options valueForKey:@"singleResult"] boolValue];
44
+
45
+ // Int
46
+ if([options valueForKey:@"showCaptureButtonDelayFromDetect"] != nil)
47
+ functionality.showCaptureButtonDelayFromDetect = [[options valueForKey:@"showCaptureButtonDelayFromDetect"] doubleValue];
48
+ if([options valueForKey:@"showCaptureButtonDelayFromStart"] != nil)
49
+ functionality.showCaptureButtonDelayFromStart = [[options valueForKey:@"showCaptureButtonDelayFromStart"] doubleValue];
50
+ if([options valueForKey:@"forcePagesCount"] != nil)
51
+ functionality.forcePagesCount = [options valueForKey:@"forcePagesCount"];
52
+ if([options valueForKey:@"orientation"] != nil)
53
+ functionality.orientation = [self interfaceOrientationMaskWithNumber:[options valueForKey:@"orientation"]];
54
+ if([options valueForKey:@"captureMode"] != nil)
55
+ functionality.captureMode = [[options valueForKey:@"captureMode"] integerValue];
56
+ if([options valueForKey:@"cameraPosition"] != nil)
57
+ functionality.cameraPosition = [self captureDevicePositionWithNumber:[options valueForKey:@"cameraPosition"]];
58
+
59
+ // String
60
+ if([options valueForKey:@"cameraFrame"] != nil)
61
+ functionality.cameraFrame = [self docReaderFrameWithString:[options valueForKey:@"cameraFrame"]];
62
+ #pragma clang diagnostic ignored "-Wdeprecated-declarations"
63
+ if([options valueForKey:@"btDeviceName"] != nil)
64
+ functionality.btDeviceName = [options valueForKey:@"btDeviceName"];
65
+ #pragma clang diagnostic pop
66
+
67
+ // Float
68
+ if([options valueForKey:@"zoomFactor"] != nil)
69
+ functionality.zoomFactor = [[options valueForKey:@"zoomFactor"] floatValue];
70
+
71
+ // JSONObject
72
+ if([options valueForKey:@"onlineProcessingConfiguration"] != nil)
73
+ functionality.onlineProcessingConfig = [RGLWJSONConstructor onlineProcessingConfigFromJson:[options valueForKey:@"onlineProcessingConfiguration"]];
74
+
75
+ // Custom
76
+ // in android - cameraSize
77
+ if([options valueForKey:@"videoSessionPreset"] != nil)
78
+ functionality.videoSessionPreset = [self captureSessionPresetWithNumber:[options valueForKey:@"videoSessionPreset"]];
79
+ if([options valueForKey:@"videoOutputSettings"] != nil)
80
+ functionality.videoOutputSettings = [options valueForKey:@"videoOutputSettings"];
81
+ }
82
+
83
+ +(NSDictionary*)getFunctionality:(RGLFunctionality*)functionality {
84
+ NSMutableDictionary *result = [NSMutableDictionary new];
85
+
86
+ // Boolean
87
+ result[@"showTorchButton"] = [NSNumber numberWithBool:functionality.showTorchButton];
88
+ result[@"showCloseButton"] = [NSNumber numberWithBool:functionality.showCloseButton];
89
+ result[@"videoCaptureMotionControl"] = [NSNumber numberWithBool:functionality.videoCaptureMotionControl];
90
+ result[@"showCaptureButton"] = [NSNumber numberWithBool:functionality.showCaptureButton];
91
+ result[@"showChangeFrameButton"] = [NSNumber numberWithBool:functionality.showChangeFrameButton];
92
+ result[@"showSkipNextPageButton"] = [NSNumber numberWithBool:functionality.showSkipNextPageButton];
93
+ result[@"useAuthenticator"] = [NSNumber numberWithBool:functionality.isUseAuthenticator];
94
+ result[@"skipFocusingFrames"] = [NSNumber numberWithBool:functionality.skipFocusingFrames];
95
+ result[@"showCameraSwitchButton"] = [NSNumber numberWithBool:functionality.showCameraSwitchButton];
96
+ result[@"displayMetadata"] = [NSNumber numberWithBool:functionality.showMetadataInfo];
97
+ result[@"isZoomEnabled"] = [NSNumber numberWithBool:functionality.isZoomEnabled];
98
+ result[@"recordScanningProcess"] = [NSNumber numberWithBool:functionality.recordScanningProcess];
99
+ result[@"manualMultipageMode"] = [NSNumber numberWithBool:functionality.manualMultipageMode];
100
+ result[@"singleResult"] = [NSNumber numberWithBool:functionality.singleResult];
101
+
102
+ // Int
103
+ result[@"showCaptureButtonDelayFromDetect"] = [NSNumber numberWithDouble:functionality.showCaptureButtonDelayFromDetect];
104
+ result[@"showCaptureButtonDelayFromStart"] = [NSNumber numberWithDouble:functionality.showCaptureButtonDelayFromStart];
105
+ result[@"forcePagesCount"] = functionality.forcePagesCount;
106
+ result[@"orientation"] = [self generateInterfaceOrientationMask:functionality.orientation];
107
+ result[@"captureMode"] = [NSNumber numberWithInteger:functionality.captureMode];
108
+ result[@"cameraPosition"] = [self generateCaptureDevicePosition:functionality.cameraPosition];
109
+
110
+ // String
111
+ result[@"cameraFrame"] = [self generateDocReaderFrame:functionality.cameraFrame];
112
+ #pragma clang diagnostic ignored "-Wdeprecated-declarations"
113
+ result[@"btDeviceName"] = functionality.btDeviceName;
114
+ #pragma clang diagnostic pop
115
+
116
+ // Float
117
+ result[@"zoomFactor"] = [NSNumber numberWithFloat:functionality.zoomFactor];
118
+
119
+ // JSONObject
120
+ result[@"onlineProcessingConfiguration"] = [RGLWJSONConstructor generateOnlineProcessingConfig:functionality.onlineProcessingConfig];
121
+
122
+ // Custom
123
+ // in android - cameraSize
124
+ result[@"videoSessionPreset"] = [self generateCaptureSessionPreset:functionality.videoSessionPreset];
125
+ result[@"videoOutputSettings"] = functionality.videoOutputSettings;
126
+
127
+ return result;
128
+ }
129
+
130
+ +(void)setProcessParams:(NSDictionary*)options :(RGLProcessParams*)processParams {
131
+
132
+ // Boolean
133
+ if([options valueForKey:@"multipageProcessing"] != nil)
134
+ processParams.multipageProcessing = [options valueForKey:@"multipageProcessing"];
135
+ if([options valueForKey:@"logs"] != nil)
136
+ processParams.logs = [options valueForKey:@"logs"];
137
+ if([options valueForKey:@"debugSaveImages"] != nil)
138
+ processParams.debugSaveImages = [options valueForKey:@"debugSaveImages"];
139
+ if([options valueForKey:@"debugSaveLogs"] != nil)
140
+ processParams.debugSaveLogs = [options valueForKey:@"debugSaveLogs"];
141
+ if([options valueForKey:@"returnUncroppedImage"] != nil)
142
+ processParams.returnUncroppedImage = [options valueForKey:@"returnUncroppedImage"];
143
+ if([options valueForKey:@"debugSaveCroppedImages"] != nil)
144
+ processParams.debugSaveCroppedImages = [options valueForKey:@"debugSaveCroppedImages"];
145
+ if([options valueForKey:@"disableFocusingCheck"] != nil)
146
+ processParams.disableFocusingCheck = [options valueForKey:@"disableFocusingCheck"];
147
+ if([options valueForKey:@"debugSaveRFIDSession"] != nil)
148
+ processParams.debugSaveRFIDSession = [options valueForKey:@"debugSaveRFIDSession"];
149
+ if([options valueForKey:@"doublePageSpread"] != nil)
150
+ processParams.doublePageSpread = [options valueForKey:@"doublePageSpread"];
151
+ if([options valueForKey:@"manualCrop"] != nil)
152
+ processParams.manualCrop = [options valueForKey:@"manualCrop"];
153
+ if([options valueForKey:@"integralImage"] != nil)
154
+ processParams.integralImage = [options valueForKey:@"integralImage"];
155
+ if([options valueForKey:@"returnCroppedBarcode"] != nil)
156
+ processParams.returnCroppedBarcode = [options valueForKey:@"returnCroppedBarcode"];
157
+ if([options valueForKey:@"checkRequiredTextFields"] != nil)
158
+ processParams.checkRequiredTextFields = [options valueForKey:@"checkRequiredTextFields"];
159
+ if([options valueForKey:@"depersonalizeLog"] != nil)
160
+ processParams.depersonalizeLog = [options valueForKey:@"depersonalizeLog"];
161
+ if([options valueForKey:@"generateDoublePageSpreadImage"] != nil)
162
+ processParams.generateDoublePageSpreadImage = [options valueForKey:@"generateDoublePageSpreadImage"];
163
+ if([options valueForKey:@"alreadyCropped"] != nil)
164
+ processParams.alreadyCropped = [options valueForKey:@"alreadyCropped"];
165
+ if([options valueForKey:@"matchTextFieldMask"] != nil)
166
+ processParams.matchTextFieldMask = [options valueForKey:@"matchTextFieldMask"];
167
+ if([options valueForKey:@"updateOCRValidityByGlare"] != nil)
168
+ processParams.updateOCRValidityByGlare = [options valueForKey:@"updateOCRValidityByGlare"];
169
+ if([options valueForKey:@"noGraphics"] != nil)
170
+ processParams.noGraphics = [options valueForKey:@"noGraphics"];
171
+ if([options valueForKey:@"multiDocOnImage"] != nil)
172
+ processParams.multiDocOnImage = [options valueForKey:@"multiDocOnImage"];
173
+ if([options valueForKey:@"forceReadMrzBeforeLocate"] != nil)
174
+ processParams.forceReadMrzBeforeLocate = [options valueForKey:@"forceReadMrzBeforeLocate"];
175
+ if([options valueForKey:@"parseBarcodes"] != nil)
176
+ processParams.parseBarcodes = [options valueForKey:@"parseBarcodes"];
177
+ if([options valueForKey:@"shouldReturnPackageForReprocess"] != nil)
178
+ processParams.shouldReturnPackageForReprocess = [options valueForKey:@"shouldReturnPackageForReprocess"];
179
+ if([options valueForKey:@"disablePerforationOCR"] != nil)
180
+ processParams.disablePerforationOCR = [options valueForKey:@"disablePerforationOCR"];
181
+ if([options valueForKey:@"respectImageQuality"] != nil)
182
+ processParams.respectImageQuality = [options valueForKey:@"respectImageQuality"];
183
+ if([options valueForKey:@"splitNames"] != nil)
184
+ processParams.splitNames = [options valueForKey:@"splitNames"];
185
+ if([options valueForKey:@"doDetectCan"] != nil)
186
+ processParams.doDetectCan = [options valueForKey:@"doDetectCan"];
187
+ if([options valueForKey:@"useFaceApi"] != nil)
188
+ processParams.useFaceApi = [options valueForKey:@"useFaceApi"];
189
+ if([options valueForKey:@"useAuthenticityCheck"] != nil)
190
+ processParams.useAuthenticityCheck = [options valueForKey:@"useAuthenticityCheck"];
191
+ if([options valueForKey:@"checkHologram"] != nil)
192
+ processParams.checkHologram = [options valueForKey:@"checkHologram"];
193
+
194
+ // Int
195
+ if([options valueForKey:@"measureSystem"] != nil)
196
+ processParams.measureSystem = [[options valueForKey:@"measureSystem"] integerValue];
197
+ if([options valueForKey:@"barcodeParserType"] != nil)
198
+ processParams.barcodeParserType = [options valueForKey:@"barcodeParserType"];
199
+ if([options valueForKey:@"perspectiveAngle"] != nil)
200
+ processParams.perspectiveAngle = [options valueForKey:@"perspectiveAngle"];
201
+ if([options valueForKey:@"minDPI"] != nil)
202
+ processParams.minDPI = [options valueForKey:@"minDPI"];
203
+ if([options valueForKey:@"imageDpiOutMax"] != nil)
204
+ processParams.imageDpiOutMax = [options valueForKey:@"imageDpiOutMax"];
205
+ if([options valueForKey:@"forceDocID"] != nil)
206
+ processParams.forceDocID = [options valueForKey:@"forceDocID"];
207
+ if([options valueForKey:@"forceDocFormat"] != nil)
208
+ processParams.forceDocFormat = [options valueForKey:@"forceDocFormat"];
209
+ if([options valueForKey:@"shiftExpiryDate"] != nil)
210
+ processParams.shiftExpiryDate = [options valueForKey:@"shiftExpiryDate"];
211
+ if([options valueForKey:@"minimalHolderAge"] != nil)
212
+ processParams.minimalHolderAge = [options valueForKey:@"minimalHolderAge"];
213
+ if([options valueForKey:@"imageOutputMaxHeight"] != nil)
214
+ processParams.imageOutputMaxHeight = [options valueForKey:@"imageOutputMaxHeight"];
215
+ if([options valueForKey:@"imageOutputMaxWidth"] != nil)
216
+ processParams.imageOutputMaxWidth = [options valueForKey:@"imageOutputMaxWidth"];
217
+ if([options valueForKey:@"processAuth"] != nil)
218
+ processParams.processAuth = [options valueForKey:@"processAuth"];
219
+ if([options valueForKey:@"convertCase"] != nil)
220
+ processParams.convertCase = [self textProcessingWithNumber:[options valueForKey:@"convertCase"]];
221
+
222
+ // String
223
+ if([options valueForKey:@"dateFormat"] != nil)
224
+ processParams.dateFormat = [options valueForKey:@"dateFormat"];
225
+ if([options valueForKey:@"scenario"] != nil)
226
+ processParams.scenario = [options valueForKey:@"scenario"];
227
+ if([options valueForKey:@"captureButtonScenario"] != nil)
228
+ processParams.captureButtonScenario = [options valueForKey:@"captureButtonScenario"];
229
+
230
+ // Double
231
+ if([options valueForKey:@"timeout"] != nil)
232
+ processParams.timeout = [options valueForKey:@"timeout"];
233
+ if([options valueForKey:@"timeoutFromFirstDetect"] != nil)
234
+ processParams.timeoutFromFirstDetect = [options valueForKey:@"timeoutFromFirstDetect"];
235
+ if([options valueForKey:@"timeoutFromFirstDocType"] != nil)
236
+ processParams.timeoutFromFirstDocType = [options valueForKey:@"timeoutFromFirstDocType"];
237
+ if([options valueForKey:@"documentAreaMin"] != nil)
238
+ processParams.documentAreaMin = [options valueForKey:@"documentAreaMin"];
239
+
240
+ // JSONArray
241
+ if([options valueForKey:@"documentIDList"] != nil)
242
+ processParams.documentIDList = [options valueForKey:@"documentIDList"];
243
+ if([options valueForKey:@"fieldTypesFilter"] != nil)
244
+ processParams.fieldTypesFilter = [options valueForKey:@"fieldTypesFilter"];
245
+ if([options valueForKey:@"barcodeTypes"] != nil)
246
+ processParams.barcodeTypes = [options valueForKey:@"barcodeTypes"];
247
+ if([options valueForKey:@"resultTypeOutput"] != nil)
248
+ processParams.resultTypeOutput = [options valueForKey:@"resultTypeOutput"];
249
+ if([options valueForKey:@"mrzFormatsFilter"] != nil)
250
+ processParams.mrzFormatsFilter = [options valueForKey:@"mrzFormatsFilter"];
251
+ if([options valueForKey:@"documentGroupFilter"] != nil)
252
+ processParams.documentGroupFilter = [options mutableArrayValueForKey:@"documentGroupFilter"];
253
+ if([options valueForKey:@"lcidIgnoreFilter"] != nil)
254
+ processParams.lcidIgnoreFilter = [options mutableArrayValueForKey:@"lcidIgnoreFilter"];
255
+ if([options valueForKey:@"lcidFilter"] != nil)
256
+ processParams.lcidFilter = [options mutableArrayValueForKey:@"lcidFilter"];
257
+
258
+ // JSONObject
259
+ if([options valueForKey:@"imageQA"] != nil)
260
+ [self setImageQA:processParams.imageQA input:[options valueForKey:@"imageQA"]];
261
+ if([options valueForKey:@"rfidParams"] != nil)
262
+ processParams.rfidParams = [RGLWJSONConstructor rfidParamsFromJson:[options valueForKey:@"rfidParams"]];
263
+ if([options valueForKey:@"faceApiParams"] != nil)
264
+ processParams.faceApiParams = [RGLWJSONConstructor faceAPIParamsFromJson:[options valueForKey:@"faceApiParams"]];
265
+ if([options valueForKey:@"backendProcessingConfig"] != nil)
266
+ processParams.backendProcessingConfig = [RGLWJSONConstructor backendProcessingConfigFromJson:[options valueForKey:@"backendProcessingConfig"]];
267
+ if([options valueForKey:@"authenticityParams"] != nil) {
268
+ if(processParams.authenticityParams == nil) processParams.authenticityParams = [RGLAuthenticityParams defaultParams];
269
+ [self setAuthenticityParams:processParams.authenticityParams input:[options valueForKey:@"authenticityParams"]];
270
+ }
271
+
272
+ // Custom
273
+ if([options valueForKey:@"customParams"] != nil)
274
+ processParams.customParams = [options valueForKey:@"customParams"];
275
+ }
276
+
277
+ +(NSDictionary*)getProcessParams:(RGLProcessParams*)processParams {
278
+ NSMutableDictionary *result = [NSMutableDictionary new];
279
+
280
+ // Boolean
281
+ result[@"multipageProcessing"] = processParams.multipageProcessing;
282
+ result[@"logs"] = processParams.logs;
283
+ result[@"debugSaveImages"] = processParams.debugSaveImages;
284
+ result[@"debugSaveLogs"] = processParams.debugSaveLogs;
285
+ result[@"returnUncroppedImage"] = processParams.returnUncroppedImage;
286
+ result[@"debugSaveCroppedImages"] = processParams.debugSaveCroppedImages;
287
+ result[@"disableFocusingCheck"] = processParams.disableFocusingCheck;
288
+ result[@"debugSaveRFIDSession"] = processParams.debugSaveRFIDSession;
289
+ result[@"doublePageSpread"] = processParams.doublePageSpread;
290
+ result[@"manualCrop"] = processParams.manualCrop;
291
+ result[@"integralImage"] = processParams.integralImage;
292
+ result[@"returnCroppedBarcode"] = processParams.returnCroppedBarcode;
293
+ result[@"checkRequiredTextFields"] = processParams.checkRequiredTextFields;
294
+ result[@"depersonalizeLog"] = processParams.depersonalizeLog;
295
+ result[@"generateDoublePageSpreadImage"] = processParams.generateDoublePageSpreadImage;
296
+ result[@"alreadyCropped"] = processParams.alreadyCropped;
297
+ result[@"matchTextFieldMask"] = processParams.matchTextFieldMask;
298
+ result[@"updateOCRValidityByGlare"] = processParams.updateOCRValidityByGlare;
299
+ result[@"noGraphics"] = processParams.noGraphics;
300
+ result[@"multiDocOnImage"] = processParams.multiDocOnImage;
301
+ result[@"forceReadMrzBeforeLocate"] = processParams.forceReadMrzBeforeLocate;
302
+ result[@"parseBarcodes"] = processParams.parseBarcodes;
303
+ result[@"shouldReturnPackageForReprocess"] = processParams.shouldReturnPackageForReprocess;
304
+ result[@"disablePerforationOCR"] = processParams.disablePerforationOCR;
305
+ result[@"respectImageQuality"] = processParams.respectImageQuality;
306
+ result[@"splitNames"] = processParams.splitNames;
307
+ result[@"doDetectCan"] = processParams.doDetectCan;
308
+ result[@"useFaceApi"] = processParams.useFaceApi;
309
+ result[@"useAuthenticityCheck"] = processParams.useAuthenticityCheck;
310
+ result[@"checkHologram"] = processParams.checkHologram;
311
+
312
+ // Int
313
+ result[@"measureSystem"] = [NSNumber numberWithInteger:processParams.measureSystem];
314
+ result[@"barcodeParserType"] = processParams.barcodeParserType;
315
+ result[@"perspectiveAngle"] = processParams.perspectiveAngle;
316
+ result[@"minDPI"] = processParams.minDPI;
317
+ result[@"imageDpiOutMax"] = processParams.imageDpiOutMax;
318
+ result[@"forceDocID"] = processParams.forceDocID;
319
+ result[@"forceDocFormat"] = processParams.forceDocFormat;
320
+ result[@"shiftExpiryDate"] = processParams.shiftExpiryDate;
321
+ result[@"minimalHolderAge"] = processParams.minimalHolderAge;
322
+ result[@"imageOutputMaxHeight"] = processParams.imageOutputMaxHeight;
323
+ result[@"imageOutputMaxWidth"] = processParams.imageOutputMaxWidth;
324
+ result[@"processAuth"] = processParams.processAuth;
325
+ result[@"convertCase"] = [self generateWithTextProcessing:processParams.convertCase];
326
+
327
+ // String
328
+ result[@"dateFormat"] = processParams.dateFormat;
329
+ result[@"scenario"] = processParams.scenario;
330
+ result[@"captureButtonScenario"] = processParams.captureButtonScenario;
331
+ result[@"sessionLogFolder"] = processParams.sessionLogFolder;
332
+
333
+ // Double
334
+ result[@"timeout"] = processParams.timeout;
335
+ result[@"timeoutFromFirstDetect"] = processParams.timeoutFromFirstDetect;
336
+ result[@"timeoutFromFirstDocType"] = processParams.timeoutFromFirstDocType;
337
+ result[@"documentAreaMin"] = processParams.documentAreaMin;
338
+
339
+ // JSONArray
340
+ result[@"documentIDList"] = processParams.documentIDList;
341
+ result[@"barcodeTypes"] = processParams.barcodeTypes;
342
+ result[@"fieldTypesFilter"] = processParams.fieldTypesFilter;
343
+ result[@"documentGroupFilter"] = processParams.documentGroupFilter;
344
+ result[@"lcidIgnoreFilter"] = processParams.lcidIgnoreFilter;
345
+ result[@"lcidFilter"] = processParams.lcidFilter;
346
+ result[@"mrzFormatsFilter"] = processParams.mrzFormatsFilter;
347
+ result[@"resultTypeOutput"] = processParams.resultTypeOutput;
348
+
349
+ // JSONObject
350
+ result[@"imageQA"] = [self getImageQA:processParams.imageQA];
351
+ result[@"rfidParams"] = [RGLWJSONConstructor generateRFIDParams:processParams.rfidParams];
352
+ result[@"faceApiParams"] = [RGLWJSONConstructor generateFaceAPIParams:processParams.faceApiParams];
353
+ result[@"backendProcessingConfig"] = [RGLWJSONConstructor generateBackendProcessingConfig:processParams.backendProcessingConfig];
354
+ result[@"authenticityParams"] = [self getAuthenticityParams:processParams.authenticityParams];
355
+
356
+ // Custom
357
+ result[@"customParams"] = processParams.customParams;
358
+
359
+ return result;
360
+ }
361
+
362
+ +(void)setCustomization:(NSDictionary*)options :(RGLCustomization*)customization {
363
+ // Boolean
364
+ if([options valueForKey:@"showStatusMessages"] != nil)
365
+ customization.showStatusMessages = [[options valueForKey:@"showStatusMessages"] boolValue];
366
+ if([options valueForKey:@"showResultStatusMessages"] != nil)
367
+ customization.showResultStatusMessages = [[options valueForKey:@"showResultStatusMessages"] boolValue];
368
+ if([options valueForKey:@"showHelpAnimation"] != nil)
369
+ customization.showHelpAnimation = [[options valueForKey:@"showHelpAnimation"] boolValue];
370
+ if([options valueForKey:@"showNextPageAnimation"] != nil)
371
+ customization.showNextPageAnimation = [[options valueForKey:@"showNextPageAnimation"] boolValue];
372
+ if([options valueForKey:@"showBackgroundMask"] != nil)
373
+ customization.showBackgroundMask = [[options valueForKey:@"showBackgroundMask"] boolValue];
374
+
375
+ // Int
376
+ if([options valueForKey:@"cameraFrameBorderWidth"] != nil)
377
+ customization.cameraFrameBorderWidth = [[options valueForKey:@"cameraFrameBorderWidth"] floatValue];
378
+ if([options valueForKey:@"cameraFrameLineLength"] != nil)
379
+ customization.cameraFrameLineLength = [[options valueForKey:@"cameraFrameLineLength"] floatValue];
380
+ if([options valueForKey:@"cameraFrameShapeType"] != nil)
381
+ customization.cameraFrameShapeType = [[options valueForKey:@"cameraFrameShapeType"] integerValue];
382
+ if([options valueForKey:@"cameraFrameOffsetWidth"] != nil)
383
+ customization.cameraFrameOffsetWidth = [[options valueForKey:@"cameraFrameOffsetWidth"] floatValue];
384
+
385
+ // String
386
+ if([options valueForKey:@"status"] != nil)
387
+ customization.status = [options valueForKey:@"status"];
388
+ if([options valueForKey:@"resultStatus"] != nil)
389
+ customization.resultStatus = [options valueForKey:@"resultStatus"];
390
+
391
+ // Color
392
+ if([options valueForKey:@"cameraFrameDefaultColor"] != nil)
393
+ customization.cameraFrameDefaultColor = [self colorWithInt:[options valueForKey:@"cameraFrameDefaultColor"]];
394
+ if([options valueForKey:@"cameraFrameActiveColor"] != nil)
395
+ customization.cameraFrameActiveColor = [self colorWithInt:[options valueForKey:@"cameraFrameActiveColor"]];
396
+ if([options valueForKey:@"statusTextColor"] != nil)
397
+ customization.statusTextColor = [self colorWithInt:[options valueForKey:@"statusTextColor"]];
398
+ if([options valueForKey:@"resultStatusTextColor"] != nil)
399
+ customization.resultStatusTextColor = [self colorWithInt:[options valueForKey:@"resultStatusTextColor"]];
400
+ if([options valueForKey:@"resultStatusBackgroundColor"] != nil)
401
+ customization.resultStatusBackgroundColor = [self colorWithInt:[options valueForKey:@"resultStatusBackgroundColor"]];
402
+ if([options valueForKey:@"multipageButtonBackgroundColor"] != nil)
403
+ customization.multipageButtonBackgroundColor = [self colorWithInt:[options valueForKey:@"multipageButtonBackgroundColor"]];
404
+ if([options valueForKey:@"tintColor"] != nil)
405
+ customization.tintColor = [self colorWithInt:[options valueForKey:@"tintColor"]];
406
+ if([options valueForKey:@"activityIndicatorColor"] != nil)
407
+ customization.activityIndicatorColor = [self colorWithInt:[options valueForKey:@"activityIndicatorColor"]];
408
+ if([options valueForKey:@"statusBackgroundColor"] != nil)
409
+ customization.statusBackgroundColor = [self colorWithInt:[options valueForKey:@"statusBackgroundColor"]];
410
+ if([options valueForKey:@"cameraPreviewBackgroundColor"] != nil)
411
+ customization.cameraPreviewBackgroundColor = [self colorWithInt:[options valueForKey:@"cameraPreviewBackgroundColor"]];
412
+
413
+ // Float
414
+ if([options valueForKey:@"statusPositionMultiplier"] != nil)
415
+ customization.statusPositionMultiplier = [[options valueForKey:@"statusPositionMultiplier"] floatValue];
416
+ if([options valueForKey:@"resultStatusPositionMultiplier"] != nil)
417
+ customization.resultStatusPositionMultiplier = [[options valueForKey:@"resultStatusPositionMultiplier"] floatValue];
418
+ if([options valueForKey:@"toolbarSize"] != nil)
419
+ customization.toolbarSize = [[options valueForKey:@"toolbarSize"] floatValue];
420
+ if([options valueForKey:@"backgroundMaskAlpha"] != nil)
421
+ customization.backgroundMaskAlpha = [[options valueForKey:@"backgroundMaskAlpha"] floatValue];
422
+ if([options valueForKey:@"customStatusPositionMultiplier"] != nil)
423
+ customization.customStatusPositionMultiplier = [[options valueForKey:@"customStatusPositionMultiplier"] floatValue];
424
+ if([options valueForKey:@"cameraFrameVerticalPositionMultiplier"] != nil)
425
+ customization.cameraFrameVerticalPositionMultiplier = [[options valueForKey:@"cameraFrameVerticalPositionMultiplier"] floatValue];
426
+ if([options valueForKey:@"cameraFrameLandscapeAspectRatio"] != nil)
427
+ customization.cameraFrameLandscapeAspectRatio = [[options valueForKey:@"cameraFrameLandscapeAspectRatio"] floatValue];
428
+ if([options valueForKey:@"cameraFramePortraitAspectRatio"] != nil)
429
+ customization.cameraFramePortraitAspectRatio = [[options valueForKey:@"cameraFramePortraitAspectRatio"] floatValue];
430
+ if([options valueForKey:@"cameraFrameCornerRadius"] != nil)
431
+ customization.cameraFrameCornerRadius = [[options valueForKey:@"cameraFrameCornerRadius"] floatValue];
432
+ if([options valueForKey:@"livenessAnimationPositionMultiplier"] != nil)
433
+ customization.livenessAnimationPositionMultiplier = [[options valueForKey:@"livenessAnimationPositionMultiplier"] floatValue];
434
+
435
+ // Drawable
436
+ if([options valueForKey:@"multipageAnimationFrontImage"] != nil)
437
+ customization.multipageAnimationFrontImage = [RGLWJSONConstructor imageWithBase64:[options valueForKey:@"multipageAnimationFrontImage"]];
438
+ if([options valueForKey:@"multipageAnimationBackImage"] != nil)
439
+ customization.multipageAnimationBackImage = [RGLWJSONConstructor imageWithBase64:[options valueForKey:@"multipageAnimationBackImage"]];
440
+ if([options valueForKey:@"borderBackgroundImage"] != nil)
441
+ customization.borderBackgroundImage = [RGLWJSONConstructor imageWithBase64:[options valueForKey:@"borderBackgroundImage"]];
442
+ if([options valueForKey:@"helpAnimationImage"] != nil)
443
+ customization.helpAnimationImage = [RGLWJSONConstructor imageWithBase64:[options valueForKey:@"helpAnimationImage"]];
444
+ if([options valueForKey:@"closeButtonImage"] != nil)
445
+ customization.closeButtonImage = [RGLWJSONConstructor imageWithBase64:[options valueForKey:@"closeButtonImage"]];
446
+ if([options valueForKey:@"captureButtonImage"] != nil)
447
+ customization.captureButtonImage = [RGLWJSONConstructor imageWithBase64:[options valueForKey:@"captureButtonImage"]];
448
+ if([options valueForKey:@"changeFrameButtonCollapseImage"] != nil)
449
+ customization.changeFrameButtonCollapseImage = [RGLWJSONConstructor imageWithBase64:[options valueForKey:@"changeFrameButtonCollapseImage"]];
450
+ if([options valueForKey:@"changeFrameButtonExpandImage"] != nil)
451
+ customization.changeFrameButtonExpandImage = [RGLWJSONConstructor imageWithBase64:[options valueForKey:@"changeFrameButtonExpandImage"]];
452
+ if([options valueForKey:@"cameraSwitchButtonImage"] != nil)
453
+ customization.cameraSwitchButtonImage = [RGLWJSONConstructor imageWithBase64:[options valueForKey:@"cameraSwitchButtonImage"]];
454
+ if([options valueForKey:@"torchButtonOnImage"] != nil)
455
+ customization.torchButtonOnImage = [RGLWJSONConstructor imageWithBase64:[options valueForKey:@"torchButtonOnImage"]];
456
+ if([options valueForKey:@"torchButtonOffImage"] != nil)
457
+ customization.torchButtonOffImage = [RGLWJSONConstructor imageWithBase64:[options valueForKey:@"torchButtonOffImage"]];
458
+ if([options valueForKey:@"livenessAnimationImage"] != nil)
459
+ customization.livenessAnimationImage = [RGLWJSONConstructor imageWithBase64:[options valueForKey:@"livenessAnimationImage"]];
460
+
461
+ // Font
462
+ if([options valueForKey:@"statusTextFont"] != nil)
463
+ customization.statusTextFont = [self UIFontFromJSON:[options valueForKey:@"statusTextFont"]];
464
+ if([options valueForKey:@"resultStatusTextFont"] != nil)
465
+ customization.resultStatusTextFont = [self UIFontFromJSON:[options valueForKey:@"resultStatusTextFont"]];
466
+
467
+ // Custom
468
+ if([options valueForKey:@"customLabelStatus"] != nil)
469
+ customization.customLabelStatus = [[NSAttributedString alloc]initWithString:[options valueForKey:@"customLabelStatus"]];
470
+ if([options valueForKey:@"cameraFrameLineCap"] != nil)
471
+ customization.cameraFrameLineCap = [self lineCapWithNumber:[options valueForKey:@"cameraFrameLineCap"]];
472
+ if([options valueForKey:@"uiCustomizationLayer"] != nil)
473
+ customization.customUILayerJSON = [options valueForKey:@"uiCustomizationLayer"];
474
+
475
+ // ContentMode
476
+ if([options valueForKey:@"helpAnimationImageContentMode"] != nil)
477
+ customization.helpAnimationImageContentMode = [self viewContentModeWithNumber:[options valueForKey:@"helpAnimationImageContentMode"]];
478
+ if([options valueForKey:@"multipageAnimationFrontImageContentMode"] != nil)
479
+ customization.multipageAnimationFrontImageContentMode = [self viewContentModeWithNumber:[options valueForKey:@"multipageAnimationFrontImageContentMode"]];
480
+ if([options valueForKey:@"multipageAnimationBackImageContentMode"] != nil)
481
+ customization.multipageAnimationBackImageContentMode = [self viewContentModeWithNumber:[options valueForKey:@"multipageAnimationBackImageContentMode"]];
482
+ if([options valueForKey:@"livenessAnimationImageContentMode"] != nil)
483
+ customization.livenessAnimationImageContentMode = [self viewContentModeWithNumber:[options valueForKey:@"livenessAnimationImageContentMode"]];
484
+ if([options valueForKey:@"borderBackgroundImageContentMode"] != nil)
485
+ customization.borderBackgroundImageContentMode = [self viewContentModeWithNumber:[options valueForKey:@"borderBackgroundImageContentMode"]];
486
+
487
+ if([options valueForKey:@"colors"] != nil)
488
+ [self setColors:[customization.uiConfiguration valueForKey:@"colors"] input:[options valueForKey:@"colors"]];
489
+ if([options valueForKey:@"fonts"] != nil)
490
+ [self setFonts:[customization.uiConfiguration valueForKey:@"fonts"] input:[options valueForKey:@"fonts"]];
491
+ if([options valueForKey:@"images"] != nil)
492
+ [self setImages:[customization.uiConfiguration valueForKey:@"images"] input:[options valueForKey:@"images"]];
493
+ }
494
+
495
+ +(NSDictionary*)getCustomization:(RGLCustomization*)customization {
496
+ NSMutableDictionary *result = [NSMutableDictionary new];
497
+
498
+ // Boolean
499
+ result[@"showStatusMessages"] = [NSNumber numberWithBool:customization.showStatusMessages];
500
+ result[@"showResultStatusMessages"] = [NSNumber numberWithBool:customization.showResultStatusMessages];
501
+ result[@"showHelpAnimation"] = [NSNumber numberWithBool:customization.showHelpAnimation];
502
+ result[@"showNextPageAnimation"] = [NSNumber numberWithBool:customization.showNextPageAnimation];
503
+ result[@"showBackgroundMask"] = [NSNumber numberWithBool:customization.showBackgroundMask];
504
+
505
+ // Int
506
+ result[@"cameraFrameBorderWidth"] = [NSNumber numberWithFloat:customization.cameraFrameBorderWidth];
507
+ result[@"cameraFrameLineLength"] = [NSNumber numberWithFloat:customization.cameraFrameLineLength];
508
+ result[@"cameraFrameShapeType"] = [NSNumber numberWithFloat:customization.cameraFrameShapeType];
509
+ result[@"cameraFrameOffsetWidth"] = [NSNumber numberWithFloat:customization.cameraFrameOffsetWidth];
510
+
511
+ // String
512
+ result[@"status"] = customization.status;
513
+ result[@"resultStatus"] = customization.resultStatus;
514
+
515
+ // Color
516
+ result[@"cameraFrameDefaultColor"] = [self intWithColor:customization.cameraFrameDefaultColor];
517
+ result[@"cameraFrameActiveColor"] = [self intWithColor:customization.cameraFrameActiveColor];
518
+ result[@"statusTextColor"] = [self intWithColor:customization.statusTextColor];
519
+ result[@"resultStatusTextColor"] = [self intWithColor:customization.resultStatusTextColor];
520
+ result[@"resultStatusBackgroundColor"] = [self intWithColor:customization.resultStatusBackgroundColor];
521
+ result[@"multipageButtonBackgroundColor"] = [self intWithColor:customization.multipageButtonBackgroundColor];
522
+ result[@"tintColor"] = [self intWithColor:customization.tintColor];
523
+ result[@"activityIndicatorColor"] = [self intWithColor:customization.activityIndicatorColor];
524
+ result[@"statusBackgroundColor"] = [self intWithColor:customization.statusBackgroundColor];
525
+ result[@"cameraPreviewBackgroundColor"] = [self intWithColor:customization.cameraPreviewBackgroundColor];
526
+
527
+ // Float
528
+ result[@"statusPositionMultiplier"] = [NSNumber numberWithFloat:customization.statusPositionMultiplier];
529
+ result[@"resultStatusPositionMultiplier"] = [NSNumber numberWithFloat:customization.resultStatusPositionMultiplier];
530
+ result[@"backgroundMaskAlpha"] = [NSNumber numberWithFloat:customization.backgroundMaskAlpha];
531
+ result[@"toolbarSize"] = [NSNumber numberWithFloat:customization.toolbarSize];
532
+ result[@"customStatusPositionMultiplier"] = [NSNumber numberWithFloat:customization.customStatusPositionMultiplier];
533
+ result[@"cameraFrameVerticalPositionMultiplier"] = [NSNumber numberWithFloat:customization.cameraFrameVerticalPositionMultiplier];
534
+ result[@"cameraFrameLandscapeAspectRatio"] = [NSNumber numberWithFloat:customization.cameraFrameLandscapeAspectRatio];
535
+ result[@"cameraFramePortraitAspectRatio"] = [NSNumber numberWithFloat:customization.cameraFramePortraitAspectRatio];
536
+ result[@"cameraFrameCornerRadius"] = [NSNumber numberWithFloat:customization.cameraFrameCornerRadius];
537
+ result[@"livenessAnimationPositionMultiplier"] = [NSNumber numberWithFloat:customization.livenessAnimationPositionMultiplier];
538
+
539
+ // Drawable
540
+ result[@"multipageAnimationFrontImage"] = [RGLWJSONConstructor base64WithImage:customization.multipageAnimationFrontImage];
541
+ result[@"multipageAnimationBackImage"] = [RGLWJSONConstructor base64WithImage:customization.multipageAnimationBackImage];
542
+ result[@"borderBackgroundImage"] = [RGLWJSONConstructor base64WithImage:customization.borderBackgroundImage];
543
+ result[@"helpAnimationImage"] = [RGLWJSONConstructor base64WithImage:customization.helpAnimationImage];
544
+ result[@"closeButtonImage"] = [RGLWJSONConstructor base64WithImage:customization.closeButtonImage];
545
+ result[@"captureButtonImage"] = [RGLWJSONConstructor base64WithImage:customization.captureButtonImage];
546
+ result[@"changeFrameButtonCollapseImage"] = [RGLWJSONConstructor base64WithImage:customization.changeFrameButtonCollapseImage];
547
+ result[@"changeFrameButtonExpandImage"] = [RGLWJSONConstructor base64WithImage:customization.changeFrameButtonExpandImage];
548
+ result[@"cameraSwitchButtonImage"] = [RGLWJSONConstructor base64WithImage:customization.cameraSwitchButtonImage];
549
+ result[@"torchButtonOnImage"] = [RGLWJSONConstructor base64WithImage:customization.torchButtonOnImage];
550
+ result[@"torchButtonOffImage"] = [RGLWJSONConstructor base64WithImage:customization.torchButtonOffImage];
551
+ result[@"livenessAnimationImage"] = [RGLWJSONConstructor base64WithImage:customization.livenessAnimationImage];
552
+
553
+ // Font
554
+ result[@"statusTextFont"] = [self generateUIFont:customization.statusTextFont];
555
+ result[@"resultStatusTextFont"] = [self generateUIFont:customization.resultStatusTextFont];
556
+
557
+ // Custom
558
+ if(customization.customLabelStatus != nil) result[@"customLabelStatus"] = customization.customLabelStatus.string;
559
+ result[@"cameraFrameLineCap"] = [self generateLineCap:customization.cameraFrameLineCap];
560
+ result[@"uiCustomizationLayer"] = customization.customUILayerJSON;
561
+
562
+ // ContentMode
563
+ result[@"helpAnimationImageContentMode"] = [self generateViewContentMode:customization.helpAnimationImageContentMode];
564
+ result[@"multipageAnimationFrontImageContentMode"] = [self generateViewContentMode:customization.multipageAnimationFrontImageContentMode];
565
+ result[@"multipageAnimationBackImageContentMode"] = [self generateViewContentMode:customization.multipageAnimationBackImageContentMode];
566
+ result[@"livenessAnimationImageContentMode"] = [self generateViewContentMode:customization.livenessAnimationImageContentMode];
567
+ result[@"borderBackgroundImageContentMode"] = [self generateViewContentMode:customization.borderBackgroundImageContentMode];
568
+
569
+ result[@"colors"] = [self getColors: [customization.uiConfiguration valueForKey:@"colors"]];
570
+ result[@"fonts"] = [self getFonts: [customization.uiConfiguration valueForKey:@"fonts"]];
571
+ result[@"images"] = [self getImages: [customization.uiConfiguration valueForKey:@"images"]];
572
+
573
+ return result;
574
+ }
575
+
576
+ +(void)setRfidScenario:(NSDictionary*)options :(RGLRFIDScenario*)rfidScenario {
577
+ // Boolean
578
+ if([options valueForKey:@"paceStaticBinding"] != nil)
579
+ rfidScenario.paceStaticBinding = [[options valueForKey:@"paceStaticBinding"] boolValue];
580
+ if([options valueForKey:@"onlineTA"] != nil)
581
+ rfidScenario.onlineTA = [[options valueForKey:@"onlineTA"] boolValue];
582
+ if([options valueForKey:@"writeEid"] != nil)
583
+ rfidScenario.writeEid = [[options valueForKey:@"writeEid"] boolValue];
584
+ if([options valueForKey:@"universalAccessRights"] != nil)
585
+ rfidScenario.universalAccessRights = [[options valueForKey:@"universalAccessRights"] boolValue];
586
+ if([options valueForKey:@"authorizedRestrictedIdentification"] != nil)
587
+ rfidScenario.authorizedRestrictedIdentification = [[options valueForKey:@"authorizedRestrictedIdentification"] boolValue];
588
+ if([options valueForKey:@"auxVerificationCommunityID"] != nil)
589
+ rfidScenario.auxVerificationCommunityID = [[options valueForKey:@"auxVerificationCommunityID"] boolValue];
590
+ if([options valueForKey:@"auxVerificationDateOfBirth"] != nil)
591
+ rfidScenario.auxVerificationDateOfBirth = [[options valueForKey:@"auxVerificationDateOfBirth"] boolValue];
592
+ if([options valueForKey:@"skipAA"] != nil)
593
+ rfidScenario.skipAA = [[options valueForKey:@"skipAA"] boolValue];
594
+ if([options valueForKey:@"strictProcessing"] != nil)
595
+ rfidScenario.strictProcessing = [[options valueForKey:@"strictProcessing"] boolValue];
596
+ if([options valueForKey:@"pkdDSCertPriority"] != nil)
597
+ rfidScenario.pkdDSCertPriority = [[options valueForKey:@"pkdDSCertPriority"] boolValue];
598
+ if([options valueForKey:@"pkdUseExternalCSCA"] != nil)
599
+ rfidScenario.pkdUseExternalCSCA = [[options valueForKey:@"pkdUseExternalCSCA"] boolValue];
600
+ if([options valueForKey:@"trustedPKD"] != nil)
601
+ rfidScenario.trustedPKD = [[options valueForKey:@"trustedPKD"] boolValue];
602
+ if([options valueForKey:@"passiveAuth"] != nil)
603
+ rfidScenario.passiveAuth = [[options valueForKey:@"passiveAuth"] boolValue];
604
+ if([options valueForKey:@"useSFI"] != nil)
605
+ rfidScenario.useSFI = [[options valueForKey:@"useSFI"] boolValue];
606
+ if([options valueForKey:@"readEPassport"] != nil)
607
+ rfidScenario.readEPassport = [[options valueForKey:@"readEPassport"] boolValue];
608
+ if([options valueForKey:@"readEID"] != nil)
609
+ rfidScenario.readEID = [[options valueForKey:@"readEID"] boolValue];
610
+ if([options valueForKey:@"readEDL"] != nil)
611
+ rfidScenario.readEDL = [[options valueForKey:@"readEDL"] boolValue];
612
+ if([options valueForKey:@"authorizedSTSignature"] != nil)
613
+ rfidScenario.authorizedSTSignature = [[options valueForKey:@"authorizedSTSignature"] boolValue];
614
+ if([options valueForKey:@"authorizedSTQSignature"] != nil)
615
+ rfidScenario.authorizedSTQSignature = [[options valueForKey:@"authorizedSTQSignature"] boolValue];
616
+ if([options valueForKey:@"authorizedWriteDG17"] != nil)
617
+ rfidScenario.authorizedWriteDG17 = [[options valueForKey:@"authorizedWriteDG17"] boolValue];
618
+ if([options valueForKey:@"authorizedWriteDG18"] != nil)
619
+ rfidScenario.authorizedWriteDG18 = [[options valueForKey:@"authorizedWriteDG18"] boolValue];
620
+ if([options valueForKey:@"authorizedWriteDG19"] != nil)
621
+ rfidScenario.authorizedWriteDG19 = [[options valueForKey:@"authorizedWriteDG19"] boolValue];
622
+ if([options valueForKey:@"authorizedWriteDG20"] != nil)
623
+ rfidScenario.authorizedWriteDG20 = [[options valueForKey:@"authorizedWriteDG20"] boolValue];
624
+ if([options valueForKey:@"authorizedWriteDG21"] != nil)
625
+ rfidScenario.authorizedWriteDG21 = [[options valueForKey:@"authorizedWriteDG21"] boolValue];
626
+ if([options valueForKey:@"authorizedVerifyAge"] != nil)
627
+ rfidScenario.authorizedVerifyAge = [[options valueForKey:@"authorizedVerifyAge"] boolValue];
628
+ if([options valueForKey:@"authorizedVerifyCommunityID"] != nil)
629
+ rfidScenario.authorizedVerifyCommunityID = [[options valueForKey:@"authorizedVerifyCommunityID"] boolValue];
630
+ if([options valueForKey:@"authorizedPrivilegedTerminal"] != nil)
631
+ rfidScenario.authorizedPrivilegedTerminal = [[options valueForKey:@"authorizedPrivilegedTerminal"] boolValue];
632
+ if([options valueForKey:@"authorizedCANAllowed"] != nil)
633
+ rfidScenario.authorizedCANAllowed = [[options valueForKey:@"authorizedCANAllowed"] boolValue];
634
+ if([options valueForKey:@"authorizedPINManagement"] != nil)
635
+ rfidScenario.authorizedPINManagment = [[options valueForKey:@"authorizedPINManagement"] boolValue];
636
+ if([options valueForKey:@"authorizedInstallCert"] != nil)
637
+ rfidScenario.authorizedInstallCert = [[options valueForKey:@"authorizedInstallCert"] boolValue];
638
+ if([options valueForKey:@"authorizedInstallQCert"] != nil)
639
+ rfidScenario.authorizedInstallQCert = [[options valueForKey:@"authorizedInstallQCert"] boolValue];
640
+ if([options valueForKey:@"applyAmendments"] != nil)
641
+ rfidScenario.applyAmendments = [[options valueForKey:@"applyAmendments"] boolValue];
642
+ if([options valueForKey:@"autoSettings"] != nil)
643
+ rfidScenario.autoSettings = [[options valueForKey:@"autoSettings"] boolValue];
644
+
645
+ // Int
646
+ if([options valueForKey:@"signManagementAction"] != nil)
647
+ rfidScenario.signManagementAction = [[options valueForKey:@"signManagementAction"] integerValue];
648
+ if([options valueForKey:@"readingBuffer"] != nil)
649
+ rfidScenario.readingBuffer = [[options valueForKey:@"readingBuffer"] intValue];
650
+ if([options valueForKey:@"onlineTAToSignDataType"] != nil)
651
+ rfidScenario.onlineTAToSignDataType = [[options valueForKey:@"onlineTAToSignDataType"] intValue];
652
+ if([options valueForKey:@"profilerType"] != nil)
653
+ rfidScenario.profilerType = [[options valueForKey:@"profilerType"] intValue];
654
+ if([options valueForKey:@"authProcType"] != nil)
655
+ rfidScenario.authProcType = [[options valueForKey:@"authProcType"] integerValue];
656
+ if([options valueForKey:@"baseSMProcedure"] != nil)
657
+ rfidScenario.baseSMProcedure = [[options valueForKey:@"baseSMProcedure"] integerValue];
658
+ if([options valueForKey:@"pacePasswordType"] != nil)
659
+ rfidScenario.pacePasswordType = [[options valueForKey:@"pacePasswordType"] integerValue];
660
+ if([options valueForKey:@"terminalType"] != nil)
661
+ rfidScenario.terminalType = [[options valueForKey:@"terminalType"] integerValue];
662
+ if([options valueForKey:@"defaultReadingBufferSize"] != nil)
663
+ rfidScenario.defaultReadingBufferSize = [[options valueForKey:@"defaultReadingBufferSize"] intValue];
664
+
665
+ // String
666
+ if([options valueForKey:@"password"] != nil)
667
+ rfidScenario.password = [options valueForKey:@"password"];
668
+ if([options valueForKey:@"pkdPA"] != nil)
669
+ rfidScenario.pkdPA = [options valueForKey:@"pkdPA"];
670
+ if([options valueForKey:@"pkdEAC"] != nil)
671
+ rfidScenario.pkdEAC = [options valueForKey:@"pkdEAC"];
672
+ if([options valueForKey:@"mrz"] != nil)
673
+ rfidScenario.mrz = [options valueForKey:@"mrz"];
674
+ if([options valueForKey:@"eSignPINDefault"] != nil)
675
+ rfidScenario.eSignPINDefault = [options valueForKey:@"eSignPINDefault"];
676
+ if([options valueForKey:@"eSignPINNewValue"] != nil)
677
+ rfidScenario.eSignPINNewValue = [options valueForKey:@"eSignPINNewValue"];
678
+
679
+ // DataGroup
680
+ if([options valueForKey:@"ePassportDataGroups"] != nil)
681
+ [self setDataGroups :rfidScenario.ePassportDataGroups dict:[options valueForKey:@"ePassportDataGroups"]];
682
+ if([options valueForKey:@"eIDDataGroups"] != nil)
683
+ [self setDataGroups :rfidScenario.eIDDataGroups dict:[options valueForKey:@"eIDDataGroups"]];
684
+ if([options valueForKey:@"eDLDataGroups"] != nil)
685
+ [self setDataGroups :rfidScenario.eDLDataGroups dict:[options valueForKey:@"eDLDataGroups"]];
686
+ }
687
+
688
+ +(NSDictionary*)getRfidScenario:(RGLRFIDScenario*)rfidScenario {
689
+ NSMutableDictionary *result = [NSMutableDictionary new];
690
+
691
+ // Boolean
692
+ result[@"paceStaticBinding"] = [NSNumber numberWithBool:rfidScenario.paceStaticBinding];
693
+ result[@"onlineTA"] = [NSNumber numberWithBool:rfidScenario.onlineTA];
694
+ result[@"writeEid"] = [NSNumber numberWithBool:rfidScenario.writeEid];
695
+ result[@"universalAccessRights"] = [NSNumber numberWithBool:rfidScenario.universalAccessRights];
696
+ result[@"authorizedRestrictedIdentification"] = [NSNumber numberWithBool:rfidScenario.authorizedRestrictedIdentification];
697
+ result[@"auxVerificationCommunityID"] = [NSNumber numberWithBool:rfidScenario.auxVerificationCommunityID];
698
+ result[@"auxVerificationDateOfBirth"] = [NSNumber numberWithBool:rfidScenario.auxVerificationDateOfBirth];
699
+ result[@"skipAA"] = [NSNumber numberWithBool:rfidScenario.skipAA];
700
+ result[@"strictProcessing"] = [NSNumber numberWithBool:rfidScenario.strictProcessing];
701
+ result[@"pkdDSCertPriority"] = [NSNumber numberWithBool:rfidScenario.pkdDSCertPriority];
702
+ result[@"pkdUseExternalCSCA"] = [NSNumber numberWithBool:rfidScenario.pkdUseExternalCSCA];
703
+ result[@"trustedPKD"] = [NSNumber numberWithBool:rfidScenario.trustedPKD];
704
+ result[@"passiveAuth"] = [NSNumber numberWithBool:rfidScenario.passiveAuth];
705
+ result[@"useSFI"] = [NSNumber numberWithBool:rfidScenario.useSFI];
706
+ result[@"readEPassport"] = [NSNumber numberWithBool:rfidScenario.readEPassport];
707
+ result[@"readEID"] = [NSNumber numberWithBool:rfidScenario.readEID];
708
+ result[@"readEDL"] = [NSNumber numberWithBool:rfidScenario.readEDL];
709
+ result[@"authorizedSTSignature"] = [NSNumber numberWithBool:rfidScenario.authorizedSTSignature];
710
+ result[@"authorizedSTQSignature"] = [NSNumber numberWithBool:rfidScenario.authorizedSTQSignature];
711
+ result[@"authorizedWriteDG17"] = [NSNumber numberWithBool:rfidScenario.authorizedWriteDG17];
712
+ result[@"authorizedWriteDG18"] = [NSNumber numberWithBool:rfidScenario.authorizedWriteDG18];
713
+ result[@"authorizedWriteDG19"] = [NSNumber numberWithBool:rfidScenario.authorizedWriteDG19];
714
+ result[@"authorizedWriteDG20"] = [NSNumber numberWithBool:rfidScenario.authorizedWriteDG20];
715
+ result[@"authorizedWriteDG21"] = [NSNumber numberWithBool:rfidScenario.authorizedWriteDG21];
716
+ result[@"authorizedVerifyAge"] = [NSNumber numberWithBool:rfidScenario.authorizedVerifyAge];
717
+ result[@"authorizedVerifyCommunityID"] = [NSNumber numberWithBool:rfidScenario.authorizedVerifyCommunityID];
718
+ result[@"authorizedPrivilegedTerminal"] = [NSNumber numberWithBool:rfidScenario.authorizedPrivilegedTerminal];
719
+ result[@"authorizedCANAllowed"] = [NSNumber numberWithBool:rfidScenario.authorizedCANAllowed];
720
+ result[@"authorizedPINManagement"] = [NSNumber numberWithBool:rfidScenario.authorizedPINManagment];
721
+ result[@"authorizedInstallCert"] = [NSNumber numberWithBool:rfidScenario.authorizedInstallCert];
722
+ result[@"authorizedInstallQCert"] = [NSNumber numberWithBool:rfidScenario.authorizedInstallQCert];
723
+ result[@"applyAmendments"] = [NSNumber numberWithBool:rfidScenario.applyAmendments];
724
+ result[@"autoSettings"] = [NSNumber numberWithBool:rfidScenario.autoSettings];
725
+
726
+ // Int
727
+ result[@"signManagementAction"] = [NSNumber numberWithInteger:rfidScenario.signManagementAction];
728
+ result[@"readingBuffer"] = [NSNumber numberWithInteger:rfidScenario.readingBuffer];
729
+ result[@"onlineTAToSignDataType"] = [NSNumber numberWithInteger:rfidScenario.onlineTAToSignDataType];
730
+ result[@"profilerType"] = [NSNumber numberWithInteger:rfidScenario.profilerType];
731
+ result[@"authProcType"] = [NSNumber numberWithInteger:rfidScenario.authProcType];
732
+ result[@"baseSMProcedure"] = [NSNumber numberWithInteger:rfidScenario.baseSMProcedure];
733
+ result[@"pacePasswordType"] = [NSNumber numberWithInteger:rfidScenario.pacePasswordType];
734
+ result[@"terminalType"] = [NSNumber numberWithInteger:rfidScenario.terminalType];
735
+ result[@"defaultReadingBufferSize"] = [NSNumber numberWithInteger:rfidScenario.defaultReadingBufferSize];
736
+
737
+ // String
738
+ result[@"password"] = rfidScenario.password;
739
+ result[@"pkdPA"] = rfidScenario.pkdPA;
740
+ result[@"pkdEAC"] = rfidScenario.pkdEAC;
741
+ result[@"mrz"] = rfidScenario.mrz;
742
+ result[@"eSignPINDefault"] = rfidScenario.eSignPINDefault;
743
+ result[@"eSignPINNewValue"] = rfidScenario.eSignPINNewValue;
744
+
745
+ // DataGroup
746
+ result[@"eDLDataGroups"] = [self getDataGroups:rfidScenario.eDLDataGroups];
747
+ result[@"ePassportDataGroups"] = [self getDataGroups:rfidScenario.ePassportDataGroups];
748
+ result[@"eIDDataGroups"] = [self getDataGroups:rfidScenario.eIDDataGroups];
749
+
750
+ return result;
751
+ }
752
+
753
+ +(void)setDataGroups:(RGLDataGroup*)dataGroup dict:(NSDictionary*)dict {
754
+
755
+ // EDLDataGroups/Common: 1-14
756
+ if([dict valueForKey:@"DG1"] != nil)
757
+ dataGroup.dG1 = [[dict valueForKey:@"DG1"] boolValue];
758
+ if([dict valueForKey:@"DG2"] != nil)
759
+ dataGroup.dG2 = [[dict valueForKey:@"DG2"] boolValue];
760
+ if([dict valueForKey:@"DG3"] != nil)
761
+ dataGroup.dG3 = [[dict valueForKey:@"DG3"] boolValue];
762
+ if([dict valueForKey:@"DG4"] != nil)
763
+ dataGroup.dG4 = [[dict valueForKey:@"DG4"] boolValue];
764
+ if([dict valueForKey:@"DG5"] != nil)
765
+ dataGroup.dG5 = [[dict valueForKey:@"DG5"] boolValue];
766
+ if([dict valueForKey:@"DG6"] != nil)
767
+ dataGroup.dG6 = [[dict valueForKey:@"DG6"] boolValue];
768
+ if([dict valueForKey:@"DG7"] != nil)
769
+ dataGroup.dG7 = [[dict valueForKey:@"DG7"] boolValue];
770
+ if([dict valueForKey:@"DG8"] != nil)
771
+ dataGroup.dG8 = [[dict valueForKey:@"DG8"] boolValue];
772
+ if([dict valueForKey:@"DG9"] != nil)
773
+ dataGroup.dG9 = [[dict valueForKey:@"DG9"] boolValue];
774
+ if([dict valueForKey:@"DG10"] != nil)
775
+ dataGroup.dG10 = [[dict valueForKey:@"DG10"] boolValue];
776
+ if([dict valueForKey:@"DG11"] != nil)
777
+ dataGroup.dG11 = [[dict valueForKey:@"DG11"] boolValue];
778
+ if([dict valueForKey:@"DG12"] != nil)
779
+ dataGroup.dG12 = [[dict valueForKey:@"DG12"] boolValue];
780
+ if([dict valueForKey:@"DG13"] != nil)
781
+ dataGroup.dG13 = [[dict valueForKey:@"DG13"] boolValue];
782
+ if([dict valueForKey:@"DG14"] != nil)
783
+ dataGroup.dG14 = [[dict valueForKey:@"DG14"] boolValue];
784
+
785
+ // EPassportDataGroups: 1-16
786
+ if ([dataGroup class] == [RGLePassportDataGroup class]) {
787
+ if([dict valueForKey:@"DG15"] != nil)
788
+ ((RGLePassportDataGroup*)dataGroup).dG15 = [[dict valueForKey:@"DG15"] boolValue];
789
+ if([dict valueForKey:@"DG16"] != nil)
790
+ ((RGLePassportDataGroup*)dataGroup).dG16 = [[dict valueForKey:@"DG16"] boolValue];
791
+ }
792
+
793
+ // EIDDataGroups: 1-21
794
+ if ([dataGroup class] == [RGLeIDDataGroup class]) {
795
+ if([dict valueForKey:@"DG15"] != nil)
796
+ ((RGLeIDDataGroup*)dataGroup).dG15 = [[dict valueForKey:@"DG15"] boolValue];
797
+ if([dict valueForKey:@"DG16"] != nil)
798
+ ((RGLeIDDataGroup*)dataGroup).dG16 = [[dict valueForKey:@"DG16"] boolValue];
799
+ if([dict valueForKey:@"DG17"] != nil)
800
+ ((RGLeIDDataGroup*)dataGroup).dG17 = [[dict valueForKey:@"DG17"] boolValue];
801
+ if([dict valueForKey:@"DG18"] != nil)
802
+ ((RGLeIDDataGroup*)dataGroup).dG18 = [[dict valueForKey:@"DG18"] boolValue];
803
+ if([dict valueForKey:@"DG19"] != nil)
804
+ ((RGLeIDDataGroup*)dataGroup).dG19 = [[dict valueForKey:@"DG19"] boolValue];
805
+ if([dict valueForKey:@"DG20"] != nil)
806
+ ((RGLeIDDataGroup*)dataGroup).dG20 = [[dict valueForKey:@"DG20"] boolValue];
807
+ if([dict valueForKey:@"DG21"] != nil)
808
+ ((RGLeIDDataGroup*)dataGroup).dG21 = [[dict valueForKey:@"DG21"] boolValue];
809
+ }
810
+ }
811
+
812
+ +(NSDictionary *)getDataGroups:(RGLDataGroup*)dataGroup {
813
+ NSMutableDictionary *result = [NSMutableDictionary new];
814
+
815
+ // EDLDataGroups/Common: 1-14
816
+ result[@"DG1"] = [NSNumber numberWithBool:dataGroup.dG1];
817
+ result[@"DG2"] = [NSNumber numberWithBool:dataGroup.dG2];
818
+ result[@"DG3"] = [NSNumber numberWithBool:dataGroup.dG3];
819
+ result[@"DG4"] = [NSNumber numberWithBool:dataGroup.dG4];
820
+ result[@"DG5"] = [NSNumber numberWithBool:dataGroup.dG5];
821
+ result[@"DG6"] = [NSNumber numberWithBool:dataGroup.dG6];
822
+ result[@"DG7"] = [NSNumber numberWithBool:dataGroup.dG7];
823
+ result[@"DG8"] = [NSNumber numberWithBool:dataGroup.dG8];
824
+ result[@"DG9"] = [NSNumber numberWithBool:dataGroup.dG9];
825
+ result[@"DG10"] = [NSNumber numberWithBool:dataGroup.dG10];
826
+ result[@"DG11"] = [NSNumber numberWithBool:dataGroup.dG11];
827
+ result[@"DG12"] = [NSNumber numberWithBool:dataGroup.dG12];
828
+ result[@"DG13"] = [NSNumber numberWithBool:dataGroup.dG13];
829
+ result[@"DG14"] = [NSNumber numberWithBool:dataGroup.dG14];
830
+
831
+ // EPassportDataGroups: 1-16
832
+ if ([dataGroup class] == [RGLePassportDataGroup class]) {
833
+ result[@"DG15"] = [NSNumber numberWithBool:((RGLePassportDataGroup*)dataGroup).dG15];
834
+ result[@"DG16"] = [NSNumber numberWithBool:((RGLePassportDataGroup*)dataGroup).dG16];
835
+ }
836
+
837
+ // EIDDataGroups: 1-21
838
+ if ([dataGroup class] == [RGLeIDDataGroup class]) {
839
+ result[@"DG15"] = [NSNumber numberWithBool:((RGLeIDDataGroup*)dataGroup).dG15];
840
+ result[@"DG16"] = [NSNumber numberWithBool:((RGLeIDDataGroup*)dataGroup).dG16];
841
+ result[@"DG17"] = [NSNumber numberWithBool:((RGLeIDDataGroup*)dataGroup).dG17];
842
+ result[@"DG18"] = [NSNumber numberWithBool:((RGLeIDDataGroup*)dataGroup).dG18];
843
+ result[@"DG19"] = [NSNumber numberWithBool:((RGLeIDDataGroup*)dataGroup).dG19];
844
+ result[@"DG20"] = [NSNumber numberWithBool:((RGLeIDDataGroup*)dataGroup).dG20];
845
+ result[@"DG21"] = [NSNumber numberWithBool:((RGLeIDDataGroup*)dataGroup).dG21];
846
+ }
847
+
848
+ return result;
849
+ }
850
+
851
+ +(void)setImageQA:(RGLImageQA*)result input:(NSDictionary*)input {
852
+ if([input valueForKey:@"dpiThreshold"] != nil)
853
+ result.dpiThreshold = [input valueForKey:@"dpiThreshold"];
854
+ if([input valueForKey:@"angleThreshold"] != nil)
855
+ result.angleThreshold = [input valueForKey:@"angleThreshold"];
856
+ if([input valueForKey:@"focusCheck"] != nil)
857
+ result.focusCheck = [input valueForKey:@"focusCheck"];
858
+ if([input valueForKey:@"glaresCheck"] != nil)
859
+ result.glaresCheck = [input valueForKey:@"glaresCheck"];
860
+ if([input valueForKey:@"colornessCheck"] != nil)
861
+ result.colornessCheck = [input valueForKey:@"colornessCheck"];
862
+ if([input valueForKey:@"screenCapture"] != nil)
863
+ result.screenCapture = [input valueForKey:@"screenCapture"];
864
+ if([input valueForKey:@"expectedPass"] != nil){
865
+ NSMutableArray<RGLImageQualityCheckType> *expectedPass = [NSMutableArray new];
866
+ for(NSString* str in [input valueForKey:@"expectedPass"])
867
+ [expectedPass addObject:str];
868
+ result.expectedPass = expectedPass;
869
+ }
870
+ if([input valueForKey:@"documentPositionIndent"] != nil)
871
+ result.documentPositionIndent = [input valueForKey:@"documentPositionIndent"];
872
+ if([input valueForKey:@"glaresCheckParams"] != nil)
873
+ result.glaresCheckParams = [RGLWJSONConstructor glaresCheckParamsFromJson:[input valueForKey:@"glaresCheckParams"]];
874
+ if([input valueForKey:@"brightnessThreshold"] != nil)
875
+ result.brightnessThreshold = [input valueForKey:@"brightnessThreshold"];
876
+ }
877
+
878
+ +(NSDictionary*)getImageQA:(RGLImageQA*)input {
879
+ NSMutableDictionary *result = [NSMutableDictionary new];
880
+
881
+ result[@"dpiThreshold"] = input.dpiThreshold;
882
+ result[@"angleThreshold"] = input.angleThreshold;
883
+ result[@"focusCheck"] = input.focusCheck;
884
+ result[@"glaresCheck"] = input.glaresCheck;
885
+ result[@"colornessCheck"] = input.colornessCheck;
886
+ result[@"screenCapture"] = input.screenCapture;
887
+ result[@"expectedPass"] = input.expectedPass;
888
+ result[@"documentPositionIndent"] = input.documentPositionIndent;
889
+ result[@"glaresCheckParams"] = [RGLWJSONConstructor generateGlaresCheckParams:input.glaresCheckParams];
890
+ result[@"brightnessThreshold"] = input.brightnessThreshold;
891
+
892
+ return result;
893
+ }
894
+
895
+ +(void)setAuthenticityParams:(RGLAuthenticityParams*)result input:(NSDictionary*)input {
896
+ if([input valueForKey:@"useLivenessCheck"] != nil)
897
+ result.useLivenessCheck = [input valueForKey:@"useLivenessCheck"];
898
+ if([input valueForKey:@"livenessParams"] != nil) {
899
+ if(result.livenessParams == nil) result.livenessParams = [RGLLivenessParams defaultParams];
900
+ [self setLivenessParams:result.livenessParams input:[input valueForKey:@"livenessParams"]];
901
+ }
902
+ if([input valueForKey:@"checkUVLuminiscence"] != nil)
903
+ result.checkUVLuminiscence = [input valueForKey:@"checkUVLuminiscence"];
904
+ if([input valueForKey:@"checkIRB900"] != nil)
905
+ result.checkIRB900 = [input valueForKey:@"checkIRB900"];
906
+ if([input valueForKey:@"checkImagePatterns"] != nil)
907
+ result.checkImagePatterns = [input valueForKey:@"checkImagePatterns"];
908
+ if([input valueForKey:@"checkFibers"] != nil)
909
+ result.checkFibers = [input valueForKey:@"checkFibers"];
910
+ if([input valueForKey:@"checkExtMRZ"] != nil)
911
+ result.checkExtMRZ = [input valueForKey:@"checkExtMRZ"];
912
+ if([input valueForKey:@"checkExtOCR"] != nil)
913
+ result.checkExtOCR = [input valueForKey:@"checkExtOCR"];
914
+ if([input valueForKey:@"checkAxial"] != nil)
915
+ result.checkAxial = [input valueForKey:@"checkAxial"];
916
+ if([input valueForKey:@"checkBarcodeFormat"] != nil)
917
+ result.checkBarcodeFormat = [input valueForKey:@"checkBarcodeFormat"];
918
+ if([input valueForKey:@"checkIRVisibility"] != nil)
919
+ result.checkIRVisibility = [input valueForKey:@"checkIRVisibility"];
920
+ if([input valueForKey:@"checkIPI"] != nil)
921
+ result.checkIPI = [input valueForKey:@"checkIPI"];
922
+ if([input valueForKey:@"checkPhotoEmbedding"] != nil)
923
+ result.checkPhotoEmbedding = [input valueForKey:@"checkPhotoEmbedding"];
924
+ if([input valueForKey:@"checkPhotoComparison"] != nil)
925
+ result.checkPhotoComparison = [input valueForKey:@"checkPhotoComparison"];
926
+ if([input valueForKey:@"checkLetterScreen"] != nil)
927
+ result.checkLetterScreen = [input valueForKey:@"checkLetterScreen"];
928
+ }
929
+
930
+ +(NSDictionary*)getAuthenticityParams:(RGLAuthenticityParams*)input {
931
+ if(input == nil) return nil;
932
+ NSMutableDictionary *result = [NSMutableDictionary new];
933
+
934
+ result[@"useLivenessCheck"] = input.useLivenessCheck;
935
+ result[@"livenessParams"] = [self getLivenessParams:input.livenessParams];
936
+ result[@"checkUVLuminiscence"] = input.checkUVLuminiscence;
937
+ result[@"checkIRB900"] = input.checkIRB900;
938
+ result[@"checkImagePatterns"] = input.checkImagePatterns;
939
+ result[@"checkFibers"] = input.checkFibers;
940
+ result[@"checkExtMRZ"] = input.checkExtMRZ;
941
+ result[@"checkExtOCR"] = input.checkExtOCR;
942
+ result[@"checkAxial"] = input.checkAxial;
943
+ result[@"checkBarcodeFormat"] = input.checkBarcodeFormat;
944
+ result[@"checkIRVisibility"] = input.checkIRVisibility;
945
+ result[@"checkIPI"] = input.checkIPI;
946
+ result[@"checkPhotoEmbedding"] = input.checkPhotoEmbedding;
947
+ result[@"checkPhotoComparison"] = input.checkPhotoComparison;
948
+ result[@"checkLetterScreen"] = input.checkLetterScreen;
949
+
950
+ return result;
951
+ }
952
+
953
+ +(void)setLivenessParams:(RGLLivenessParams*)result input:(NSDictionary*)input {
954
+ if([input valueForKey:@"checkOVI"] != nil)
955
+ result.checkOVI = [input valueForKey:@"checkOVI"];
956
+ if([input valueForKey:@"checkMLI"] != nil)
957
+ result.checkMLI = [input valueForKey:@"checkMLI"];
958
+ if([input valueForKey:@"checkHolo"] != nil)
959
+ result.checkHolo = [input valueForKey:@"checkHolo"];
960
+ if([input valueForKey:@"checkED"] != nil)
961
+ result.checkED = [input valueForKey:@"checkED"];
962
+ }
963
+
964
+ +(NSDictionary*)getLivenessParams:(RGLLivenessParams*)input {
965
+ if(input == nil) return nil;
966
+ NSMutableDictionary *result = [NSMutableDictionary new];
967
+
968
+ result[@"checkOVI"] = input.checkOVI;
969
+ result[@"checkMLI"] = input.checkMLI;
970
+ result[@"checkHolo"] = input.checkHolo;
971
+ result[@"checkED"] = input.checkED;
972
+
973
+ return result;
974
+ }
975
+
976
+ +(void)setColors:(NSMutableDictionary*)result input:(NSDictionary*)input {
977
+ if([input valueForKey:@"rfidProcessingScreenBackground"] != nil)
978
+ result[@(RFIDProcessingScreenBackground)] = [self colorWithInt:[input valueForKey:@"rfidProcessingScreenBackground"]];
979
+ if([input valueForKey:@"rfidProcessingScreenHintLabelText"] != nil)
980
+ result[@(RFIDProcessingScreenHintLabelText)] = [self colorWithInt:[input valueForKey:@"rfidProcessingScreenHintLabelText"]];
981
+ if([input valueForKey:@"rfidProcessingScreenHintLabelBackground"] != nil)
982
+ result[@(RFIDProcessingScreenHintLabelBackground)] = [self colorWithInt:[input valueForKey:@"rfidProcessingScreenHintLabelBackground"]];
983
+ if([input valueForKey:@"rfidProcessingScreenProgressLabelText"] != nil)
984
+ result[@(RFIDProcessingScreenProgressLabelText)] = [self colorWithInt:[input valueForKey:@"rfidProcessingScreenProgressLabelText"]];
985
+ if([input valueForKey:@"rfidProcessingScreenProgressBar"] != nil)
986
+ result[@(RFIDProcessingScreenProgressBar)] = [self colorWithInt:[input valueForKey:@"rfidProcessingScreenProgressBar"]];
987
+ if([input valueForKey:@"rfidProcessingScreenProgressBarBackground"] != nil)
988
+ result[@(RFIDProcessingScreenProgressBarBackground)] = [self colorWithInt:[input valueForKey:@"rfidProcessingScreenProgressBarBackground"]];
989
+ if([input valueForKey:@"rfidProcessingScreenResultLabelText"] != nil)
990
+ result[@(RFIDProcessingScreenResultLabelText)] = [self colorWithInt:[input valueForKey:@"rfidProcessingScreenResultLabelText"]];
991
+ }
992
+
993
+ +(NSDictionary*)getColors:(NSDictionary*)input {
994
+ return @{
995
+ @"rfidProcessingScreenBackground": [self intWithColor:input[@(RFIDProcessingScreenBackground)]],
996
+ @"rfidProcessingScreenHintLabelText": [self intWithColor:input[@(RFIDProcessingScreenHintLabelText)]],
997
+ @"rfidProcessingScreenHintLabelBackground": [self intWithColor:input[@(RFIDProcessingScreenHintLabelBackground)]],
998
+ @"rfidProcessingScreenProgressLabelText": [self intWithColor:input[@(RFIDProcessingScreenProgressLabelText)]],
999
+ @"rfidProcessingScreenProgressBar": [self intWithColor:input[@(RFIDProcessingScreenProgressBar)]],
1000
+ @"rfidProcessingScreenProgressBarBackground": [self intWithColor:input[@(RFIDProcessingScreenProgressBarBackground)]],
1001
+ @"rfidProcessingScreenResultLabelText": [self intWithColor:input[@(RFIDProcessingScreenResultLabelText)]],
1002
+ };
1003
+ }
1004
+
1005
+ +(void)setFonts:(NSMutableDictionary*)result input:(NSDictionary*)input {
1006
+ if([input valueForKey:@"rfidProcessingScreenHintLabel"] != nil)
1007
+ result[@(RFIDProcessingScreenHintLabel)] = [self UIFontFromJSON:[input valueForKey:@"rfidProcessingScreenHintLabel"]];
1008
+ if([input valueForKey:@"rfidProcessingScreenProgressLabel"] != nil)
1009
+ result[@(RFIDProcessingScreenProgressLabel)] = [self UIFontFromJSON:[input valueForKey:@"rfidProcessingScreenProgressLabel"]];
1010
+ if([input valueForKey:@"rfidProcessingScreenResultLabel"] != nil)
1011
+ result[@(RFIDProcessingScreenResultLabel)] = [self UIFontFromJSON:[input valueForKey:@"rfidProcessingScreenResultLabel"]];
1012
+ }
1013
+
1014
+ +(NSDictionary*)getFonts:(NSDictionary*)input {
1015
+ return @{
1016
+ @"rfidProcessingScreenHintLabel": [self generateUIFont:input[@(RFIDProcessingScreenHintLabel)]],
1017
+ @"rfidProcessingScreenProgressLabel": [self generateUIFont:input[@(RFIDProcessingScreenProgressLabel)]],
1018
+ @"rfidProcessingScreenResultLabel": [self generateUIFont:input[@(RFIDProcessingScreenResultLabel)]],
1019
+ };
1020
+ }
1021
+
1022
+ +(void)setImages:(NSMutableDictionary*)result input:(NSDictionary*)input {
1023
+ if([input valueForKey:@"rfidProcessingScreenFailureImage"] != nil)
1024
+ result[@(RFIDProcessingScreenFailureImage)] = [RGLWJSONConstructor imageWithBase64:[input valueForKey:@"rfidProcessingScreenFailureImage"]];
1025
+ }
1026
+
1027
+ +(NSDictionary*)getImages:(NSDictionary*)input {
1028
+ return @{
1029
+ @"rfidProcessingScreenFailureImage": [RGLWJSONConstructor base64WithImage:input[@(RFIDProcessingScreenFailureImage)]],
1030
+ };
1031
+ }
1032
+
1033
+ +(UIColor*)colorWithInt:(NSNumber*)input {
1034
+ // Convert hex int to hex string
1035
+ NSInteger hexInt = [input integerValue];
1036
+ NSString* numbers = @"0123456789ABCDEF";
1037
+ NSString* hexString = @"";
1038
+ while(hexInt>0){
1039
+ int digit = hexInt % 16;
1040
+ hexString = [NSString stringWithFormat:@"%@%@", [numbers substringWithRange:NSMakeRange(digit, 1)], hexString];
1041
+ hexInt = hexInt/16;
1042
+ }
1043
+ // If we use int, then all the starting zeros are lost: 0x0F123456 == 0xF123456
1044
+ if(hexString.length == 5 || hexString.length == 7)
1045
+ hexString = [NSString stringWithFormat:@"0%@", hexString];
1046
+ hexString = [NSString stringWithFormat:@"#%@", hexString];
1047
+
1048
+ // Convert hex string to UIColor
1049
+ NSString *colorString = [[hexString stringByReplacingOccurrencesOfString: @"#" withString: @""] uppercaseString];
1050
+ CGFloat alpha, red, blue, green;
1051
+ switch ([colorString length]) {
1052
+ case 3: // #RGB
1053
+ alpha = 1.0f;
1054
+ red = [self colorComponentFrom: colorString start: 0 length: 1];
1055
+ green = [self colorComponentFrom: colorString start: 1 length: 1];
1056
+ blue = [self colorComponentFrom: colorString start: 2 length: 1];
1057
+ break;
1058
+ case 4: // #ARGB
1059
+ alpha = [self colorComponentFrom: colorString start: 0 length: 1];
1060
+ red = [self colorComponentFrom: colorString start: 1 length: 1];
1061
+ green = [self colorComponentFrom: colorString start: 2 length: 1];
1062
+ blue = [self colorComponentFrom: colorString start: 3 length: 1];
1063
+ break;
1064
+ case 6: // #RRGGBB
1065
+ alpha = 1.0f;
1066
+ red = [self colorComponentFrom: colorString start: 0 length: 2];
1067
+ green = [self colorComponentFrom: colorString start: 2 length: 2];
1068
+ blue = [self colorComponentFrom: colorString start: 4 length: 2];
1069
+ break;
1070
+ case 8: // #AARRGGBB
1071
+ alpha = [self colorComponentFrom: colorString start: 0 length: 2];
1072
+ red = [self colorComponentFrom: colorString start: 2 length: 2];
1073
+ green = [self colorComponentFrom: colorString start: 4 length: 2];
1074
+ blue = [self colorComponentFrom: colorString start: 6 length: 2];
1075
+ break;
1076
+ default:
1077
+ [NSException raise:@"Invalid color value" format: @"Color value %@ is invalid. It should be a hex value of the form #RBG, #ARGB, #RRGGBB, or #AARRGGBB", hexString];
1078
+ break;
1079
+ }
1080
+ return [UIColor colorWithRed: red green: green blue: blue alpha: alpha];
1081
+ }
1082
+
1083
+ +(CGFloat)colorComponentFrom:(NSString*)string start:(NSUInteger)start length:(NSUInteger)length {
1084
+ NSString *substring = [string substringWithRange: NSMakeRange(start, length)];
1085
+ NSString *fullHex = length == 2 ? substring : [NSString stringWithFormat: @"%@%@", substring, substring];
1086
+ unsigned hexComponent;
1087
+ [[NSScanner scannerWithString: fullHex] scanHexInt: &hexComponent];
1088
+ return hexComponent / 255.0;
1089
+ }
1090
+
1091
+ +(NSNumber*)intWithColor:(UIColor*)color {
1092
+ if(color == nil) return nil;
1093
+
1094
+ const CGFloat *components = CGColorGetComponents(color.CGColor);
1095
+ CGFloat r = components[0];
1096
+ CGFloat g = components[1];
1097
+ CGFloat b = components[2];
1098
+ CGFloat a = components[3];
1099
+
1100
+ NSString* hexString = [NSString stringWithFormat:@"#%02lX%02lX%02lX%02lX",
1101
+ lroundf(a * 255),
1102
+ lroundf(r * 255),
1103
+ lroundf(g * 255),
1104
+ lroundf(b * 255)];
1105
+
1106
+ unsigned int hexInt = 0;
1107
+ NSScanner *scanner = [NSScanner scannerWithString:hexString];
1108
+ [scanner setCharactersToBeSkipped:[NSCharacterSet characterSetWithCharactersInString:@"#"]];
1109
+ [scanner scanHexInt:&hexInt];
1110
+
1111
+ return [NSNumber numberWithInteger:hexInt];
1112
+ }
1113
+
1114
+ +(UIFont*)UIFontFromJSON:(NSDictionary*)input {
1115
+ return [UIFont fontWithName:[input valueForKey:@"name"] size:[[input valueForKey:@"size"] integerValue]];
1116
+ }
1117
+
1118
+ +(NSDictionary*)generateUIFont:(UIFont*)input {
1119
+ return @{
1120
+ @"name": input.fontName,
1121
+ @"size": @(input.pointSize)
1122
+ };
1123
+ }
1124
+
1125
+ +(AVCaptureSessionPreset)captureSessionPresetWithNumber:(NSNumber*)value {
1126
+ int input = [value intValue];
1127
+ if(input == 0) return AVCaptureSessionPresetLow;
1128
+ if(input == 1) return AVCaptureSessionPresetMedium;
1129
+ if(input == 2) return AVCaptureSessionPresetHigh;
1130
+ if(input == 3) return AVCaptureSessionPresetPhoto;
1131
+ if(input == 4) return AVCaptureSessionPresetInputPriority;
1132
+ if(input == 6) return AVCaptureSessionPreset1280x720;
1133
+ if(input == 7) return AVCaptureSessionPreset1920x1080;
1134
+ if(input == 8) return AVCaptureSessionPreset3840x2160;
1135
+ if(input == 9) return AVCaptureSessionPresetiFrame960x540;
1136
+ if(input == 10) return AVCaptureSessionPresetiFrame1280x720;
1137
+ if(input == 12) return AVCaptureSessionPreset640x480;
1138
+ if(input == 13) return AVCaptureSessionPreset352x288;
1139
+ return AVCaptureSessionPreset1920x1080;
1140
+ }
1141
+
1142
+ +(NSNumber*)generateCaptureSessionPreset:(AVCaptureSessionPreset)value {
1143
+ if(value == AVCaptureSessionPresetLow) return @0;
1144
+ if(value == AVCaptureSessionPresetMedium) return @1;
1145
+ if(value == AVCaptureSessionPresetHigh) return @2;
1146
+ if(value == AVCaptureSessionPresetPhoto) return @3;
1147
+ if(value == AVCaptureSessionPresetInputPriority) return @4;
1148
+ if(value == AVCaptureSessionPreset1280x720) return @6;
1149
+ if(value == AVCaptureSessionPreset1920x1080) return @7;
1150
+ if(value == AVCaptureSessionPreset3840x2160) return @8;
1151
+ if(value == AVCaptureSessionPresetiFrame960x540) return @9;
1152
+ if(value == AVCaptureSessionPresetiFrame1280x720) return @10;
1153
+ if(value == AVCaptureSessionPreset640x480) return @12;
1154
+ if(value == AVCaptureSessionPreset352x288) return @13;
1155
+ return @0;
1156
+ }
1157
+
1158
+ +(CGLineCap)lineCapWithNumber:(NSNumber*)value {
1159
+ int input = [value intValue];
1160
+ if(input == 0) return kCGLineCapButt;
1161
+ if(input == 1) return kCGLineCapRound;
1162
+ if(input == 2) return kCGLineCapSquare;
1163
+ return kCGLineCapButt;
1164
+ }
1165
+
1166
+ +(NSNumber*)generateLineCap:(CGLineCap)value {
1167
+ if(value == kCGLineCapButt) return @0;
1168
+ if(value == kCGLineCapRound) return @1;
1169
+ if(value == kCGLineCapSquare) return @2;
1170
+ return @0;;
1171
+ }
1172
+
1173
+ +(UIInterfaceOrientationMask)interfaceOrientationMaskWithNumber:(NSNumber*)value {
1174
+ int input = [value intValue];
1175
+ if(input == 0) return UIInterfaceOrientationMaskPortrait;
1176
+ if(input == 1) return UIInterfaceOrientationMaskLandscapeLeft;
1177
+ if(input == 2) return UIInterfaceOrientationMaskLandscapeRight;
1178
+ if(input == 3) return UIInterfaceOrientationMaskPortraitUpsideDown;
1179
+ if(input == 4) return UIInterfaceOrientationMaskLandscape;
1180
+ if(input == 5) return UIInterfaceOrientationMaskAll;
1181
+ if(input == 6) return UIInterfaceOrientationMaskAllButUpsideDown;
1182
+ return UIInterfaceOrientationMaskPortrait;
1183
+ }
1184
+
1185
+ +(NSNumber*)generateInterfaceOrientationMask:(UIInterfaceOrientationMask)value {
1186
+ if(value == UIInterfaceOrientationMaskPortrait) return @0;
1187
+ if(value == UIInterfaceOrientationMaskLandscapeLeft) return @1;
1188
+ if(value == UIInterfaceOrientationMaskLandscapeRight) return @2;
1189
+ if(value == UIInterfaceOrientationMaskPortraitUpsideDown) return @3;
1190
+ if(value == UIInterfaceOrientationMaskLandscape) return @4;
1191
+ if(value == UIInterfaceOrientationMaskAll) return @5;
1192
+ if(value == UIInterfaceOrientationMaskAllButUpsideDown) return @6;
1193
+ return @0;
1194
+ }
1195
+
1196
+ +(AVCaptureDevicePosition)captureDevicePositionWithNumber:(NSNumber*)value {
1197
+ int input = [value intValue];
1198
+ if(input == 0) return AVCaptureDevicePositionUnspecified;
1199
+ if(input == 1) return AVCaptureDevicePositionBack;
1200
+ if(input == 2) return AVCaptureDevicePositionFront;
1201
+ return AVCaptureDevicePositionUnspecified;
1202
+ }
1203
+
1204
+ +(NSNumber*)generateCaptureDevicePosition:(AVCaptureDevicePosition)value {
1205
+ if(value == AVCaptureDevicePositionUnspecified) return @0;
1206
+ if(value == AVCaptureDevicePositionBack) return @1;
1207
+ if(value == AVCaptureDevicePositionFront) return @2;
1208
+ return @0;
1209
+ }
1210
+
1211
+ +(UIViewContentMode)viewContentModeWithNumber:(NSNumber*)value {
1212
+ int input = [value intValue];
1213
+ if(input == 0) return UIViewContentModeScaleToFill;
1214
+ if(input == 1) return UIViewContentModeScaleAspectFit;
1215
+ if(input == 2) return UIViewContentModeScaleAspectFill;
1216
+ if(input == 3) return UIViewContentModeRedraw;
1217
+ if(input == 4) return UIViewContentModeCenter;
1218
+ if(input == 5) return UIViewContentModeTop;
1219
+ if(input == 6) return UIViewContentModeBottom;
1220
+ if(input == 7) return UIViewContentModeLeft;
1221
+ if(input == 8) return UIViewContentModeRight;
1222
+ if(input == 9) return UIViewContentModeTopLeft;
1223
+ if(input == 10) return UIViewContentModeTopRight;
1224
+ if(input == 11) return UIViewContentModeBottomLeft;
1225
+ if(input == 12) return UIViewContentModeBottomRight;
1226
+ return UIViewContentModeCenter;
1227
+ }
1228
+
1229
+ +(NSNumber*)generateViewContentMode:(UIViewContentMode)value {
1230
+ if(value == UIViewContentModeScaleToFill) return @0;
1231
+ if(value == UIViewContentModeScaleAspectFit) return @1;
1232
+ if(value == UIViewContentModeScaleAspectFill) return @2;
1233
+ if(value == UIViewContentModeRedraw) return @3;
1234
+ if(value == UIViewContentModeCenter) return @4;
1235
+ if(value == UIViewContentModeTop) return @5;
1236
+ if(value == UIViewContentModeBottom) return @6;
1237
+ if(value == UIViewContentModeLeft) return @7;
1238
+ if(value == UIViewContentModeRight) return @8;
1239
+ if(value == UIViewContentModeTopLeft) return @9;
1240
+ if(value == UIViewContentModeTopRight) return @10;
1241
+ if(value == UIViewContentModeBottomLeft) return @11;
1242
+ if(value == UIViewContentModeBottomRight) return @12;
1243
+ return @4;
1244
+ }
1245
+
1246
+ +(RGLDocReaderFrame)docReaderFrameWithString:(NSString*)value {
1247
+ if([value isEqual: @"id1"]) return RGLDocReaderFrameScenarioDefault;
1248
+ if([value isEqual: @"max"]) return RGLDocReaderFrameMax;
1249
+ if([value isEqual: @"none"]) return RGLDocReaderFrameNone;
1250
+ if([value isEqual: @"document"]) return RGLDocReaderFrameDocument;
1251
+ return RGLDocReaderFrameNone;
1252
+ }
1253
+
1254
+ +(NSString*)generateDocReaderFrame:(RGLDocReaderFrame)value {
1255
+ if(value == RGLDocReaderFrameScenarioDefault) return @"id1";
1256
+ if(value == RGLDocReaderFrameMax) return @"max";
1257
+ if(value == RGLDocReaderFrameNone) return @"none";
1258
+ if(value == RGLDocReaderFrameDocument) return @"document";
1259
+ return @"none";
1260
+ }
1261
+
1262
+ +(RGLTextProcessing*)textProcessingWithNumber:(NSNumber*)value {
1263
+ int input = [value intValue];
1264
+ if(input == 0) return RGLTextProcessing.noChange;
1265
+ if(input == 1) return RGLTextProcessing.uppercase;
1266
+ if(input == 2) return RGLTextProcessing.lowercase;
1267
+ if(input == 3) return RGLTextProcessing.capital;
1268
+ return RGLTextProcessing.noChange;
1269
+ }
1270
+
1271
+ +(NSNumber*)generateWithTextProcessing:(RGLTextProcessing*)value {
1272
+ return [value valueForKey:@"rawValue"];
1273
+ }
1274
+
1275
+ +(NSNumber*)generateDocReaderAction:(RGLDocReaderAction)value {
1276
+ if(value == RGLDocReaderActionComplete) return @0;
1277
+ if(value == RGLDocReaderActionProcess) return @1;
1278
+ if(value == RGLDocReaderActionMorePagesAvailable) return @2;
1279
+ if(value == RGLDocReaderActionCancel) return @3;
1280
+ if(value == RGLDocReaderActionError) return @4;
1281
+ if(value == RGLDocReaderActionProcessWhiteFlashLight) return @5;
1282
+ if(value == RGLDocReaderActionProcessTimeout) return @6;
1283
+ if(value == RGLDocReaderActionProcessOnServer) return @7;
1284
+ return @4;
1285
+ }
1286
+
1287
+ +(NSNumber*)generateRFIDCompleteAction:(RGLRFIDCompleteAction)value {
1288
+ if(value == RGLRFIDCompleteActionComplete) return @0;
1289
+ if(value == RGLRFIDCompleteActionError) return @4;
1290
+ if(value == RGLRFIDCompleteActionCancel) return @3;
1291
+ if(value == RGLRFIDCompleteActionSessionRestarted) return @0;
1292
+ return @0;
1293
+ }
1294
+
1295
+ +(NSNumber*)generateImageQualityCheckType:(RGLImageQualityCheckType)value {
1296
+ if(value == RGLImageQualityCheckTypeImageGlares) return @0;
1297
+ if(value == RGLImageQualityCheckTypeImageFocus) return @1;
1298
+ if(value == RGLImageQualityCheckTypeImageResolution) return @2;
1299
+ if(value == RGLImageQualityCheckTypeImageColorness) return @3;
1300
+ if(value == RGLImageQualityCheckTypeImagePerspective) return @4;
1301
+ if(value == RGLImageQualityCheckTypeImageBounds) return @5;
1302
+ if(value == RGLImageQualityCheckTypeScreenCapture) return @6;
1303
+ if(value == RGLImageQualityCheckTypePortrait) return @7;
1304
+ if(value == RGLImageQualityCheckTypeHandwritten) return @8;
1305
+ if(value == RGLImageQualityCheckTypeBrightness) return @9;
1306
+ return 0;
1307
+ }
1308
+
1309
+ +(RGLImageQualityCheckType)imageQualityCheckTypeWithNumber:(NSNumber*)input {
1310
+ if(input == nil) return nil;
1311
+ int value = [input intValue];
1312
+ if(value == 0) return RGLImageQualityCheckTypeImageGlares;
1313
+ if(value == 1) return RGLImageQualityCheckTypeImageFocus;
1314
+ if(value == 2) return RGLImageQualityCheckTypeImageResolution;
1315
+ if(value == 3) return RGLImageQualityCheckTypeImageColorness;
1316
+ if(value == 4) return RGLImageQualityCheckTypeImagePerspective;
1317
+ if(value == 5) return RGLImageQualityCheckTypeImageBounds;
1318
+ if(value == 6) return RGLImageQualityCheckTypeScreenCapture;
1319
+ if(value == 7) return RGLImageQualityCheckTypePortrait;
1320
+ if(value == 8) return RGLImageQualityCheckTypeHandwritten;
1321
+ if(value == 9) return RGLImageQualityCheckTypeBrightness;
1322
+ return RGLImageQualityCheckTypeImageGlares;
1323
+ }
1324
+
1325
+ @end