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

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.IsvsubMchParams;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

/**
 * 杉德[河马] 服务商子商户配置
 *
 * @author xiaoyu
 *
 * @date 2022/3/8 15:08
 */
@Data
public class HmpayIsvsubMchParams extends IsvsubMchParams {

    /** 子商户ID **/
    @ChannelMchId(type = ChannelMchIdTypeEnum.MCH_NO)
    private String subAppId;

    /** 小程序appId **/
    private String wxLiteAppId;

    /** 门店配置 **/
    private String mchStoreConfig;

    public JSONObject getJsonParams() {
        JSONObject params = new JSONObject();
        params.put("subAppId", this.subAppId);
        params.put("wxLiteAppId", this.wxLiteAppId);
        if (StringUtils.isEmpty(this.mchStoreConfig)) {
            params.put("mchStoreConfig", "[]");
        }else {
            params.put("mchStoreConfig", this.mchStoreConfig);
        }
        return params;
    }
}
