package com.huiju.estateagents.common.wxpay;

public enum WXPayRefundReason {
    SYSTEMERROR("SYSTEMERROR","系统超时等"),
    BIZERR_NEED_RETRY("BIZERR_NEED_RETRY","并发情况下，业务被拒绝，商户重试即可解决"),
    TRADE_OVERDUE("TRADE_OVERDUE","订单已经超过可退款的最大期限(支付后一年内可退款)"),
    ERROR("ERROR","申请退款业务发生错误"),
    USER_ACCOUNT_ABNORMAL("USER_ACCOUNT_ABNORMAL","用户帐号注销"),
    INVALID_REQ_TOO_MUCH("INVALID_REQ_TOO_MUCH","连续错误请求数过多被系统短暂屏蔽"),
    NOTENOUGH("NOTENOUGH","商户可用退款余额不足"),
    INVALID_TRANSACTIONID("INVALID_TRANSACTIONID","请求参数未按指引进行填写"),
    PARAM_ERROR("PARAM_ERROR","请求参数未按指引进行填写"),
    APPID_NOT_EXIST("APPID_NOT_EXIST","参数中缺少APPID"),
    MCHID_NOT_EXIST("MCHID_NOT_EXIST","参数中缺少MCHID"),
    ORDERNOTEXIST("ORDERNOTEXIST","缺少有效的订单号"),
    REQUIRE_POST_METHOD("REQUIRE_POST_METHOD","未使用post传递参数 "),
    SIGNERROR("SIGNERROR","参数签名结果不正确"),
    XML_FORMAT_ERROR("XML_FORMAT_ERROR","XML格式错误"),
    FREQUENCY_LIMITED("FREQUENCY_LIMITED","2个月之前的订单申请退款有频率限制"),
    NOAUTH("NOAUTH","请求ip异常"),
    ;

    WXPayRefundReason(String code, String message) {
        this.code = code;
        this.message = message;
    }

    private String code;

    private String message;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }


    public static String getMsg(String code) {
        String message = "";
       switch (code){
           case "SYSTEMERROR":
               message = SYSTEMERROR.getMessage();
               break;
           case "BIZERR_NEED_RETRY":
               message = BIZERR_NEED_RETRY.getMessage();
               break;
           case "TRADE_OVERDUE":
               message = TRADE_OVERDUE.getMessage();
               break;
           case "ERROR":
               message = ERROR.getMessage();
               break;
           case "USER_ACCOUNT_ABNORMAL":
               message = USER_ACCOUNT_ABNORMAL.getMessage();
               break;
           case "INVALID_REQ_TOO_MUCH":
               message = INVALID_REQ_TOO_MUCH.getMessage();
               break;
           case "NOTENOUGH":
               message = NOTENOUGH.getMessage();
               break;
           case "INVALID_TRANSACTIONID":
               message = INVALID_TRANSACTIONID.getMessage();
               break;
           case "PARAM_ERROR":
               message = PARAM_ERROR.getMessage();
               break;
           case "APPID_NOT_EXIST":
               message = APPID_NOT_EXIST.getMessage();
               break;
           case "MCHID_NOT_EXIST":
               message = MCHID_NOT_EXIST.getMessage();
               break;
           case "REQUIRE_POST_METHOD":
               message = REQUIRE_POST_METHOD.getMessage();
               break;
           case "SIGNERROR":
               message = SIGNERROR.getMessage();
               break;
           case "XML_FORMAT_ERROR":
               message = XML_FORMAT_ERROR.getMessage();
               break;
           case "FREQUENCY_LIMITED":
               message = FREQUENCY_LIMITED.getMessage();
               break;
           case "NOAUTH":
               message = NOAUTH.getMessage();
               break;
           case "ORDERNOTEXIST":
               message = ORDERNOTEXIST.getMessage();
               break;
       }
        return message;
    }
}
