Skip to content

Commit

Permalink
Merge pull request #163 from niscy-eudiw/main
Browse files Browse the repository at this point in the history
fixed user pseudonym attribute from age attestation to be decoded cor…
  • Loading branch information
stzouvaras authored Jul 31, 2024
2 parents 943dfbc + 6011021 commit baeacca
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@ object DocumentJsonKeys {
const val LAST_NAME = "family_name"
const val PORTRAIT = "portrait"
const val SIGNATURE = "signature_usual_mark"
const val VEHICLE_CATEGORY = "vehicle_category_code"
const val ISSUE_DATE = "issue_date"
const val EXPIRY_DATE = "expiry_date"
const val GENDER = "gender"
const val SEX = "sex"
const val USER_PSEUDONYM = "user_pseudonym"
private const val GENDER = "gender"
private const val SEX = "sex"

val GENDER_KEYS: List<String> = listOf(GENDER, SEX)
val BASE64_IMAGE_KEYS: List<String> = listOf(PORTRAIT, SIGNATURE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package eu.europa.ec.commonfeature.util

import eu.europa.ec.businesslogic.extension.decodeFromBase64
import eu.europa.ec.businesslogic.util.getStringFromJsonOrEmpty
import eu.europa.ec.businesslogic.util.toDateFormatted
import eu.europa.ec.businesslogic.util.toLocalDate
Expand Down Expand Up @@ -69,6 +70,10 @@ fun keyIsBase64(key: String): Boolean {
return listOfBase64Keys.contains(key)
}

private fun keyIsUserPseudonym(key: String): Boolean {
return key == DocumentJsonKeys.USER_PSEUDONYM
}

private fun keyIsGender(key: String): Boolean {
val listOfGenderKeys = DocumentJsonKeys.GENDER_KEYS
return listOfGenderKeys.contains(key)
Expand Down Expand Up @@ -147,6 +152,10 @@ fun parseKeyValueUi(
getGenderValue(json.toString(), resourceProvider)
}

keyIsUserPseudonym(groupIdentifier) -> {
json.toString().decodeFromBase64()
}

date != null && keyIdentifier.isEmpty() -> {
date
}
Expand Down

0 comments on commit baeacca

Please sign in to comment.