panMerchantMethod property
PANMerchantMethod
get
panMerchantMethod
Determines the Merchant Payment Method based on the 9th character of the PAN.
The 9th character (index 8) of the PAN is used to determine the Merchant's payment method, which could represent Debit, Credit, Electronic Money, or a reserved method for future use.
Returns:
-
A
PANMerchantMethod
representing the payment method. Possible values include: -
B 'RAW' value of the 9th character of the PAN.
0
forunspecified
.1
fordebit
.2
forcredit
.3
forelectronicMoney
.
Implementation
PANMerchantMethod get panMerchantMethod {
final panCode = pan;
if (panCode.isNotEmpty && panCode.length >= 9) {
final code = int.tryParse(panCode[8]);
switch (code) {
case 0:
return PANMerchantMethod.unspecified;
case 1:
return PANMerchantMethod.debit;
case 2:
return PANMerchantMethod.credit;
case 3:
return PANMerchantMethod.electronicMoney;
default:
return (code != null && code >= 4 && code <= 9)
? PANMerchantMethod.rfu
: PANMerchantMethod.unspecified;
}
}
return PANMerchantMethod.unspecified;
}