ministero-salute / it-dgc-verificac19-sdk-android

Digital Covid Certificate SDK
Apache License 2.0
57 stars 30 forks source link

Recovery Validity Period Check Error #63

Closed fricoepolenta closed 1 year ago

fricoepolenta commented 2 years ago

Describe the bug In function checkRecoveryStatements (/sdk/src/main/java/it/ministerodellasalute/verificaC19sdk/model/VerificationViewModel.kt) the end date (for certificates valid just in Italy) is calculated by adding getRecoveryCertEndDay to startDate (which is certificateValidFrom+getRecoveryCertStartDay, so the end date becomes: certificateValidFrom+getRecoveryCertStartDay+getRecoveryCertEndDay). Since getRecoveryCertStartDay it's 0, it's not giving bad results, but it that value would be changed in the future in /settings, it would lead to wrong results, when calculating validity, since (in Italy) it should be just certificateValidFrom+getRecoveryCertEndDay.

You should change to:

LocalDate.now() .isAfter( LocalDate.parse(clearExtraTime(it.last().certificateValidFrom)).plusDays( Integer.parseInt(getRecoveryCertEndDay()) .toLong() ) ) -> CertificateStatus.NOT_VALID

Additional context (https://www.dgc.gov.it/web/faq.html#pguarite) Check answer to question: Sono guarito dal Covid da meno di sei mesi, come faccio a ottenere la Certificazione verde Covid-19? "che, in Italia, varrà per 6 mesi dalla data di inizio validità indicata sul certificato di guarigione"

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.