package com.jeequan.jeepay.core.model.params.sumapay;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.jeequan.jeepay.core.annotate.ChannelMchId;
import com.jeequan.jeepay.core.constants.ChannelMchIdTypeEnum;
import com.jeequan.jeepay.core.model.params.NormalMchParams;
import com.jeequan.jeepay.core.utils.StringKit;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

/*
 * 丰付支付 配置参数
 *
 * @author zx
 *
 * @date 2022/11/23 18:02
 */
@Data
public class SumapayNormalMchParams extends NormalMchParams {


    /**
     * 环境配置：0-生产环境，1-沙箱环境
     */
    private Byte sandbox;

    /**
     * 商户编号
     */
    @ChannelMchId(type = ChannelMchIdTypeEnum.MCH_NO)
    private String merchantCode;

    /**
     * 业务类型代码
     */
    private String totalBizType;

    /**
     * 密钥
     */
    private String md5Key;

    @Override
    public String deSenData() {
        SumapayNormalMchParams mchParams = this;
        if (StringUtils.isNotBlank(this.md5Key)) {
            mchParams.setMd5Key(StringKit.autoDesensitization(this.md5Key));
        }
        return ((JSONObject) JSON.toJSON(mchParams)).toJSONString();
    }

}
