getTransactionStatus function

TransactionStatus getTransactionStatus(
  1. String status
)

NEW, PENDING, COMPLETED, EXPIRED, UNRESOLVED, RESOLVED, CANCELED, REFUND PENDING, REFUNDED Every charge object has a timeline of status updates.

Implementation

TransactionStatus getTransactionStatus(String status) {
  switch (status) {
    case 'NEW':
      return TransactionStatus.new_;
    case 'PENDING':
      return TransactionStatus.pending;
    case 'COMPLETED':
      return TransactionStatus.completed;
    case 'EXPIRED':
      return TransactionStatus.expired;
    case 'UNRESOLVED':
      return TransactionStatus.unresolved;
    case 'RESOLVED':
      return TransactionStatus.resolved;
    case 'CANCELED':
      return TransactionStatus.canceled;
    case 'REFUND PENDING':
      return TransactionStatus.refund_pending;
    case 'REFUNDED':
      return TransactionStatus.refunded;

    default:
      return TransactionStatus.none;
  }
}