BTPaymentMethodNonceParser
@objcMembers
public class BTPaymentMethodNonceParser : NSObject
A JSON parser that parses BTJSON into concrete BTPaymentMethodNonce objects. It supports registration of parsers at runtime.
BTPaymentMethodNonceParser provides access to JSON parsing for different payment options
without introducing compile-time dependencies on payment option frameworks and their symbols.
-
The singleton instance
Declaration
Swift
@objc(sharedParser) public static let shared: BTPaymentMethodNonceParser -
An array of the tokenization types currently registered
Declaration
Swift
public var allTypes: [String] { get } -
Indicates whether a tokenization type is currently registered
Declaration
Swift
public func isTypeAvailable(_ type: String) -> BoolParameters
typeThe tokenization type string
Return Value
A bool indicating if the payment method type is available.
-
Registers a parsing block for a tokenization type.
Declaration
Swift
public func registerType(_ type: String?, withParsingBlock: @escaping (_ json: BTJSON?) -> BTPaymentMethodNonce?)Parameters
typeThe tokenization type string
withParsingBlockjsonParsingBlock The block to execute when
parseJSON:type:is called for the tokenization type. This block should return aBTPaymentMethodNonceobject, ornilif the JSON cannot be parsed. -
Parses tokenized payment information that has been serialized to JSON, and returns a
BTPaymentMethodNonceobject.The
BTPaymentMethodNonceobject is created by the JSON parsing block that has been registered for the tokenization type.If the
typehas not been registered, this method will attempt to read the nonce from the JSON and return a basic object; if it fails, it will returnnil.Declaration
Swift
public func parseJSON(_ json: BTJSON?, withParsingBlockForType type: String?) -> BTPaymentMethodNonce?Return Value
A
BTPaymentMethodNonceobject, ornilif the tokenized payment info JSON does not contain a nonce
View on GitHub