pan property
String
get
pan
Retrieves the Merchant PAN (Primary Account Number) from the QR code data.
The Merchant PAN is typically found in sub-tag 01 within the QR data tags 26 to 45.
The function will first attempt to extract the PAN from tag 26, and if it's not available,
it will proceed to check tag 51. These are the standard tags where the Merchant PAN is stored.
PAN Validation:
- This PAN is not checked for validity, for validation use the
isPanValidmethod.
Returns:
- The Merchant PAN as a string if available and, or an empty string (
'') if not found or invalid. The value is taken from QR data tag26to45, specifically sub-tag01.
Example:
String pan = QRISMPM(qrData).merchant.pan;
print(pan); // "936008860000000042" if valid, or an empty string if not found or invalid.
Implementation
String get pan {
for (var tagId in _baseTagIds) {
var mPAN = _raw['merchant_information_$tagId'];
if (mPAN != null && mPAN['merchant_pan'] != null) {
String merchantPan = mPAN['merchant_pan'];
return merchantPan;
}
}
// Return an empty string if merchant_pan is not found
return '';
}