本文整理汇总了PHP中CSalePaySystemAction::getOldToNewHandlersMap方法的典型用法代码示例。如果您正苦于以下问题:PHP CSalePaySystemAction::getOldToNewHandlersMap方法的具体用法?PHP CSalePaySystemAction::getOldToNewHandlersMap怎么用?PHP CSalePaySystemAction::getOldToNewHandlersMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSalePaySystemAction
的用法示例。
在下文中一共展示了CSalePaySystemAction::getOldToNewHandlersMap方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPSPrice
public static function getPSPrice($arPaySystem, $orderPrice, $deliveryPrice, $buyerLocationId)
{
$result = 0;
$map = CSalePaySystemAction::getOldToNewHandlersMap();
$oldHandler = array_search($arPaySystem["PSA_ACTION_FILE"], $map);
if ($oldHandler !== false) {
$arPaySystem["PSA_ACTION_FILE"] = $oldHandler;
}
$PSTarifClassName = self::getTarifClassName($arPaySystem["PSA_ACTION_FILE"]);
if (strlen($PSTarifClassName) > 0 && is_callable($PSTarifClassName . '::getPrice')) {
$result = call_user_func_array($PSTarifClassName . '::getPrice', array(&$arPaySystem, $orderPrice, $deliveryPrice, $buyerLocationId));
}
return $result;
}
示例2: 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'];
}
示例3: GetList
public static function GetList($arOrder = array("SORT" => "ASC", "NAME" => "ASC"), $arFilter = array(), $arGroupBy = false, $arNavStartParams = false, $arSelectFields = array())
{
if (array_key_exists("PSA_PERSON_TYPE_ID", $arFilter)) {
$arFilter['PERSON_TYPE_ID'] = $arFilter['PSA_PERSON_TYPE_ID'];
unset($arFilter["PSA_PERSON_TYPE_ID"]);
}
$salePaySystemFields = array('ID', 'NAME', 'ACTIVE', 'SORT', 'DESCRIPTION');
$ignoredFields = array('LID', 'CURRENCY', 'PERSON_TYPE_ID');
if (!$arSelectFields) {
$select = array('ID', 'NAME', 'ACTIVE', 'SORT', 'DESCRIPTION');
} else {
$select = array();
foreach ($arSelectFields as $key => $field) {
if (in_array($field, $ignoredFields)) {
continue;
}
$select[$key] = self::getAlias($field);
}
}
$filter = array();
foreach ($arFilter as $key => $value) {
if (in_array($key, $ignoredFields)) {
continue;
}
$filter[self::getAlias($key)] = $value;
}
if (isset($arFilter['PERSON_TYPE_ID'])) {
$select = array_merge($select, array('PSA_ID' => 'ID', 'PSA_NAME', 'ACTION_FILE', 'RESULT_FILE', 'NEW_WINDOW', 'PERSON_TYPE_ID', 'PARAMS', 'TARIF', 'HAVE_PAYMENT', 'HAVE_ACTION', 'HAVE_RESULT', 'HAVE_PREPAY', 'HAVE_RESULT_RECEIVE', 'ENCODING', 'LOGOTIP'));
}
if (in_array('PARAMS', $select) && !array_key_exists('PSA_ID', $select)) {
$select['PSA_ID'] = 'ID';
}
if (in_array('PARAMS', $select) && !in_array('PERSON_TYPE_ID', $select)) {
$select[] = 'PERSON_TYPE_ID';
}
$order = array();
foreach ($arOrder as $key => $value) {
$order[self::getAlias($key)] = $value;
}
$groupBy = array();
if ($arGroupBy !== false) {
$arGroupBy = !is_array($arGroupBy) ? array($arGroupBy) : $arGroupBy;
foreach ($arGroupBy as $key => $value) {
$groupBy[$key] = self::getAlias($value);
}
}
$dbRes = PaySystemActionTable::getList(array('select' => $select, 'filter' => $filter, 'order' => $order, 'group' => $groupBy));
$limit = null;
if (is_array($arNavStartParams) && isset($arNavStartParams['nTopCount'])) {
if ($arNavStartParams['nTopCount'] > 0) {
$limit = $arNavStartParams['nTopCount'];
}
}
$result = array();
while ($data = $dbRes->fetch()) {
if ($limit !== null && !$limit) {
break;
}
$dbRestriction = \Bitrix\Sale\Internals\ServiceRestrictionTable::getList(array('filter' => array('SERVICE_ID' => $data['ID'], 'SERVICE_TYPE' => \Bitrix\Sale\Services\PaySystem\Restrictions\Manager::SERVICE_TYPE_PAYMENT)));
while ($restriction = $dbRestriction->fetch()) {
if (!CSalePaySystemAction::checkRestriction($restriction, $arFilter)) {
continue 2;
}
}
if (isset($data['ACTION_FILE'])) {
$oldHandler = array_search($data['ACTION_FILE'], CSalePaySystemAction::getOldToNewHandlersMap());
if ($oldHandler !== false) {
$data['ACTION_FILE'] = $oldHandler;
}
}
if (array_key_exists('PARAMS', $data)) {
$params = CSalePaySystemAction::getParamsByConsumer('PAYSYSTEM_' . $data['PSA_ID'], $data['PERSON_TYPE_ID']);
$params['BX_PAY_SYSTEM_ID'] = array('TYPE' => '', 'VALUE' => $data['PSA_ID']);
$data['PARAMS'] = serialize($params);
}
foreach ($data as $key => $value) {
if (!in_array($key, $salePaySystemFields)) {
$newKey = self::getAliasBack($key);
if ($newKey != $key) {
$data[$newKey] = $value;
unset($data[$key]);
}
}
}
$result[] = $data;
$limit--;
}
$dbRes = new \CDBResult();
$dbRes->InitFromArray($result);
return $dbRes;
}