package com.neusoft.smart.pos.card.constants;

public enum CardTradeConstants { //TODO

        ORDER_TYPE("ORDER_TYPE", "订单类型"),
        ORDER_TYPE_ZF("1", "支付订单"),
        ORDER_TYPE_ZZ("2", "转账订单"),
        ORDER_TYPE_CZ("3", "充值订单"),

        CARD_TRADE_PAY_STATUS("CARD_TRADE_PAY_STATUS", "卡交易支付状态"),
        CARD_TRADE_PAY_STATUS_WFK("1","PAYERROR"), //"付款失败"：密码错误、余额不足或账户不可用导致的付款失败
        CARD_TRADE_PAY_STATUS_YFK("2","SUCCESS"),   // "已付款"：从买方账户扣款成功
        CARD_TRADE_PAY_STATUS_FKWC("3","CLOSED"), // "付款交易完成"：卖方账户收到交易款
        CARD_TRADE_PAY_STATUS_YTK("4","REFUND"), //"已退款"：资金已退回买家账户
        CARD_TRADE_PAY_STATUS_QX("5","CANCELED"), // "付款交易取消"：未付款状态调用取消接口
        CARD_TRADE_PAY_STATUS_CX("5","REVERSE"), // "付款交易撤销"：未付款或已付款状态调用撤销接口

        CARD_TRADE_REFUND_STATUS("CARD_TRADE_REFUND_STATUS", "卡交易退款状态"),
        CARD_TRADE_REFUND_STATUS_WTK("1", "REFUNDERROR"), //"退款失败"：余额不足或账户不可用导致的退款失败
        CARD_TRADE_REFUND_STATUS_YTK("2", "SUCCESS"), // "已退款"：从卖方账户扣款成功
        CARD_TRADE_REFUND_STATUS_TKWC("3", "CLOSED"), // "退款交易完成"：买方账户收到退回款项

        CARD_PAY_TYPE("CARD_PAY_TYPE", "支付方式"),
        CARD_PAY_TYPE_YE("1", "余额支付方式"),
        CARD_PAY_TYPE_JF("2", "积分支付方式"),
        ;

        public static final String SIGN_KTY = "0d9a73a9e8f82612"; //招行充值签名加密key
        private String code;
        private String value;

        CardTradeConstants(String code, String value) {
            this.code = code;
            this.value = value;
        }

        public String getCode() {
            return code;
        }

        public String getValue() {
            return value;
        }

        public static CardTradeConstants getEnumByCode(String enumName, String code){
                for(CardTradeConstants dictEnum : CardTradeConstants.values()){
                        if(dictEnum.name().startsWith(enumName) && code.equals(dictEnum.getCode())){
                                return dictEnum;
                        }
                }
                return null;
        }
}
