Skip to content

Commit fdfcb9c

Browse files
committed
Add expiry date encryption
COSDK-570
1 parent b17994d commit fdfcb9c

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
@@ -24,6 +24,7 @@ import com.adyen.checkout.core.analytics.internal.AnalyticsManager
2424
import com.adyen.checkout.core.analytics.internal.ErrorEvent
2525
import com.adyen.checkout.core.analytics.internal.GenericEvents
2626
import com.adyen.checkout.core.common.internal.helper.bufferedChannel
27+
import com.adyen.checkout.core.common.ui.model.ExpiryDate
2728
import com.adyen.checkout.core.components.data.PaymentComponentData
2829
import com.adyen.checkout.core.components.internal.PaymentComponentEvent
2930
import com.adyen.checkout.core.components.internal.ui.PaymentComponent
@@ -151,14 +152,13 @@ internal class CardComponent(
151152
// val cvc = outputData.securityCodeState.value
152153
// if (cvc.isNotEmpty()) unencryptedCardBuilder.setCvc(cvc)
153154
// }
154-
// val expiryDateResult = outputData.expiryDateState.value
155-
// if (expiryDateResult.isNotBlank()) {
156-
// val expiryDate = ExpiryDate.from(expiryDateResult)
157-
// unencryptedCardBuilder.setExpiryDate(
158-
// expiryMonth = expiryDate.expiryMonth.toString(),
159-
// expiryYear = expiryDate.expiryYear.toString(),
160-
// )
161-
// }
155+
if (expiryDate.text.isNotBlank()) {
156+
val expiryDate = ExpiryDate.from(expiryDate.text)
157+
unencryptedCardBuilder.setExpiryDate(
158+
expiryMonth = expiryDate.expiryMonth.toString(),
159+
expiryYear = expiryDate.expiryYear.toString(),
160+
)
161+
}
162162

163163
cardEncryptor.encryptFields(unencryptedCardBuilder.build(), componentParams.publicKey)
164164
} catch (_: EncryptionException) {
@@ -183,8 +183,8 @@ internal class CardComponent(
183183
checkoutAttemptId = analyticsManager.getCheckoutAttemptId(),
184184
).apply {
185185
encryptedCardNumber = encryptedCard.encryptedCardNumber
186-
// encryptedExpiryMonth = encryptedCard.encryptedExpiryMonth
187-
// encryptedExpiryYear = encryptedCard.encryptedExpiryYear
186+
encryptedExpiryMonth = encryptedCard.encryptedExpiryMonth
187+
encryptedExpiryYear = encryptedCard.encryptedExpiryYear
188188

189189
// if (!isCvcHidden()) {
190190
// encryptedSecurityCode = encryptedCard.encryptedSecurityCode

0 commit comments

Comments
 (0)