/**
  * prepare params array to send it to gateway page via POST
  *
  * @return array
  */
 public function getFormFields()
 {
     $currency = $this->getOrder()->getBaseCurrencyCode();
     $returnurl = Mage::getUrl('wirecard_checkout_page/processing/checkresponse', array('_secure' => true, '_nosid' => true));
     $shopName = 'Magento';
     $shopVersion = Mage::getVersion();
     $pluginName = $this->getPluginName();
     $pluginVersion = $this->_pluginVersion;
     $versionString = base64_encode($shopName . ';' . $shopVersion . '; ;' . $pluginName . ';' . $pluginVersion);
     $deliveryAddress = $this->getOrder()->getShippingAddress();
     $billingAddress = $this->getOrder()->getBillingAddress();
     $locale = explode('_', Mage::app()->getLocale()->getLocaleCode());
     if (is_array($locale) && !empty($locale)) {
         $locale = $locale[0];
     } else {
         $locale = $this->getDefaultLocale();
     }
     $params = array('customerId' => $this->getConfigData('customer_id'), 'amount' => round($this->getOrder()->getBaseGrandTotal(), 2), 'currency' => $currency, 'language' => $locale, 'orderDescription' => $this->getOrder()->getRealOrderId(), 'customerStatement' => $this->getOrder()->getRealOrderId(), 'successURL' => $returnurl, 'cancelURL' => $returnurl, 'failureURL' => $returnurl, 'pendingURL' => $returnurl, 'serviceURL' => Mage::getUrl($this->getConfigData('service_url'), array('_nosid' => true)), 'confirmURL' => Mage::getUrl('wirecard_checkout_page/processing/confirm', array('_secure' => true, '_nosid' => true)), 'duplicateRequestCheck' => 'no', 'paymenttype' => $this->_paymentMethod, 'orderId' => $this->getOrder()->getRealOrderId(), 'orderReference' => $this->getOrder()->getRealOrderId(), 'pluginVersion' => $versionString, 'backgroundColor' => $this->getConfigData('background_color'), 'consumerUserAgent' => Mage::app()->getRequest()->getHeader('User-Agent'), 'consumerIpAddress' => Mage::app()->getRequest()->getServer('REMOTE_ADDR'));
     $params = array_merge($params, $this->_getConsumerInformation());
     if (strlen($this->getConfigData('shop_id')) > 0) {
         $params['shopId'] = $this->getConfigData('shop_id');
     }
     if (strlen($this->getConfigData('display_text')) > 0) {
         $params['displayText'] = $this->getConfigData('display_text');
     }
     if (strlen($this->getConfigData('logo_url')) > 0) {
         $params['imageURL'] = Mage::getDesign()->getSkinUrl($this->getConfigData('logo_url'));
     }
     if ($this->getConfigData('auto_deposit')) {
         $params['autoDeposit'] = 'yes';
     }
     if ($this->getConfigData('detect_layout')) {
         $detect = new WirecardCEE_MobileDetect();
         if ($detect->isTablet()) {
             $layout = 'TABLET';
         } elseif ($detect->isMobile()) {
             $layout = 'SMARTPHONE';
         } else {
             $layout = 'DESKTOP';
         }
         $params['layout'] = $layout;
     }
     // compile fingerprint
     $requestFingerprintOrder = 'secret,';
     $requestFingerprintSeed = $this->getConfigData('secret_key');
     foreach ($params as $key => $value) {
         if ($value == NULL) {
             unset($params[$key]);
         } else {
             $requestFingerprintOrder .= $key . ',';
             $requestFingerprintSeed .= $value;
         }
     }
     $requestFingerprintOrder .= 'requestFingerprintOrder';
     $requestFingerprintSeed .= $requestFingerprintOrder;
     $requestfingerprint = md5($requestFingerprintSeed);
     $params['requestFingerprintOrder'] = $requestFingerprintOrder;
     $params['requestFingerprint'] = $requestfingerprint;
     return $params;
 }
 public function isIframeAction()
 {
     $result = array();
     $paymentMethod = $this->getRequest()->getParam('paymentMethod', null);
     if (!$paymentMethod) {
         $result['isIframe'] = false;
     } else {
         if (preg_match('/^wirecard_checkout_page/', $paymentMethod)) {
             $session = $this->getCheckout();
             $detectLayout = new WirecardCEE_MobileDetect();
             $order = Mage::getModel('sales/order');
             $order->loadByIncrementId($session->getLastRealOrderId());
             $paymentInst = $order->getPayment()->getMethodInstance();
             if ($paymentInst->getConfigData('useIFrame') && $paymentInst->getConfigData('useSeamless') && ($paymentInst->getConfigData('detect_layout') == false || $paymentInst->getConfigData('detect_layout') == true && $detectLayout->isMobile() == false)) {
                 $session = $this->getCheckout();
                 $session->setIsQMoreIframe(true);
                 $result['isIframe'] = true;
             } else {
                 $result['isIframe'] = false;
             }
         } else {
             $result['isIframe'] = false;
         }
     }
     $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
 }