本文整理汇总了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;
}/*}}}*/
示例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;
}
}
}
示例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;
}/*}}}*/
示例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);
}/*}}}*/
示例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);
}