CardDetails

public class CardDetails: NSObject, NSCoding

CardDetails

The CardDetails object stores information that is returned from a successful payment or pre-auth

This class also implements the NSCoding protocol to enable serialization for persistency

  • The last four digits of the card used for this transaction

    Declaration

    Swift

    public var cardLastFour: String?
  • Expiry date of the card used for this transaction formatted as a two digit month and year i.e. MM/YY

    Declaration

    Swift

    public let endDate: String?
  • Can be used to charge future payments against this card

    Declaration

    Swift

    public let cardToken: String?
  • The computed card network

    Declaration

    Swift

    public var cardNetwork: CardNetwork?
  • The card number if available

    Declaration

    Swift

    public var cardNumber: String?
  • Undocumented

    Declaration

    Swift

    public class CardDetails: NSObject, NSCoding
  • Description string for print functions

    Declaration

    Swift

    override public var description: String
  • Convenience initializer that takes in a card number and an expiry date in case a transaction should be made with pre-known information

    Declaration

    Swift

    public convenience init(cardNumber: String?, expiryMonth: Int?, expiryYear: Int?)

    Parameters

    cardNumber

    a card number as a String

    endDate

    an enddate in MM/YY format as a String

    Return Value

    a CardDetails object

  • Designated initializer for Card Details

    Declaration

    Swift

    public init(_ dict: JSONDictionary?)

    Parameters

    dict

    all parameters as a dictionary

    Return Value

    a CardDetails object

  • Initialise the CardDetails object with a coder

    Declaration

    Swift

    public required init?(coder decoder: NSCoder)

    Parameters

    decoder

    the decoder object

    Return Value

    a CardDetails object or nil

  • Encode the receiver CardDetails object

    Declaration

    Swift

    public func encodeWithCoder(aCoder: NSCoder)

    Parameters

    aCoder

    the Coder

  • Get a formatted string with the right whitespacing for a certain card type

    Declaration

    Swift

    public func formattedLastFour() -> String?

    Return Value

    a string with the last four digits with the right format

  • Get a formatted string with the right slash for a date

    Declaration

    Swift

    public func formattedEndDate() -> String?

    Return Value

    a string with the date as shown on the credit card with the right format