Type Aliases

The following type aliases are available globally.

  • An empty block, called with no arguments, returning nothing.

    Declaration

    Swift

    public typealias OPVoidBlock = () -> Void
  • A callback used to return an error during the ApplePay completion flow

    Declaration

    Swift

    public typealias OPApplePayCompletionBlock = (_ error: Error?) -> Void

    Parameters

    error

    The error that occurred when submitting an ApplePay payment method to Olo’s Ordering API, or nil if no error occurred

  • A completion handler used when generating payment methods

    Declaration

    Swift

    public typealias OPPaymentMethodCompletionBlock = (_ paymentMethod: OPPaymentMethodProtocol?, _ error: Error?) -> Void

    Parameters

    paymentMethod

    The payment method from the response. Will be nil if an error occurs.

    error

    The error returned from the response, or nil if no error occurred.

  • A completion handler used when generating CVV update tokens

    Declaration

    Swift

    public typealias OPCvvTokenUpdateCompletionBlock = (_ token: OPCvvUpdateTokenProtocol?, _ error: Error?) -> Void

    Parameters

    token

    The CVV Update token from the response. Will be nil if an error occurs

    error

    The error returned from the response, or nil if no error occured

  • A block used for returning an image associated with the card brand parameter

    Declaration

    Swift

    public typealias OPCardBrandImageBlock = (_ cardBrand: OPCardBrand) -> UIImage?

    Parameters

    cardBrand

    The brand to get an image for

    Return Value

    An image associated with the given brand, or nil

  • A block used for returning an error message based on the current state of the Card control

    Declaration

    Swift

    public typealias OPCardErrorMessageBlock = (_ cardState: NSDictionary, _ cardBrand: OPCardBrand, _ ignoreUneditedFieldErrors: Bool) -> String

    Parameters

    cardState

    A representation of the current state of the card input control

    cardBrand

    The detected brand of the card number entered by the user

    ignoreUneditedFieldErrors

    If true, only fields that have been edited should be considered when generating an error message. If false, all fields should be considered.

    Return Value

    An error message, or empty string if no message should be displayed

  • A block used for returning an error message based on the current state of the CVV control

    Declaration

    Swift

    public typealias OPCvvErrorMessageBlock = (_ cvvFieldState: OPCardFieldStateProtocol, _ ignoreUneditedFieldErrors: Bool) -> String

    Parameters

    cvvFieldState

    A representation of the current state of the CVV control

    ignoreUneditedFieldErrors

    If true, only fields that have been edited should be considered when generating an error message. If false, all fields should be considered.

    Return Value

    An error message, or empty string if no message should be displayed