/**
  * Show the ppBox for given price.
  *
  * @param float $price price
  * @param int   $page  KlarnaFlags page flag
  *
  * @return void
  */
 public function showPPBox($price, $page = KlarnaFlags::PRODUCT_PAGE)
 {
     if (!$this->_enabled) {
         return;
     }
     if (!KiTT_CountryLogic::isBelowLimit($this->_country, $price)) {
         return;
     }
     $templateLoader = KiTT::templateLoader($this->_locale);
     $cssLoader = $templateLoader->load('css.mustache');
     $jsLoader = $templateLoader->load('javascript.mustache');
     $merchantID = KlarnaConstant::merchantID(KiTT::PART, $this->_country);
     $styles = array("includes/external/klarna/template/css/oscstyle.css", "includes/modules/payment/klarna/productprice/style.css", EXTERNAL_KITT . "pp/v1.0/pp.css?eid=" . $merchantID);
     if (KlarnaConstant::isLegacyShop()) {
         $styles[] = "includes/external/klarna/template/css/klarna22rc2a.css";
     }
     $html = $cssLoader->render(array('styles' => $styles));
     $html .= $jsLoader->render(array("scripts" => array(EXTERNAL_KITT . "core/v1.0/js/klarna.min.js", EXTERNAL_KITT . "res/v1.0/js/klarna.lib.min.js", EXTERNAL_KITT . "pp/v1.0/js/productprice.min.js")));
     $html .= "<div style='clear: both;'></div>";
     $html .= KiTT::partPaymentBox($this->_locale, $price, $page)->show();
     return $html;
 }
 /**
  * Check if pclasses for given option exists and show warning if it doesn't
  *
  * @param string $option 'part' or 'spec'
  *
  * @return void
  */
 public function checkForPClasses($option)
 {
     $sql = "";
     $module = "";
     if ($option == KiTT::PART) {
         $module = 'Part Payment Module';
         $sql = "type <> 2";
     } else {
         if (KiTT::SPEC) {
             $module = 'Special Campaigns Module';
             $sql = "type = 2";
         } else {
             return;
         }
     }
     if (KlarnaConstant::isEnabled($option, $this->_country)) {
         // instantiate MySQLStorage to ensure the table exists
         $pcURI = KlarnaConstant::pcURI();
         $pcstorage = new MySQLStorage();
         $pcstorage->load($pcURI);
         $count = $this->_klarnaDB->query("SELECT COUNT(type) as num FROM klarna_pclasses WHERE {$sql}")->getArray();
         if ($count['num'] == 0 && !isset($_GET['get_pclasses']) && headers_sent()) {
             $templateLoader = KiTT::templateLoader(KiTT::Locale($this->_country));
             $no_pclasses = $templateLoader->load('no_pclasses.mustache');
             echo $no_pclasses->render(array('module' => $module));
         }
     }
 }
 /**
  * Build the apropriate description for the admin page.
  *
  * @return string
  */
 private function _buildDescription()
 {
     $data = array();
     if ($this->_isInvoice()) {
         $data['desc'] = KiTT::translator($this->_locale)->translate('INVOICE_TEXT_DESCRIPTION');
     } elseif ($this->_isPart()) {
         $data['desc'] = KiTT::translator($this->_locale)->translate('PARTPAY_TEXT_DESCRIPTION');
     } elseif ($this->_isSpec()) {
         $data['desc'] = KiTT::translator($this->_locale)->translate('SPEC_TEXT_DESCRIPTION');
     } else {
         return '';
     }
     $data['version'] = KlarnaCore::getCurrentVersion();
     if (KlarnaConstant::isAdmin() && KlarnaConstant::isEnabled($this->_option, $this->_country) && ($this->_isPart() || $this->_isSpec())) {
         $data['code'] = $this->code;
         $data['pclasses'] = true;
     }
     $templateLoader = KiTT::templateLoader($this->_locale);
     return $templateLoader->load('description.mustache')->render($data);
 }