parseApiResponseCode function

LokotroPayApiResponseCode parseApiResponseCode(
  1. String? code
)

Enhanced response models for Lokotro Pay with modern design patterns Helper functions for enum parsing Public helper to parse API response codes from strings

Implementation

/// Helper functions for enum parsing
/// Public helper to parse API response codes from strings
LokotroPayApiResponseCode parseApiResponseCode(String? code) {
  if (code == null) return LokotroPayApiResponseCode.lok001;
  switch (code.toUpperCase()) {
    case 'LOK000':
      return LokotroPayApiResponseCode.lok000;
    case 'LOK001':
      return LokotroPayApiResponseCode.lok001;
    case 'LOK002':
      return LokotroPayApiResponseCode.lok002;
    case 'LOK003':
      return LokotroPayApiResponseCode.lok003;
    case 'LOK004':
      return LokotroPayApiResponseCode.lok004;
    case 'LOK005':
      return LokotroPayApiResponseCode.lok005;
    case 'LOK006':
      return LokotroPayApiResponseCode.lok006;
    case 'LOK007':
      return LokotroPayApiResponseCode.lok007;
    case 'LOK008':
      return LokotroPayApiResponseCode.lok008;
    case 'LOK009':
      return LokotroPayApiResponseCode.lok009;
    default:
      return LokotroPayApiResponseCode.lok001;
  }
}