Skip to content

Commit 0464b44

Browse files
committed
Add expiry date encryption
COSDK-570
1 parent a1a3da5 commit 0464b44

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

card/src/main/java/com/adyen/checkout/card/internal/ui/CardComponent.kt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import com.adyen.checkout.core.common.AdyenLogLevel
2929
import com.adyen.checkout.core.common.helper.runCompileOnly
3030
import com.adyen.checkout.core.common.internal.helper.adyenLog
3131
import com.adyen.checkout.core.common.internal.helper.bufferedChannel
32+
import com.adyen.checkout.core.common.ui.model.ExpiryDate
3233
import com.adyen.checkout.core.components.data.PaymentComponentData
3334
import com.adyen.checkout.core.components.internal.PaymentComponentEvent
3435
import com.adyen.checkout.core.components.internal.ui.PaymentComponent
@@ -162,14 +163,13 @@ internal class CardComponent(
162163
// val cvc = outputData.securityCodeState.value
163164
// if (cvc.isNotEmpty()) unencryptedCardBuilder.setCvc(cvc)
164165
// }
165-
// val expiryDateResult = outputData.expiryDateState.value
166-
// if (expiryDateResult.isNotBlank()) {
167-
// val expiryDate = ExpiryDate.from(expiryDateResult)
168-
// unencryptedCardBuilder.setExpiryDate(
169-
// expiryMonth = expiryDate.expiryMonth.toString(),
170-
// expiryYear = expiryDate.expiryYear.toString(),
171-
// )
172-
// }
166+
if (expiryDate.text.isNotBlank()) {
167+
val expiryDate = ExpiryDate.from(expiryDate.text)
168+
unencryptedCardBuilder.setExpiryDate(
169+
expiryMonth = expiryDate.expiryMonth.toString(),
170+
expiryYear = expiryDate.expiryYear.toString(),
171+
)
172+
}
173173

174174
cardEncryptor.encryptFields(unencryptedCardBuilder.build(), publicKey)
175175
} catch (_: EncryptionException) {
@@ -194,8 +194,8 @@ internal class CardComponent(
194194
checkoutAttemptId = analyticsManager.getCheckoutAttemptId(),
195195
).apply {
196196
encryptedCardNumber = encryptedCard.encryptedCardNumber
197-
// encryptedExpiryMonth = encryptedCard.encryptedExpiryMonth
198-
// encryptedExpiryYear = encryptedCard.encryptedExpiryYear
197+
encryptedExpiryMonth = encryptedCard.encryptedExpiryMonth
198+
encryptedExpiryYear = encryptedCard.encryptedExpiryYear
199199

200200
// if (!isCvcHidden()) {
201201
// encryptedSecurityCode = encryptedCard.encryptedSecurityCode

0 commit comments

Comments
 (0)