TextFieldState

This represents the different states a field can be in, in each of these cases there might be a reason to show the error in a different way. This interface separates how the state is implemented from what information is required by clients of the interface. This will allow the implementation to change without impacting the clients.

Inheritors

Functions

Link copied to clipboard
Link copied to clipboard
abstract fun getError(): FieldError?

If in a state where isValid() returns false, this function returns the error message. It is up to calling shouldShowError to determine if it should be displayed on screen.

Link copied to clipboard
abstract fun isBlank(): Boolean

This is used to indicate the field is blank which can be helpful when ignoring optional fields.

Link copied to clipboard
abstract fun isFull(): Boolean

This is used to indicate the field contains the maximum number of characters. This is needed to know when to advance to the next field.

Link copied to clipboard
abstract fun isValid(): Boolean

Indicates an field is valid and field extraction can happen and be used to create PaymentMethod Parameters

Link copied to clipboard
abstract fun shouldShowError(hasFocus: Boolean): Boolean

Indicate if this is an error that should be displayed to the user. This cannot be used to determine if the field is valid or not because there are some cases such as incomplete or blank where the error is not displayed, but also not valid.