JudoKit
public struct JudoKit
Entry point for interacting with judoKit
-
JudoKit local judo session
Declaration
Swift
public var apiSession = Session() -
the theme of the current judoKitSession
Declaration
Swift
public var theme: Theme = Theme() -
currently active JudoPayViewController if available
Declaration
Swift
public weak var activeViewController: JudoPayViewController? -
designated initializer of JudoKit
Parameter
Parameter token: a string object representing the tokenParameter
Parameter secret: a string object representing the secretThrows
Throws JailbrokenDeviceDisallowedError: In case jailbroken devices are not allowed, this method will throw an exception if it is run on a jailbroken device
Declaration
Swift
public init(token: String, secret: String, allowJailbrokenDevices: Bool) throwsParameters
tokena string object representing the token
secreta string object representing the secret
allowJailbrokenDevicesboolean that indicates whether jailbroken devices are restricted
Return Value
a new instance of JudoKit
-
convenience initializer of JudoKit
Parameter
Parameter token: a string object representing the tokenParameter
Parameter secret: a string object representing the secret
Declaration
Swift
public init(token: String, secret: String)Parameters
tokena string object representing the token
secreta string object representing the secret
Return Value
a new instance of JudoKit
-
Set the app to sandboxed mode
Declaration
Swift
public mutating func sandboxed(enabled: Bool)Parameters
enabledtrue to set the SDK to sandboxed mode
-
A mandatory function that sets the token and secret for making payments with judo
Parameter
Parameter token: a string object representing the tokenParameter
Parameter secret: a string object representing the secretDeclaration
Swift
public mutating func setToken(token: String, secret: String)Parameters
tokena string object representing the token
secreta string object representing the secret
-
A function to check whether a token and secret has been set
Returns
a Boolean indicating whether the parameters have been setDeclaration
Swift
public func didSetTokenAndSecret() -> BoolReturn Value
a Boolean indicating whether the parameters have been set
-
Main payment method
Declaration
Swift
public mutating func invokePayment(judoId: String, amount: Amount, reference: Reference, cardDetails: CardDetails? = nil, completion: (Response?, JudoError?) -> ()) throwsParameters
judoIdThe judoId of the merchant to receive the payment
amountThe amount and currency of the payment (default is GBP)
referenceReference object that holds consumer and payment reference and a meta data dictionary which can hold any kind of JSON formatted information
completionThe completion handler which will respond with a Response Object or an NSError
-
Make a pre-auth using this method
Declaration
Swift
public mutating func invokePreAuth(judoId: String, amount: Amount, reference: Reference, cardDetails: CardDetails? = nil, completion: (Response?, JudoError?) -> ()) throwsParameters
judoIdThe judoId of the merchant to receive the pre-auth
amountThe amount and currency of the payment (default is GBP)
referenceReference object that holds consumer and payment reference and a meta data dictionary which can hold any kind of JSON formatted information
completionThe completion handler which will respond with a Response Object or an NSError
-
Initiates a card registration
Declaration
Swift
public mutating func invokeRegisterCard(judoId: String, amount: Amount, reference: Reference, cardDetails: CardDetails? = nil, completion: (Response?, JudoError?) -> ()) throwsParameters
judoIdThe judoId of the merchant to receive the pre-auth
amountThe amount and currency of the payment (default is GBP)
referenceReference object that holds consumer and payment reference and a meta data dictionary which can hold any kind of JSON formatted information
completionThe completion handler which will respond with a Response Object or an NSError
-
Initiates the token payment process
Declaration
Swift
public mutating func invokeTokenPayment(judoId: String, amount: Amount, reference: Reference, cardDetails: CardDetails, paymentToken: PaymentToken, completion: (Response?, JudoError?) -> ()) throwsParameters
judoIdThe judoId of the merchant to receive the payment
amountThe amount and currency of the payment (default is GBP)
referenceReference object that holds consumer and payment reference and a meta data dictionary which can hold any kind of JSON formatted information
cardDetailsThe card details to present in the input fields
paymentTokenThe consumer and card token to make a token payment with
completionThe completion handler which will respond with a Response Object or an NSError
-
Initiates the token pre-auth process
Declaration
Swift
public mutating func invokeTokenPreAuth(judoId: String, amount: Amount, reference: Reference, cardDetails: CardDetails, paymentToken: PaymentToken, completion: (Response?, JudoError?) -> ()) throwsParameters
judoIdThe judoId of the merchant to receive the pre-auth
amountThe amount and currency of the payment (default is GBP)
referenceReference object that holds consumer and payment reference and a meta data dictionary which can hold any kind of JSON formatted information
cardDetailsThe card details to present in the input fields
paymentTokenThe consumer and card token to make a token payment with
completionThe completion handler which will respond with a Response Object or an NSError
-
Starting point and a reactive method to create a transaction that is sent to a certain judo ID
Parameter
Parameter transactionType: The type of the transaction (payment, pre-auth or registercard)Parameter
Parameter judoId: The recipient - has to be between 6 and 10 characters and luhn-validParameter
Parameter amount: The amount of the PaymentParameter
Parameter reference: The reference
Throws
JudoIDInvalidError judoId does not match the given length or is not luhn valid
Throws
InvalidOperationError if you call this method with .Refund as a transactionType
Returns
a Payment Object
Declaration
Swift
public func transaction(transactionType: TransactionType, judoId: String, amount: Amount, reference: Reference) throws -> TransactionParameters
transactionTypeThe type of the transaction (payment, pre-auth or registercard)
judoIdThe recipient - has to be between 6 and 10 characters and luhn-valid
amountThe amount of the Payment
referenceThe reference
Return Value
a Payment Object
-
Starting point and a reactive method to create a payment that is sent to a certain judo ID
Parameter
Parameter judoId: The recipient - has to be between 6 and 10 characters and luhn-validParameter
Parameter amount: The amount of the PaymentParameter
Parameter reference: The reference
Throws
JudoIDInvalidError judoId does not match the given length or is not luhn valid
Returns
a Payment Object
Declaration
Swift
public func payment(judoId: String, amount: Amount, reference: Reference) throws -> PaymentParameters
judoIdThe recipient - has to be between 6 and 10 characters and luhn-valid
amountThe amount of the Payment
referenceThe reference
Return Value
a Payment Object
-
Starting point and a reactive method to create a pre-auth that is sent to a certain judo ID
Parameter
Parameter judoId: The recipient - has to be between 6 and 10 characters and LUHN validParameter
Parameter amount: The amount of the pre-authParameter
Parameter reference: The reference
Throws
JudoIDInvalidError judoId does not match the given length or is not LUHN valid
Returns
pre-auth Object
Declaration
Swift
public func preAuth(judoId: String, amount: Amount, reference: Reference) throws -> PreAuthParameters
judoIdThe recipient - has to be between 6 and 10 characters and LUHN valid
amountThe amount of the pre-auth
referenceThe reference
Return Value
pre-auth Object
-
Starting point and a reactive method to create a RegisterCard that is sent to a certain judo ID
Parameter
Parameter judoId: The recipient - has to be between 6 and 10 characters and LUHN validParameter
Parameter amount: The amount of the RegisterCardParameter
Parameter reference: The reference
Throws
JudoIDInvalidError judoId does not match the given length or is not LUHN valid
Returns
a RegisterCard Object
Declaration
Swift
public func registerCard(judoId: String, reference: Reference) throws -> RegisterCardParameters
judoIdThe recipient - has to be between 6 and 10 characters and LUHN valid
amountThe amount of the RegisterCard
referenceThe reference
Return Value
a RegisterCard Object
-
Creates a Receipt object which can be used to query for the receipt of a given ID.
The receipt ID has to be LUHN valid, an error will be thrown if the receipt ID does not pass the LUHN check.
If you want to use the receipt function - you need to enable that in the judo Dashboard - Your Apps - Permissions for the given App
Parameter
Parameter receiptId: The receipt ID as a String
Throws
LuhnValidationError if the receiptId does not match
Returns
a Receipt Object for reactive usage
Declaration
Swift
public func receipt(receiptId: String? = nil) throws -> ReceiptParameters
receiptIdThe receipt ID as a String
Return Value
a Receipt Object for reactive usage
-
Creates a Collection object which can be used to collect a previously pre-authorized transaction
Parameter
Parameter receiptId: The receipt of the previously authorized transactionParameter
Parameter amount: The amount to be transactedParameter
Parameter paymentReference: The payment reference string
Throws
LuhnValidationError judoId does not match the given length or is not LUHN valid
Returns
a Collection object for reactive usage
Declaration
Swift
public func collection(receiptId: String, amount: Amount) throws -> CollectionParameters
receiptIdThe receipt of the previously authorized transaction
amountThe amount to be transacted
paymentReferenceThe payment reference string
Return Value
a Collection object for reactive usage
-
Creates a Refund object which can be used to refund a previous transaction
Parameter
Parameter receiptId: The receipt of the previous transactionParameter
Parameter amount: The amount to be refunded (will check if funds are available in your account)Parameter
Parameter paymentReference: The payment reference string
Throws
LuhnValidationError judoId does not match the given length or is not LUHN valid
Returns
a Refund object for reactive usage
Declaration
Swift
public func refund(receiptId: String, amount: Amount) throws -> RefundParameters
receiptIdThe receipt of the previous transaction
amountThe amount to be refunded (will check if funds are available in your account)
paymentReferenceThe payment reference string
Return Value
a Refund object for reactive usage
-
Creates a VoidTransaction object which can be used to void a previous preAuth
Parameter
Parameter receiptId: The receipt of the previous transactionParameter
Parameter amount: The amount to be refunded (will check if funds are available in your account)Parameter
Parameter paymentReference: The payment reference string
Throws
LuhnValidationError judoId does not match the given length or is not LUHN valid
Returns
a Void object for reactive usage
Declaration
Swift
public func voidTransaction(receiptId: String, amount: Amount) throws -> VoidTransactionParameters
receiptIdThe receipt of the previous transaction
amountThe amount to be refunded (will check if funds are available in your account)
paymentReferenceThe payment reference string
Return Value
a Void object for reactive usage
-
Creates an instance of a class that conforms to SessionProtocol. This means that anything related to Payments or PreAuths can be queried for a list
Declaration
Swift
public func list<T:SessionProtocol>(type: T.Type) -> TParameters
typethe type
Return Value
a new instance that can be used to fetch information
JudoKit Struct Reference