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

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;

/**
 * 付呗 isv参数定义
 *
 * @author xiaoyu
 *
 * @date 2022/5/13 10:27
 */
@Data
public class FbpayIsvParams extends IsvParams {

    /** vendorSn 服务商ID */
    @ChannelMchId(type = ChannelMchIdTypeEnum.ISV_NO)
    private String vendorSn;

    /** privateKey 服务商私钥 */
    private String privateKey;

    @Override
    public String deSenData() {

        FbpayIsvParams isvParams = this;
        if (StringUtils.isNotBlank(isvParams.privateKey)) {
            isvParams.setPrivateKey(StringKit.autoDesensitization(isvParams.privateKey));
        }

        return JSONObject.toJSONString(isvParams);
    }

}
