$tservices_categories = new tservices_categories(); $result = $tservices_categories->getTitleAndSubtitle(10); assert('$result == array("spec_title" => "Веб-программирование", "group_title" => "Разработка сайтов")'); $result = $tservices_categories->getCategoryParentId(10); assert('$result == 7'); $tservices_tags = new tservices_tags(); $result = $tservices_tags->getsByTServiceId(39); assert('$result == array( 0 => "альбом", 1 => "бронировать", 2 => "забронировать", 3 => "заказать", 4 => "заказывать", 5 => "зарезервировать" )'); $tservices = new tservices(2); $result = $tservices->isExistFeedbacks(27); assert('$result == 2'); $result = $tservices->getTotalCount(); assert('$result == array("plus" => 2, "minus" => 2)'); $result = $tservices->getNearBy('next', 38); $result = $tservices->getNearBy('prev', 38); $result = $tservices->getCountCompleteSbrServices(); assert('$result == 5'); $result = $tservices->deleteById(750); assert('$result == TRUE'); $result = $tservices->isExists(749); $result = $tservices->getFeedbacks(36); $result = $tservices->getCard(36); $result = $tservices->setPage(5)->getShortList(); $result = $tservices->initProps(); assert('$tservices->user_id == 2'); $result = $tservices->fieldsPropsToArray(); $stop_words = new stop_words(); print_r($stop_words); //print_r($cfile); //var_dump($result); exit;
/** * Оплата через Плати потом. * * @param type $type - тип оплаты * @param type $data - данные по параметрам покупаемой услуги * * @return \xajaxResponse */ function quickPaymentTservicebindPlatipotom($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_prolong = (bool) @$data['is_prolong']; $promo_code = (string) @$data['promo']; $tservices_binds = new tservices_binds($kind); $tservices = new tservices($uid); $allow = $tservices_binds->isAllowBind($uid, $tservice_id, $kind, $prof_id); $valid = $tservices->isExists($tservice_id) && ($is_prolong ? !$allow : $allow); if ($valid) { $is_error = false; $bill = new billing($uid); //Допустимо использование промокодов $bill->setPromoCodes('SERVICE_TSERVICEBIND', $promo_code); $op_code = $tservices_binds->getOpCode(); $option = array('weeks' => (int) @$data['weeks'], 'prof_id' => $prof_id, 'tservice_id' => $tservice_id, 'is_prolong' => $is_prolong); //Формируем заказ $billReserveId = $bill->addServiceAndCheckout($op_code, $option); $payed_sum = $bill->getRealPayedSum(); $platipotom = new platipotom(); $html_form = $platipotom->render($payed_sum, $bill->account->id, $billReserveId); if ($html_form) { $idx = quickPaymentPopupTservicebind::getPopupId($is_prolong ? $tservice_id : 0); $objResponse->script("\n var qp_form_wrapper = \$\$('#" . $idx . " .__quick_payment_form');\n if(qp_form_wrapper){ \n qp_form_wrapper.set('html','{$html_form}');\n qp_form_wrapper.getElement('form')[0].submit();\n }\n "); //сохранаем в сессию куда перейти при успешной покупке $redirect = (string) @$data['redirect']; $_SESSION[quickPaymentPopup::QPP_REDIRECT] = $redirect; } } // Показываем предупреждение в случае ошибки if ($is_error) { $idx = quickPaymentPopupTservicebind::getPopupId($is_prolong ? $tservice_id : 0); $action = $is_prolong ? 'продлении закрепления' : 'закреплении'; $objResponse->script("\n var qp = window.quick_payment_factory.getQuickPaymentById('tservicebind', '" . $idx . "');\n if(qp) qp.show_error('Возникла ошибка при {$action} услуги!');\n "); } return $objResponse; }