Transaction

public class Transaction: SessionProtocol

Superclass Helper for Payment, Pre-auth and RegisterCard

  • The current Session to access the Judo API

    Declaration

    Swift

    public var APISession: Session?
  • The judo ID for the transaction

    Declaration

    Swift

    public private (set) var judoId: String
  • The reference of the transaction

    Declaration

    Swift

    public private (set) var reference: Reference
  • The amount and currency of the transaction

    Declaration

    Swift

    public private (set) var amount: Amount?
  • The card info of the transaction

    Declaration

    Swift

    public private (set) var card: Card?
  • The payment token of the transaction

    Declaration

    Swift

    public private (set) var payToken: PaymentToken?
  • Location coordinate for fraud prevention in this transaction

    Declaration

    Swift

    public private (set) var location: CLLocationCoordinate2D?
  • Device identification for this transaction

    Declaration

    Swift

    public private (set) var deviceSignal: JSONDictionary?
  • Mobile number of the entity initiating the transaction

    Declaration

    Swift

    public private (set) var mobileNumber: String?
  • Email address of the entity initiating the transaction

    Declaration

    Swift

    public private (set) var emailAddress: String?
  • Support for Apple Pay transactions added in Base

    Declaration

    Swift

    public private (set) var pkPayment: PKPayment?
  • hidden parameter to enable recurring payments

    Declaration

    Swift

    public private (set) var initialRecurringPayment: Bool = false
  • Starting point and a reactive method to create a payment or pre-auth

    Parameter

    Parameter judoId: the number (e.g. 123-456 or 654321) identifying the Merchant you wish to pay - has to be between 6 and 10 characters and luhn-valid

    Parameter

    Parameter amount: The amount to process

    Parameter

    Parameter reference: the reference

    Throws

    JudoIDInvalidError judoId does not match the given length or is not luhn valid

    Declaration

    Swift

    public init(judoId: String, amount: Amount?, reference: Reference) throws

    Parameters

    judoId

    the number (e.g. 123-456 or 654321) identifying the Merchant you wish to pay - has to be between 6 and 10 characters and luhn-valid

    amount

    The amount to process

    reference

    the reference

  • Internal initializer for the purpose of creating an instance for listing payments or preAuths

    Declaration

    Swift

    public required init()
  • If making a card payment, add the details here

    Parameter

    Parameter card: a card object containing the information from which to make a payment

    Returns

    reactive self

    Declaration

    Swift

    public func card(card: Card) -> Self

    Parameters

    card

    a card object containing the information from which to make a payment

    Return Value

    reactive self

  • If a card payment or a card registration has been previously made, add the token to make a repeat payment

    Parameter

    Parameter token: a token-string from a previous payment or registration

    Returns

    reactive self

    Declaration

    Swift

    public func paymentToken(token: PaymentToken) -> Self

    Parameters

    token

    a token-string from a previous payment or registration

    Return Value

    reactive self

  • Reactive method to set location information of the user, this method is optional and is used for fraud prevention

    Parameter

    Parameter location: a CLLocationCoordinate2D which represents the current location of the user

    Returns

    reactive self

    Declaration

    Swift

    public func location(location: CLLocationCoordinate2D) -> Self

    Parameters

    location

    a CLLocationCoordinate2D which represents the current location of the user

    Return Value

    reactive self

  • Reactive method to set device signal information of the device, this method is optional and is used for fraud prevention

    Parameter

    Parameter deviceSignal: a Dictionary which contains information about the device

    Returns

    reactive self

    Declaration

    Swift

    public func deviceSignal(deviceSignal: JSONDictionary) -> Self

    Parameters

    deviceSignal

    a Dictionary which contains information about the device

    Return Value

    reactive self

  • Reactive method to set contact information of the user such as mobile number and email address, this method is optional

    Parameter

    Parameter mobileNumber: a mobile number String

    Parameter

    Parameter emailAddress: an email address String

    Returns

    reactive self

    Declaration

    Swift

    public func contact(mobileNumber : String?, _ emailAddress : String? = nil) -> Self

    Parameters

    mobileNumber

    a mobile number String

    emailAddress

    an email address String

    Return Value

    reactive self

  • For creating an Apple Pay Transaction, use this method to add the PKPayment object

    Parameter

    Parameter payment: the PKPayment object

    Returns

    reactive self

    Declaration

    Swift

    public func pkPayment(payment: PKPayment) -> Self

    Parameters

    payment

    the PKPayment object

    Return Value

    reactive self

  • apiSession caller - this method sets the session variable and returns itself for further use

    Parameter

    Parameter session: the API session which is used to call the Judo endpoints

    Returns

    reactive self

    Declaration

    Swift

    public func apiSession(session: Session) -> Self

    Parameters

    session

    the API session which is used to call the Judo endpoints

    Return Value

    reactive self

  • Completion caller - this method will automatically trigger a Session Call to the judo REST API and execute the request based on the information that were set in the previous methods

    Parameter

    Parameter block: a completion block that is called when the request finishes

    Returns

    reactive self

    Throws

    ParameterError one or more of the given parameters were in the incorrect format or nil

    Throws

    CardAndTokenError multiple methods of payment have been provided, please make sure to only provide one method

    Throws

    CardOrTokenMissingError no method of transaction was provided, please provide either a card, paymentToken or PKPayment

    Throws

    AmountMissingError no amount has been provided

    Throws

    DuplicateTransactionError please provide a new Reference object if this transaction is not a duplicate

    Declaration

    Swift

    public func completion(block: JudoCompletionBlock) throws -> Self

    Parameters

    block

    a completion block that is called when the request finishes

    Return Value

    reactive self

  • threeDSecure call - this method will automatically trigger a Session Call to the judo REST API and execute the finalizing 3DS call on top of the information that had been sent in the previous methods

    Parameter

    Parameter dictionary: the dictionary that contains all the information from the 3DS UIWebView Request

    Parameter

    Parameter receiptId: the receipt for the given Transaction

    Parameter

    Parameter block: a completion block that is called when the request finishes

    Returns

    reactive self

    Declaration

    Swift

    public func threeDSecure(dictionary: JSONDictionary, receiptId: String, block: JudoCompletionBlock) -> Self

    Parameters

    dictionary

    the dictionary that contains all the information from the 3DS UIWebView Request

    receiptId

    the receipt for the given Transaction

    block

    a completion block that is called when the request finishes

    Return Value

    reactive self

  • This method will return a list of transactions, filtered to just show the payment or preAuth transactions. The method will show the first 10 items in a Time Descending order

    See List all transactions for more information.

    Parameter

    Parameter block: a completion block that is called when the request finishes

    Declaration

    Swift

    public func list(block: JudoCompletionBlock)

    Parameters

    block

    a completion block that is called when the request finishes

  • This method will return a list of transactions, filtered to just show the payment or pre-auth transactions.

    See List all transactions for more information.

    Parameter

    Parameter pagination: The offset, number of items and order in which to return the items

    Parameter

    Parameter block: a completion block that is called when the request finishes

    Declaration

    Swift

    public func list(pagination: Pagination?, block: JudoCompletionBlock)

    Parameters

    pagination

    The offset, number of items and order in which to return the items

    block

    a completion block that is called when the request finishes

  • Helper method for extensions of this class to be able to access the dynamic path value

    :returns: the rest api access path of the current class

    Declaration

    Swift

    public func path() -> String