public function init()
 {
     $is_emp = is_emp();
     $form = new ProForm($is_emp);
     $css_class = $is_emp ? 'g-color_64bc39' : 'g-color_ff7f1a';
     $options = array('payments_exclude' => array(self::PAYMENT_TYPE_BANK), 'is_emp' => $is_emp);
     $list = $form->getPayedList();
     if ($list) {
         $clientside_templates = array();
         foreach ($list as $item) {
             $key = "{$this->ID}Type{$item['opcode']}";
             $value = sprintf(self::TXT_DTITLE, proItemToText($item));
             if (isset($item['sale'])) {
                 $value .= sprintf(self::TXT_DTITLE_SUFFIX, $css_class, $item['sale']);
             } else {
                 $value .= ',';
             }
             $clientside_templates[$key] = $value;
         }
         $options['clientside_templates'] = $clientside_templates;
     }
     if ($is_emp) {
         $options['popup_title'] = sprintf(self::TXT_EMP_TITLE, view_pro_emp('b-icon__pro_va_baseline'));
         $options['popup_subtitle'] = self::TXT_EMP_SUBTITLE;
     } else {
         $options['popup_title'] = sprintf(self::TXT_FRL_TITLE, view_pro('b-icon__pro_va_baseline'));
         $options['popup_subtitle'] = self::TXT_FRL_SUBTITLE;
     }
     $this->addWaitMessageForAll();
     $this->setContent($form->render());
     parent::init($options);
     $this->options['payments'][self::PAYMENT_TYPE_PLATIPOTOM]['content_after'] = sprintf($this->options['payments'][self::PAYMENT_TYPE_PLATIPOTOM]['content_after'], 'аккаунт PRO');
 }
/**
 * Оплата карусели через Плати потом
 * 
 * @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;
}