当前位置: 首页>>代码示例>>PHP>>正文


PHP XString::calculateBalancePrice方法代码示例

本文整理汇总了PHP中XString::calculateBalancePrice方法的典型用法代码示例。如果您正苦于以下问题:PHP XString::calculateBalancePrice方法的具体用法?PHP XString::calculateBalancePrice怎么用?PHP XString::calculateBalancePrice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XString的用法示例。


在下文中一共展示了XString::calculateBalancePrice方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getCaseRechargeOrderString4ali

    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;
    }/*}}}*/
开发者ID:sdgdsffdsfff,项目名称:hdf-client,代码行数:43,代码来源:casedatabucket.php

示例2: pay

 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;
         }
     }
 }
开发者ID:sdgdsffdsfff,项目名称:hdf-client,代码行数:56,代码来源:paymentcontroller.php

示例3: getPhoneOrderPayStringByOrderId

    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;
    }/*}}}*/
开发者ID:sdgdsffdsfff,项目名称:hdf-client,代码行数:44,代码来源:paymentdatabucket.php

示例4: _unionPayForServiceOrder

 public function _unionPayForServiceOrder($request, $response)
 {/*{{{*/
     $serviceOrder = DAL::get()->find('serviceOrder', $request->sourceId);
     $account = $serviceOrder->user->getCashAccount();
     if ($account->amount >= $serviceOrder->getSalePrice())
     {
         $response->setRedirect($serviceOrder->getShowPayUrl());
         return parent::DIRECT_OUTPUT;
     }
     $amount = XString::calculateBalancePrice($serviceOrder->getSalePrice(), $account->amount);
     DBC::requireTrue($serviceOrder->user->id == $this->user->id, '无权访问此页');
     //dodo::zhb 创建充值单
     $depositeOrder = OrderClient::getInstance()->createDepositeOrder($this->user, $amount, 
         DepositeOrder::RECHARGE_TYPE_UNION, array($serviceOrder)); 
     $response->html = $this->_unionPayOrder(UnionPayConnector::TYPE_SERVICEORDER.$depositeOrder->id, $amount, $request->defaultPayType);
 }/*}}}*/
开发者ID:sdgdsffdsfff,项目名称:hdf-client,代码行数:16,代码来源:telpaymentcontroller.php

示例5: alipayChannel4Zixun

 public function alipayChannel4Zixun($request, $response)
 {
     /*{{{*/
     $flow = DAL::get()->find('DoctorPatientRef', $request->refid);
     DBC::requireFalse($flow->isNull(), '无效订单');
     $product = ProductClient::getInstance()->getDoctorChargeFlowProduct($flow->space);
     $needPay = XString::calculateBalancePrice($product->salePrice, $flow->user->getCashAccount()->amount);
     DBC::requireTrue($needPay > 0, '价格有错误 或 余额可够支付');
     $serviceOrder = ServiceOrderClient::getInstance()->create($flow, $product, $flow->user);
     DBC::requireFalse($serviceOrder->isNull(), '无效订单');
     $depositeOrder = OrderClient::getInstance()->createDepositeOrder($flow->user, $needPay, DepositeOrder::RECHARGE_TYPE_ALIPAYWAP, array($serviceOrder));
     DBC::requireFalse($depositeOrder->isNull(), '无效订单!');
     $userName = $flow->user->name;
     $returnUrl = WaperAlipay::getDefaultReturnUrl4TouchZixun();
     $notifyUrl = WaperAlipay::getDefaultNotifyUrl();
     $sellerUrl = WaperAlipay::getDefaultSellerUrl4TouchZixun($serviceOrder->id);
     $aliPayUrl = WaperAlipay::getAliWapPayUrl($depositeOrder->id, $this->getPayTypeByOrder($serviceOrder), $needPay, $notifyUrl, $returnUrl, $sellerUrl, ServiceDef::getServiceSpec(ServiceDef::TYPE_FLOW)->text, $this->getPayDescriptionByOrder($serviceOrder, $userName));
     $response->setRedirect($aliPayUrl);
 }
开发者ID:sdgdsffdsfff,项目名称:hdf-client,代码行数:19,代码来源:paycontroller.php


注:本文中的XString::calculateBalancePrice方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。