parsePaymentStatus function

LokotroPaymentStatus parsePaymentStatus(
  1. String? status
)

Public helper to parse payment status from strings

Implementation

LokotroPaymentStatus parsePaymentStatus(String? status) {
  if (status == null) return LokotroPaymentStatus.failed;
  switch (status.toLowerCase()) {
    case 'pending':
      return LokotroPaymentStatus.pending;
    case 'processing':
      return LokotroPaymentStatus.processing;
    case 'approved':
    case 'success':
    case 'successful':
      return LokotroPaymentStatus.approved;
    case 'declined':
      return LokotroPaymentStatus.declined;
    case 'failed':
    case 'fail':
      return LokotroPaymentStatus.failed;
    case 'cancelled':
    case 'canceled':
      return LokotroPaymentStatus.cancelled;
    case 'expired':
      return LokotroPaymentStatus.expired;
    case 'refunded':
      return LokotroPaymentStatus.refunded;
    default:
      return LokotroPaymentStatus.failed;
  }
}