Skip to content
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

Create PaymentIntent.ClientSecret and SetupIntent.ClientSecret for validation #1958

Merged
merged 1 commit into from
Dec 17, 2019

Conversation

mshafrir-stripe
Copy link
Collaborator

Summary

Confirm a PaymentIntent or SetupIntent will now fail early if an
invalid clientSecret is provided.

Motivation

ANDROID-455

Testing

Unit tests + manual testing

…lidation

Confirm a PaymentIntent or SetupIntent will now fail early if an
invalid clientSecret is provided.

ANDROID-455
Copy link
Contributor

@aliriaz-stripe aliriaz-stripe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving

left one comment but that might be me not fully understanding

internal data class ClientSecret(internal val value: String) {
internal val paymentIntentId: String =
value.split("_secret".toRegex())
.dropLastWhile { it.isEmpty() }.toTypedArray()[0]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not entirely sure how this works but wondering if there is a case where we end up with an empty array here? Or do we ensure an empty array will never be the case with the isEmpty()

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if there are any edge cases this isn't handling, but given that it's the existing logic for obtaining an ID from a client secret, I'm going to leave it as is.

@mshafrir-stripe mshafrir-stripe merged commit b9c4a75 into master Dec 17, 2019
@mshafrir-stripe mshafrir-stripe deleted the client-secret-validation branch December 17, 2019 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants