package com.jeequan.jeepay.core.constants;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author terrfly
 * @Date 2019/11/16 15:09
 * @Description Constants 常量对象
 **/
public class CS {

    /** 可能需要根据环境 进行修改的地方 **/

    /**
     * DB密码因子 : 规则[必须32位， 支持数字和大小写字母]
     */
    public final static String DB_PASSWD_DECRYPT_KEY = "jeepayDJeIVzvyD6apRY7CSgmA3LN1Kk";

    //登录图形验证码缓存时间，单位：s
    public static final int VERCODE_CACHE_TIME = 60;


    /**
     * 系统 角色 定义
     **/
    public interface SYS_ROLE_TYPE {
        String PLATFORM = "PLATFORM"; // 平台： 一般指运营平台系统。 或者 或者平台收益者。
        String ISV = "ISV";  //服务商角色
        String AGENT = "AGENT"; // 服务商系统  or  服务商角色
        String MCH = "MCH";  // 商户系统 or  商户角色
        /**
         * @since 2024-01-28 14:15:14
         * 商户/用户费率，不在于应用绑定，后期如果需要用到应用费率，再对现有名词做区分
         */
        String MCH_APP = "MCH_APP"; // 商户应用

        /**
         * 用户进件商户信息
         */
        String MCH_APPLYMENT = "MCH_APPLYMENT";

        String ISV_OAUTH2 = "ISV_OAUTH2"; // 服务商的oauth2参数
        String MCH_APP_OAUTH2 = "MCH_APP_OAUTH2"; // 商户应用的oauth2参数（目前仅普通商户）

        Map<String, String> SYS_ROLE_TYPE_MAP = new HashMap<>();
    }

    static {

        SYS_ROLE_TYPE.SYS_ROLE_TYPE_MAP.put(SYS_ROLE_TYPE.PLATFORM, "运营平台");
        SYS_ROLE_TYPE.SYS_ROLE_TYPE_MAP.put(SYS_ROLE_TYPE.AGENT, "服务商系统");
        SYS_ROLE_TYPE.SYS_ROLE_TYPE_MAP.put(SYS_ROLE_TYPE.MCH, "商户系统");
        SYS_ROLE_TYPE.SYS_ROLE_TYPE_MAP.put(SYS_ROLE_TYPE.ISV, "服务商");
        SYS_ROLE_TYPE.SYS_ROLE_TYPE_MAP.put(SYS_ROLE_TYPE.MCH_APP, "商户应用");
        SYS_ROLE_TYPE.SYS_ROLE_TYPE_MAP.put(SYS_ROLE_TYPE.MCH_APPLYMENT, "商户应用");
    }

    /**
     * 特殊的infoId 的枚举值
     **/
    public interface INFO_ID_ENUM {
        String PLATFORM_PROFIT = "PLATFORM_PROFIT"; // 运营平台的利润
        String PLATFORM_INACCOUNT = "PLATFORM_INACCOUNT";  // 运营平台的三方支付网关的入账金额 (并非利润， 包含了服务商的所有的利润  )
    }


    /**
     * yes or no
     **/
    public static final byte NO = 0;
    public static final byte YES = 1;

    /**
     * 通用 可用 / 禁用
     **/
    public static final int PUB_USABLE = 1;
    public static final int PUB_DISABLE = 0;

    public static final Map<Integer, String> PUB_USABLE_MAP = new HashMap<>();

    static {
        PUB_USABLE_MAP.put(PUB_USABLE, "正常");
        PUB_USABLE_MAP.put(PUB_DISABLE, "停用");
    }

    /**
     * 商户类型:1-普通商户 2-特约商户
     */
    public static final byte MCH_TYPE_NORMAL = 1;
    public static final byte MCH_TYPE_ISVSUB = 2;

    /**
     * 性别 1- 男， 2-女
     */
    public static final byte SEX_UNKNOWN = 0;
    public static final byte SEX_MALE = 1;
    public static final byte SEX_FEMALE = 2;


    public static final long TOKEN_TIME = 60 * 60 * 2; //单位：s,  两小时

    public static final long TOKEN_TIME_APP = 60 * 60 * 24 * 30; //单位：s,  30天


    //access_token 名称
    public static final String ACCESS_TOKEN_NAME = "iToken";
    public static final String FACE_DEVICE_NAME = "facedevice";

    /** ！！不同系统请放置不同的redis库 ！！ **/
    /**
     * 缓存key: 当前用户所有用户的token集合  example: TOKEN_1001_HcNheNDqHzhTIrT0lUXikm7xU5XY4Q
     */
    public static final String CACHE_KEY_TOKEN = "TOKEN_%s_%s";

    public static String getCacheKeyToken(Object sysUserId, String uuid) {
        return String.format(CACHE_KEY_TOKEN, sysUserId, uuid);
    }

    /**
     * 缓存key: 当前用户所有用户的token集合  example: tokenList_1001
     */
    public static final String CACHE_KEY_TOKEN_LIST = "tokenList_%s";

    public static String getCacheKeyTokenList(Long uid) {
        return String.format(CACHE_KEY_TOKEN_LIST, uid);
    }

    /**
     * 图片验证码 缓存key
     **/
    public static final String CACHE_KEY_IMG_CODE = "img_code_%s";

    public static String getCacheKeyImgCode(String imgToken) {
        return String.format(CACHE_KEY_IMG_CODE, imgToken);
    }

    /**
     * 短信验证码 缓存key
     **/
    public static final String CACHE_KEY_SMS_CODE = "sms_code_%s";

    public static String getCacheKeySmsCode(String phone) {
        return String.format(CACHE_KEY_SMS_CODE, phone);
    }

    /**
     * wxjava redis缓存key前缀
     **/
    public static final String CACHE_KEY_WX_JAVA = "WX_JAVA_REDIS_";

    /**
     * 登录防穷举 缓存key
     **/
    public static final String CACHE_KEY_LOGIN_ERR = "LOGIN_ERR_%s_%s";

    public static String getCacheKeyLoginErr(String sysType, String username) {
        return String.format(CACHE_KEY_LOGIN_ERR, sysType, username);
    }

    /**
     * 扫码登录 二维码 缓存key
     **/
    public static final String CACHE_KEY_LOGIN_QRCODE = "JEEPAY_LOGIN_QR_%s";

    public static String getCacheKeyLoginQrcode(String uuid) {
        return String.format(CACHE_KEY_LOGIN_QRCODE, uuid);
    }

    /**
     * T+N时间 缓存key；  参数：dateStr-日期YYYY-MM-DD   dayTN-(T+N的N天)
     **/
    public static final String CACHE_KEY_DATE_TN_PREFIX = "CACHE_KEY_DATE_TN_";

    public static String getCacheKeyDateTn(String dateStr, int dayTN) {
        return String.format(CACHE_KEY_DATE_TN_PREFIX + "%s_%s", dateStr, dayTN);
    }

    /**
     * 百度语音合成token 缓存key
     **/
    public static final String BAIDU_TOKEN_CACHE_KEY = "baidu_bce_token";
    public static final long BAIDU_TOKEN_TIME = 29; // 单位：天

    /**
     * 品生云喇叭token 缓存key
     **/
    public static final String PINSHENG_TOKEN_CACHE_KEY = "ps_token";
    public static final long PINSHENG_TOKEN_TIME = 3600; // 单位：秒

    /**
     * 回调URL的格前缀
     */
    public static final String PAY_RETURNURL_FIX_ONLY_JUMP_PREFIX = "ONLYJUMP_";
    public static final String PAY_RETURNURL_FIX_MCHAPP_PREFIX = "JEEPAYMCHAPP_";
    public static final String PAY_RETURNURL_FIX_ISV_PREFIX = "JEEPAYISV_";

    public static String parsePayReturnUrlFix(String urlOrderId, String prefixStr) {
        if (StringUtils.isAnyEmpty(urlOrderId, prefixStr)) {
            return null;
        }

        if (urlOrderId.indexOf(prefixStr) != 0) {
            return null;
        }

        return urlOrderId.substring(prefixStr.length());
    }

    /**
     * 登录认证类型
     **/
    public interface AUTH_TYPE {

        byte LOGIN_USER_NAME = 1; //登录用户名
        byte TELPHONE = 2; //手机号
        byte EMAIL = 3; //邮箱

        byte WX_UNION_ID = 10; //微信unionId
        byte WX_MINI = 11; //微信小程序
        byte WX_MP = 12; //微信公众号

        byte QQ = 20; //QQ
    }

    //菜单类型
    public interface ENT_TYPE {

        String MENU_LEFT = "ML";  //左侧显示菜单
        String MENU_OTHER = "MO";  //其他菜单
        String PAGE_OR_BTN = "PB";  //页面 or 按钮

    }

    @Getter
    @AllArgsConstructor
    public enum IfCode {

        YSPAY("yspay"),
        KQPAY("kqpay"),
        LKLSPAY("lklspay"),
        LKLSB2BPAY("lklsb2bpay"),
        SXFPAY("sxfpay"),
        RYXPAY("ryxpay"),
        DGPAY("dgpay"),
        ZFTPAY("zftpay")
        ;

        private final String value;

        public static IfCode get(String value) {
            for (IfCode ifCode : values()) {
                if (ifCode.value.equals(value)) {
                    return ifCode;
                }
            }

            return null;
        }
    }

    //接口类型
    public interface IF_CODE {

        String ALIPAY = "alipay";   // 支付宝官方支付
        String WXPAY = "wxpay";     // 微信官方支付
        String YSFPAY = "ysfpay";   // 云闪付开放平台
        String XXPAY = "xxpay";     // 小新支付
        String ADAPAY = "adapay";   // 汇付支付
        String SHENGPAY = "shengpay";   // 盛付通支付
        String UNIONPAY = "unionpay";   // 银联支付
        String ZFTPAY = "zftpay";       // 支付宝直付通
        String SFTPAY = "sftpay";       // 微信收付通
        String SANDPAY = "sandpay";     // 杉德支付
        String PPPAY = "pppay";         // Paypal 支付
        String HMPAY = "hmpay";         // 河马[杉德]支付
        String FUIOUPAY = "fuioupay";   // 富友支付
        String LKLPAY = "lklpay";       // 拉卡拉支付
        String LKLSPAY = "lklspay";     // 拉卡拉saas支付
        String LKLSB2BPAY = "lklsb2bpay";     // 拉卡拉saas支付
        String PFPAY = "pfpay";         // 浦发银行
        String FBPAY = "fbpay";         // 付呗支付
        String DGPAY = "dgpay";         // 斗拱[汇付]支付
        String UTMPAY = "utmpay";       // 支付
        String SQBPAY = "sqbpay";       // 收钱吧支付
        String YSPAY = "yspay";         // 银盛支付
        String JOINPAY = "joinpay";     // 汇聚支付
        String RYXPAY = "ryxpay";       // 瑞银信支付
        String ALLINPAY = "allinpay";   // 通联支付
        String MBPAY = "mbpay";         // 米花支付
        String TERPAY = "terpay";       // 国通星驿支付
        String PMPAY = "pmpay";         // PayerMax支付
        String UMPAY = "umpay";         // 联动优势
        String CCBPAY = "ccbpay";       // 建行支付
        String CLOUDPAY = "cloudpay";   // 支付宝云支付
        String HKPAY = "hkpay";         // 海科融通支付
        String HNAPAY = "hnapay";       // 新生支付
        String BCMPAY = "bcmpay";       // 交行支付
        String SUMAPAY = "sumapay";       // 丰付支付
        String ICBCPAY = "icbcpay";     // 工行支付
        String EASYPAY = "easypay";       // 易生支付
        String LMSPAY = "lmspay";       // 立码收
        String LESHUAPAY = "leshuapay";       // 乐刷
        String ALIAQF = "aliaqf"; // 支付宝安全发
        String SXFPAY = "sxfpay"; // 随行付
        String CIBPAY = "CIBPAY"; // 兴业银行
        String EPSPAY = "epspay"; // 易票联
        String DEMOMOCKPAY = "demomockpay";   // 【模拟支付】
        String UMHSPAY = "umhspay";         // 联动惠商
        String KDBPAY = "kdbpay";           // 开店宝


        /**
         * 快钱支付
         */
        String KQPAY = "kqpay";

        String SYBPAY = "sybpay";

        /**
         * 福禄
         */
        String FLPAY = "flpay";
    }

    public interface SETTLEMENT_TYPE {

        String T1 = "T1";
        String D1 = "D1";
        String D0 = "D0";
    }

    //支付方式代码
    public interface PAY_WAY_CODE {

        // 特殊支付方式
        String WEB_CASHIER = "WEB_CASHIER"; //  ( web端的统一收银台支付  )
        String AUTO_POS = "AUTO_POS"; //  ( 智能pos收款 )
        String TRANSFER = "TRANSFER"; //  ( 转账 )

        String QR_CASHIER = "QR_CASHIER"; //  ( 通过二维码跳转到收银台完成支付， 已集成获取用户ID的实现。  )
        String AUTO_BAR = "AUTO_BAR"; // 条码聚合支付（自动分类条码类型）

        String OUT_TRADE = "OUT_TRADE"; // 外部订单

        String ALI_BAR = "ALI_BAR";  //支付宝条码支付
        String ALI_JSAPI = "ALI_JSAPI";  //支付宝服务窗支付
        String ALI_LITE = "ALI_LITE";  //支付宝小程序支付
        String ALI_APP = "ALI_APP";  //支付宝 app支付
        String ALI_PC = "ALI_PC";  //支付宝 电脑网站支付
        String ALI_WAP = "ALI_WAP";  //支付宝 wap支付
        String ALI_QR = "ALI_QR";  //支付宝 二维码付款

        String YSF_BAR = "YSF_BAR";  //云闪付条码支付
        String YSF_JSAPI = "YSF_JSAPI";  //云闪付服务窗支付

        String ALI_H5 = "ALI_H5";  //微信H5支付

        String WX_JSAPI = "WX_JSAPI";  //微信jsapi支付
        String WX_LITE = "WX_LITE";  //微信小程序支付
        String WX_BAR = "WX_BAR";  //微信条码支付
        String WX_H5 = "WX_H5";  //微信H5支付
        String WX_NATIVE = "WX_NATIVE";  //微信扫码支付
        String WX_APP = "WX_APP";  //微信扫码支付

        String UP_APP = "UP_APP";     // 银联App支付
        String UP_WAP = "UP_WAP";     // 银联手机网站支付
        String UP_QR = "UP_QR";       // 银联二维码(主扫)
        String UP_BAR = "UP_BAR";     // 银联二维码(被扫)
        String UP_B2B = "UP_B2B";     // 银联企业网银支付
        String UP_PC = "UP_PC";       // 银联网关支付
        String UP_JSAPI = "UP_JSAPI"; // 银联JS支付

        String PP_PC = "PP_PC"; // Paypal 支付

        String SAND_H5 = "SAND_H5"; // 杉德H5收银台
        String CASHIER = "CASHIER"; // 渠道收银台

        String BANK_QUICK = "BANK_QUICK"; // 银联快捷
        String BANK_B2C = "BANK_B2C"; // 网银B2C

        String DCEP_BAR = "DCEP_BAR"; // 数字人民币条码支付
        String DCEP_QR = "DCEP_QR"; // 数字人民币二维码支付

        String KQ_H5 = "KQ_H5"; // 快钱

        String D1 = "D1";  // D1垫资费, 部分通道有

        String D0 = "D0";  // D0垫资费, 部分通道有

        String SCAN = "SCAN";  // 线上费率
    }

    //支付数据包 类型
    public interface PAY_DATA_TYPE {
        String PAY_URL = "payurl";  //跳转链接的方式  redirectUrl
        String FORM = "form";  //表单提交
        String WX_APP = "wxapp";  //微信app参数
        String ALI_APP = "aliapp";  //支付宝app参数
        String YSF_APP = "ysfapp";  //云闪付app参数
        String CODE_URL = "codeUrl";  //二维码URL
        String CODE_IMG_URL = "codeImgUrl";  //二维码图片显示URL
        String NONE = "none";  //无参数
//        String QR_CONTENT = "qrContent";  //二维码实际内容
    }

    // 支付方式 分类字典
    public interface PAY_WAY_CODE_TYPE {
        String WECHAT = "WECHAT";
        String ALIPAY = "ALIPAY";
        String YSFPAY = "YSFPAY";
        String UNIONPAY = "UNIONPAY";
        String DCEPPAY = "DCEPPAY";
        String OTHER = "OTHER";
        String SCAN = "SCAN";
    }

    // 支付方式分类名称
    public static final Map<String, String> PAY_WAY_CODE_TYPE_MAP = new HashMap<>();

    static {
        PAY_WAY_CODE_TYPE_MAP.put(PAY_WAY_CODE_TYPE.ALIPAY, "支付宝");
        PAY_WAY_CODE_TYPE_MAP.put(PAY_WAY_CODE_TYPE.WECHAT, "微信");
        PAY_WAY_CODE_TYPE_MAP.put(PAY_WAY_CODE_TYPE.YSFPAY, "云闪付");
        PAY_WAY_CODE_TYPE_MAP.put(PAY_WAY_CODE_TYPE.UNIONPAY, "银联");
        PAY_WAY_CODE_TYPE_MAP.put(PAY_WAY_CODE_TYPE.DCEPPAY, "数字人民币");
        PAY_WAY_CODE_TYPE_MAP.put(PAY_WAY_CODE_TYPE.OTHER, "其他");
        PAY_WAY_CODE_TYPE_MAP.put(PAY_WAY_CODE_TYPE.SCAN, "线上");
    }

    // 智能POS  支付方式
    public interface AUTO_POS_PAY_TYPE {
        String CARD = "CARD"; // 银行卡
        String SCAN = "SCAN"; // 扫一扫
        String QRCODE = "QRCODE"; // 聚合码
    }

    // 智能POS  支付渠道
    public interface AUTO_POS_PAY_CHANNEL {
        String WECHAT = "WECHAT"; // 微信
        String ALIPAY = "ALIPAY"; // 支付宝
        String UNIONPAY = "UNIONPAY"; // 银联
        String QR_CASHIER = "QR_CASHIER"; // 聚合码
        String DCEP = "DCEPPAY"; // 数字货币
    }


    //接口版本
    public interface PAY_IF_VERSION {
        String WX_V2 = "V2";  //微信接口版本V2
        String WX_V3 = "V3";  //微信接口版本V3
    }

    // 设备厂商
    public interface DEVICE_PROVIDER {

        String BSJ = "bsj";   // 博实结
        String ZGWL = "zgwl";     // 智谷物联
        String PS = "ps";   // 品生
        String FE = "fe";     // 飞鹅
        String ZW = "zw";     // 智网
        String JSD = "jsd";     // 金士盾
        String LLZN = "llzn";     // 零零智能
        String YLY = "yly";     // 易联云
        String LKLS = "lkls";     // 拉卡拉
    }

    // 统计接口类型
    public interface STATISTIC_TYPE {
        String MCH = "mch";                     // 商户
        String AGENT = "agent";                 // 服务商
        String ISV = "isv";                     // 服务商
        String CHANNEL = "channel";             // 通道
        String TRANSACTION = "transaction";     // 报表
        String STORE = "store";                 // 门店
        String WAY_CODE = "wayCode";            // 支付方式
        String WAY_CODE_TYPE = "wayCodeType";   // 支付类型
        String DEVICE = "device";             // 设备
    }

    /**
     * 代码（项目）层面 ， 全部的系统定义， 需要注入到对应的bean中
     **/
    public interface CODE_SYS_NAME_SET {
        String JEEPAY_MANAGER = "MANAGER";
        String JEEPAY_MERCHANT = "MERCHANT";
        String JEEPAY_AGENT = "AGENT";
        String JEEPAY_STORE = "STORE";
        String JEEPAY_PAYMENT = "PAYMENT";
    }

    /**
     * 商户通知类型的枚举值
     **/
    public interface NOTIFY_POST_TYPE {
        String POST_QUERYSTRING = "POST_QUERYSTRING";
        String POST_BODY = "POST_BODY";
        String POST_JSON = "POST_JSON";
    }

    /**
     * 商户自调用接口
     */
    public interface MCH_APP_API_ENUM {

        String API_PAY_ORDER = "API_PAY_ORDER"; // 统一下单
        String API_PAY_ORDER_QUERY = "API_PAY_ORDER_QUERY"; // 对分账用户的渠道余额发起提现
        String API_PAY_ORDER_CLOSE = "API_PAY_ORDER_CLOSE"; // 支付订单关闭
        String API_CHANNEL_USER = "API_CHANNEL_USER"; // 获取渠道用户ID
        String API_REFUND_ORDER = "API_REFUND_ORDER"; // 发起支付退款
        String API_REFUND_ORDER_QUERY = "API_REFUND_ORDER_QUERY"; // 查询退款订单
        String API_TRANS_ORDER = "API_TRANS_ORDER"; // 发起转账订单
        String API_TRANS_ORDER_QUERY = "API_TRANS_ORDER_QUERY"; // 查询转账订单
        String API_TRANS_BALANCE_QUERY = "API_TRANS_BALANCE_QUERY"; // 查询转账可用余额
        String API_DIVISION_BIND = "API_DIVISION_BIND"; // 绑定分账用户
        String API_DIVISION_EXEC = "API_DIVISION_EXEC"; // 发起订单分账
        String API_DIVISION_CHANNEL_BALANCE = "API_DIVISION_CHANNEL_BALANCE"; // 查询分账用户可用余额
        String API_DIVISION_CHANNEL_CASHOUT = "API_DIVISION_CHANNEL_CASHOUT"; // 对分账用户的渠道余额发起提现

    }

    public interface MCH_APP_API_ENUM_V2 {
        String APP_PAY = "API_APP_PAY"; // APP支付
        String H5_PAY = "API_H5_PAY"; // H5支付 手机
        String JSAPI_PAY = "API_JSAPI_PAY"; // 公众号/生活号支付
        String APPLET_PAY = "API_APPLET_PAY"; // 小程序支付
        String MICRO_PAY = "API_MICRO_PAY"; // 反扫支付
        String SCAN_PAY = "API_SCAN_PAY"; // （聚合码）电脑网站支付
        String CASHIER_PAY = "API_CASHIER_PAY"; // 聚合收银台
    }

    /**
     * 会员头像默认值
     **/
    public static final List<String> MEMBER_AVATAR_ICON = new ArrayList<>();

    static {
        MEMBER_AVATAR_ICON.add("http://jeequan.oss-cn-beijing.aliyuncs.com/jeepay/img/m-photo-0.svg");
        MEMBER_AVATAR_ICON.add("http://jeequan.oss-cn-beijing.aliyuncs.com/jeepay/img/m-photo-1.svg");
        MEMBER_AVATAR_ICON.add("http://jeequan.oss-cn-beijing.aliyuncs.com/jeepay/img/m-photo-2.svg");
        MEMBER_AVATAR_ICON.add("http://jeequan.oss-cn-beijing.aliyuncs.com/jeepay/img/m-photo-3.svg");
        MEMBER_AVATAR_ICON.add("http://jeequan.oss-cn-beijing.aliyuncs.com/jeepay/img/m-photo-4.svg");
        MEMBER_AVATAR_ICON.add("http://jeequan.oss-cn-beijing.aliyuncs.com/jeepay/img/m-photo-5.svg");
        MEMBER_AVATAR_ICON.add("http://jeequan.oss-cn-beijing.aliyuncs.com/jeepay/img/m-photo-6.svg");
    }

    /**
     * 短信配置类型
     */
    public interface SMS_TYPE_API_ENUM {
        String TYPE_AUTH = "auth"; // 登录验证码
        String TYPE_REGISTER = "register"; // 注册验证码
        String TYPE_RETRIEVE = "retrieve"; // 找回密码验证码
        String TYPE_ACCOUNT_OPEN = "accountOpen"; // 账号开通
        String TYPE_MBR_TEL_BIND = "mbrTelBind"; // 会员手机号绑定
        String TYPE_ACCOUNT_BALANCE = "accountBalance"; //账户余额
    }

    /**
     * 短信厂商配置类型
     */
    public interface SMS_PROVIDER_TYPE_API_ENUM {
        /**
         * 模拟测试
         */
        String SMS_PROVIDE_KEY_MOCKTEST = "mocktest";

        /**
         * 阿里大于
         */
        String SMS_PROVIDE_KEY_ALIYUNDY = "aliyundy";
        /**
         * 计全短信
         */
        String SMS_PROVIDE_KEY_JEEPAYDX = "jeepaydx";

        /**
         * 聚合数据短信
         */
        String SMS_PROVIDE_KEY_JUHEDX = "juhedx";
    }

    /**
     * 通知类型
     */
    public interface OpenMsgType {

        /**
         * 交易通知
         */
        String TRADE_MSG_TYPE = "sft.trade.notify";

        /**
         * 退款通知
         */
        String REFUND_MSG_TYPE = "sft.refund.notify";
        /**
         * 分账通知
         */
        String DIVISION_MSG_TYPE = "sft.division.notify";

    }



    @Getter
    @AllArgsConstructor
    public enum DrType{
        DEBIT("00","借记卡"),
        CREDIT("01","贷记卡"),
        BALANCE("02","余额"),
        TOKIO("03","花呗"),
        DCEP("04","数字人民币"),
        OTHER("99","其他");
        private final String type;
        private final String desc;
    }


    @Getter
    @AllArgsConstructor
    public enum AccountOperateType{

        CHARGE((byte)0,"充值"),

        CASH((byte)1,"提现"),

        TRANSFER((byte)2,"转账"),

        REFUND((byte)3,"退款");

        private final Byte type;

        private final String desc;

        public static AccountOperateType getVal(byte value){
            AccountOperateType[] values = values();
            for (AccountOperateType val:values) {
                if(val.getType() == value){
                    return val;
                }
            }
            return CHARGE;
        }
    }

    /**
     * 支付状态: 0-订单生成, 1-支付中, 2-支付成功, 3-支付失败, 4-已撤销, 5-已退款, 6-订单关闭 7,退款中
     */
    @Getter
    @AllArgsConstructor
    public enum OpenOrderState{

        INIT((byte)0,"INIT","订单初始化"),

        AWAIT((byte)1,"TRADE_AWAIT","等待用户付款"),

        SUCCESS((byte)2,"TRADE_SUCCESS","成功"),

        FAIL((byte)3,"TRADE_FAIL","失败"),

        CANCEL((byte)4,"TRADE_CANCEL","交易取消"),

        REFUND((byte)5,"TRADE_REFUND","订单退款"),

        CLOSE((byte)6,"TRADE_CLOSE","订单关闭"),

        REFUND_ING((byte)7,"REFUND_ING","退款中");

        private final Byte value;

        private final String code;

        private final String desc;

        public static OpenOrderState getVal(byte value){
            OpenOrderState[] values = values();
            for (OpenOrderState val:values) {
                if(val.getValue() == value){
                    return val;
                }
            }
            return AWAIT;
        }
    }

    @Getter
    @AllArgsConstructor
    public enum OpenRefundState{

        INIT((byte)0,"INIT","订单初始化"),
        ING((byte)1,"ING","退款中"),
        SUCCESS((byte)2,"SUCCESS","退款成功"),
        FAIL((byte)3,"FAIL","退款失败"),
        CLOSE((byte)4,"CLOSE","退款关闭");

        private final Byte value;

        private final String code;

        private final String desc;

        public static OpenRefundState getVal(byte value){
            OpenRefundState[] values = values();
            for (OpenRefundState val:values) {
                if(val.getValue() == value){
                    return val;
                }
            }
            return INIT;
        }
    }

}
