public function init($options = array()) { if (isset($options['payments_exclude'])) { foreach ($options['payments_exclude'] as $payment_type) { unset($this->options['payments'][$payment_type]); } } if (isset($this->options['payments'][self::PAYMENT_TYPE_PLATIPOTOM])) { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/platipotom.php'; $platipotom = new platipotom(); $this->options['payments'][self::PAYMENT_TYPE_PLATIPOTOM]['data-maxprice'] = $platipotom->getMaxPrice(); } $this->options['is_show'] = __paramInit('bool', $options['popup_id'], $options['popup_id'], false); $this->options = array_merge($this->options, $options); }
public function init($options = array()) { $this->options = array_merge($this->options, $options); if (isset($options['payments_exclude'])) { foreach ($options['payments_exclude'] as $payment_type) { unset($this->options['payments'][$payment_type]); } } if (isset($this->options['payments'][self::PAYMENT_TYPE_PLATIPOTOM])) { require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/platipotom.php'; $platipotom = new platipotom(); $this->options['payments'][self::PAYMENT_TYPE_PLATIPOTOM]['data-maxprice'] = $platipotom->getMaxPrice(); } if (isset($_SESSION['ref_uri'])) { $ref_uri = urldecode($_SESSION['ref_uri']); $query = parse_url($ref_uri, PHP_URL_QUERY); $toAppend = strpos($query, $this->options['popup_id']) === false; if ($toAppend) { $delimitter = $query ? '&' : '?'; $_SESSION['redirect_from_finance'] = urlencode($ref_uri . $delimitter . $this->options['popup_id'] . '=1'); } } $this->options['is_show'] = __paramInit('bool', $this->options['popup_id'], $this->options['popup_id'], false); }
<?php define('NO_CSRF', 1); require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stdf.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/platipotom.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/log.php'; $platipotom = new platipotom(); $log = new log('platipotom/%d%m%Y.log'); $log->writeln('----- ' . date('d.m.Y H:i:s')); $log->writevar($_GET); $result = $platipotom->order(); $log->writeln('----- ' . (isset($result['status']) && $result['status'] == 1 ? 'SUCCESS' : 'FAIL')); $log->writeln(); header('Content-Type: application/json'); echo json_encode($result);
/** * Оплата через Плати потом. * * @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; }
case 'project': $quickPRO_title = 'Покупка аккаунта Pro для ответа на проект'; $quickPRO_ok_close_btn = 'Закрыть и ответить на проект'; $quickPRO_redirect = getFriendlyUrl('project', $project['id']); break; case 'promotion': $quickPRO_redirect = '/promotion/'; default: $quickPRO_title = 'Покупка аккаунта Pro'; $quickPRO_ok_close_btn = 'Закрыть'; break; } if (!isset($_SESSION['quickbuypro_success_opcode'])) { $_GET[$quickpro_ok_default] = false; } $platipotom = new platipotom(true); $platipotomMaxSum = (int) $platipotom->getMaxPrice(0); ?> <div id="quick_pro_win_main" class="b-shadow b-shadow_center b-shadow_width_520 b-shadow_hide b-shadow__quick" style="display:block;"> <div class="b-shadow__body b-shadow__body_pad_15_20"> <div class="b-fon b-fon_bg_fpro"> <div class="b-layout__title b-layout__title_padbot_5"> <span class="b-icon b-page__desktop b-page__ipad <?php if ($quickPRO_type == 'profi') { ?> b-icon__profi<?php } else { ?> b-icon__spro b-icon__spro_<?php echo is_emp() ? 'e' : 'f';
/** * Была ли у пользователя покупка через ПлатиПотом * * @param type $uid * @return boolean */ function isWasPlatipotom($bill_id = 0) { static $isWasPlatipotom = null; if ($isWasPlatipotom !== null) { return $isWasPlatipotom; } require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/platipotom.php'; $platipotomObject = new platipotom(); $isWasPlatipotom = $platipotomObject->isWasPlatipotom($bill_id); return $isWasPlatipotom; }
/** * Оплата карусели через Плати потом * * @param type $type * @param type $data * @return \xajaxResponse */ function quickPaymentProPlatipotom($type, $data) { $uid = get_uid(false); $objResponse = new xajaxResponse(); if (!($uid > 0)) { return $objResponse; } $is_emp = is_emp(); $form = new ProForm($is_emp); if (!$form->isValid($data)) { $objResponse->script("\n var qp = window.quick_ext_payment_factory.getQuickPayment('pro');\n if(qp) qp.show_error('К сожалению, в процессе оплаты произошла ошибка, и платеж не был завершен. Попробуйте провести оплату еще раз.');\n "); return $objResponse; } $data = $form->getValues(); $opcode = $data['type']; $promo_code = isset($data['promo']) ? $data['promo'] : ""; $bill = new billing($uid); //Допустимо использование промокодов $bill->setPromoCodes('SERVICE_PRO', $promo_code); //Формируем заказ $billReserveId = $bill->addServiceAndCheckout($opcode); $sum = $bill->getRealPayedSum(); $platipotom = new platipotom(true); if ($sum > 0 && $sum <= $platipotom->getMaxPrice($bill->account->id)) { $html_form = $platipotom->render($sum, $bill->account->id, $billReserveId); if ($html_form) { $objResponse->script("\n var qp = window.quick_ext_payment_factory.getQuickPayment('pro');\n if (qp) qp.sendPaymentForm('{$html_form}');\n "); //сохранаем в сессию куда перейти при успешной покупке $_SESSION[quickPaymentPopup::QPP_REDIRECT] = urldecode($_SESSION['ref_uri']); $payed_sum = $bill->getRealPayedSum(); //@todo: функционал из старого попапа оплаты нужен рефакторинг $_SESSION['quickbuypro_is_begin'] = 1; $_SESSION['quickbuypro_success_opcode'] = $payed_sum; $_SESSION['quickbuypro_success_opcode2'] = $opcode; //$_SESSION['quickbuypro_redirect'] = $redirect; } } return $objResponse; }
/** * Оплата через Плати потом * * @param type $type - тип оплаты * @param type $data - данные по параметрам покупаемой услуги * @return \xajaxResponse */ function quickPaymentFrlbindPlatipotom($type, $data) { $is_error = true; $uid = get_uid(false); $objResponse =& new xajaxResponse(); $prof_id = (int) @$data['prof_id']; $is_spec = (bool) @$data['is_spec']; $is_prolong = (bool) @$data['is_prolong']; $promo_code = (string) @$data['promo']; $freelancer_binds = new freelancer_binds(); $valid = $is_prolong ? $freelancer_binds->isUserBinded($uid, $prof_id, $is_spec) : $freelancer_binds->isAllowBind($uid, $prof_id, $is_spec); if ($valid) { $is_error = false; $bill = new billing($uid); //Допустимо использование промокодов $bill->setPromoCodes('SERVICE_FRLBIND', $promo_code); $op_code = $freelancer_binds->getOpCode($prof_id, $is_spec, $is_prolong); $option = array('weeks' => (int) @$data['weeks'], 'prof_id' => $prof_id); //Формируем заказ $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) { $objResponse->script("\n var qp_form_wrapper = \$\$('#quick_payment_frlbind .__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 "); $link = '/freelancers/'; if ($prof_id) { if ($is_spec) { $link .= professions::GetProfLink($prof_id) . '/'; } else { $group = professions::GetGroup($prof_id, $error); $link .= $group['link'] . '/'; } } //сохранаем в сессию куда перейти при успешной покупке $_SESSION[quickPaymentPopup::QPP_REDIRECT] = $link; } } // Показываем предупреждение в случае ошибки if ($is_error) { $action = $is_prolong ? 'продлении закрепления' : 'закреплении'; $objResponse->script("\n var qp = window.quick_payment_factory.getQuickPayment('frlbind');\n if(qp) qp.show_error('Возникла ошибка при {$action} в каталоге!');\n "); } return $objResponse; }
/** * Оплата карусели через Плати потом * * @param type $type * @param type $data * @return \xajaxResponse */ function quickPaymentCaruselPlatipotom($type, $data) { $uid = get_uid(false); $objResponse =& new xajaxResponse(); $promo = isset($data['promo']) ? $data['promo'] : ""; $form = new CaruselForm(); if (!$form->isValid($data)) { $params = addslashes(urldecode(http_build_query($form->getAllMessages('<br/>')))); $objResponse->script("\n var qp = window.quick_ext_payment_factory.getQuickPayment('carusel');\n if(qp) qp.showElementsError('{$params}');\n "); return $objResponse; } $data = $form->getValues(); $bill = new billing($uid); $bill->setPromoCodes('SERVICE_CARUSEL', $promo); $options = array('ad_header' => $data['title'], 'ad_text' => $data['description'], 'num' => $data['num']); if ($data['num'] > 1) { $options['hours'] = $data['hours']; } //Каталог //@todo: неиспользуется разделение платный мест в картусели //$tarif = 73; //Главная //@todo: сейчас общий раздел для всех $tarif = 65; //Формируем заказ $billReserveId = $bill->addServiceAndCheckout($tarif, $options); $payed_sum = $bill->getRealPayedSum(); $platipotom = new platipotom(); $html_form = $platipotom->render($payed_sum, $bill->account->id, $billReserveId); if ($html_form) { $objResponse->script("\n var qp = window.quick_ext_payment_factory.getQuickPayment('carusel');\n if (qp) qp.sendPaymentForm('{$html_form}');\n "); //сохранаем в сессию куда перейти при успешной покупке $_SESSION[quickPaymentPopup::QPP_REDIRECT] = urldecode($_SESSION['ref_uri']); } return $objResponse; }
define('NO_CSRF', 1); //Данные платежной формы $paypost = $_POST; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stdf.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/platipotom.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/payment_keys.php'; if (is_release()) { exit; } if (isset($_GET['cancel'])) { //Отказ от платежа header('Location: /bill/fail'); exit; } elseif ($_GET['success']) { $host = $GLOBALS['host']; $platipotom = new platipotom(); $payment = $_SESSION['post_payment']; $request = array('orderid' => $payment['orderid'], 'subid' => $payment['subid'], 'sig' => $platipotom->getSig($payment['price'], $payment['orderid'], $payment['subid'])); $get = '?'; foreach ($request as $param => $value) { if ($get !== '?') { $get .= '&'; } $get .= $param . '=' . $value; } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $host . '/income/platipotom.php' . $get); curl_setopt($ch, CURLOPT_USERPWD, BASIC_AUTH); ob_start(); $res = curl_exec($ch); $complete = ob_get_clean();
/** * Оплата через ПлатиПотом сервис * * @param type $opcode * @param type $redirect * @param type $promo_code * @return \xajaxResponse */ function quickPROGetPlatipotomLink($opcode, $redirect, $promo_code) { $objResponse = new xajaxResponse(); $pro = 0; require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/payed.php"; $proList = payed::getAvailablePayedList(is_emp()); foreach ($proList as $proItem) { if ($proItem['opcode'] == $opcode) { $pro = $proItem; break; } } if ($pro) { $uid = get_uid(false); $bill = new billing($uid); //Допустимо использование промокодов $bill->setPromoCodes('SERVICE_PRO', $promo_code); //Формируем заказ $billReserveId = $bill->addServiceAndCheckout($opcode); $sum = $bill->getRealPayedSum(); $payed_sum = $bill->getOrderPayedSum(); $platipotom = new platipotom(true); if ($sum > 0 && $sum <= $platipotom->getMaxPrice($bill->account->id)) { $html_form = $platipotom->render($sum, $bill->account->id, $billReserveId); if ($html_form) { $html_form = preg_replace('/^[^\\/]+\\/\\*!?/', '', $html_form); $html_form = preg_replace('/\\*\\/[^\\/]+$/', '', $html_form); $_SESSION['quickbuypro_is_begin'] = 1; $_SESSION['quickbuypro_success_opcode'] = $payed_sum; $_SESSION['quickbuypro_success_opcode2'] = $opcode; $_SESSION['quickbuypro_redirect'] = $redirect; $_SESSION['referer'] = $_SERVER['HTTP_REFERER']; $objResponse->script('$("quick_pro_div_wait_txt").set("html", \'' . $html_form . '\');'); $objResponse->script("\$('quick_pro_div_wait_txt').getElements('form')[0].submit();"); } } } return $objResponse; }