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); }
$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 $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 $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; }