* All rights reserved * * Reuse or modification of this source code is not allowed * without written permission from creativestyle GmbH * * @category Creativestyle * @package Creativestyle_CheckoutByAmazon * @copyright Copyright (c) 2012 creativestyle GmbH (http://www.creativestyle.de) * @author Marek Zabrowarny / creativestyle GmbH */ abstract class Creativestyle_CheckoutByAmazon_Block_Abstract extends Mage_Checkout_Block_Onepage_Abstract { const XML_PATH_REUSE_AMAZON_SESSION = 'checkoutbyamazon/general/reuse_amazon_session'; const XML_PATH_OVERLAY_ENABLED = 'checkoutbyamazon/design/overlay_enabled'; const XML_PATH_OVERLAY_WIDTH = 'checkoutbyamazon/design/overlay_width'; const XML_PATH_BUTTON_SIZE = 'checkoutbyamazon/design/button_size'; const XML_PATH_BUTTON_COLOR = 'checkoutbyamazon/design/button_color'; const XML_PATH_BUTTON_BACKGROUND = 'checkoutbyamazon/design/button_background'; const XML_PATH_ADDRESS_WIDGET_WIDTH = 'checkoutbyamazon/design/address_width'; const XML_PATH_ADDRESS_WIDGET_HEIGHT = 'checkoutbyamazon/design/address_height'; const XML_PATH_PAYMENT_WIDGET_WIDTH = 'checkoutbyamazon/design/payment_width'; const XML_PATH_PAYMENT_WIDGET_HEIGHT = 'checkoutbyamazon/design/payment_height'; const XML_PATH_PROGRESS_WIDGET_WIDTH = 'checkoutbyamazon/design/progress_width'; const XML_PATH_PROGRESS_WIDGET_HEIGHT = 'checkoutbyamazon/design/progress_height'; const XML_PATH_REVIEW_WIDGET_WIDTH = 'checkoutbyamazon/design/review_width'; const XML_PATH_REVIEW_WIDGET_HEIGHT = 'checkoutbyamazon/design/review_height'; protected function _isActive() { return Mage::helper('checkoutbyamazon')->getConfigData('active'); } protected function _getMode() { return Mage::helper('checkoutbyamazon')->getConfigData('mode'); } protected function _getMarketplace() { return Mage::helper('checkoutbyamazon')->getConfigData('marketplace'); } public function getMerchantId() { return Mage::helper('checkoutbyamazon')->getConfigData('merchant_id'); } public function getPaymentWidgetJsUrl() { switch ($this->_getMarketplace()) { case 'de_DE': switch ($this->_getMode()) { case 'live': return 'https://static-eu.payments-amazon.com/cba/js/de/PaymentWidgets.js'; case 'sandbox': return 'https://static-eu.payments-amazon.com/cba/js/de/sandbox/PaymentWidgets.js'; } case 'en_GB': switch ($this->_getMode()) { case 'live': return 'https://static-eu.payments-amazon.com/cba/js/gb/PaymentWidgets.js'; case 'sandbox': return 'https://static-eu.payments-amazon.com/cba/js/gb/sandbox/PaymentWidgets.js'; } default: switch ($this->_getMode()) { case 'live': return 'https://static-na.payments-amazon.com/cba/js/us/PaymentWidgets.js'; case 'sandbox': return 'https://static-na.payments-amazon.com/cba/js/us/sandbox/PaymentWidgets.js'; } } } public function getPurchaseContractId() { if (Mage::getSingleton('checkout/session')->getAmazonPurchaseContractId()) return Mage::getSingleton('checkout/session')->getAmazonPurchaseContractId(); return false; } public function isOverlayEnabled() { return Mage::getStoreConfig(self::XML_PATH_OVERLAY_ENABLED); } public function getOverlayWidth() { return Mage::getStoreConfig(self::XML_PATH_OVERLAY_WIDTH); } }