acquirerName property

String get acquirerName

Extracts and formats the Acquirer Name by removing common prefixes and non-alphanumeric characters.

This method formats the Acquirer Name by removing common prefixes (e.g., ID., BANK.) and non-alphanumeric characters, making the name cleaner and more readable.

Data source: Tag: 26/27 sub tag Sub tag 00

Returns:

  • The formatted Acquirer Name as a string.

Implementation

String get acquirerName {
  String rawName = _raw['merchant_information_26']
          ?['global_unique_identifier'] ??
      _raw['merchant_information_27']?['global_unique_identifier'] ??
      '';

  final prefixesToRemove = [
    'ID.',
    'COM.',
    'CO.',
    'QRIS.',
    'ORG.',
    'BANK.',
    'MERCHANT.',
    'GOV.',
    'IND.',
    'IN.',
    'COMMERCE.',
    'PT.',
    'MY.',
    'SG.',
    'KR.',
    'CN.',
    'JP.',
    'TH.'
  ];

  for (final prefix in prefixesToRemove) {
    rawName = rawName.replaceAll(prefix, '');
  }

  rawName = rawName
      .replaceAll(RegExp(r'\.[wW][wW][wW]$'), '') // Remove '.WWW'
      .replaceAll('BANK', 'BANK ') // Add space after 'BANK'
      .replaceAll(RegExp(r'[^a-zA-Z0-9\s]'), '') // Remove non-alphanumeric
      .trim(); // Trim spaces

  return rawName;
}