PaymentCardCvvView

class PaymentCardCvvView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : ConstraintLayout

Convenience view for collecting CVV details from a user

Important:

User-entered CVV details are intentionally restricted for PCI compliance


Styling/Branding

This class can be styled in the following ways:

  1. Override general-purpose resource values

  2. Set styles programmatically

Override general-purpose resource values

Overriding general-purpose resource values is the easiest way to control the look/feel of the views in the Olo Pay SDK. Changing these values (listed below) will apply to not just PaymentCardCvvView, but also PaymentCardDetailsSingleLineView and PaymentCardDetailsMultiLineView. To override the resources, simply define resources in your app with the same names listed below

Color Resources

olopay_edittext_textcolor
olopay_errortext_textcolor

Set styles programmatically

A number of methods exist that allow you to style PaymentCardCvvView. Methods exist for changing the background style (color, border, radius, etc), the text colors, error text colors, hint text colors, font, and font size.

Constructors

Link copied to clipboard
constructor(context: Context, attrs: AttributeSet? = null)

Creates a new instance of PaymentCardCvvView

Properties

Link copied to clipboard

Set this to receive callbacks about card input events for this control

Link copied to clipboard

Get an ICvvTokenParams instance that can be used to create an ICvvUpdateToken instance. If the field is not valid this will return null.

Link copied to clipboard

Whether or not to display built-in error messages

Link copied to clipboard

Provides a snapshot of the current state of the field

Link copied to clipboard

Whether or not the input field contains a valid CVV value

Functions

Link copied to clipboard
fun clear()

Clears the text field in this control

Link copied to clipboard

Dismisses the keyboard, if visible, and removes focus from the input field in this control

Link copied to clipboard
fun getErrorMessage(ignoreUneditedFieldErrors: Boolean): String

Get the error message that would be displayed if isValid is false. Note that isValid having a value of false does not necessarily mean there will be an error message (see ignoreUneditedFieldErrors param)

Link copied to clipboard
fun hasErrorMessage(ignoreUneditedFieldErrors: Boolean = true): Boolean

Check if there is an error message to be displayed.

Link copied to clipboard
fun requestFocus(showKeyboard: Boolean)

Moves focus to the input field

Link copied to clipboard
@RequiresApi(value = 29)
fun setCursorColor(color: Int)
@RequiresApi(value = 29)
fun setCursorColor(colorHex: String)

Sets the color for the cursor, selection handles, and text selection highlight

Link copied to clipboard
fun setCvvBackgroundStyle(backgroundColor: Int? = null, borderColor: Int? = null, borderWidthPx: Float? = null, borderRadiusPx: Float? = null)
@RequiresApi(value = 27)
fun setCvvBackgroundStyle(backgroundColorHex: String? = null, borderColorHex: String? = null, borderWidthPx: Float? = null, borderRadiusPx: Float? = null)

Sets background styles for this view.

Link copied to clipboard
fun setCvvPadding(startPx: Int?, topPx: Int?, endPx: Int?, bottomPx: Int?)

Sets the padding for the area immediately surrounding the CVV input

Link copied to clipboard
open override fun setEnabled(enabled: Boolean)

Enables or disables the control

Link copied to clipboard

Sets the error font for the error message

Link copied to clipboard
fun setErrorPadding(startPx: Int?, topPx: Int?, endPx: Int?, bottomPx: Int?)

Sets the padding for the error message displayed below the CVV input

Link copied to clipboard
@RequiresApi(value = 27)
fun setErrorTextColor(colorHex: String)

Sets the error text color for the CVV input and error message

Link copied to clipboard

Sets the text size for the error message

Link copied to clipboard
fun setFont(font: Typeface)

Sets the font for the CVV input

Link copied to clipboard
fun setGravity(gravityPosition: Int)

Sets the gravity for this view

Link copied to clipboard
fun setHintText(hint: String)

Sets the hint text for the CVV input

Link copied to clipboard
fun setHintTextColor(color: Int)
@RequiresApi(value = 27)
fun setHintTextColor(colorHex: String)

Sets the hint text color for the CVV input

Link copied to clipboard
fun setTextColor(color: Int)
@RequiresApi(value = 27)
fun setTextColor(colorHex: String)

Sets the text color for the CVV input

Link copied to clipboard
fun setTextSize(size: Float)

Sets the text size for the CVV input