コード例 #1
0
 private function getQpayForm4FollowupOrder(FollowupOrder $order, $bankid)
 {
     //dodo::zhb 创建充值单
     $depositeOrder = OrderClient::getInstance()->createDepositeOrder($this->user, $order->price, 
         DepositeOrder::RECHARGE_TYPE_QPAY, array($order)); 
     //设置订单信息提交给快钱
     $orders = array();
     $orders['orderId'] = $depositeOrder->id;
     $orders['productName'] = strip_tags($order->product->title);
     if($bankid == '00')
     {
         $orders['bankId'] = '';
         $orders['bankType'] = '00';
     }else{
         $orders['bankId'] = $bankid;
         $orders['payType'] = 10;
     }
     $orders['orderTimestamp'] = Qpay::getInstance()->getQpayOrderTimestamp();
     $orders['payerIP'] = XIpLocation::getIp();
     //dodo::zhb 快钱回调url
     $orders['bgUrl'] = BeanFinder::get('configs')->qpay_callback_url;//$this->getQpayAccessUrl().'/400/pay/followupqpayreceive';
     $orders['pageUrl'] = BeanFinder::get('configs')->qpay_callback_returnurl;
     $orders['orderAmount'] = $order->price;
     $qpay = new Qpay();
     $qpay->setOrderInfo($orders, Pay::TYPE_FOLLOWUPORDER);
     $form = $qpay->getSubmitForm(); 
     return $form;
 }
コード例 #2
0
 public function pay($request, $response)
 {
     /*{{{*/
     $this->validLogin($response);
     $source = $this->getSource($request);
     if ($source->isNull()) {
         $response->setRedirect($this->space->getPhoneServiceUrl4Order());
         return parent::DIRECT_OUTPUT;
     }
     $this->checkIsMySource($source);
     if ($source->isPaid()) {
         $response->setRedirect($source->successUrl());
         return parent::DIRECT_OUTPUT;
     }
     $account = $source->user->getCashAccount();
     if ($account->amount >= $source->getSalePrice()) {
         $response->setRedirect($response->router->urlfor('payment/showpaytype', array('sourceId' => $source->id, 'sourceType' => $request->sourceType)));
         return parent::DIRECT_OUTPUT;
     }
     $amount = XString::calculateBalancePrice($source->getSalePrice(), $account->amount);
     $doctor = $this->space->host;
     $hospitalfaculty = $doctor->hospitalfaculty;
     $hospital = $hospitalfaculty->hospital;
     $description = $hospital->name . $hospitalfaculty->name . $doctor->name;
     $onlinePayType = $request->onlinePayType;
     $depositeOrder = OrderClient::getInstance()->createDepositeOrder($this->user, $amount, $onlinePayType == 'alipay' ? DepositeOrder::RECHARGE_TYPE_ALIPAY : DepositeOrder::RECHARGE_TYPE_QPAY, array($source));
     if ($onlinePayType == 'alipay') {
         //创建支付url
         $callBackUrl = BeanFinder::get('configs')->alipay_callback_url;
         $frontUrl = BeanFinder::get('configs')->alipay_callback_returnurl;
         $payUrl = Alipay::getInstance()->getPayUrl($depositeOrder->id, Pay::TYPE_PAY, $depositeOrder->amount, $callBackUrl, ServiceDef::getServiceSpec(ServiceDef::TYPE_TELORDER)->text, $description, $frontUrl);
         $response->exitJump($payUrl);
     } else {
         if ($onlinePayType == '00') {
             $orders = array();
             $orders['orderId'] = $depositeOrder->id;
             $orders['productName'] = ServiceDef::getServiceSpec(ServiceDef::TYPE_TELORDER)->text;
             $orders['bankId'] = '';
             $orders['bankType'] = '00';
             $orders['orderTimestamp'] = Qpay::getInstance()->getQpayOrderTimestamp();
             $orders['payerIP'] = XIpLocation::getIp();
             $orders['bgUrl'] = BeanFinder::get('configs')->qpay_callback_url;
             $orders['orderAmount'] = $amount;
             $qpay = new Qpay();
             $qpay->setOrderInfo($orders, Pay::TYPE_PAY);
             $form = $qpay->getSubmitForm();
             $response->form = $form;
         } else {
             //创建支付url
             $callBackUrl = BeanFinder::get('configs')->alipay_gateway_callback_url;
             $frontUrl = BeanFinder::get('configs')->alipay_gateway_callback_returnurl;
             $payUrl = GatewayAlipay::getInstance()->getPayUrl($depositeOrder->id, Pay::TYPE_PAY, $amount, $callBackUrl, ServiceDef::getServiceSpec(ServiceDef::TYPE_TELORDER)->text, $description, $frontUrl, $onlinePayType);
             $response->form = $payUrl;
         }
     }
 }
コード例 #3
0
	public function pay($request, $response)
	{/*{{{*/
		$this->validLogin();
		$user = $this->_newUser;
		$onlinePayType = $request->onlinePayType;
		
		$order = DAL::get()->find('TelOrder', $request->sId);
        if (false == $order->isNull() && $order->isPayed())
        {
            $response->setRedirect($response->router->urlfor('payment/paymessage', array('orderId'=>$order->id)));
            return ;
        }
        DBC::requireTrue($user->id == $order->getUser()->id, '请患者重新登陆,或者重新下单!');
		
		$ownerDoctor = $order->getExecuterBySpace()->host;
		$hospitalfaculty = $ownerDoctor->hospitalfaculty;
		$hospital = $hospitalfaculty->hospital;
		$description = $hospital->name.$hospitalfaculty->name.$ownerDoctor->name;
		$buyerCashAccount = $order->owner->relatedObject->getCashAccount();
		$balance = 0;
		if($buyerCashAccount != null && $buyerCashAccount->isNull() == false)
		{
			$balance = $order->owner->relatedObject->getCashAccount()->amount;
		}
		$amount = number_format($order->getAmount()-$balance, 2, '.', '');
		
        TelOrderClient::getInstance()->updatePayType($order->id, $onlinePayType);
        //dodo::zhb 创建充值单
        $depositeOrder = OrderClient::getInstance()->createDepositeOrder($user, $user->getCashAccount(), $amount, 
            $onlinePayType == 'alipay'?DepositeOrder::RECHARGE_TYPE_ALIPAY:DepositeOrder::RECHARGE_TYPE_QPAY, $order->id, get_class($order)); 
		if($onlinePayType == 'alipay')
		{
			//创建支付url
            $callBackUrl = BeanFinder::get('configs')->alipay_callback_url;
            $frontUrl = BeanFinder::get('configs')->alipay_callback_returnurl;
            $payUrl = Alipay::getInstance()->getPayUrl($depositeOrder->id, Pay::TYPE_PAY, $amount, $callBackUrl, 
                TelService::$serviceType[TelService::APPOINTMENT_SERVICE], $description, $frontUrl);
			header("Location: $payUrl");
			exit();
		}
		else
		{
            $orders = array();
            $orders['orderId'] = $depositeOrder->id;
            $orders['productName'] = TelService::$serviceType[TelService::APPOINTMENT_SERVICE];
            if($onlinePayType == '00')
            {
                $orders['bankId'] = '';
                $orders['bankType'] = '00';
            }else{
                $orders['bankId'] = $onlinePayType;
                $orders['payType'] = 10;
            }
            $orders['orderTimestamp'] = Qpay::getInstance()->getQpayOrderTimestamp();
            $orders['payerIP'] = XIpLocation::getIp();
            $orders['bgUrl'] = BeanFinder::get('configs')->qpay_callback_url;
            $orders['orderAmount'] = $amount;
            $qpay = new Qpay();
            $qpay->setOrderInfo($orders, Pay::TYPE_PAY);
            $form = $qpay->getSubmitForm(); 
            $response->form = $form;
		}
	}/*}}}*/