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

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.IsvParams;
import com.jeequan.jeepay.core.utils.StringKit;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

/*
 * 银联条码支付前置 配置信息
 *
 * @author zx
 *
 * @date 2022/6/20 18:02
 */
@Data
public class UtmpayIsvParams extends IsvParams {

    /** 机构号 **/
    @ChannelMchId(type = ChannelMchIdTypeEnum.ISV_NO)
    private String partner;

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

    /** 申请服务商的 公众号的 appID */
    private String appId;

    /** 小程序的 appID */
    private String liteAppId;

    @Override
    public String deSenData() {

        UtmpayIsvParams isvParams = this;
        if (StringUtils.isNotBlank(this.md5Key)) {
            isvParams.setMd5Key(StringKit.autoDesensitization(this.md5Key));
        }
        return ((JSONObject) JSON.toJSON(isvParams)).toJSONString();
    }

}
