/**
 * 这是支付相关的业务逻辑的服务
 */
export default class PayService {
    constructor(AjaxService) {
        Object.assign(this, { AjaxService })
        this.name = 'PayService'
    }
    /* 小程序支付-查询线上支付开关状态 */
    PayOrderOnLineSwitch (data = {}) {
        return this.AjaxService.get({ 
            url:'/order/pay/online/switch', 
            data, 
            isLoading: false ,
            isHost:true
        })
    }
    /* 小程序支付-初始化收银台 */
    PayOrderCheckoutCounter (data = {}) {
        return this.AjaxService.get({ 
            url:'/order/pay/checkout/counter', 
            data, 
            isLoading: true ,
            isHost:true
        })
    }
    /**
	 *小程序支付-微信支付
	 *@param  amount支付金额，单位分，必须大于2
	 *@param  payWay银联：UNIONPAY，微信：WEIXIN，支付宝：ALIPAY
	 *@param  payType 微信小程序支付: MINIAPP_WEIXIN ,微信公众号支付: JSAPI_WEIXIN
	 *@param  code  微信小程序code,微信小程序支付使用
	 *@param  orderId  主订单ID
	 */
    WeChatMiniWxPay (data = {}) {
        return this.AjaxService.post({ 
            url:'/order/pay/wechat', 
            data, 
            isLoading: true ,
            isHost:true
        })
    }
    /**
	 *生成支付链接
	 *@param  unpaidAmount 本次待付款金额
	 *@param  orderId  主订单ID
	 */
    PayOrderPayLink (data = {}) {
        return this.AjaxService.post({ 
            url:'/order/pay/link', 
            data, isLoading: true ,
            isHost:true
        })
    }
    /**
	 *@param 二手发布支付
	 *@param  orderId  主订单ID
	 */
    SecondHandPay (data = {}) {
        return this.AjaxService.post({
            url:'/order/pay/second/wechat', 
            data, 
            isLoading: true ,
            isHost:true
        })
    } 
    /**
	 *@param 采美豆抵扣开通超级会员
	 *@param  orderId  主订单ID
	 */
    getUserRegisterSuperBeans (data = {}) {
        return this.AjaxService.get({
            url:'/user/register/super/beans', 
            data, 
            isLoading: true ,
            isHost:true
        })
    } 
    /**
	 *@在线支付开通超级会员
	 */
    getUserRegisterSuperPay (data = {}) {
	    return this.AjaxService.get({ 
	        url:'/user/register/super/pay', 
	        data, 
	        isLoading: true,
	        isHost:true
	    })
    }
    /**
	 *@param 微信支付开通超级会员
	 *@param  vipId  套餐ID
	 *@param  userId 用户D
	 *@param  code  wechatCode
	 */
    PayOrderVipWechat (data = {}) {
        return this.AjaxService.post({
            url:'/order/pay/vip/wechat', 
            data, 
            isLoading: true ,
            isHost:true
        })
    } 
}
