paymentInitiationPaymentStatusFromJson function

PaymentInitiationPaymentStatus paymentInitiationPaymentStatusFromJson(
  1. Object? paymentInitiationPaymentStatus, [
  2. PaymentInitiationPaymentStatus? defaultValue
])

Implementation

enums.PaymentInitiationPaymentStatus paymentInitiationPaymentStatusFromJson(
  Object? paymentInitiationPaymentStatus, [
  enums.PaymentInitiationPaymentStatus? defaultValue,
]) {
  if (paymentInitiationPaymentStatus is String) {
    return enums.$PaymentInitiationPaymentStatusMap.entries
        .firstWhere(
            (element) =>
                element.value.toLowerCase() ==
                paymentInitiationPaymentStatus.toLowerCase(),
            orElse: () => const MapEntry(
                enums.PaymentInitiationPaymentStatus.swaggerGeneratedUnknown,
                ''))
        .key;
  }

  final parsedResult = defaultValue == null
      ? null
      : enums.$PaymentInitiationPaymentStatusMap.entries
          .firstWhereOrNull((element) => element.value == defaultValue)
          ?.key;

  return parsedResult ??
      defaultValue ??
      enums.PaymentInitiationPaymentStatus.swaggerGeneratedUnknown;
}