/** * Оплата из буфера. * * @param type $type * @param array $data (prof_id) * * @return type */ function quickPaymentFrlbindupBuffer($type, $data) { $is_error = true; $uid = get_uid(false); $objResponse =& new xajaxResponse(); $prof_id = (int) @$data['prof_id']; $is_spec = (bool) @$data['is_spec']; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/buffer.php'; $buffer = new buffer(); $buffer_sum = $buffer->getSum(); $freelancer_binds = new freelancer_binds(); $is_binded = $freelancer_binds->isUserBinded($uid, $prof_id, $is_spec); $price = $freelancer_binds->getPriceUp($prof_id, $is_spec, $uid); if ($is_binded && $buffer_sum >= $price) { $bill = new billing($uid); $option = array('prof_id' => $prof_id); //Покупаем услугу смоимостью 0 рублей при любом заначении ЛС $ok = $bill->addServiceAndPayZero(freelancer_binds::OP_CODE_UP_BUFFER, $option); if ($ok) { $is_error = false; $buffer->setUsedSum($price); $objResponse->script('window.location.reload();'); } } // Показываем предупреждение в случае ошибки if ($is_error) { $objResponse->script("\n var qp = window.quick_payment_factory.getQuickPayment('frlbindup');\n if(qp) qp.show_error('Возникла ошибка при поднятии закрепления в каталоге!');\n "); } return $objResponse; }
/** * Оплата из буфера * @param type $type * @param array $data (prof_id) * @return type */ function quickPaymentTservicebindupBuffer($type, $data) { $is_error = true; $uid = get_uid(false); $objResponse =& new xajaxResponse(); $kind = (int) @$data['kind']; $tservice_id = (int) @$data['tservice_text_db_id']; $prof_id = (int) @$data['prof_id']; $is_spec = $kind == tservices_binds::KIND_SPEC; $tservices_binds = new tservices_binds($kind); $bind = $tservices_binds->getItem($uid, $tservice_id, $prof_id); require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/buffer.php"; $buffer = new buffer(); $buffer_sum = $buffer->getSum(); $price = $tservices_binds->getPrice(true, $uid, $prof_id); if ($bind && $buffer_sum >= $price) { $bill = new billing($uid); $ok = $bill->addServiceAndPayFromAccount(tservices_binds::OP_CODE_UP_BUFFER, array('bind_id' => $bind['id'])); if ($ok) { $is_error = false; $buffer->setUsedSum($price); $objResponse->script("window.location.reload();"); } } // Показываем предупреждение в случае ошибки if ($is_error) { $idx = quickPaymentPopupTservicebindup::getPopupId($tservice_id); $objResponse->script("\n var qp = window.quick_payment_factory.getQuickPaymentById('tservicebindup', '" . $idx . "');\n if(qp) qp.show_error('Возникла ошибка при поднятии закрепления услуги!');\n "); } return $objResponse; }
public function init($options) { parent::init($options); $this->setBuyPopupTemplate('buy_popup_frlbindup.tpl.php'); $promoCodes = new PromoCodes(); $buffer = new buffer(); $options = array('popup_title_class_bg' => 'b-fon_bg_po', 'popup_title_class_icon' => 'b-icon__po', 'popup_title' => 'Поднятие закрепления на 1 место', 'popup_id' => $this->ID, 'unic_name' => $this->UNIC_NAME, 'payments_title' => 'Сумма и способ оплаты', 'payments_exclude' => array(self::PAYMENT_TYPE_BANK), 'ac_sum' => round($_SESSION['ac_sum'], 2), 'payment_account' => self::PAYMENT_TYPE_ACCOUNT, 'is_show' => $options['autoshow'], 'buffer' => $buffer->getSum(), 'promo_code' => $promoCodes->render(PromoCodes::SERVICE_FRLBIND)); //Обязательно передаем родителю parent::init($options); //Добавляем свойство к одному способу оплаты $this->options['payments'][self::PAYMENT_TYPE_CARD]['wait'] = 'Ждите ....'; $this->options['payments'][self::PAYMENT_TYPE_PLATIPOTOM]['content_after'] = sprintf($this->options['payments'][self::PAYMENT_TYPE_PLATIPOTOM]['content_after'], 'закрепление'); }
public function init($params) { $kind = $params['kind'] ?: tservices_binds::KIND_LANDING; //По умолчанию ставим лендинг $prof_id = (int) $params['prof_id']; $this->setBuyPopupTemplate('buy_popup_tservicebindup.tpl.php'); $tservices_binds = new tservices_binds($kind); $promoCodes = new PromoCodes(); $buffer = new buffer(); $options = array('popup_title_class_bg' => 'b-fon_bg_po', 'popup_title_class_icon' => 'b-icon__po', 'popup_title' => 'Поднятие закрепления на 1 место', 'popup_id' => $this->getPopupId(0), 'unic_name' => $this->UNIC_NAME, 'payments_title' => 'Сумма и способ оплаты', 'payments_exclude' => array(self::PAYMENT_TYPE_BANK), 'ac_sum' => round($_SESSION['ac_sum'], 2), 'payment_account' => self::PAYMENT_TYPE_ACCOUNT, 'kind' => $kind, 'profession' => $tservices_binds->getProfessionText(false, $prof_id), 'buffer' => $buffer->getSum(), 'ammount' => round($tservices_binds->getPrice(true, @$params['uid'], $prof_id), 2), 'disable_tservices' => false, 'prof_id' => $prof_id, 'promo_code' => $promoCodes->render(PromoCodes::SERVICE_TSERVICEBIND)); //Обязательно передаем родителю parent::init($options); //Добавляем свойство к одному способу оплаты $this->options['payments'][self::PAYMENT_TYPE_CARD]['wait'] = 'Ждите ....'; $this->options['payments'][self::PAYMENT_TYPE_PLATIPOTOM]['content_after'] = sprintf($this->options['payments'][self::PAYMENT_TYPE_PLATIPOTOM]['content_after'], 'закрепление'); $this->inited = true; }