public function __construct() { parent::__construct(); $customerId = mage::getSingleton('customer/session')->getId(); $customer = mage::getModel('customer/customer')->load($customerId); if (is_object($customer) || $customer->getId()) { $this->_customer = $customer; } }
/** * Can Save Enabled * @return string */ public function canSave() { $cansave = mage::getStoreConfig('payment/pinpayments/can_save'); $isLoggedIn = mage::getSingleton('customer/session')->isLoggedIn(); if ($cansave && $isLoggedIn) { return true; } return false; }
/** * Add product to shopping cart action */ public function getAction() { try { if (!$this->getRequest()->isPost() && !mage::getSingleton('customer/session')->isLoggedIn()) { return; } $result = array(); $data = $this->getRequest()->getPost('payment', array()); if ($data['method'] != 'pinpayments') { return; } $pinCustomerModel = mage::getModel('pinpayments/customer'); $cardToken = array('response' => $pinCustomerModel->getCustomerTokenCard()); $this->getResponse()->setHeader('Content-type', 'application/json'); $this->getResponse()->setBody(json_encode($cardToken)); } catch (Exception $e) { Mage::logException($e); } return $this; }
/** * @return array */ public function getStage1FormData() { $session = mage::getSingleton('core/session'); return $session->getEsendexSmsStage1FormData(); }