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

import com.alibaba.fastjson.JSONObject;
import com.jeequan.jeepay.core.model.params.alipay.AlipayIsvParams;
import com.jeequan.jeepay.core.utils.StringKit;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

/*
* 支付宝直付通 isv参数定义
*
* @author terrfly
*
* @date 2021/6/8 16:34
*/
@Data
public class ZftpayIsvParams extends AlipayIsvParams {

    /** 结算方式 */
    private String settType;

    /** 结算时间类型 */
    private String settDayType;

    /** 结算时间天数 */
    private int settDay;

    @Override
    public String deSenData() {

        ZftpayIsvParams isvParams = this;
        if (StringUtils.isNotBlank(isvParams.getPrivateKey())) {
            isvParams.setPrivateKey(StringKit.str2Star(isvParams.getPrivateKey(), 4, 4, 6));
        }
        if (StringUtils.isNotBlank(isvParams.getAlipayPublicKey())) {
            isvParams.setAlipayPublicKey(StringKit.str2Star(isvParams.getAlipayPublicKey(), 6, 6, 6));
        }

        return JSONObject.toJSONString(isvParams);
    }
}
