All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.yes.tools.pay.module.request.BaseRequest Maven / Gradle / Ivy

There is a newer version: 2.0.4
Show newest version
package org.yes.tools.pay.module.request;

import cn.hutool.core.date.DateUtil;
import io.micrometer.common.util.StringUtils;
import lombok.Data;
import lombok.experimental.Accessors;
import org.yes.tools.core.exception.YesBaseException;
import org.yes.tools.pay.config.PayConfig;

import java.io.Serializable;

@Data
@Accessors(chain = true)
public abstract class BaseRequest implements Serializable {
    private static final long serialVersionUID = -4766915659779847060L;

    //报文请求时间,格式yyyy-MM-ddHH:mm:ss
    private String requestTimestamp;
    //商户号
    private String mid;
    //业务类型 APPDEFAULT
    private String instMid;

    public void checkAndSign(PayConfig payConfig) {
        if (StringUtils.isBlank(payConfig.getMid())) {
            throw new YesBaseException("主商务号不存在");
        }
        if (StringUtils.isBlank(this.instMid)) {
            throw new YesBaseException("业务类型不存在");
        }
        this.mid = payConfig.getMid();
        this.requestTimestamp = DateUtil.now();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy