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

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 xiaoyu
 * 
 * @date 2022/11/15 9:23
 */
@Data
public class UmhspayIsvParams extends IsvParams {

    /** 合作方ID */
    @ChannelMchId(type = ChannelMchIdTypeEnum.ISV_NO)
    private String partnerId;

    /** AES密钥 **/
    private String aesKey;

    /** 商户私钥 **/
    private String privateKey;

    /** 联动平台公钥 **/
    private String publicKey;

    /** 微信开通意愿二维码url */
    private String wxOpenUrl;

    /** 支付宝开通意愿二维码url */
    private String aliChannelExtUrl;



    @Override
    public String deSenData() {
        UmhspayIsvParams isvParams = this;
        if (StringUtils.isNotBlank(isvParams.aesKey)) {
            isvParams.setAesKey(StringKit.autoDesensitization(isvParams.aesKey));
        }
        if (StringUtils.isNotBlank(isvParams.privateKey)) {
            isvParams.setPrivateKey(StringKit.autoDesensitization(isvParams.privateKey));
        }
        if (StringUtils.isNotBlank(isvParams.publicKey)) {
            isvParams.setPublicKey(StringKit.autoDesensitization(isvParams.publicKey));
        }
        return JSONObject.toJSONString(isvParams);
    }

}
