} } } if ($arParams["DELIVERY_TO_PAYSYSTEM"] == "p2d") { $arD2P = array(); } if ($arUserResult["PREPAYMENT_MODE"] && IntVal($arUserResult["PAY_SYSTEM_ID"]) > 0) { $arFilter["ID"] = $arUserResult["PAY_SYSTEM_ID"]; } $bFirst = True; $dbPaySystem = CSalePaySystem::GetList(array("SORT" => "ASC", "PSA_NAME" => "ASC"), $arFilter); while ($arPaySystem = $dbPaySystem->Fetch()) { //if (count($arD2P[$delivery]) <= 0 || in_array($arPaySystem["ID"], $arD2P[$delivery])) //{ if (strlen($arUserResult["DELIVERY_ID"]) <= 0 || $arParams["DELIVERY_TO_PAYSYSTEM"] == "p2d" || CSaleDelivery2PaySystem::isPaySystemApplicable($arPaySystem["ID"], $arUserResult["DELIVERY_ID"])) { if (!CSalePaySystemsHelper::checkPSCompability($arPaySystem["PSA_ACTION_FILE"], $arOrder, $arResult["ORDER_PRICE"], $arResult["DELIVERY_PRICE"], $arUserResult["DELIVERY_LOCATION"])) { continue; } if ($arPaySystem["PSA_LOGOTIP"] > 0) { $arPaySystem["PSA_LOGOTIP"] = CFile::GetFileArray($arPaySystem["PSA_LOGOTIP"]); } $arPaySystem["PSA_NAME"] = htmlspecialcharsEx($arPaySystem["PSA_NAME"]); $arResult["PAY_SYSTEM"][$arPaySystem["ID"]] = $arPaySystem; $arResult["PAY_SYSTEM"][$arPaySystem["ID"]]["PRICE"] = CSalePaySystemsHelper::getPSPrice($arPaySystem, $arResult["ORDER_PRICE"], $arResult["DELIVERY_PRICE"], $arUserResult["DELIVERY_LOCATION"]); if (IntVal($arUserResult["PAY_SYSTEM_ID"]) == IntVal($arPaySystem["ID"]) || IntVal($arUserResult["PAY_SYSTEM_ID"]) <= 0 && $bFirst) { //$arPaySystem["CHECKED"] = "Y"; $arResult["PAY_SYSTEM"][$arPaySystem["ID"]]["CHECKED"] = "Y"; $arUserResult["PAY_SYSTEM_ID"] = $arPaySystem["ID"]; } $bFirst = false; }
public function getPaysystems($deliveryId = null) { if (empty($deliveryId)) { $deliveryId = $this->deliveryId; } if (empty($deliveryId)) { throw new \Exception('Для получения способов оплаты нужно указать службу доставки'); } $paySystems = array(); $paySystemFilter = array('ACTIVE' => 'Y', 'PERSON_TYPE_ID' => 1, 'PSA_HAVE_PAYMENT' => 'Y'); $res = \CSalePaySystem::GetList(array("SORT" => "ASC", "PSA_NAME" => "ASC"), $paySystemFilter); while ($paySystem = $res->Fetch()) { if (!\CSaleDelivery2PaySystem::isPaySystemApplicable($paySystem['ID'], $deliveryId)) { continue; } $check = \CSalePaySystemsHelper::checkPSCompability($paySystem['PSA_ACTION_FILE'], $this->getItemsRaw(), $this->getTotal(), $this->deliveryPrice, $this->location); if (!$check) { continue; } $paySystem['PRICE'] = \CSalePaySystemsHelper::getPSPrice($paySystem, $this->getTotal(), $this->deliveryPrice, $this->location); $paySystems[] = $paySystem; } return $paySystems; }