Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Call to a member function getMethodInstance() on a non-object in /app/code/core/Mage/Payment/Model/Observer.php on line 46
- app/code/core/Mage/Payment/Model/Observer.php
- $order->getPayment()
- protected $_isGateway = false;
- protected $_canAuthorize = false;
- protected $_canCapture = true;
- protected $_canCapturePartial = false;
- protected $_canRefund = false;
- protected $_canVoid = false;
- protected $_canUseInternal = false;
- protected $_canUseCheckout = true;
- protected $_canUseForMultishipping = false;
- protected $_paymentMethod = 'standard';
- protected $_order;
- protected $_code = 'eazypay';
- protected $_isGateway = false;
- protected $_canAuthorize = false;
- protected $_canCapture = true;
- protected $_canCapturePartial = false;
- protected $_canRefund = false;
- protected $_canVoid = false;
- protected $_canUseInternal = false;
- protected $_canUseCheckout = true;
- protected $_canUseForMultishipping = false;
- protected $_paymentMethod = 'standard';
- protected $_order;
- public function cleanString($string) {
- $string_step1 = strip_tags($string);
- $string_step2 = nl2br($string_step1);
- $string_step3 = str_replace("<br />", "<br>", $string_step2);
- $cleaned_string = str_replace(""", " inch", $string_step3);
- return $cleaned_string;
- }
- /**
- * Get checkout session namespace
- *
- * @return Mage_Checkout_Model_Session
- */
- public function getCheckout() {
- return Mage::getSingleton('checkout/session');
- }
- /**
- * Get current quote
- *
- * @return Mage_Sales_Model_Quote
- */
- public function getQuote() {
- return $this->getCheckout()->getQuote();
- }
- /**
- * Get order model
- *
- * @return Mage_Sales_Model_Order
- */
- public function getOrder() {
- if (!$this->_order) {
- $paymentInfo = $this->getInfoInstance();
- $this->_order = Mage::getModel('sales/order')
- ->loadByIncrementId($paymentInfo->getOrder()->getRealOrderId());
- }
- return $this->_order;
- }
- public function getOrderPlaceRedirectUrl() {
- return Mage::getUrl('eazypay/payment/redirect', array('_secure' => true));
- }
- public function getShippingAddress($order){
- $shipping = $order->getShippingAddress();
- $addr_entity_id = $shipping->getCustomerAddressId();
- $shippingaddress = Mage::getModel('sales/order_address');
- return $shippingaddress->load($addr_entity_id);
- }
- public function getRedirectURL(){
- $success = 'onepage/success/';
- $coFields = array();
- $order = $this->getOrder();
- $orderId = $order->getRealOrderId();
- $shippingAddress = $this->getShippingAddress($order);
- $phone = $shippingAddress->getTelephone();
- $grandTotal = $order->getGrandTotal();
- $paymode = 9;
- $redirectURL = Mage::getConfig()->getNode('default/payment/eazypay/api_url');
- $merchantid = Mage::getStoreConfig('payment/eazypay/merchantid',Mage::app()->getStore());
- $key = Mage::getStoreConfig('payment/eazypay/key',Mage::app()->getStore());
- $referenceNum = Mage::getStoreConfig('payment/eazypay/reference_num',Mage::app()->getStore());
- $submerchantid = Mage::getStoreConfig('payment/eazypay/submerchant_id',Mage::app()->getStore());
- $debug_mode = Mage::getStoreConfig('payment/eazypay/debug_mode');
- $coFields['merchantid'] = $merchantid;
- $mandatoryfields = "$referenceNum|$submerchantid|$grandTotal|test|$phone";
- $returnurl= 'http://localhost/buildnext/index.php/eazypay/payment/response/?';//Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB).$success;
- $returnURL_params = "ReferenceNo=$orderId&submerchantid=$submerchantid&ransaction amount=$grandTotal&paymode=$paymode";
- $returnurl.= $returnURL_params;
- if($debug_mode){
- $debugModel = Mage::getModel('eazypay/eazypaydebug');
- $debugModel->setOrderId($orderId);
- $debugModel->setParams($mandatoryfields);
- $debugModel->setCreatedDatetime(date("Y-m-d H:i:s"));
- $debugModel->save();
- }
- $en_mandatoryfields = $this->aes128Encrypt($mandatoryfields,$key);
- $en_returnurl = $this->aes128Encrypt($returnurl,$key);
- $en_referencenum = $this->aes128Encrypt($referenceNum,$key);
- $en_submerchantid = $this->aes128Encrypt($submerchantid,$key);
- $en_transaction_amount = $this->aes128Encrypt(1,$key);
- $en_paymode = $this->aes128Encrypt($paymode,$key);
- Mage::getSingleton('core/session')->setEazyPayOrdId($orderId);
- $redirectURL="merchantid=$merchantid"
- ."&mandatory fields=$en_mandatoryfields"
- ."&optional fields="
- ."&returnurl=$en_returnurl"
- ."&Reference No=$en_referencenum"
- ."&submerchantid=$en_submerchantid&transaction amount=$en_transaction_amount"
- ."&paymode=$en_paymode";
- return $redirectURL;
- }
- function aes128Encrypt($str,$key){
- $block = mcrypt_get_block_size('rijndael_128', 'ecb');
- $pad = $block - (strlen($str) % $block);
- $str .= str_repeat(chr($pad), $pad);
- return base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $str, MCRYPT_MODE_ECB));
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement