EnumBankBackCode.java 3.66 KB
package com.yohoufo.user.common;

/**
 * 银联定义的返回应答码
 * 如有变化,具体以银联文档为准
 */
public enum EnumBankBackCode {
    //定义
    code_0000("0000","验证一致","00","验证一致"),
    code_2314("2314","发卡行无此卡号","01","验证不一致"),
    code_2316("2316","发卡行返回该卡状态不正常,建议持卡人与发卡行联系","01","验证不一致"),
    code_2319("2319","验证不一致","01","验证不一致"),
    code_2320("2320","发卡行返回该卡密码错次数超限,建议持卡人与发卡行联系","01","验证不一致"),
    code_2344("2344","发卡行返回该卡未预留手机号,建议持卡人与发卡行联系","01","验证不一致"),
    code_2321("2321","不支持发现卡验证交易","02","不支持验证"),
    code_2325("2325","发卡行返回该卡不支持验证,建议持卡人与发卡行联系","02","不支持验证"),
    code_2334("2334","发卡行返回该卡验证次数已超限,请明日再试","02","不支持验证"),
    code_2346("2346","建行卡不支持卡号+手机号两要素组合验证","02","不支持验证"),
    code_5000("5000","未知商户,不予通过","02","不支持验证"),
    code_5101("5101","该卡交易过于频繁,请稍后重试","02","不支持验证"),
    code_5102("5102","该证件号交易过于频繁,请稍后重试","02","不支持验证"),
    code_5103("5103","该卡今日验证失败次数过多,请明日重试","02","不支持验证"),
    code_5104("5104","该证件号今日验证失败次数过多,请明日重试","02","不支持验证"),
    code_5105("5105","短期内有同卡重复交易,请稍后重试","02","不支持验证"),
    code_5106("5106","该卡今日验证次数过多,请明日重试","02","不支持验证"),
    code_5107("5107","请取得个人授权","02","不支持验证"),
    code_5108("5108","当日验证次数已达最大值,请明日再试","02","不支持验证"),
    code_4001("4001","无效卡","03","验证要素格式有误"),
    code_4002("4002","无效证件类型","03","验证要素格式有误"),
    code_4003("4003","无效证件号","03","验证要素格式有误"),
    code_4004("4004","无效手机号","03","验证要素格式有误"),
    code_4005("4005","无效姓名","03","验证要素格式有误"),
    code_4006("4006","多种要素格式错误","03","验证要素格式有误"),
    code_1302("1302","发卡行响应超时,请稍后重试","04","系统异常"),
    code_1399("1399","发卡行系统异常,请稍后重试","04","系统异常"),
    code_2208("2208","渠道方系统异常,请稍后重试","04","系统异常"),
    code_2329("2329","系统异常,请稍后重试","04","系统异常")
    ;

    // 成员变量
    //应答码细分
    private String secondCode;
    private String secondCodeDesc;

    // 应答码 00 验证一致(收费) 和 01 验证不一致(收费) ,其余情况不收费
    private String firstCode;
    private String firstCodeDesc;

    //构造函数
    EnumBankBackCode(String secondCode,String secondCodeDesc,String firstCode,String firstCodeDesc){
        this.secondCode = secondCode;
        this.secondCodeDesc = secondCodeDesc;
        this.firstCode = firstCode;
        this.firstCodeDesc = firstCodeDesc;
    }

    public static String getFirstCodeBySecondCode(String secondCode){
        if(secondCode==null){
            return "";
        }
        for(EnumBankBackCode backCode:EnumBankBackCode.values()){
            if(secondCode.equals(backCode.secondCode)){
                return backCode.firstCode;
            }
        }
        return "";
    }


}