MPQRParser
@interface MPQRParser : NSObject
Primary interface of the framework.
This class provide interface to parse the QRCode string to structured data, i.e. PushPaymentData.
- It has
+parse:error:method that do parsing as well as do validation if the string is compliance with EMVCO standard. - It also has
+parseWithoutTagValidation:error:and+parseWithoutTagValidationAndCRC:error:to parse the string without validating if the value is compliance with EMVCO standard.
-
Parse QR string to structured data.
It performs validation by calling
PushPaymentData.validate()after parsingNote
Throws:MPQRErrorexceptionsNote
SeeAlso: parseWithoutTagValidation(string:)Declaration
Objective-C
+ (PushPaymentData *_Nullable)parse:(NSString *_Nonnull)string error:(NSError *_Nullable *_Nullable)error;Swift
class func parse(string: String) throws -> PushPaymentDataParameters
stringString to parse
Return Value
Parsed
PushPaymentData -
Parse QR string to structured data without full tag validation. It validates CRC of the provided string.
Note
SeeAlso: parseWithoutTagValidationAndCRC(string:)Declaration
Objective-C
+ (PushPaymentData *_Nullable) parseWithoutTagValidation:(NSString *_Nonnull)string error:(NSError *_Nullable *_Nullable)error;Swift
class func parseWithoutTagValidation(_ string: String) throws -> PushPaymentDataParameters
stringString to parse
Return Value
Parsed
PushPaymentData -
Parse QR string to structured data without full tag and crc validation
Note
Throws:MPQRErrorexceptionsDeclaration
Objective-C
+ (PushPaymentData *_Nullable) parseWithoutTagValidationAndCRC:(NSString *_Nonnull)string error:(NSError *_Nullable *_Nullable)error;Swift
class func parseWithoutTagValidationAndCRC(_ string: String) throws -> PushPaymentDataParameters
stringString to parse
Return Value
Parsed
PushPaymentData -
Read next
TLVfrom the stringNote
Throws:MPQRError.invalidFormatexception if length field is not numericDeclaration
Objective-C
+ (TLV *_Nullable)readNextTLV:(NSString *_Nonnull)string start:(NSInteger)start tagType:(Class<Tag> _Nonnull)tagType error:(NSError *_Nullable *_Nullable)error;Parameters
stringString to read from
startIndex from which to start reading
tagTypeType of the tag to read for
Return Value
Parsed
TLV -
Parse
AdditionalDatafrom stringNote
SeeAlso:readNextTLV(string:, start:, tagType:)Declaration
Objective-C
+ (AdditionalData *_Nullable)parseAdditionalData:(NSString *_Nonnull)string error:(NSError *_Nullable *_Nullable) error;Swift
class func parseAdditionalData(_ string: String) throws -> AdditionalDataParameters
stringString to parse
Return Value
Parsed
AdditionalData -
Read substring
Note
Throws:MPQRError.invalidFormatif there are not enough characters to be read based on end indexDeclaration
Objective-C
+ (NSString *_Nullable)readSubstring:(NSString *_Nonnull)string start:(NSInteger)start end:(NSInteger)end error:(NSError *_Nullable *_Nullable)error;Swift
class func readSubstring(_ string: String, start: Int, end: Int) throws -> StringParameters
stringString to read from
startStart index of the substring inclusive
endEnd index of the substring exclusive
Return Value
Substring
MPQRParser Class Reference