/** * Constructor */ function __construct() { global $order; $this->code = 'ot_klarna_fee'; $this->_country = $order->delivery['country']['iso_code_2']; $this->_utils = new KlarnaUtils($this->_country); $this->_lang = KlarnaUtils::getLanguageCode(); $this->_klarnaDB = new XtcKlarnaDB(); // Configure KiTT $this->_utils->configureKiTT(); $invFee = $this->_utils->translate('ot_klarna_title', $this->_lang); //~ ENT_NOQUOTES, //~ 'ISO-8859-1' //~ ); if (KlarnaConstant::isAdmin() && (!array_key_exists('action', $_GET) || !in_array($_GET['action'], array('install', 'remove')))) { echo "<link href='" . KlarnaUtils::getStaticPath() . "images.css' type='text/css' rel='stylesheet'/>"; $this->title = "<span class='klarna_icon'></span> Klarna - {$invFee}"; } else { $this->title = $invFee; } $this->description .= $this->_utils->translate('ot_klarna_title', $this->_lang); $this->description .= "<br />All invoice fees should be set in that countries currency"; $this->enabled = MODULE_KLARNA_FEE_STATUS; $this->sort_order = MODULE_KLARNA_FEE_SORT_ORDER; $this->tax_class = MODULE_KLARNA_FEE_TAX_CLASS; $this->output = array(); }
/** * Create the instance of this payment method translator * * @param string $lang language iso code */ public function __construct($lang) { if ($lang === null) { $lang = 'en'; } KlarnaUtils::configureKITT(); $this->_translator = KiTT::translator(KiTT::locale(null, $lang)); }
/** * Constructor. * Takes information from GET and sends it to KlarnaAjax and * the Dispatcher. */ public function __construct() { $country = $_GET['country']; $option = str_replace('klarna_box_', '', $_GET['type']); if ($option == 'special') { $option = 'spec'; } KlarnaUtils::configureKiTT($option); KlarnaUtils::configureKlarna($option); $dispatcher = KiTT::ajaxDispatcher(new KiTT_Addresses(KiTT::api($country)), null); $dispatcher->dispatch(); }
/** * The constructor * * @param int|string $country country * * @return void */ public function __construct($country = null) { global $currency; $this->_country = KlarnaUtils::deduceCountry('part'); $this->_language = KlarnaUtils::getLanguageCode(); $this->_currency = $currency; if ($country === null && $this->_country == null) { $this->_country = strtoupper($_SESSION['language_code']); } if ($this->_country === null) { Klarna::printDebug(__METHOD__, array('currency' => $this->_currency, 'language' => $this->_language)); $this->_enabled = false; return; } $this->_utils = new KlarnaUtils($this->_country); $this->_enabled = KlarnaConstant::isEnabled('part', $this->_country); if ($this->_enabled === true && !KlarnaConstant::isActivated('part', $this->_country)) { $this->_enabled = false; } $this->_locale = KiTT::locale($this->_country, $this->_language, $this->_currency); }
</div> <!--br /><br /--> <!-- Bestellung Sichern Ende //--> <!-- Ende //--> <?php $heading = array(); $contents = array(); // KLARNA ORDERSTATUS UPDATE START require_once DIR_FS_DOCUMENT_ROOT . 'includes/external/klarna/class.KlarnaCore.php'; if ($_GET['edit_action'] == "klarna_check_orderstatus") { include_once DIR_FS_ADMIN . 'klarna_check_orderstatus.php'; $orderStatus = new KlarnaCheckOrder(); $orderStatus->checkOrder($_GET['oID'], $order->info['payment_method']); } if ($order->info['payment_method'] == 'klarna_partPayment' || $order->info['payment_method'] == 'klarna_invoice' || $order->info['payment_method'] == 'klarna_SpecCamp') { echo "<link href='" . KlarnaUtils::getStaticPath() . "images.css' type='text/css' rel='stylesheet'/>"; $contents[] = array('align' => 'center', 'text' => '<br /><span class="klarna_logo_small"></span><br /><br />' . '<a class="btn btn-default" onclick="this.blur();" href="' . xtc_href_link(FILENAME_ORDERS_EDIT, 'edit_action=klarna_check_orderstatus&oID=' . $_GET['oID']) . '">Check Order Status</a><br /><br />'); } // KLARNA ORDERSTATUS UPDATE END switch ($action) { default: if (is_object($order)) { $heading[] = array('text' => '<b>' . TABLE_HEADING_ORDER . (int) $_GET['oID'] . '</b>'); $contents[] = array('align' => 'center', 'text' => '<br />' . TEXT_EDIT_ADDRESS . '<br /><a class="btn btn-default" onclick="this.blur();" href="' . xtc_href_link(FILENAME_ORDERS_EDIT, 'edit_action=address&oID=' . (int) $_GET['oID']) . '">' . BUTTON_EDIT . '</a><br /><br />'); $contents[] = array('align' => 'center', 'text' => '<br />' . TEXT_EDIT_PRODUCTS . '<br /><a class="btn btn-default" onclick="this.blur();" href="' . xtc_href_link(FILENAME_ORDERS_EDIT, 'edit_action=products&oID=' . (int) $_GET['oID']) . '">' . BUTTON_EDIT . '</a><br /><br />'); $contents[] = array('align' => 'center', 'text' => '<br />' . TEXT_EDIT_OTHER . '<br /><a class="btn btn-default" onclick="this.blur();" href="' . xtc_href_link(FILENAME_ORDERS_EDIT, 'edit_action=other&oID=' . (int) $_GET['oID']) . '">' . BUTTON_EDIT . '</a><br /><br />'); } break; } if (xtc_not_null($heading) && xtc_not_null($contents)) { echo '<div class="col-md-3 col-sm-12 col-xs-12 pull-right edit-box-class">' . "\n";
/** * Get values for the HTML prefilling from the session if we happen to be * returning from a failed purchase. * * @return array values for the HTML prefilling */ public function getValuesFromSession() { if (isset($_SESSION['klarna_data'])) { self::$prefillData = $_SESSION['klarna_data']; unset($_SESSION['klarna_data']); } $fields = array('first_name', 'last_name', 'street', 'city', 'zipcode', 'phone_number', 'company_name', 'reference', 'pno', 'house_extension', 'house_number', 'gender', 'birth_year', 'birth_month', 'birth_day'); $array = array(); // split the pno to date of birth if (array_key_exists('pno', self::$prefillData)) { $dob = self::$prefillData['pno']; self::$prefillData['birth_year'] = substr($dob, 4, 4); self::$prefillData['birth_month'] = substr($dob, 2, 2); self::$prefillData['birth_day'] = substr($dob, 0, 2); } foreach ($fields as $field) { if (array_key_exists($field, self::$prefillData) && self::$prefillData[$field] !== "" && self::$prefillData[$field] !== null) { $array[$field] = KiTT_String::encode(self::$prefillData[$field], null, 'UTF-8'); if ($field === 'gender') { $array['gender'] = KiTT_String::encode(intval(self::$prefillData['gender']), null, 'UTF-8'); } } } return $array; }
/** * Implements any checks or processing on the order information before * proceeding to payment confirmation. * * @return array */ public function confirmation() { $logo_base = KlarnaUtils::getStaticPath() . 'logo/'; $country = strtolower($this->_locale->getCountryCode()); $url_base = "<a href='http://www.klarna.com' target='_blank'>"; $desc = ''; if ($this->_isInvoice()) { $type = 'invoice'; } if ($this->_isPart()) { $type = 'account'; } if ($this->_isSpec()) { $type = 'special'; $desc = '<br>' . KiTT::api($country)->getPClass($_POST['klarna_spec_paymentPlan'])->getDescription(); } $css = "<link href='" . KlarnaUtils::getStaticPath() . "images.css' type='text/css' rel='stylesheet'/>"; $logo = "<span class='klarna_logo_{$type}_{$country}'></span>"; $title = "{$css}<br />{$url_base}{$logo}</a>{$desc}"; return array('title' => $title); }
/** * Get the country for the order * * @return string */ private function _getOrderCountry() { global $order; // get order country $id = $order->customer['ID']; $query = $this->_klarnaDB->query("SELECT entry_country_id FROM `address_book` WHERE customers_id = {$id}")->getArray(); return KlarnaUtils::getCountryByID($query['entry_country_id']); }