-
Generate the push payment string with new CRC checksum. The existing CRC field will be replaced by the new CRC checksum.
Note
The string is generated with ordered tags, it’s not following the original order. This method is mutating i.e it will mutate the CRC tag.
Declaration
Objective-C
- (NSString *_Nullable)generatePushPaymentString: (NSError *_Nullable *_Nullable)error;
Swift
func generatePushPaymentString() throws -> String
Return Value
Generated string with CRC.
-
Get value with luhn checksum appended with the string representation of underlying value related to the tag.
Note
This is usually used for merchant id fields
Note
Throws:
MPQRError.invalidFormat
exceptionIf the value doesn’t exist for the tag
If the format of the underlying value is not valid for generating the checksum
Declaration
Objective-C
- (NSString *_Nullable)valueWithLuhnChecksum:(TagInfo *_Nonnull)tag error: (NSError *_Nullable *_Nullable)error;
Swift
func valueWithLuhnChecksum(_ tag: TagInfo) throws -> String
Parameters
tag
Tag info for which to generate value with luhn checksum
Return Value
Value with luhn checksum appended
-
Check if this data represents is dynamic
Declaration
Objective-C
- (BOOL)isDynamic;
Swift
func isDynamic() -> Bool
Return Value
true
if dynamic,false
otherwise -
Payload format indicator
Declaration
Objective-C
@property (readwrite, retain, atomic, nullable) NSString *payloadFormatIndicator;
Swift
var payloadFormatIndicator: String? { get set }
-
Point of initiation method
Declaration
Objective-C
@property (readwrite, retain, atomic, nullable) NSString *pointOfInitiationMethod;
Swift
var pointOfInitiationMethod: String? { get set }
-
Merchant identifier Visa with tag
02
Declaration
Objective-C
@property (readwrite, retain, atomic, nullable) NSString *merchantIdentifierVisa02;
Swift
var merchantIdentifierVisa02: String? { get set }
-
Merchant identifier Visa with tag
03
Declaration
Objective-C
@property (readwrite, retain, atomic, nullable) NSString *merchantIdentifierVisa03;
Swift
var merchantIdentifierVisa03: String? { get set }
-
Merchant identifier MasterCard with tag
04
Declaration
Objective-C
@property (readwrite, retain, atomic, nullable) NSString *merchantIdentifierMastercard04;
Swift
var merchantIdentifierMastercard04: String? { get set }
-
Merchant identifier MasterCard with tag
05
Declaration
Objective-C
@property (readwrite, retain, atomic, nullable) NSString *merchantIdentifierMastercard05;
Swift
var merchantIdentifierMastercard05: String? { get set }
-
Merchant identifier tag 06 is reserved by EMVCo. For Bharat QR standard in India, this tag is currently defined by NCPI
Declaration
Objective-C
@property (readwrite, retain, atomic, nullable) NSString *merchantIdentifierNPCI06;
Swift
var merchantIdentifierNPCI06: String? { get set }
-
Merchant identifier with tag 07 is reserved by EMVCo. For Bharat QR standard in India, this tag is currently defined by NPCI
Declaration
Objective-C
@property (readwrite, retain, atomic, nullable) NSString *merchantIdentifierNPCI07;
Swift
var merchantIdentifierNPCI07: String? { get set }
-
Merchant identifier with tag 08 is reserved by EMVCo
Declaration
Objective-C
@property (readwrite, retain, atomic, nullable) NSString *merchantIdentifierIFSCCODE08;
Swift
var merchantIdentifierIFSCCODE08: String? { get set }
-
Merchant identifier (Discover)
Declaration
Objective-C
@property (readwrite, retain, atomic, nullable) NSString *merchantIdentifierDISCOVER09;
Swift
var merchantIdentifierDISCOVER09: String? { get set }
-
Merchant identifier (Discover)
Declaration
Objective-C
@property (readwrite, retain, atomic, nullable) NSString *merchantIdentifierDISCOVER10;
Swift
var merchantIdentifierDISCOVER10: String? { get set }
-
Merchant identifier (Amex)
Declaration
Objective-C
@property (readwrite, retain, atomic, nullable) NSString *merchantIdentifierAMEX11;
Swift
var merchantIdentifierAMEX11: String? { get set }
-
Merchant identifier (Amex)
Declaration
Objective-C
@property (readwrite, retain, atomic, nullable) NSString *merchantIdentifierAMEX12;
Swift
var merchantIdentifierAMEX12: String? { get set }
-
Merchant identifier (JCB)
Declaration
Objective-C
@property (readwrite, retain, atomic, nullable) NSString *merchantIdentifierJCB13;
Swift
var merchantIdentifierJCB13: String? { get set }
-
Merchant identifier (JCB)
Declaration
Objective-C
@property (readwrite, retain, atomic, nullable) NSString *merchantIdentifierJCB14;
Swift
var merchantIdentifierJCB14: String? { get set }
-
Merchant identifier (UnionPay)
Declaration
Objective-C
@property (readwrite, retain, atomic, nullable) NSString *merchantIdentifierUNIONPAY15;
Swift
var merchantIdentifierUNIONPAY15: String? { get set }
-
Merchant identifier (UnionPay)
Declaration
Objective-C
@property (readwrite, retain, atomic, nullable) NSString *merchantIdentifierUNIONPAY16;
Swift
var merchantIdentifierUNIONPAY16: String? { get set }
-
Get MAIData for some tag
Declaration
Objective-C
- (MAIData *_Nullable)getMAIDataForTagString:(NSString *_Nonnull)tagString error: (NSError *_Nullable *_Nullable)error;
Swift
func getMAIData(forTagString tagString: String) throws -> MAIData
Parameters
tagString
Tag to get the value
Return Value
The value if it is available
-
Set MAIData tag for some tag. In case the tag need to be specified in certain tag, this function is used instead. For example, we want to set MAID to specific tag 28.
Declaration
Objective-C
- (BOOL)setMAIDataForTagString:(NSString *_Nonnull)tagString data:(MAIData *_Nonnull)data error:(NSError *_Nullable *_Nullable)error;
Swift
func setMAIDataForTagString(_ tagString: String, data: MAIData) throws
Parameters
tagString
Tag to be set
data
The value to be set
-
Merchant Category Code: MCC as defined by ISO 18245
Declaration
Objective-C
@property (readwrite, retain, atomic, nullable) NSString *merchantCategoryCode;
Swift
var merchantCategoryCode: String? { get set }
-
Transaction Currency Code: As defined by ISO 4217
Declaration
Objective-C
@property (readwrite, retain, atomic, nullable) NSString *transactionCurrencyCode;
Swift
var transactionCurrencyCode: String? { get set }
-
Transaction amount
This amount is expressed as how the value appears.
Defines the regex to validate amount with max length 13 chars with following rules - amount “100.00” is defined as “100.00”, or - amount “99.85” is defined as “99.85”, or - amount “99.333” is defined as “99.333”, or - amount “99.3456” is defined as “99.3456”
Declaration
Objective-C
@property (readwrite, retain, atomic, nullable) NSString *transactionAmount;
Swift
var transactionAmount: String? { get set }
-
Tip or convenience indicator - 01 : Indicates Consumer should be prompted to enter tip - 02 : Indicates that merchant would mandatorily charge a flat convenience fee - 03 : Indicates that merchant would charge a percentage convenience fee
Declaration
Objective-C
@property (readwrite, retain, atomic, nullable) NSString *tipOrConvenienceIndicator;
Swift
var tipOrConvenienceIndicator: String? { get set }
-
Value of convenience fee fixed.
The convenience fee of a fixed amount should be specified here. This amount is expressed as how the value appears.
Defines the regex to validate amount with max length 13 chars with following rules - amount “100.00” is defined as “100.00”, or - amount “99.85” is defined as “99.85”, or - amount “99.333” is defined as “99.333” - amount “99.3456” is defined as “99.3456”
Declaration
Objective-C
@property (readwrite, retain, atomic, nullable) NSString *valueOfConvenienceFeeFixed;
Swift
var valueOfConvenienceFeeFixed: String? { get set }
-
Value of convenience fee percentage.
The Convenience Fee Percentage is specified as whole integers between 00.01 (for 00.01%) to 99.99 (99.99%). E.g. 11.95
Declaration
Objective-C
@property (readwrite, retain, atomic, nullable) NSString *valueOfConvenienceFeePercentage;
Swift
var valueOfConvenienceFeePercentage: String? { get set }
-
Country Code: As defined by ISO 3166.
Declaration
Objective-C
@property (readwrite, retain, atomic, nullable) NSString *countryCode;
Swift
var countryCode: String? { get set }
-
“Merchant Name: Should always be the “doing business as” name for the merchant.
Declaration
Objective-C
@property (readwrite, retain, atomic, nullable) NSString *merchantName;
Swift
var merchantName: String? { get set }
-
Merchant city
Declaration
Objective-C
@property (readwrite, retain, atomic, nullable) NSString *merchantCity;
Swift
var merchantCity: String? { get set }
-
Postal code: Zip code or Pin code or Postal code of merchant
Declaration
Objective-C
@property (readwrite, retain, atomic, nullable) NSString *postalCode;
Swift
var postalCode: String? { get set }
-
Additional Data Field: Additional information beyond basic may be required in certain cases. This information may be either presented by the merchant or acquirer or the Consumer may be prompted for entry on the app. For consumer prompt, the value field of Tag would be 3 asterisks i.e. ***. The acquirer / merchant should provide only minimum information in order to avoid making the size of data onerous. The length of each tag is variable up to 26 characters and overall it is not to exceed the maximum of 99 characters for the total size of the Additional Data Field.
Declaration
Objective-C
@property (readwrite, retain, atomic, nullable) AdditionalData *additionalData;
Swift
var additionalData: AdditionalData? { get set }
-
Language data, It will have:
- mandatory tag 00,
- mandatory Merchant Name tag 01,
- optional Merchant City tag 02.
Declaration
Objective-C
@property (readwrite, retain, atomic, nullable) LanguageData *languageData;
Swift
var languageData: LanguageData? { get set }
-
CRC calculated to ISO/IEC 3309 compliant 16 bit CRC which includes all the preceding TLV objects till the Tag and length value of CRC i.e. A904. CRC would be the last TLV object.
Declaration
Objective-C
@property (readwrite, retain, atomic, nullable) NSString *crc;
Swift
var crc: String? { get set }
-
Get Unreserved Unrestricted Data for some tag
Declaration
Objective-C
- (UnrestrictedData *_Nullable) getUnreservedDataForTagString:(NSString *_Nonnull)tagString error:(NSError *_Nullable *_Nullable)error;
Swift
func getUnreservedData(forTagString tagString: String) throws -> UnrestrictedData
Parameters
tagString
Tag to get the value
Return Value
The value if it is available
-
Set Unreserved Unrestricted Data for some tag
Declaration
Objective-C
- (BOOL)setUnreservedDataForTagString:(NSString *_Nonnull)tagString data:(UnrestrictedData *_Nonnull)data error:(NSError *_Nullable *_Nullable)error;
Swift
func setUnreservedDataForTagString(_ tagString: String, data: UnrestrictedData) throws
Parameters
tagString
Tag to be set
data
The value to be set
-
Set MAI Data for some tag without specifying the tag, the tag will be automatically assign. This function will set MAID data for tag 26 to 51 automatically given MAID data, starting from lowest tag to highest tag. For example, first call of this function will assign data to tag 26. Second call of this function will assign data to tag 27, and so on.
Note
If the tags are all taken, it will throw error as data cannot be set
Declaration
Objective-C
- (BOOL)setDynamicMAIDTag:(MAIData *_Nonnull)value error:(NSError *_Nullable *_Nullable)error;
Swift
func setDynamicMAIDTag(_ value: MAIData) throws
Parameters
value
The value to be set
-
Set Unrestricted Data for some tag without specifying the tag, the tag will be automatically assign. This function will set UnrestrictedData data for tag 80 to 99 automatically given UnrestrictedData data, starting from lowest tag to highest tag. For example, first call of this function will assign data to tag 80. Second call of this function will assign data to tag 81, and so on.
Note
If the tags are all taken, it will throw error as data cannot be set
Declaration
Objective-C
- (BOOL)setDynamicUnrestrictedTag:(UnrestrictedData *_Nonnull)value error:(NSError *_Nullable *_Nullable)error;
Swift
func setDynamicUnrestrictedTag(_ value: UnrestrictedData) throws
Parameters
value
The value to be set
-
Validate merchant fields
Atleast
1
field related to merchant identifiers should exist.Note
Throws:MPQRError.missingTag
exception if the none of the merchant tags is foundDeclaration
Objective-C
- (BOOL)validateMerchantIdentifiers:(NSError *_Nullable *_Nullable)error;
Swift
func validateMerchantIdentifiers() throws
-
Validate tip fields
Logic for validation is as following:
If the
tipIndicator
tagPPTag.TAG_55_TIP_INDICATOR
does not exist then tip fields are validIf the
tipIndicator
isTipConvenienceIndicator.promptedToEnterTip
then itMust NOT have
PPTag.TAG_56_CONVENIENCE_FEE_FIXED
else it throwsMPQRError.conflictingTag
Must NOT have
PPTag.TAG_57_CONVENIENCE_FEE_PERCENTAGE
else it throwsMPQRError.conflictingTag
If the
tipIndicator
isTipConvenienceIndicator.flatConvenienceFee
then itMUST have
PPTag.TAG_56_CONVENIENCE_FEE_FIXED
else it throwsMPQRError.missingTag
Must NOT have
PPTag.TAG_57_CONVENIENCE_FEE_PERCENTAGE
else it throwsMPQRError.conflictingTag
If the
tipIndicator
isTipConvenienceIndicator.percentageConvenienceFee
then itMUST have
PPTag.TAG_57_CONVENIENCE_FEE_PERCENTAGE
else it throwsMPQRError.missingTag
Must NOT have
PPTag.TAG_56_CONVENIENCE_FEE_FIXED
else it throwsMPQRError.conflictingTag
Else tip fields are valid
Note
Throws:MPQRError.conflictingTag
exception if the tags are conflicting.MPQRError.missingTag
exception if the required tag is missing.Declaration
Objective-C
- (BOOL)validateTipFields:(NSError *_Nullable *_Nullable)error;
Swift
func validateTipFields() throws
-
Validate price fields
Logic for validation is as following:
If
transactionAmount
is not present andisDynamic
returns true then tagPPTag.TAG_54_TRANSACTION_AMOUNT
is missing and it throwsMPQRError.missingTag
exceptionIf
transactionAmount
is present andisDynamic
returns false then tagPPTag.TAG_54_TRANSACTION_AMOUNT
is conflicting and it throwsMPQRError.conflictingTag
exceptionElse price fields are valid
Note
Throws:MPQRError.conflictingTag
exception if the tags are conflicting.MPQRError.missingTag
exception if the required tag is missing.Declaration
Objective-C
- (BOOL)validatePriceField:(NSError *_Nullable *_Nullable)error;
Swift
func validatePriceField() throws