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

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 xiaoyu
 *
 * @date 2022/3/8 14:45
 */
@Data
public class SqbpayIsvParams extends IsvParams {

    /** 开发者序列号 */
    @ChannelMchId(type = ChannelMchIdTypeEnum.ISV_NO)
    private String vendorSn;

    /** 开发者序秘钥 */
    private String vendorKey;

    /** 应用ID */
    private String appId;

    /** 收钱吧公钥 */
    private String publicKey;

    @Override
    public String deSenData() {
        SqbpayIsvParams isvParams = this;
        if (StringUtils.isNotBlank(this.publicKey)) {
            isvParams.setPublicKey(StringKit.autoDesensitization(this.publicKey));
        }
        return ((JSONObject) JSON.toJSON(isvParams)).toJSONString();
    }

}
