コード例 #1
0
    public function getPhoneOrderPayStringByOrderId($orderId)
    {/*{{{*/
		$source = DAL::get()->find('intention', $orderId);
        if ($source->isNull())
        {
          //  $proposal = DAL::get()->find('proposal', $orderId);
            $proposal = $this->getRightObj($orderId);
            if($proposal->isNull())
            {
                $this->setErrorCode(313);
                return 0;
            }
            $source = DAL::get()->find_by_source('serviceorder', $proposal);
            if($source->isNull())
            {
                $this->setErrorCode(313);
                return 0;
            }
        }

		$hospitalfaculty = $source->space->host->hospitalfaculty;
		$hospital = $hospitalfaculty->hospital;
		$description = $hospital->commonName.$hospitalfaculty->name.$source->space->name;
        $amount = XString::calculateBalancePrice($source->getSalePrice(), $source->user->getCashAccount()->amount);
        if (0 >= $amount)
        {
            $this->setErrorCode(338);
            return 0;
        }

        //dodo::zhb 创建充值单
        $depositeOrder = OrderClient::getInstance()->createDepositeOrder($source->user, $amount, 
            DepositeOrder::RECHARGE_TYPE_ALIPAYWAP, array($source)); 
        //创建支付url
        $callBackUrl = WapAlipay::getDefaultNotifyUrl();
        $string = WapAlipay::getInstance()->encryptOrderInfo($depositeOrder->id, Pay::TYPE_PAY, $depositeOrder->amount, $callBackUrl, 
                                            ServiceDef::getServiceSpec(ServiceDef::TYPE_TELORDER)->text, $description);
        $infos = array();
        $infos['string'] = $string;
        $infos['wapPayUrl'] = WaperAlipay::getPayUrl4telorder($source->id);
        $infos['wapPayReturnUrl'] = WaperAlipay::getDefaultReturnUrl();
        $infos['wapPaySellerUrl'] = WaperAlipay::getDefaultSellerUrl();
        $this->content = $infos;
    }/*}}}*/
コード例 #2
0
    public function getCaseRechargeOrderString4ali($caseId, $caseType, $os)
    {/*{{{*/
        $infos = array();
        if ($caseType != 'flow' && $caseType != 'Flow') {
            $this->setErrorCode(335);
            return false; 
        }
        $flow = DAL::get()->find('DoctorPatientRef', $caseId);
        if ($flow->isNull()) {
            $this->setErrorCode(335);
            return false; 
        }
        $product = ProductClient::getInstance()->getDoctorChargeFlowProduct($flow->space);
        $needPay = XString::calculateBalancePrice($product->salePrice, $flow->user->getCashAccount()->amount);
        if ($needPay <= 0) {
            return false;
        }
        $serviceOrder = ServiceOrderClient::getInstance()->create($flow, $product, $flow->user);
        if ($serviceOrder->isNull()) {
            $this->setErrorCode(307);
            return false;
        }
        //dodo::zhb 创建充值单
        $depositeOrder = OrderClient::getInstance()->createDepositeOrder($flow->user, $needPay, 
            DepositeOrder::RECHARGE_TYPE_ALIPAYWAP, array($serviceOrder)); 
        if ($depositeOrder->isNull()) {
            $this->setErrorCode(3071);
            return false;
        }

        $userName = $flow->user->name;
        $callBackUrl = WapAlipay::getDefaultNotifyUrl();
        $description = $userName."充值购买咨询";
        $type = Pay::TYPE_FLOWORDER;
        $orderString = WapAlipay::getInstance()->encryptOrderInfo($depositeOrder->id, $type, $needPay, $callBackUrl,
                                                                  ServiceDef::getServiceSpec(ServiceDef::TYPE_FLOW)->text,
                                                                  $description);
        $infos['orderString'] = $orderString;
        $infos['wapPayUrl'] = WaperAlipay::getPayUrl4rechargeableCase($caseId, $os, $serviceOrder->id, $depositeOrder->id);
        $infos['wapPayReturnUrl'] = WaperAlipay::getDefaultReturnUrl();
        $infos['wapPaySellerUrl'] = WaperAlipay::getDefaultSellerUrl();
        $this->content = $infos;
    }/*}}}*/
コード例 #3
0
    public function alipayCallBack4ClientWap()
    {/*{{{*/
        if($_SERVER['REQUEST_METHOD'] == 'POST')
        {
            $name = Pay::NAME_TYPE_WAPALIPAY_NOTIFY;
            $content = $_POST;
        }
        else
        {
            $name = Pay::NAME_TYPE_WAPALIPAY_RETURN;
            $content = $_GET;
        }
        $wapAlipay = WapAlipay::getInstance()->initCallBackData($content, $name);
        $this->_checkPayable($wapAlipay, $name);

    	//notify
    	$ret = $this->_callbackImp4notify();

    	if($ret){
    		//返回回调成功
    		echo "success";
    	}else {
    		echo "fail";
    	}
        return parent::DIRECT_OUTPUT;
    }/*}}}*/