@@ -13,6 +13,7 @@ import android.util.Pair
1313import com.regula.common.exception.RegulaException
1414import com.regula.documentreader.api.License
1515import com.regula.documentreader.api.completions.model.PrepareProgress
16+ import com.regula.documentreader.api.config.FinalizeConfig
1617import com.regula.documentreader.api.config.RecognizeConfig
1718import com.regula.documentreader.api.config.ScannerConfig
1819import com.regula.documentreader.api.enums.BarcodeType
@@ -1861,6 +1862,7 @@ fun documentReaderResultsFromJSON(input: JSONObject?) = input?.let {
18611862 result.mrzPosition = it.optJSONArray(" mrzPosition" ).toList(::elementPositionFromJSON)!!
18621863 result.imageQuality = it.optJSONArray(" imageQuality" ).toList(::imageQualityGroupFromJSON)!!
18631864 result.rawResult = it.optString(" rawResult" )
1865+ result.bsiTr03135Results = it.optString(" bsiTr03135Results" )
18641866 result.rfidSessionData = rfidSessionDataFromJSON(it.optJSONObject(" rfidSessionData" ))
18651867 result.authenticityResult = documentReaderAuthenticityResultFromJSON(it.optJSONObject(" authenticityResult" ))
18661868 result.barcodeResult = documentReaderBarcodeResultFromJSON(it.optJSONObject(" barcodeResult" ))
@@ -1888,6 +1890,7 @@ fun generateDocumentReaderResults(input: DocumentReaderResults?) = input?.let {
18881890 " mrzPosition" to it.mrzPosition.toJson(::generateElementPosition),
18891891 " imageQuality" to it.imageQuality.toJson(::generateImageQualityGroup),
18901892 " rawResult" to it.rawResult,
1893+ " bsiTr03135Results" to it.bsiTr03135Results,
18911894 " rfidSessionData" to generateRFIDSessionData(it.rfidSessionData),
18921895 " authenticityResult" to generateDocumentReaderAuthenticityResult(it.authenticityResult),
18931896 " barcodeResult" to generateDocumentReaderBarcodeResult(it.barcodeResult),
@@ -1959,7 +1962,7 @@ fun generateDeviceEngagement(input: DeviceEngagement?) = input?.let {
19591962fun nameSpaceMDLFromJSON (input : JSONObject ? ) = input?.let {
19601963 val result = NameSpaceMDL (it.getString(" name" ))
19611964 it.getJSONObject(" map" ).forEach { key, value ->
1962- result.addField(key, eMDLIntentToRetain.values()[value as Int ])
1965+ result.addField(key, eMDLIntentToRetain.values()[value.toInt() ])
19631966 }
19641967 result
19651968}
@@ -1997,8 +2000,8 @@ fun generateDocumentRequestMDL(input: DocumentRequestMDL?): JSONObject? = input?
19972000fun documentRequest18013MDLFromJSON (input : JSONObject ? ) = input?.let {
19982001 val result = DocumentRequest18013MDL ()
19992002
2000- result.setPrivateProperty(" docType" , it.getString(" docType" ))
2001- result.setPrivateProperty(" nameSpaceMDLs" , it.getJSONArray(" namespaces" ).toList(::nameSpaceMDLFromJSON))
2003+ if (it.has( " docType " )) result.setPrivateProperty(" docType" , it.getString(" docType" ))
2004+ if (it.has( " namespaces " )) result.setPrivateProperty(" nameSpaceMDLs" , it.getJSONArray(" namespaces" ).toList(::nameSpaceMDLFromJSON))
20022005 result.familyName = it.getIntOrNull(" familyName" )?.let { enm -> eMDLIntentToRetain.values()[enm] }
20032006 result.givenName = it.getIntOrNull(" givenName" )?.let { enm -> eMDLIntentToRetain.values()[enm] }
20042007 result.birthDate = it.getIntOrNull(" birthDate" )?.let { enm -> eMDLIntentToRetain.values()[enm] }
@@ -2102,3 +2105,19 @@ fun generateDeviceEngagementCompletion(deviceEngagement: DeviceEngagement?, erro
21022105 " deviceEngagement" to generateDeviceEngagement(deviceEngagement),
21032106 " error" to generateRegulaException(error)
21042107)
2108+
2109+ fun finalizeConfigFromJSON (input : JSONObject ? ) = input?.let {
2110+ val result = FinalizeConfig .Builder ()
2111+ if (it.has(" rawImages" )) result.setRawImages(it.getBoolean(" rawImages" ))
2112+ if (it.has(" video" )) result.setVideo(it.getBoolean(" video" ))
2113+ if (it.has(" rfidSession" )) result.setRfidSession(it.getBoolean(" rfidSession" ))
2114+ result.build()
2115+ }
2116+
2117+ fun generateFinalizeConfig (input : FinalizeConfig ? ) = input?.let {
2118+ mapOf (
2119+ " rawImages" to it.getPrivateProperty(" rawImages" ),
2120+ " video" to it.getPrivateProperty(" video" ),
2121+ " rfidSession" to it.getPrivateProperty(" rfidSession" )
2122+ ).toJson()
2123+ }
0 commit comments