package com.jeequan.jeepay.core.model.rqrs.payorder.payway;

import com.jeequan.jeepay.core.constants.CS;
import com.jeequan.jeepay.core.model.rqrs.payorder.UnifiedOrderRS;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

/*
 * 支付方式： WX_JSAPI
 *
 * @author zhuxiao
 *
 * @date 2021/6/8 17:34
 */
@Data
public class WxJsapiOrderRS extends UnifiedOrderRS {

    /** 预支付数据包 **/
    private String payInfo;

    /** 跳转支付地址 **/
    private String payUrl;

    @Override
    public String buildPayDataType(){
        if (StringUtils.isNotEmpty(payUrl)) {
            return CS.PAY_DATA_TYPE.PAY_URL;
        }
        return CS.PAY_DATA_TYPE.WX_APP;
    }

    @Override
    public String buildPayData(){
        if (StringUtils.isNotEmpty(payUrl)) {
            return payUrl;
        }
        return payInfo;
    }

}
