當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CSaleOrder::getByID方法代碼示例

本文整理匯總了PHP中CSaleOrder::getByID方法的典型用法代碼示例。如果您正苦於以下問題:PHP CSaleOrder::getByID方法的具體用法?PHP CSaleOrder::getByID怎麽用?PHP CSaleOrder::getByID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CSaleOrder的用法示例。


在下文中一共展示了CSaleOrder::getByID方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: HttpClient

$shopId = CSalePaySystemAction::GetParamValue("SHOP_ID");
$changePayStatus = CSalePaySystemAction::GetParamValue("CHANGE_STATUS_PAY") == "Y";
$statusUrl = "https://w.qiwi.com/api/v2/prv/{prv_id}/bills/{bill_id}";
$request = new HttpClient();
$request->setAuthorization($login, $password);
$request->setHeader("Accept", "text/json");
$request->setCharset("utf-8");
$response = $request->get(str_replace(array("{prv_id}", "{bill_id}"), array($shopId, $orderID), $statusUrl));
if ($response === false) {
    return 1;
}
$response = (array) json_decode($response);
if (!$response || !isset($response['response'])) {
    return 1;
}
$response = (array) $response['response'];
if ((int) $response['result_code']) {
    CSaleOrder::Update($orderID, array("PS_STATUS" => "N", "PS_STATUS_CODE" => $response['result_code'], "PS_STATUS_MESSAGE" => Loc::getMessage("SALE_QWH_ERROR_CODE_" . $response['result_code']), "PS_STATUS_DESCRIPTION" => isset($response['description']) ? $response['description'] : "", "PS_RESPONSE_DATE" => \Bitrix\Main\Type\DateTime::createFromTimestamp(time())));
} elseif (isset($response['bill'])) {
    $bill = (array) $response['bill'];
    if ($order = CSaleOrder::getByID($bill['bill_id'])) {
        $paidInfo = array("PS_STATUS" => $bill['status'] == "paid" ? "Y" : "N", "PS_STATUS_CODE" => substr($bill['status'], 0, 10), "PS_STATUS_MESSAGE" => Loc::getMessage("SALE_QWH_STATUS_MESSAGE_" . strtoupper($bill['status'])), "PS_RESPONSE_DATE" => \Bitrix\Main\Type\DateTime::createFromTimestamp(time()), "PS_SUM" => (double) $bill['amount'], "PS_CURRENCY" => $bill['ccy'], 'PS_STATUS_DESCRIPTION' => '');
        foreach ($bill as $key => $value) {
            $paidInfo['PS_STATUS_DESCRIPTION'] .= "{$key}:{$value}, ";
        }
        CSaleOrder::Update($orderID, $paidInfo);
        if ($bill['status'] == "paid" && (double) $bill['amount'] == (double) $order['PRICE'] && $changePayStatus) {
            CSaleOrder::payOrder($orderID, "Y", true, true);
        }
    }
}
開發者ID:DarneoStudio,項目名稱:bitrix,代碼行數:31,代碼來源:result.php


注:本文中的CSaleOrder::getByID方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。