def isPaymentError()

in support-payment-api/src/main/scala/services/CloudWatchService.scala [49:67]


  def isPaymentError(error: Exception): Boolean = {
    // Payment errors are failures caused by something other than problems with the contributors card or account.
    // These are worthy of further investigation and will be used to trigger alerts
    error match {
      case e: StripeApiError => !e.exceptionType.contains("CardException")
      case e: PaypalApiError =>
        e.errorName.getOrElse("") match {
          case ("CREDIT_CARD_CVV_CHECK_FAILED") => false
          case ("CREDIT_CARD_REFUSED") => false
          case ("INSTRUMENT_DECLINED") => false
          case ("INSUFFICIENT_FUNDS") => false
          // PAYMENT_ALREADY_DONE is a valid error, but currently alerting too often and possibly masking other errors
          // Adding this error to the filter list until we can get it fixed.
          case ("PAYMENT_ALREADY_DONE") => false
          case _ => true
        }
      case _ => true
    }
  }