本文整理汇总了PHP中CSaleUserAccount::Withdraw方法的典型用法代码示例。如果您正苦于以下问题:PHP CSaleUserAccount::Withdraw方法的具体用法?PHP CSaleUserAccount::Withdraw怎么用?PHP CSaleUserAccount::Withdraw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSaleUserAccount
的用法示例。
在下文中一共展示了CSaleUserAccount::Withdraw方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DoPayOrderFromAccount
static function DoPayOrderFromAccount($userId, $currency, $orderId, $orderSum, $arOptions, &$arErrors)
{
if (!array_key_exists("ONLY_FULL_PAY_FROM_ACCOUNT", $arOptions)) {
$arOptions["ONLY_FULL_PAY_FROM_ACCOUNT"] = COption::GetOptionString("sale", "ONLY_FULL_PAY_FROM_ACCOUNT", "N");
}
$dbUserAccount = CSaleUserAccount::GetList(array(), array("USER_ID" => $userId, "CURRENCY" => $currency));
$arUserAccount = $dbUserAccount->Fetch();
if (!$arUserAccount) {
return false;
}
if ($arUserAccount["CURRENT_BUDGET"] <= 0) {
return false;
}
if ($arOptions["ONLY_FULL_PAY_FROM_ACCOUNT"] == "Y" && doubleval($arUserAccount["CURRENT_BUDGET"]) < doubleval($orderSum)) {
return false;
}
$withdrawSum = CSaleUserAccount::Withdraw($userId, $orderSum, $currency, $orderId);
if ($withdrawSum > 0) {
$arFields = array("SUM_PAID" => $withdrawSum, "USER_ID" => $userId);
CSaleOrder::Update($orderId, $arFields);
if ($withdrawSum == $orderSum) {
CSaleOrder::PayOrder($orderId, "Y", False, False);
}
return true;
}
return false;
}
示例2: IntVal
$arFields["AFFILIATE_ID"] = $affiliateID;
}
} else {
$arFields["AFFILIATE_ID"] = false;
}
$arResult["ORDER_ID"] = CSaleOrder::DoSaveOrder($arOrderDat, $arFields, 0, $arResult["ERROR"]);
$arResult["ORDER_ID"] = IntVal($arResult["ORDER_ID"]);
if ($arResult["ORDER_ID"] > 0 && empty($arResult["ERROR"])) {
$arOrder = CSaleOrder::GetByID($arResult["ORDER_ID"]);
CSaleBasket::OrderBasket($arResult["ORDER_ID"], CSaleBasket::GetBasketUserID(), SITE_ID, false);
$arResult["ACCOUNT_NUMBER"] = $arResult["ORDER_ID"] <= 0 ? $arResult["ORDER_ID"] : $arOrder["ACCOUNT_NUMBER"];
}
$withdrawSum = 0.0;
if (empty($arResult["ERROR"])) {
if ($arResult["PAY_FROM_ACCOUNT"] == "Y" && $arUserResult["PAY_CURRENT_ACCOUNT"] == "Y" && ($arParams["ONLY_FULL_PAY_FROM_ACCOUNT"] == "Y" && DoubleVal($arResult["USER_ACCOUNT"]["CURRENT_BUDGET"]) >= DoubleVal($orderTotalSum) || $arParams["ONLY_FULL_PAY_FROM_ACCOUNT"] != "Y")) {
$withdrawSum = CSaleUserAccount::Withdraw($USER->GetID(), $orderTotalSum, $arResult["BASE_LANG_CURRENCY"], $arResult["ORDER_ID"]);
if ($withdrawSum > 0) {
$arFields = array("SUM_PAID" => $withdrawSum, "USER_ID" => $USER->GetID());
CSaleOrder::Update($arResult["ORDER_ID"], $arFields);
if ($withdrawSum == $orderTotalSum) {
CSaleOrder::PayOrder($arResult["ORDER_ID"], "Y", False, False);
}
}
}
if ($arResult["HAVE_PREPAYMENT"]) {
if ($psPreAction && $psPreAction->IsAction()) {
$psPreAction->orderId = $arResult["ORDER_ID"];
$psPreAction->orderAmount = $orderTotalSum;
$psPreAction->deliveryAmount = $arResult["DELIVERY_PRICE"];
$psPreAction->taxAmount = $arResult["TAX_PRICE"];
$orderData = array();