Esempio n. 1
0
 protected static function getOrderInfo($orderId)
 {
     // order itself
     $order = \CSaleOrder::getById($orderId);
     // buyer info
     $siteUserId = $order['USER_ID'];
     $phone = '';
     $email = '';
     $result = \CSaleOrderPropsValue::GetList(array(), array("ORDER_ID" => $orderId));
     while ($row = $result->fetch()) {
         if (empty($phone) && stripos($row['CODE'], 'PHONE') !== false) {
             $stPhone = static::normalizePhoneNumber($row['VALUE']);
             if (!empty($stPhone)) {
                 $phone = sha1($stPhone);
             }
         }
         if (empty($email) && stripos($row['CODE'], 'EMAIL') !== false) {
             if (!empty($row['VALUE'])) {
                 $email = sha1($row['VALUE']);
             }
         }
     }
     // products info
     $products = array();
     $result = \CSaleBasket::getList(array(), $arFilter = array('ORDER_ID' => $orderId), false, false, array('PRODUCT_ID'));
     while ($row = $result->fetch()) {
         $products[] = array('product_id' => $row['PRODUCT_ID'], 'recommendation' => '0');
     }
     // all together
     $data = array('order_id' => $orderId, 'user_id' => $siteUserId, 'phone' => $phone, 'email' => $email, 'products' => $products);
     return $data;
 }
Esempio n. 2
0
$bUserCanViewOrder = CSaleOrder::CanUserViewOrder($ID, $arUserGroups, $intUserID);
$bUserCanEditOrder = CSaleOrder::CanUserUpdateOrder($ID, $arUserGroups);
$bUserCanCancelOrder = CSaleOrder::CanUserCancelOrder($ID, $arUserGroups, $intUserID);
$bUserCanDeductOrder = CSaleOrder::CanUserChangeOrderFlag($ID, "PERM_DEDUCTION", $arUserGroups);
$bUserCanMarkOrder = CSaleOrder::CanUserMarkOrder($ID, $arUserGroups, $intUserID);
$bUserCanPayOrder = CSaleOrder::CanUserChangeOrderFlag($ID, "PERM_PAYMENT", $arUserGroups);
$bUserCanDeliverOrder = CSaleOrder::CanUserChangeOrderFlag($ID, "PERM_DELIVERY", $arUserGroups);
$bUserCanDeleteOrder = CSaleOrder::CanUserDeleteOrder($ID, $arUserGroups, $intUserID);

if (isset($_REQUEST["ORDER_AJAX"]) AND $_REQUEST["ORDER_AJAX"] == "Y" AND check_bitrix_sessid())
{
	CUtil::DecodeUriComponent($_REQUEST);
	$type = $_REQUEST["type"];

	$order = CSaleOrder::getById($ID);
	$allowIds = \Bitrix\Main\Config\Option::get("sale", "p2p_status_list", "");
	if(strlen($allowIds))
		$allowIds = unserialize($allowIds);
	else
		$allowIds = array();

	/*
	* get more product
	*/
	if (isset($type) && $type != "")
	{

		$arResult = array();
		$arErrors = array();
		$LID = (array_key_exists('LID', $_REQUEST))? ($_REQUEST['LID']) : false;
Esempio n. 3
0
 protected static function getOrderInfo($orderId)
 {
     // order itself
     $order = \CSaleOrder::getById($orderId);
     // buyer info
     $siteUserId = $order['USER_ID'];
     $phone = '';
     $email = '';
     $result = \CSaleOrderPropsValue::GetList(array(), array("ORDER_ID" => $orderId));
     while ($row = $result->fetch()) {
         if (empty($phone) && stripos($row['CODE'], 'PHONE') !== false) {
             $stPhone = static::normalizePhoneNumber($row['VALUE']);
             if (!empty($stPhone)) {
                 $phone = sha1($stPhone);
             }
         }
         if (empty($email) && stripos($row['CODE'], 'EMAIL') !== false) {
             if (!empty($row['VALUE'])) {
                 $email = sha1($row['VALUE']);
             }
         }
     }
     // products info
     $products = array();
     $result = \CSaleBasket::getList(array(), $arFilter = array('ORDER_ID' => $orderId, 'MODULE' => 'catalog'), false, false, array('PRODUCT_ID', 'RECOMMENDATION', 'QUANTITY', 'PRICE', 'CURRENCY'));
     while ($row = $result->fetch()) {
         $productInfo = \CCatalogSKU::GetProductInfo($row['PRODUCT_ID']);
         $iblockId = 0;
         if (!empty($productInfo['ID'])) {
             $realProductId = $productInfo['ID'];
             $iblockId = $productInfo['IBLOCK_ID'];
         } else {
             $realProductId = $row['PRODUCT_ID'];
             // get iblock id
             $element = \Bitrix\Iblock\ElementTable::getRow(array('select' => array('IBLOCK_ID'), 'filter' => array('=ID' => $realProductId)));
             if (!empty($element)) {
                 $iblockId = $element['IBLOCK_ID'];
             }
         }
         $products[] = array('product_id' => $realProductId, 'iblock_id' => $iblockId, 'quantity' => $row['QUANTITY'], 'price' => $row['PRICE'], 'currency' => $row['CURRENCY'], 'recommendation' => $row['RECOMMENDATION']);
     }
     // all together
     $data = array('order_id' => $orderId, 'user_id' => $siteUserId, 'phone' => $phone, 'email' => $email, 'products' => $products, 'price' => $order['PRICE'], 'currency' => $order['CURRENCY']);
     return $data;
 }
Esempio n. 4
0
    }
} else {
    $key = CSalePaySystemAction::GetParamValue("API_PASSWORD");
    if (isset($_SERVER['HTTP_X_API_SIGNATURE']) && strlen($key) > 0) {
        $key = CSalePaySystemAction::GetParamValue("API_PASSWORD");
        $params = $_POST;
        ksort($params);
        $check = base64_encode(sha1($key, implode("|", array_values($params))));
        if ($check != $_SERVER['HTTP_X_API_SIGNATURE']) {
            qiwiWalletXmlResponse(QIWI_WALLET_ERROR_CODE_AUTH);
        }
    } else {
        qiwiWalletXmlResponse(QIWI_WALLET_ERROR_CODE_AUTH);
    }
}
if ($order = CSaleOrder::getById($_POST['bill_id'])) {
    $paidInfo = array("PS_STATUS" => $_POST['status'] == "paid" ? "Y" : "N", "PS_STATUS_CODE" => substr($_POST['status'], 0, 5), "PS_STATUS_MESSAGE" => Loc::getMessage("SALE_QWH_STATUS_MESSAGE_" . strtoupper($_POST['status'])), "PS_RESPONSE_DATE" => \Bitrix\Main\Type\DateTime::createFromTimestamp(time()), "PS_SUM" => (double) $_POST['amount'], "PS_CURRENCY" => $_POST['ccy'], "PS_STATUS_DESCRIPTION" => "");
    if ((int) $_POST['error']) {
        $paidInfo['PS_STATUS_DESCRIPTION'] = "Error: " . Loc::getMessage("SALE_QWH_ERROR_CODE_" . $_POST['error']);
        CSaleOrder::Update($order['ID'], $paidInfo);
        qiwiWalletXmlResponse(QIWI_WALLET_ERROR_CODE_OTHER);
    }
    foreach ($_POST as $key => $value) {
        $paidInfo['PS_STATUS_DESCRIPTION'] .= "{$key}:{$value}, ";
    }
    CSaleOrder::Update($order['ID'], $paidInfo);
    $changeStatusPay = CSalePaySystemAction::GetParamValue("CHANGE_STATUS_PAY") == "Y";
    $difference = (double) $_POST['amount'] - (double) $order['PRICE'];
    if ($difference < 0) {
        qiwiWalletXmlResponse(QIWI_WALLET_ERROR_CODE_TOO_LOW);
    } elseif ($difference > 0) {