コード例 #1
0
    public function onlineBankPay($request,$response)
    {
        $bankid = $request->paycard;
        $spaceid = $request->spaceid;
        $productid = $request->productid; 
        $fuProduct = DAL::get()->find('FollowupProduct', $productid);
        DBC::requireFalse($fuProduct->isNull(), '无效的随访商品');
        $space = DAL::get()->find('space', $spaceid);
        DBC::requireFalse($space->isNull(), '无效的随访space');
        $realPrice = 0;//$fuProduct->price;
        if($fuProduct->isNoPriceProduct())
        {
            $realPrice = $request->price;
            DBC::requireTrue((int)$realPrice > 0, '无效的续费金额');
        }
        $order = FollowupClient::getInstance()->getFollowupOrder($this->user->id, $productid, $spaceid, $realPrice);
        DBC::requireFalse($order->isNull(), '无效的订单');

        $binds = array();
        $binds['payType'] = FollowupOrder::PAYTYPE_ALIPAY; 
        $form = '';
        if ($bankid == 'alipay')
        {
            $form = $this->getAlipayForm4FollowupOrder($order);
            $binds['payType'] = FollowupOrder::PAYTYPE_ALIPAY; 
        }
		else if($bankid == '00')//快钱
        {
            $form = $this->getQpayForm4FollowupOrder($order, $bankid);
            $binds['payType'] = FollowupOrder::BANK_NAME_ONLLINE; //设置订单状态为网银支付
        }
        else//网银(支付宝纯网关)
        {
            $callbackUrl = BeanFinder::get('configs')->alipay_gateway_callback_url;
            $frontUrl = BeanFinder::get('configs')->alipay_gateway_callback_returnurl;
            $price = $order->price;//原价
            //dodo::zhb 创建充值单
            $depositeOrder = OrderClient::getInstance()->createDepositeOrder($this->user, $price, 
                DepositeOrder::RECHARGE_TYPE_ALIPAY, array($order)); 
            $description = '';
            $form = GatewayAlipay::getInstance()->getPayUrl($depositeOrder->id, Pay::TYPE_FOLLOWUPORDER, $price, $callbackUrl, $order->product->title, $order->product->title, $frontUrl, $bankid);
            $binds['payType'] = FollowupOrder::PAYTYPE_ALIPAY; 
        }

        $response->form = $form;
        $response->orderId = $order->id;
        FollowupClient::getInstance()->updateFollowupOrder($order->id,$binds);
        unset($binds);
    }
コード例 #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 alipayGatewayCallBack4notify()
 {/*{{{*/
 	$payable = GatewayAlipay::getInstance()->initCallBackData($_POST, Pay::NAME_TYPE_ALIPAY_NOTIFY);
 	 
 	//参数检查,如果无效,直接退出
 	$this->_checkPayable($payable,Pay::NAME_TYPE_ALIPAY_NOTIFY);
 	
 	//notify
 	$ret = $this->_callbackImp4notify();
 	 
 	if($ret){
 		//返回回调成功
 		echo "success";
 	}else {
 		echo "fail";
 	}
 	 
 	exit;
 }/*}}}*/