package cn.freemud.demo.utils;

import cn.freemud.demo.enums.BizTypeEnum;
import com.freemud.sdk.api.assortment.shoppingcart.constant.CommonsConstant;
import org.apache.commons.lang.StringUtils;

public class CommonUtils {

    public static Boolean isProductCoupon(String couponCode, String spqid){

        if (StringUtils.isNotBlank(couponCode) || spqid.startsWith(CommonsConstant.COUPON_PREFIX)) {
            return true;
        }
        return false;

    }


    public static String getCouponCode(String couponCode, String spqid){
        if (spqid.startsWith(CommonsConstant.COUPON_PREFIX)){ // 兼容老版本
            couponCode = spqid.substring(CommonsConstant.COUPON_PREFIX.length());
        }
        return couponCode;
    }

}
