本文整理汇总了PHP中Bitrix\Sale\Order::load方法的典型用法代码示例。如果您正苦于以下问题:PHP Order::load方法的具体用法?PHP Order::load怎么用?PHP Order::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bitrix\Sale\Order
的用法示例。
在下文中一共展示了Order::load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
<?php
CCurrencyLang::disableUseHideZero();
$orderId = (int) $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["ID"];
if ($orderId) {
/** @var \Bitrix\Sale\Order $order */
$order = \Bitrix\Sale\Order::load($orderId);
if ($order) {
/** @var \Bitrix\Sale\PaymentCollection $paymentCollection */
$paymentCollection = $order->getPaymentCollection();
if ($paymentCollection) {
/** @var \Bitrix\Sale\Payment $payment */
foreach ($paymentCollection as $payment) {
if (!$payment->isInner()) {
break;
}
}
if ($payment) {
$context = \Bitrix\Main\Application::getInstance()->getContext();
$service = \Bitrix\Sale\PaySystem\Manager::getObjectById($payment->getPaymentSystemId());
if ($_REQUEST['pdf'] && $_REQUEST['GET_CONTENT'] == 'Y') {
$result = $service->initiatePay($payment, $context->getRequest(), \Bitrix\Sale\PaySystem\BaseServiceHandler::STRING);
if ($result->isSuccess()) {
return $result->getTemplate();
}
}
$result = $service->initiatePay($payment, $context->getRequest());
}
CCurrencyLang::enableUseHideZero();
}
}
示例2: GetMessage
echo "<p><h3>" . GetMessage("PPL_T1") . "</h3></p>";
echo "<b>" . GetMessage("PPL_T2") . "</b><br>\n";
echo "<li>" . GetMessage("PPL_T3") . ": {$firstname} {$lastname}</li>\n";
echo "<li>" . GetMessage("PPL_T4") . ": {$itemname}</li>\n";
echo "<li>" . GetMessage("PPL_T5") . ": {$amount}</li>\n";
} elseif (strcmp($res, "VERIFIED") == 0) {
$strPS_STATUS_MESSAGE = "";
$strPS_STATUS_MESSAGE .= GetMessage("PPL_T3") . ": " . $_POST["first_name"] . " " . $_POST["last_name"] . "; ";
$strPS_STATUS_MESSAGE .= "Email: " . $_POST["payer_email"] . "; ";
$strPS_STATUS_MESSAGE .= GetMessage("PPL_T4") . ": " . $_POST["item_name"] . "; ";
$strPS_STATUS_MESSAGE .= GetMessage("PPL_T5") . ": " . $_POST["mc_gross"] . "; ";
$strPS_STATUS_DESCRIPTION = "";
$strPS_STATUS_DESCRIPTION .= "Payment status - " . $_POST["payment_status"] . "; ";
$strPS_STATUS_DESCRIPTION .= "Payment sate - " . $_POST["payment_date"] . "; ";
/** @var \Bitrix\Sale\Order $order */
$order = Order::load($_POST["custom"]);
$payment = $order->getPaymentCollection()->getItemById($_POST["item_number"]);
$arOrder = $order->getFieldValues();
$arFields = array("PS_STATUS" => "Y", "PS_STATUS_CODE" => "-", "PS_STATUS_DESCRIPTION" => $strPS_STATUS_DESCRIPTION, "PS_STATUS_MESSAGE" => $strPS_STATUS_MESSAGE, "PS_SUM" => $_POST["mc_gross"], "PS_CURRENCY" => $_POST["mc_currency"], "PS_RESPONSE_DATE" => new \Bitrix\Main\Type\DateTime(), "USER_ID" => $arOrder["USER_ID"]);
$arFields["PAY_VOUCHER_NUM"] = $tx;
$arFields["PAY_VOUCHER_DATE"] = new \Bitrix\Main\Type\Date();
if (intval($payment->getField('SUM')) == IntVal($_POST["mc_gross"]) && ToLower($_POST["receiver_email"]) == ToLower(CSalePaySystemAction::GetParamValue("BUSINESS")) && $_POST["payment_status"] == "Completed" && strlen($payment->getField("PAY_VOUCHER_NUM")) <= 0 && $payment->getField("PAY_VOUCHER_NUM") != $tx) {
$result = $payment->setField('PAID', 'Y');
}
if (strlen($payment->getField("PAY_VOUCHER_NUM")) <= 0 || $payment->getField("PAY_VOUCHER_NUM") != $tx) {
$result = $payment->setFields($arFields);
if ($result->isSuccess()) {
$order->save();
}
}
} else {
示例3: array
Asset::getInstance()->addCss('/bitrix/themes/.default/sale.css');
/** @var null|\Bitrix\Sale\Order $saleOrder */
$saleOrder = null;
$shipment = null;
$dataArray = array();
$dataForRecovery = array();
$errors = array();
$request = Application::getInstance()->getContext()->getRequest();
$lang = Application::getInstance()->getContext()->getLanguage();
$orderId = intval($request->get('order_id'));
$shipmentId = intval($request->get('shipment_id'));
$siteId = Application::getInstance()->getContext()->getSite();
$backUrl = $request->get('backurl');
$save = $_SERVER["REQUEST_METHOD"] == "POST" && (isset($_POST["apply"]) || isset($_POST["save"]));
$refresh = $_SERVER["REQUEST_METHOD"] == "POST" && !$save;
if ($orderId <= 0 || !($saleOrder = Bitrix\Sale\Order::load($orderId))) {
LocalRedirect("/bitrix/admin/sale_order.php?lang=" . $lang . GetFilterParams("filter_", false));
}
$shipmentCollection = $saleOrder->getShipmentCollection();
if ($request->get('delete') == 'Y' && check_bitrix_sessid()) {
$shipment = $shipmentCollection->getItemById($shipmentId);
if ($shipment) {
$delResult = $shipment->delete();
if (!$delResult->isSuccess()) {
$errors = $delResult->getErrorMessages();
} else {
$result = $saleOrder->save();
if ($result->isSuccess()) {
if ($backUrl) {
LocalRedirect($backUrl);
} else {
示例4: obtainDataPaySystem
/**
* Function gets pay system info from database, no cache is used here
* @return void
*/
protected function obtainDataPaySystem()
{
if (empty($this->dbResult["ID"])) {
return;
}
foreach ($this->dbResult['PAYMENT'] as &$payment) {
if (intval($payment["PAY_SYSTEM_ID"])) {
$payment["PAY_SYSTEM"] = \Bitrix\Sale\PaySystem\Manager::getById($payment["PAY_SYSTEM_ID"]);
$payment["PAY_SYSTEM"]['NAME'] = htmlspecialcharsbx($payment["PAY_SYSTEM"]['NAME']);
}
if ($payment["PAID"] != "Y" && $this->dbResult["CANCELED"] != "Y") {
$payment['BUFFERED_OUTPUT'] = '';
$payment['ERROR'] = '';
$service = new \Bitrix\Sale\PaySystem\Service($payment["PAY_SYSTEM"]);
if ($service) {
$payment["CAN_REPAY"] = "Y";
if ($service->getField("NEW_WINDOW") == "Y") {
$payment["PAY_SYSTEM"]["PSA_ACTION_FILE"] = htmlspecialcharsbx($this->arParams["PATH_TO_PAYMENT"]) . '?ORDER_ID=' . urlencode(urlencode($this->dbResult["ACCOUNT_NUMBER"])) . '&PAYMENT_ID=' . $payment['ID'];
} else {
CSalePaySystemAction::InitParamArrays($this->dbResult, $this->requestData["ID"], '', array(), $payment);
// for compatibility
$actionFile = $service->getField('ACTION_FILE');
$map = CSalePaySystemAction::getOldToNewHandlersMap();
$oldHandler = array_search($actionFile, $map);
if ($oldHandler !== false && !$service->isCustom()) {
$actionFile = $oldHandler;
}
$pathToAction = Main\Application::getDocumentRoot() . $actionFile;
$pathToAction = str_replace("\\", "/", $pathToAction);
while (substr($pathToAction, strlen($pathToAction) - 1, 1) == "/") {
$pathToAction = substr($pathToAction, 0, strlen($pathToAction) - 1);
}
if (file_exists($pathToAction)) {
if (is_dir($pathToAction) && file_exists($pathToAction . "/payment.php")) {
$pathToAction .= "/payment.php";
}
$payment["PAY_SYSTEM"]["PSA_ACTION_FILE"] = $pathToAction;
}
$encoding = $service->getField("ENCODING");
if (strlen($encoding) > 0) {
define("BX_SALE_ENCODING", $encoding);
AddEventHandler("main", "OnEndBufferContent", array($this, "changeBodyEncoding"));
}
/** @var \Bitrix\Sale\Order $order */
$order = \Bitrix\Sale\Order::load($this->dbResult["ID"]);
if ($order) {
/** @var \Bitrix\Sale\PaymentCollection $paymentCollection */
$paymentCollection = $order->getPaymentCollection();
if ($paymentCollection) {
/** @var \Bitrix\Sale\Payment $paymentItem */
$paymentItem = $paymentCollection->getItemById($payment['ID']);
if ($paymentItem) {
$initResult = $service->initiatePay($paymentItem, null, \Bitrix\Sale\PaySystem\BaseServiceHandler::STRING);
if ($initResult->isSuccess()) {
$payment['BUFFERED_OUTPUT'] = $initResult->getTemplate();
} else {
$payment['ERROR'] = implode('\\n', $initResult->getErrorMessages());
}
}
}
}
}
$payment["PAY_SYSTEM"]["PSA_NEW_WINDOW"] = $payment["PAY_SYSTEM"]["NEW_WINDOW"];
}
}
}
unset($payment);
// for compatibility
$this->dbResult['PAY_SYSTEM'] = $this->dbResult['PAYMENT'][0]['PAY_SYSTEM'];
$this->dbResult['CAN_REPAY'] = $this->dbResult['PAYMENT'][0]['CAN_REPAY'];
}
示例5: processStatusChange
/**
* @param StatusChangeEventParam[] $params
* @return Result
* @throws ArgumentNullException
* @throws \Bitrix\Main\NotSupportedException
*/
protected function processStatusChange($params)
{
$result = new Result();
foreach ($params as $param) {
if (intval($param->status) <= 0) {
continue;
}
$mappedStatuses = $this->getMappedStatuses();
if (!empty($mappedStatuses[$param->status])) {
/** @var Order $order */
$order = Order::load($param->orderId);
/** @var \Bitrix\Sale\ShipmentCollection $shipmentCollection */
$shipmentCollection = $order->getShipmentCollection();
/** @var Shipment $oShipment */
$oShipment = $shipmentCollection->getItemById($param->shipmentId);
$res = $oShipment->setField('STATUS_ID', $mappedStatuses[$param->status]);
if ($res->isSuccess()) {
$res = $order->save();
if (!$res->isSuccess()) {
$result->addErrors($res->getErrors());
}
} else {
$result->addErrors($res->getErrors());
}
}
}
$this->sendOnStatusesChangedEvent($params);
return $result;
}
示例6: unlock
/**
* Unlock order.
*
* @param int $id Order id.
* @return Entity\UpdateResult|Result
* @throws Main\ArgumentNullException
* @throws \Exception
*/
public static function unlock($id)
{
global $USER;
$result = new Result();
$id = (int) $id;
if ($id <= 0) {
$result->addError(new ResultError(Loc::getMessage('SALE_ORDER_WRONG_ID'), 'SALE_ORDER_WRONG_ID'));
return $result;
}
if (!($order = Order::load($id))) {
$result->addError(new ResultError(Loc::getMessage('SALE_ORDER_ENTITY_NOT_FOUND'), 'SALE_ORDER_ENTITY_NOT_FOUND'));
return $result;
}
$userRights = \CMain::getUserRight("sale", $USER->getUserGroupArray(), "Y", "Y");
if ($userRights >= "W" || $order->getField("LOCKED_BY") == $USER->getID()) {
return Internals\OrderTable::update($id, array('DATE_LOCK' => null, 'LOCKED_BY' => null));
}
return $result;
}
示例7: GetMessage
?>
');
</script>
<?php
echo GetMessage("SOA_TEMPL_PAY_LINK", array("#LINK#" => $arParams["PATH_TO_PAYMENT"] . "?ORDER_ID=" . $arResult["ORDER_BASKET"]["ORDER_ID"]));
?>
<?php
} else {
$service = \Bitrix\Sale\PaySystem\Manager::getObjectById($arResult['PAY_SYSTEM_ID']);
if ($service) {
$orderId = $arResult['ORDER_ID'];
/** @var \Bitrix\Sale\Order $order */
$order = \Bitrix\Sale\Order::load($orderId);
if ($order === null) {
$data = \Bitrix\Sale\Internals\OrderTable::getRow(array('select' => array('ID'), 'filter' => array('ACCOUNT_NUMBER' => $orderId)));
$order = \Bitrix\Sale\Order::load($data['ID']);
}
/** @var \Bitrix\Sale\PaymentCollection $paymentCollection */
$paymentCollection = $order->getPaymentCollection();
/** @var \Bitrix\Sale\Payment $payment */
foreach ($paymentCollection as $payment) {
if (!$payment->isInner()) {
$context = \Bitrix\Main\Application::getInstance()->getContext();
$service->initiatePay($payment, $context->getRequest());
break;
}
}
} else {
echo '<span style="color:red;">' . GetMessage("SOA_TEMPL_ORDER_PS_ERROR") . '</span>';
}
}
示例8: foreach
}
$row->AddField("BASKET", $fieldValue);
$row->AddField("BASKET_NAME", $fieldName);
$row->AddField("BASKET_QUANTITY", $fieldQuantity);
$row->AddField("BASKET_PRODUCT_ID", $fieldProductID);
$row->AddField("BASKET_PRICE", $fieldPrice);
$row->AddField("BASKET_WEIGHT", $fieldWeight);
$row->AddField("BASKET_NOTES", $fieldNotes);
$row->AddField("BASKET_DISCOUNT_PRICE", $fieldDiscountPrice);
$row->AddField("BASKET_CATALOG_XML_ID", $fieldCatalogXML);
$row->AddField("BASKET_PRODUCT_XML_ID", $fieldProductXML);
$row->AddField("BASKET_DISCOUNT_VALUE", $fieldDiscountValue);
$row->AddField("BASKET_VAT_RATE", $fieldVatRate);
if ($bNeedProps) {
/** @var \Bitrix\Sale\Order $propOrder */
$propOrder = \Bitrix\Sale\Order::load($arOrder["ID"]);
/** @var Bitrix\Sale\PropertyValue $property */
foreach ($propOrder->getPropertyCollection() as $property) {
$code = $property->getField("CODE");
$colName = "PROP_" . (strlen($code) > 0 ? $code : $property->getField("ORDER_PROPS_ID"));
$row->AddField($colName, $property->getViewHtml());
}
} else {
foreach ($arOrderProps + $arOrderPropsCode as $key => $value) {
$row->AddField("PROP_" . $key, "");
}
}
$row->AddField("EXTERNAL_ORDER", $arOrder["EXTERNAL_ORDER"] != "Y" ? Loc::getMessage("SO_NO") : Loc::getMessage("SO_YES"));
//SHIPMENTS etc.
$shipmentFields = array("SHIPMENTS", "ALLOW_DELIVERY", "DATE_ALLOW_DELIVERY", "DELIVERY", "DEDUCTED", "DELIVERY_DOC_NUM", "DELIVERY_DOC_DATE");
$shipmentFields = array_intersect($arVisibleColumns, $shipmentFields);
示例9: Withdraw
/**
* <p>Метод снимает указанную сумму с внутреннего счета пользователя. Если на внутреннем счете не достаточно средств, то снимается максимально доступная сумма (т.е. все доступные средства). Метод динамичный.</p>
*
*
* @param int $userID Код пользователя. </h
*
* @param double $paySum Снимаемая сумма.
*
* @param string $payCurrency Валюта снимаемой суммы.
*
* @param $int Код заказа, если снятие денег относится к заказу.
*
* @param orderI $D = 0]
*
* @return double <p>Метод возвращает реально снятую со счета сумму или <i>false</i> в
* случае ошибки.</p> <p></p><div class="note"> <b>Замечание:</b> деньги снимаются
* только со счета той же валюты, которая передается параметром в
* метод. Счета пользователя в другой валюте не затрагиваются.</div> <a
* name="examples"></a>
*
* <h4>Example</h4>
* <pre>
* <?
* // Оплатим полностью или хотя бы частично заказ номер 21 со счета пользователя
*
* $arOrder = CSaleOrder::GetByID(21);
*
* $withdrawSum = CSaleUserAccount::Withdraw(
* $arOrder["USER_ID"],
* $arOrder["PRICE"],
* $arOrder["CURRENCY"],
* $arOrder["ID"]
* );
*
* if ($withdrawSum > 0)
* {
* $arFields = array(
* "SUM_PAID" => $withdrawSum,
* "USER_ID" => $arOrder["USER_ID"]
* );
* CSaleOrder::Update($arOrder["ID"], $arFields);
*
* if ($withdrawSum == $arOrder["PRICE"])
* CSaleOrder::PayOrder($arOrder["ID"], "Y", False, False);
* }
* ?>
* </pre>
*
*
* @static
* @link http://dev.1c-bitrix.ru/api_help/sale/classes/csaleuseraccount/csaleuseraccount.withdraw.php
* @author Bitrix
*/
public static function Withdraw($userID, $paySum, $payCurrency, $orderID = 0)
{
global $DB;
$errorCode = "";
$userID = IntVal($userID);
if ($userID <= 0) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGU_EMPTYID"), "EMPTY_USER_ID");
return False;
}
$paySum = str_replace(",", ".", $paySum);
$paySum = DoubleVal($paySum);
if ($paySum <= 0) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGU_EMPTY_SUM"), "EMPTY_SUM");
return False;
}
$payCurrency = Trim($payCurrency);
if (strlen($payCurrency) <= 0) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGU_EMPTY_CUR"), "EMPTY_CURRENCY");
return False;
}
$orderID = IntVal($orderID);
if (!CSaleUserAccount::Lock($userID, $payCurrency)) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGU_ACCOUNT_NOT_LOCKED"), "ACCOUNT_NOT_LOCKED");
return False;
}
$currentBudget = 0.0;
// Check current user account budget
$dbUserAccount = CSaleUserAccount::GetList(array(), array("USER_ID" => $userID, "CURRENCY" => $payCurrency));
if ($arUserAccount = $dbUserAccount->Fetch()) {
$currentBudget = DoubleVal($arUserAccount["CURRENT_BUDGET"]);
if ($orderID > 0) {
/** @var \Bitrix\Sale\Order $order */
if ($order = \Bitrix\Sale\Order::load($orderID)) {
/** @var \Bitrix\Sale\PaymentCollection $paymentCollection */
if (($paymentCollection = $order->getPaymentCollection()) && $paymentCollection->isExistsInnerPayment()) {
/** @var \Bitrix\Sale\Payment $payment */
if (($payment = $paymentCollection->getInnerPayment()) && $payment->isPaid()) {
return 0;
}
}
}
}
if ($currentBudget > 0) {
$withdrawSum = $paySum;
if ($withdrawSum > $currentBudget) {
$withdrawSum = $currentBudget;
}
//.........这里部分代码省略.........
示例10: array
if (($ids = $lAdmin->GroupAction()) && !$bReadOnly) {
$payments = array();
$select = array('ID', 'ORDER_ID');
$params = array('select' => $select, 'filter' => array_merge($arFilter, array('ID' => $ids)), 'order' => array($by => $order), 'limit' => 1000);
$dbResultList = PaymentTable::getList($params);
$payments = $dbResultList->fetchAll();
foreach ($payments as $payment) {
if ($payment['ID'] <= 0 || $payment['ORDER_ID'] <= 0) {
continue;
}
switch ($_REQUEST['action']) {
case "delete":
@set_time_limit(0);
Application::getConnection()->startTransaction();
/** @var \Bitrix\Sale\Order $ord */
$ord = Order::load($payment['ORDER_ID']);
/** @var \Bitrix\Sale\PaymentCollection $paymentCollection */
$paymentCollection = $ord->getPaymentCollection();
$item = $paymentCollection->getItemById($payment['ID']);
$result = $item->delete();
if (!$result->isSuccess()) {
Application::getConnection()->rollbackTransaction();
$lAdmin->AddGroupError(implode('\\n', $result->getErrorMessages()));
} else {
$result = $ord->save();
if ($result->isSuccess()) {
Application::getConnection()->commitTransaction();
} else {
$lAdmin->AddGroupError(implode('\\n', $result->getErrorMessages()));
}
}
示例11: ExportOrders2Xml
function ExportOrders2Xml($arFilter = array(), $nTopCount = 0, $currency = "", $crmMode = false, $time_limit = 0, $version = false, $arOptions = array())
{
self::setVersionSchema($version);
self::setCrmMode($crmMode);
self::setCurrencySchema($currency);
$count = false;
if (IntVal($nTopCount) > 0) {
$count = array("nTopCount" => $nTopCount);
}
$end_time = self::getEndTime($time_limit);
if (IntVal($time_limit) > 0) {
$lastOrderPrefix = self::getOrderPrefix();
if (self::$crmMode) {
$lastOrderPrefix = md5(serialize($arFilter));
if (!empty($_SESSION["BX_CML2_EXPORT"][$lastOrderPrefix]) && IntVal($nTopCount) > 0) {
$count["nTopCount"] = $count["nTopCount"] + count($_SESSION["BX_CML2_EXPORT"][$lastOrderPrefix]);
}
} else {
if (IntVal($_SESSION["BX_CML2_EXPORT"][$lastOrderPrefix]) > 0) {
$arFilter["<ID"] = $_SESSION["BX_CML2_EXPORT"][$lastOrderPrefix];
}
}
}
self::$arResultStat = array("ORDERS" => 0, "CONTACTS" => 0, "COMPANIES" => 0);
$bExportFromCrm = self::isExportFromCRM($arOptions);
//$paySystems = self::getSalePaySystem();
//$delivery = self::getSaleDelivery();
$arStore = self::getCatalogStore();
$arMeasures = self::getCatalogMeasure();
self::setCatalogMeasure($arMeasures);
$arAgent = self::getSaleExport();
if (self::$crmMode) {
self::setXmlEncoding("UTF-8");
$arCharSets = self::getSite();
}
echo self::getXmlRootName();
?>
<<?php
echo CSaleExport::getTagName("SALE_EXPORT_COM_INFORMATION");
?>
<?php
echo self::getCmrXmlRootNameParams();
?>
><?php
$arOrder = array("ID" => "DESC");
if (self::$crmMode) {
$arOrder = array("DATE_UPDATE" => "ASC");
}
$arSelect = array("ID", "LID", "PERSON_TYPE_ID", "PAYED", "DATE_PAYED", "EMP_PAYED_ID", "CANCELED", "DATE_CANCELED", "EMP_CANCELED_ID", "REASON_CANCELED", "STATUS_ID", "DATE_STATUS", "PAY_VOUCHER_NUM", "PAY_VOUCHER_DATE", "EMP_STATUS_ID", "PRICE_DELIVERY", "ALLOW_DELIVERY", "DATE_ALLOW_DELIVERY", "EMP_ALLOW_DELIVERY_ID", "PRICE", "CURRENCY", "DISCOUNT_VALUE", "SUM_PAID", "USER_ID", "PAY_SYSTEM_ID", "DELIVERY_ID", "DATE_INSERT", "DATE_INSERT_FORMAT", "DATE_UPDATE", "USER_DESCRIPTION", "ADDITIONAL_INFO", "COMMENTS", "TAX_VALUE", "STAT_GID", "RECURRING_ID", "ACCOUNT_NUMBER", "SUM_PAID", "DELIVERY_DOC_DATE", "DELIVERY_DOC_NUM", "TRACKING_NUMBER", "STORE_ID", "ID_1C", "VERSION", "USER.XML_ID");
$bCrmModuleIncluded = false;
if ($bExportFromCrm) {
$arSelect[] = "UF_COMPANY_ID";
$arSelect[] = "UF_CONTACT_ID";
if (IsModuleInstalled("crm") && CModule::IncludeModule("crm")) {
$bCrmModuleIncluded = true;
}
}
$filter = array('select' => $arSelect, 'filter' => $arFilter, 'order' => $arOrder, 'limit' => $count["nTopCount"]);
if (!empty($arOptions['RUNTIME']) && is_array($arOptions['RUNTIME'])) {
$filter['runtime'] = $arOptions['RUNTIME'];
}
$dbOrderList = \Bitrix\Sale\Internals\OrderTable::getList($filter);
//$dbOrderList = CSaleOrder::GetList($arOrder, $arFilter, false, $count, $arSelect);
while ($arOrder = $dbOrderList->Fetch()) {
$order = \Bitrix\Sale\Order::load($arOrder['ID']);
/* @var $order \Bitrix\Sale\Order*/
$arOrder['DATE_STATUS'] = $arOrder['DATE_STATUS']->toString();
$arOrder['DATE_INSERT'] = $arOrder['DATE_INSERT']->toString();
$arOrder['DATE_UPDATE'] = $arOrder['DATE_UPDATE']->toString();
foreach ($arOrder as $field => $value) {
if (self::isFormattedDateFields('Order', $field)) {
$arOrder[$field] = self::getFormatDate($value);
}
}
if (self::$crmMode) {
if (self::getVersionSchema() > self::DEFAULT_VERSION && is_array($_SESSION["BX_CML2_EXPORT"][$lastOrderPrefix]) && in_array($arOrder["ID"], $_SESSION["BX_CML2_EXPORT"][$lastOrderPrefix]) && empty($arFilter["ID"])) {
continue;
}
ob_start();
}
self::$arResultStat["ORDERS"]++;
$agentParams = array_key_exists($arOrder["PERSON_TYPE_ID"], $arAgent) ? $arAgent[$arOrder["PERSON_TYPE_ID"]] : array();
$arResultPayment = self::getPayment($arOrder);
$paySystems = $arResultPayment['paySystems'];
$arPayment = $arResultPayment['payment'];
$arResultShipment = self::getShipment($arOrder);
$arShipment = $arResultShipment['shipment'];
$delivery = $arResultShipment['deliveryServices'];
self::setDeliveryAddress('');
self::setSiteNameByOrder($arOrder);
$saleProperties = self::getSaleProperties($order, $arOrder, $agentParams, $bExportFromCrm, $bCrmModuleIncluded, $paySystems, $delivery, $arOptions);
$arProp = $saleProperties['arProp'];
$agent = $saleProperties['agent'];
$arOrderTax = CSaleExport::getOrderTax($arOrder["ID"]);
$xmlResult['OrderTax'] = self::getXMLOrderTax($arOrderTax);
self::setOrderSumTaxMoney(self::getOrderSumTaxMoney($arOrderTax));
$xmlResult['Contragents'] = self::getXmlContragents($arOrder, $arProp, $agent, $bExportFromCrm ? array("EXPORT_FROM_CRM" => "Y") : array());
$xmlResult['OrderDiscount'] = self::getXmlOrderDiscount($arOrder);
$xmlResult['SaleStore'] = self::getXmlSaleStore($arOrder, $arStore);
//.........这里部分代码省略.........
示例12: array
$resp = base64_decode($_POST['operation_xml']);
$order_id = str_replace("ORDER_", "", liqpay_parseTag($resp, "order_id"));
$paymentId = str_replace("PAYMENT_", "", liqpay_parseTag($resp, "payment_id"));
$status = liqpay_parseTag($resp, "status");
$response_description = liqpay_parseTag($resp, "response_description");
$transaction_id = liqpay_parseTag($resp, "transaction_id");
$pay_details = liqpay_parseTag($resp, "pay_details");
$pay_way = liqpay_parseTag($resp, "pay_way");
$amount = liqpay_parseTag($resp, "amount");
$currency = liqpay_parseTag($resp, "currency");
$sender_phone = liqpay_parseTag($resp, "sender_phone");
if ($order_id <= 0 || $paymentId <= 0) {
die;
}
/** @var \Bitrix\Sale\Order $order */
$order = Order::load($order_id);
if (!$order) {
die;
}
$payment = $order->getPaymentCollection()->getItemById($paymentId);
if ($payment->getField('PAID') == "Y") {
die;
}
$arOrder = $order->getFieldValues();
CSalePaySystemAction::InitParamArrays($arOrder, $arOrder["ID"], '', array(), $payment->getFieldValues());
$merchant_id = CSalePaySystemAction::GetParamValue("MERCHANT_ID");
$signature = CSalePaySystemAction::GetParamValue("SIGN");
$gensig = base64_encode(sha1($signature . $resp . $signature, 1));
if ($insig == $gensig && strlen($signature) > 0) {
if ($status == "success") {
$sDescription = '';
示例13: executeComponent
public function executeComponent()
{
global $APPLICATION;
try {
# verify token is valid
$token = $this->checkToken();
# locate order and its payment system
$order_id = $_REQUEST['order_id'];
$payment_id = $_REQUEST['payment_id'];
$uid = $_REQUEST['uid'];
$order = Order::load($order_id);
if (!$order)
throw new Exception( Loc::getMessage("COMPONENT_BEGATEWAY_WRONG_ORDER_ID") . $order_id);
$payment = $order->getPaymentCollection()->getItemById($payment_id);
if (!$payment)
throw new Exception( Loc::getMessage("COMPONENT_BEGATEWAY_WRONG_PAYMENT_ID") . $payment_id);
$arOrder = CSaleOrder::GetByID($order_id);
CSalePaySystemAction::InitParamArrays($arOrder, $arOrder["ID"], '', array(), $payment->getFieldValues());
\beGateway\Settings::$shopId = CSalePaySystemAction::GetParamValue("SHOP_ID");
\beGateway\Settings::$shopKey = CSalePaySystemAction::GetParamValue("SHOP_KEY");
\beGateway\Settings::$gatewayBase = "https://" . CSalePaySystemAction::GetParamValue("DOMAIN_GATEWAY");
\beGateway\Settings::$checkoutBase = "https://" . CSalePaySystemAction::GetParamValue("DOMAIN_PAYMENT_PAGE");
$query = new \beGateway\QueryByToken();
$query->setToken($token);
$response = $query->submit()->getResponse();
if( ! isset( $response->checkout ) )
throw new Exception( Loc::getMessage("COMPONENT_BEGATEWAY_FAIL_TOKEN_QUERY") );
# verify token matches uid
$this->arResult = $response->checkout;
$type = $this->arResult->transaction_type;
if (! isset($this->arResult->gateway_response))
throw new Exception( Loc::getMessage("COMPONENT_BEGATEWAY_NO_TRANS_INFO") );
if ($this->arResult->gateway_response->$type->uid != $uid)
throw new Exception( Loc::getMessage("COMPONENT_BEGATEWAY_NO_UID_TOKEN_ACCESS") );
if ($this->arResult->order->tracking_id != $order_id . ':' . $payment_id)
throw new Exception( Loc::getMessage("COMPONENT_BEGATEWAY_WRONG_TRACKING_ID") );
$money = new \beGateway\Money;
$money->setCents($response->checkout->order->amount);
$money->setCurrency($response->checkout->order->currency);
$response->checkout->order->amount = CCurrencyLang::CurrencyFormat( $money->getAmount(), $money->getCurrency() );
$this->arResult->order->description = $APPLICATION->ConvertCharset($this->arResult->order->description, 'utf-8', SITE_CHARSET);
$this->arResult->gateway_response->$type->billing_descriptor = $APPLICATION->ConvertCharset($this->arResult->gateway_response->$type->billing_descriptor, SITE_CHARSET, 'utf-8');
$this->IncludeComponentTemplate();
} catch(Exception $e) {
ShowError( $e->getMessage() );
}
}
示例14: payOrder
function payOrder($orderData = array())
{
if (strlen($this->token) > 0) {
global $APPLICATION;
$url = "https://api-3t." . $this->domain . "paypal.com/nvp";
$arFields = array("METHOD" => "GetExpressCheckoutDetails", "VERSION" => $this->version, "USER" => $this->username, "PWD" => $this->pwd, "SIGNATURE" => $this->signature, "TOKEN" => $this->token, "buttonsource" => "Bitrix_Cart");
$ht = new \Bitrix\Main\Web\HttpClient(array("version" => "1.1"));
if ($res = $ht->post($url, $arFields)) {
$result = $this->parseResult($res);
if ($result["ACK"] == "Success" && in_array($result["CHECKOUTSTATUS"], array("PaymentActionNotInitiated"))) {
$arFields["METHOD"] = "DoExpressCheckoutPayment";
$arFields["PAYERID"] = $this->payerId;
$arFields["PAYMENTACTION"] = "Sale";
$arFields["PAYMENTREQUEST_0_AMT"] = number_format($this->orderAmount, 2, ".", "");
$arFields["PAYMENTREQUEST_0_CURRENCYCODE"] = $this->currency;
$arFields["PAYMENTREQUEST_0_DESC"] = "Order #" . $this->orderId;
$arFields["PAYMENTREQUEST_0_NOTETEX"] = "Order #" . $this->orderId;
$arFields["PAYMENTREQUEST_0_INVNUM"] = $this->orderId;
$arFields["PAYMENTREQUEST_0_CUSTOM"] = $this->paymentId;
if (DoubleVal($this->deliveryAmount) > 0) {
$arFields["PAYMENTREQUEST_0_SHIPPINGAMT"] = number_format($this->deliveryAmount, 2, ".", "");
}
$orderProps = $this->getProps();
if (!empty($orderProps)) {
$arFields["PAYMENTREQUEST_0_SHIPTONAME"] = $APPLICATION->ConvertCharset($orderProps["PP_SOURCE"]["PAYMENTREQUEST_0_SHIPTONAME"], SITE_CHARSET, "utf-8");
$arFields["PAYMENTREQUEST_0_SHIPTOSTREET"] = $APPLICATION->ConvertCharset($orderProps["PP_SOURCE"]["PAYMENTREQUEST_0_SHIPTOSTREET"], SITE_CHARSET, "utf-8");
$arFields["PAYMENTREQUEST_0_SHIPTOSTREET2"] = $APPLICATION->ConvertCharset($orderProps["PP_SOURCE"]["PAYMENTREQUEST_0_SHIPTOSTREET2"], SITE_CHARSET, "utf-8");
$arFields["PAYMENTREQUEST_0_SHIPTOCITY"] = $APPLICATION->ConvertCharset($orderProps["PP_SOURCE"]["PAYMENTREQUEST_0_SHIPTOCITY"], SITE_CHARSET, "utf-8");
$arFields["PAYMENTREQUEST_0_SHIPTOSTATE"] = $APPLICATION->ConvertCharset($orderProps["PP_SOURCE"]["PAYMENTREQUEST_0_SHIPTOSTATE"], SITE_CHARSET, "utf-8");
$arFields["PAYMENTREQUEST_0_SHIPTOZIP"] = $orderProps["PP_SOURCE"]["PAYMENTREQUEST_0_SHIPTOZIP"];
$arFields["PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE"] = $APPLICATION->ConvertCharset($orderProps["PP_SOURCE"]["PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE"], SITE_CHARSET, "utf-8");
}
if (!empty($orderData["BASKET_ITEMS"])) {
$arFields["PAYMENTREQUEST_0_ITEMAMT"] = number_format($this->orderAmount - $this->deliveryAmount, 2, ".", "");
foreach ($orderData["BASKET_ITEMS"] as $k => $val) {
$arFields["L_PAYMENTREQUEST_0_NAME" . $k] = $APPLICATION->ConvertCharset($val["NAME"], SITE_CHARSET, "utf-8");
$arFields["L_PAYMENTREQUEST_0_AMT" . $k] = number_format($val["PRICE"], 2, ".", "");
$arFields["L_PAYMENTREQUEST_0_QTY" . $k] = $val["QUANTITY"];
$arFields["L_PAYMENTREQUEST_0_NUMBER" . $k] = $val["PRODUCT_ID"];
}
}
if (strlen($this->notifyUrl) > 0) {
$arFields["PAYMENTREQUEST_0_NOTIFYURL"] = $this->notifyUrl;
}
if ($res2 = $ht->Post($url, $arFields)) {
$result2 = $this->parseResult($res2);
/** @var \Bitrix\Sale\Order $order */
$order = Order::load($this->orderId);
$payment = $order->getPaymentCollection()->getItemById($this->paymentId);
if ($result2["ACK"] == "Success" && in_array($result2["PAYMENTINFO_0_PAYMENTSTATUS"], array("Completed"))) {
$payment->setField('PAID', 'Y');
$strPS_STATUS_MESSAGE = "";
$strPS_STATUS_MESSAGE .= "Name: " . $result["FIRSTNAME"] . " " . $result["LASTNAME"] . "; ";
$strPS_STATUS_MESSAGE .= "Email: " . $result["EMAIL"] . "; ";
$strPS_STATUS_DESCRIPTION = "";
$strPS_STATUS_DESCRIPTION .= "Payment status: " . $result2["PAYMENTINFO_0_PAYMENTSTATUS"] . "; ";
$strPS_STATUS_DESCRIPTION .= "Payment sate: " . $result2["PAYMENTINFO_0_ORDERTIME"] . "; ";
$arOrderFields = array("PS_STATUS" => "Y", "PS_STATUS_CODE" => "-", "PS_STATUS_DESCRIPTION" => $strPS_STATUS_DESCRIPTION, "PS_STATUS_MESSAGE" => $strPS_STATUS_MESSAGE, "PS_SUM" => $result2["PAYMENTINFO_0_AMT"], "PS_CURRENCY" => $result2["PAYMENTINFO_0_CURRENCYCODE"], "PS_RESPONSE_DATE" => new \Bitrix\Main\Type\DateTime(), "PAY_VOUCHER_NUM" => $result2["PAYMENTINFO_0_TRANSACTIONID"], "PAY_VOUCHER_DATE" => new \Bitrix\Main\Type\DateTime());
} else {
$strPS_STATUS_MESSAGE = "";
$strPS_STATUS_MESSAGE .= "Name: " . $result["FIRSTNAME"] . " " . $result["LASTNAME"] . "; ";
$strPS_STATUS_MESSAGE .= "Email: " . $result["EMAIL"] . "; ";
$strPS_STATUS_DESCRIPTION = "";
$strPS_STATUS_DESCRIPTION .= "Payment status: " . $result2["PAYMENTINFO_0_PAYMENTSTATUS"] . "; ";
$strPS_STATUS_DESCRIPTION .= "Pending reason: " . $result2["PAYMENTINFO_0_PENDINGREASON"] . "; ";
$strPS_STATUS_DESCRIPTION .= "Payment sate: " . $result2["PAYMENTINFO_0_ORDERTIME"] . "; ";
$arOrderFields = array("PS_STATUS" => "N", "PS_STATUS_CODE" => $result2["PAYMENTINFO_0_PAYMENTSTATUS"], "PS_STATUS_DESCRIPTION" => $strPS_STATUS_DESCRIPTION, "PS_STATUS_MESSAGE" => $strPS_STATUS_MESSAGE, "PS_SUM" => $result2["PAYMENTINFO_0_AMT"], "PS_CURRENCY" => $result2["PAYMENTINFO_0_CURRENCYCODE"], "PS_RESPONSE_DATE" => new \Bitrix\Main\Type\DateTime(), "PAY_VOUCHER_NUM" => $result2["PAYMENTINFO_0_TRANSACTIONID"], "PAY_VOUCHER_DATE" => new \Bitrix\Main\Type\DateTime());
}
$result = $payment->setFields($arOrderFields);
if ($result->isSuccess()) {
$order->save();
}
}
}
}
}
}
示例15: delete
/**
* Delete the order
* @param int $id Order ID.
* @return Sale\Result
* @throws \Bitrix\Main\ArgumentNullException
*/
public static function delete($id)
{
$result = new Sale\Result();
if (intval($id) <= 0) {
$result->addError(new Sale\ResultError(Main\Localization\Loc::getMessage('SALE_COMPATIBLE_ORDER_ID_NOT_FOUND'), 'SALE_COMPATIBLE_ORDER_ID_NOT_FOUND'));
return $result;
}
/** @var Sale\Order $order */
if (!($order = Sale\Order::load($id))) {
$result->addError(new Sale\ResultError(Loc::getMessage('SALE_ORDER_ENTITY_NOT_FOUND'), 'SALE_ORDER_ENTITY_NOT_FOUND'));
return $result;
}
/** @var Sale\PaymentCollection $paymentCollection */
if ($paymentCollection = $order->getPaymentCollection()) {
/** @var Sale\Payment $payment */
foreach ($paymentCollection as $payment) {
if ($payment->isPaid()) {
$payment->setPaid('N');
}
}
/** @var Sale\Result $r */
$r = $order->save();
if (!$r->isSuccess()) {
return $r;
}
}
/** @var Sale\Result $r */
$r = Sale\Order::delete($id);
if (!$r->isSuccess()) {
$result->addErrors($r->getErrors());
}
return $result;
}