public static HpsCreditException GetException(long transactionId, string responseCode, string responseText, HpsCardType type = HpsCardType.Credit)
        {
            if (responseCode == "00" || responseCode == "0")
            {
                return(null);
            }

            HpsExceptionCodes code;
            string            message;

            switch (type)
            {
            case HpsCardType.Credit:
                if (responseCode == "85" || responseCode == "10")
                {
                    return(null);
                }
                if (IssuerCodeToCreditExceptionCode.TryGetValue(responseCode, out code))
                {
                    CreditExceptionCodeToMessage.TryGetValue(code, out message);
                    return(new HpsCreditException(transactionId, code, message ?? "Unknown issuer error.", responseCode, responseText));
                }
                break;

            case HpsCardType.Gift:
                if (responseCode == "13")
                {
                    return(null);
                }
                if (IssuerCodeToGiftExceptionCode.TryGetValue(responseCode, out code))
                {
                    CreditExceptionCodeToMessage.TryGetValue(code, out message);
                    return(new HpsCreditException(transactionId, code, message ?? "Unknown issuer error.", responseCode, responseText));
                }
                break;
            }
            return(new HpsCreditException(transactionId, HpsExceptionCodes.UnknownIssuerError, CreditExceptionCodeToMessage[HpsExceptionCodes.UnknownIssuerError], responseCode, responseText));
        }
        public static void CheckResponse(long transactionId, string responseCode, string responseText, HpsCardType type = HpsCardType.Credit)
        {
            var e = GetException(transactionId, responseCode, responseText, type);

            if (e != null)
            {
                throw e;
            }
        }