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 callback to be run with a PaymentMethod response from the OloPay API.

    Declaration

    Swift

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

    Parameters

    paymentMethod

    The Olo Pay PaymentMethod from the response. Will be nil if an error occurs.

    error

    The error returned from the response, or nil if none occurs.

  • 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 passed-in card control

    Declaration

    Swift

    public typealias OPCardErrorMessageBlock = (_ card: OPPaymentCardDetailsView, _ field: OPCardField) -> String

    Parameters

    card

    The card control

    field

    The field that is invalid, or nil if a general error message should be displayed

    Return Value

    An error message, or nil if no message should be displayed