/** * @return null * @throws KlarnaApiException */ public function languagepack() { $sSubAction = JRequest::getWord('subAction'); if (!isset($this->template['name']) || $this->template['name'] == '') { $this->template['name'] = "default"; } if ($sSubAction == "klarna_box") { $sNewISO = JRequest::getWord('newIso'); $sCountry = JRequest::getWord('country'); $iSum = JRequest::getFloat('sum', 0); $iInvoiceFee = JRequest::getFloat('fee', 0); $iFlag = JRequest::getInt('flag'); $sType = JRequest::getWord('type'); $aParams = JRequest::getVar('params'); $aValues = JRequest::getVar('values'); // foreach($aValues as $key => $value) { // $aValues[$key] = utf8_encode($value); // } // foreach($aParams as $key => $value) { // $aParams[$key] = utf8_decode($value); // } if ($sType != "part" && $sType != "invoice" && $sType != "spec") { throw new KlarnaApiException("Invalid parameters"); } $this->api->setCountry($sCountry); if ($sType == 'spec') { $types = array(KlarnaPClass::SPECIAL); } else { $types = array(KlarnaPClass::CAMPAIGN, KlarnaPClass::ACCOUNT, KlarnaPClass::FIXED); } $oApi = new KlarnaAPI($sCountry, $sNewISO, $sType, $iSum, $iFlag, $this->api, $types, VMKLARNAPLUGINWEBROOT); // $oApi->addSetupValue ('web_root', $this->webroot); // $oApi->setPaths (); $oApi->addSetupValue('eid', $this->eid); if ($sType == 'invoice') { $oApi->setInvoiceFee($iInvoiceFee); } $oApi->setCurrency($this->api->getCurrency()); if (count($this->coSetup) > 0) { $oApi->addMultipleSetupValues($this->coSetup); } return $oApi->retrieveLayout($aParams, $aValues); // if ($sType == 'spec') { // return $oApi->retrieveHTML($aParams, $aValues, null, $this->template); // } else { // return $oApi->retrieveHTML ($aParams, $aValues); // } } else { if ($sSubAction == 'jsLanguagePack') { $sNewISO = JRequest::getWord('newIso'); $sFetch = ""; } else { throw new KlarnaApiException("Invalid sub-action"); } } }