-
Notifications
You must be signed in to change notification settings - Fork 659
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Link Cvc & Expiry recollection #9880
base: master
Are you sure you want to change the base?
Conversation
get() = true | ||
// get() = !DateUtils.isExpiryDataValid( | ||
// expiryMonth = expiryMonth, | ||
// expiryYear = expiryYear | ||
// ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The isExpired
property appears to be hardcoded to true
for testing purposes, with the actual expiry validation logic commented out. This will cause all cards to be treated as expired in production. The original validation using DateUtils.isExpiryDataValid()
should be uncommented and restored to ensure correct expiry checking behavior.
Spotted by Graphite Reviewer
Is this helpful? React 👍 or 👎 to let us know.
Diffuse output:
APK
DEX
|
@@ -23,7 +30,11 @@ internal data class WalletUiState( | |||
val isExpired = card?.isExpired ?: false | |||
val requiresCvcRecollection = card?.cvcCheck?.requiresRecollection ?: false | |||
|
|||
val disableButton = isExpired || requiresCvcRecollection | |||
val isMissingExpiryDateInput = (expiryDateInput.isComplete && cvcInput.isComplete).not() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The isMissingExpiryDateInput
check should only depend on expiryDateInput.isComplete
. Including cvcInput.isComplete
in this check is incorrect since it's meant to validate expiry date completeness only. The check should be simplified to:
val isMissingExpiryDateInput = expiryDateInput.isComplete.not()
Spotted by Graphite Reviewer
Is this helpful? React 👍 or 👎 to let us know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expired cards requires both updated expiryDate and cvc
3af6c2f
to
08ac506
Compare
private suspend fun performPaymentConfirmation( | ||
selectedPaymentDetails: ConsumerPaymentDetails.PaymentDetails, | ||
) { | ||
val card = _uiState.value.selectedCard | ||
val isExpired = card != null && card.isExpired | ||
|
||
if (isExpired) { | ||
performPaymentDetailsUpdate(selectedPaymentDetails).fold( | ||
onSuccess = { result -> | ||
val updatedPaymentDetails = result.paymentDetails.single { | ||
it.id == selectedPaymentDetails.id | ||
} | ||
performPaymentConfirmation(updatedPaymentDetails) | ||
}, | ||
onFailure = { error -> | ||
_uiState.update { | ||
it.copy( | ||
alertMessage = error.stripeErrorMessage(), | ||
isProcessing = false | ||
) | ||
} | ||
} | ||
) | ||
} | ||
|
||
// Confirm payment with LinkConfirmationHandler | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The performPaymentConfirmation
method needs a return
statement after the if (isExpired)
block to prevent executing the payment confirmation logic twice. Currently, if a card is expired, the method will both update the card details and attempt to confirm the payment in the same call, which could lead to duplicate transactions.
Spotted by Graphite Reviewer
Is this helpful? React 👍 or 👎 to let us know.
08ac506
to
ca44972
Compare
private fun WalletUiState.toPaymentMethodCreateParams(): PaymentMethodCreateParams { | ||
val expiryDateValues = createExpiryDateFormFieldValues(expiryDateInput) | ||
return FieldValuesToParamsMapConverter.transformToPaymentMethodCreateParams( | ||
fieldValuePairs = expiryDateValues, | ||
code = PaymentMethod.Type.Card.code, | ||
requiresMandate = false | ||
) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The toPaymentMethodCreateParams()
function appears incomplete - it transforms the expiry date but omits the CVC value from cvcInput
. Both values should be included in the fieldValuePairs
map passed to transformToPaymentMethodCreateParams()
to properly validate the card details.
Spotted by Graphite Reviewer
Is this helpful? React 👍 or 👎 to let us know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cvc is not part of PaymentMethodCreateParams
. It will be passed extraParams
to the LinkConfirmationHandler` here
} | ||
) | ||
} else { | ||
// Confirm payment with LinkConfirmationHandler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
onWalletAddPaymentMethodRow().assertIsDisplayed().assertHasClickAction() | ||
onExpandedWalletHeader().assertIsDisplayed() | ||
onPaymentMethodList().assertCountEquals(2) | ||
onWalletPayButton().assertIsDisplayed().assertIsNotEnabled().assertHasClickAction() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pay button is hidden on Android for small devices, when the wallet is expanded. I created a ticket to resolve this
Summary
Perform cvc recollection and collect updated expiry date for expired cards
Motivation
JIRA
Testing
Screenshots
Screen.Recording.2025-01-09.at.1.50.06.AM.mov
Changelog