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

Add CardValidCallback and add support in card forms #2093

Merged
merged 1 commit into from
Jan 23, 2020

Conversation

mshafrir-stripe
Copy link
Collaborator

Summary

Add CardInputWidget#setCardValidCallback() and
CardMultilineWidget#setCardValidCallback()

Setting a callback instance will allow the integrating
app to determine if the current form input is valid
and which fields are invalid, if any.

For example, when none of the fields are valid,
CardValidCallback#onInputChanged() will be called with

false,
setOf(
  CardValidCallback.Fields.Number,
  CardValidCallback.Fields.Expiry,
  CardValidCallback.Fields.Cvc
)

When all of the fields are valid,
CardValidCallback#onInputChanged() will be called with

true, emptySet()

Testing

Add unit tests and manually verified

Motivation

Fixes #1808

Summary
Add `CardInputWidget#setCardValidCallback()` and
`CardMultilineWidget#setCardValidCallback()`

Setting a callback instance will allow the integrating
app to determine if the current form input is valid
and which fields are invalid, if any.

For example, when none of the fields are valid,
`CardValidCallback#onInputChanged()` will be called with
```
false,
setOf(
  CardValidCallback.Fields.Number,
  CardValidCallback.Fields.Expiry,
  CardValidCallback.Fields.Cvc
)
```

When all of the fields are valid,
`CardValidCallback#onInputChanged()` will be called with
```
true, emptySet()
```

Testing
Add unit tests and manually verified

Motivation
Fixes #1808
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.

Allow validation of individual fields without error messages in CardMultilineWidget
4 participants