Ejemplo n.º 1
0
 protected function _afterLoad()
 {
     parent::_afterLoad();
     if (is_string($this->getTransactionObject())) {
         $this->setTransactionObject(Mage::helper('SaferpayCw')->unserialize($this->getTransactionObject()));
         $orderId = $this->getOrderId();
         if (!empty($orderId)) {
             Customweb_SaferpayCw_Model_ConfigurationAdapter::setStore($this->getOrder());
         }
     }
 }
Ejemplo n.º 2
0
 /**
  *         	   		  	 	 	
  * @return NULL
  */
 public function getAuthorizationAdapter($isOrderAvailable, Customweb_SaferpayCw_Model_Transaction $transaction = null)
 {
     if ($this->authorizationAdapter == null) {
         if ($this->authorizationMethodName != null) {
             $this->authorizationAdapter = $this->getHelper()->getAuthorizationAdapter($this->authorizationMethodName);
         } else {
             if ($isOrderAvailable == true) {
                 $order = Mage::getModel('sales/order');
                 $order->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());
                 Customweb_SaferpayCw_Model_ConfigurationAdapter::setStore($order);
             }
             if ($transaction && $transaction !== null && $transaction->getTransactionObject() !== null && $transaction->getTransactionObject()->getTransactionContext()->isMotoTransaction()) {
                 $this->authorizationAdapter = $this->getHelper()->getAuthorizationAdapter(Customweb_Payment_Authorization_Moto_IAdapter::AUTHORIZATION_METHOD_NAME);
             } else {
                 $this->authorizationAdapter = $this->getHelper()->getAuthorizationAdapterByContext($this->getOrderContext($isOrderAvailable));
             }
             $this->authorizationMethodName = $this->authorizationAdapter->getAuthorizationMethodName();
         }
     }
     return $this->authorizationAdapter;
 }
 protected function getBaseUrl()
 {
     return Mage::getUrl('SaferpayCw/endpoint/index', array('_store' => Customweb_SaferpayCw_Model_ConfigurationAdapter::getStoreId()));
 }
 public function getStoreHierarchy()
 {
     if (self::$storeHierarchy != null && empty(self::$storeHierarchy)) {
         if (self::$storeId == null) {
             $store = Mage::app()->getStore();
         } else {
             $store = Mage::getModel('core/store')->load(self::$storeId);
         }
         $website = $store->getWebsite();
         self::$storeHierarchy = array('website_' . $website->getId() => $website->getName(), 'store_' . $store->getId() => $store->getName());
     }
     return self::$storeHierarchy;
 }
Ejemplo n.º 5
0
 public function getConfigurationValue($key)
 {
     $configAdapter = new Customweb_SaferpayCw_Model_ConfigurationAdapter();
     return $configAdapter->getConfigurationValue($key);
 }
 private function updateStoreHierarchy()
 {
     $websiteCode = $this->getRequest()->getParam('website');
     $storeCode = $this->getRequest()->getParam('store');
     $storeHierarchy = null;
     $storeId = Mage::app()->getDefaultStoreView()->getId();
     if ($websiteCode != null || $storeCode != null) {
         $storeHierarchy = array();
         if ($websiteCode != null) {
             $website = Mage::getModel('core/website')->load($websiteCode);
             $storeHierarchy['website_' . $website->getId()] = $website->getName();
             $storeId = $website->getDefaultStore()->getId();
         }
         if ($storeCode != null) {
             $store = Mage::getModel('core/store')->load($storeCode);
             $storeHierarchy['store_' . $store->getId()] = $store->getName();
             $storeId = $store->getId();
         }
     }
     Customweb_SaferpayCw_Model_ConfigurationAdapter::setStoreId($storeId);
     Customweb_SaferpayCw_Model_ConfigurationAdapter::setStoreHierarchy($storeHierarchy);
 }