in membership-common/src/main/scala/com/gu/zuora/soap/models/Errors.scala [89:104]
private def handlePaymentGatewayResponseError(result: Node) = {
val code = (result \ "Errors" \ "Code").head.text
val message = (result \ "Errors" \ "Message").head.text
val `type` = message match {
case "Transaction declined.insufficient_funds - Your card has insufficient funds." => InsufficientFunds
case "Transaction declined.fraudulent - Your card was declined." => Fraudulent
case "Transaction declined.transaction_not_allo - Your card does not support this type of purchase." => TransactionNotAllowed
case "Transaction declined.do_not_honor - Your card was declined." => DoNotHonor
case "Transaction declined.revocation_of_author - Your card was declined." => RevocationOfAuthorization
case "Transaction declined.generic_decline - Your card was declined." => GenericDecline
case _ => UnknownPaymentError
}
PaymentGatewayError(code, message, (result \ "GatewayResponse").head.text, (result \ "GatewayResponseCode").head.text, `type`)
}