本文整理汇总了PHP中CSaleOrder::payOrder方法的典型用法代码示例。如果您正苦于以下问题:PHP CSaleOrder::payOrder方法的具体用法?PHP CSaleOrder::payOrder怎么用?PHP CSaleOrder::payOrder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSaleOrder
的用法示例。
在下文中一共展示了CSaleOrder::payOrder方法的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);
}
}
}