Advertisement
Guest User

Untitled

a guest
Jun 28th, 2016
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.67 KB | None | 0 0
  1. Call to a member function getMethodInstance() on a non-object in /app/code/core/Mage/Payment/Model/Observer.php on line 46
  2.  
  3. app/code/core/Mage/Payment/Model/Observer.php
  4.  
  5. $order->getPayment()
  6.  
  7. protected $_isGateway = false;
  8. protected $_canAuthorize = false;
  9. protected $_canCapture = true;
  10. protected $_canCapturePartial = false;
  11. protected $_canRefund = false;
  12. protected $_canVoid = false;
  13. protected $_canUseInternal = false;
  14. protected $_canUseCheckout = true;
  15. protected $_canUseForMultishipping = false;
  16. protected $_paymentMethod = 'standard';
  17. protected $_order;
  18.  
  19. protected $_code = 'eazypay';
  20. protected $_isGateway = false;
  21. protected $_canAuthorize = false;
  22. protected $_canCapture = true;
  23. protected $_canCapturePartial = false;
  24. protected $_canRefund = false;
  25. protected $_canVoid = false;
  26. protected $_canUseInternal = false;
  27. protected $_canUseCheckout = true;
  28. protected $_canUseForMultishipping = false;
  29. protected $_paymentMethod = 'standard';
  30. protected $_order;
  31.  
  32. public function cleanString($string) {
  33.  
  34. $string_step1 = strip_tags($string);
  35. $string_step2 = nl2br($string_step1);
  36. $string_step3 = str_replace("<br />", "<br>", $string_step2);
  37. $cleaned_string = str_replace(""", " inch", $string_step3);
  38. return $cleaned_string;
  39. }
  40.  
  41. /**
  42. * Get checkout session namespace
  43. *
  44. * @return Mage_Checkout_Model_Session
  45. */
  46. public function getCheckout() {
  47. return Mage::getSingleton('checkout/session');
  48. }
  49.  
  50. /**
  51. * Get current quote
  52. *
  53. * @return Mage_Sales_Model_Quote
  54. */
  55. public function getQuote() {
  56. return $this->getCheckout()->getQuote();
  57. }
  58.  
  59. /**
  60. * Get order model
  61. *
  62. * @return Mage_Sales_Model_Order
  63. */
  64. public function getOrder() {
  65.  
  66. if (!$this->_order) {
  67. $paymentInfo = $this->getInfoInstance();
  68. $this->_order = Mage::getModel('sales/order')
  69. ->loadByIncrementId($paymentInfo->getOrder()->getRealOrderId());
  70. }
  71. return $this->_order;
  72. }
  73.  
  74. public function getOrderPlaceRedirectUrl() {
  75. return Mage::getUrl('eazypay/payment/redirect', array('_secure' => true));
  76. }
  77.  
  78. public function getShippingAddress($order){
  79. $shipping = $order->getShippingAddress();
  80. $addr_entity_id = $shipping->getCustomerAddressId();
  81. $shippingaddress = Mage::getModel('sales/order_address');
  82. return $shippingaddress->load($addr_entity_id);
  83. }
  84.  
  85. public function getRedirectURL(){
  86.  
  87. $success = 'onepage/success/';
  88. $coFields = array();
  89. $order = $this->getOrder();
  90. $orderId = $order->getRealOrderId();
  91. $shippingAddress = $this->getShippingAddress($order);
  92. $phone = $shippingAddress->getTelephone();
  93. $grandTotal = $order->getGrandTotal();
  94. $paymode = 9;
  95. $redirectURL = Mage::getConfig()->getNode('default/payment/eazypay/api_url');
  96.  
  97. $merchantid = Mage::getStoreConfig('payment/eazypay/merchantid',Mage::app()->getStore());
  98. $key = Mage::getStoreConfig('payment/eazypay/key',Mage::app()->getStore());
  99. $referenceNum = Mage::getStoreConfig('payment/eazypay/reference_num',Mage::app()->getStore());
  100. $submerchantid = Mage::getStoreConfig('payment/eazypay/submerchant_id',Mage::app()->getStore());
  101. $debug_mode = Mage::getStoreConfig('payment/eazypay/debug_mode');
  102.  
  103. $coFields['merchantid'] = $merchantid;
  104. $mandatoryfields = "$referenceNum|$submerchantid|$grandTotal|test|$phone";
  105. $returnurl= 'http://localhost/buildnext/index.php/eazypay/payment/response/?';//Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB).$success;
  106. $returnURL_params = "ReferenceNo=$orderId&submerchantid=$submerchantid&ransaction amount=$grandTotal&paymode=$paymode";
  107. $returnurl.= $returnURL_params;
  108.  
  109. if($debug_mode){
  110. $debugModel = Mage::getModel('eazypay/eazypaydebug');
  111. $debugModel->setOrderId($orderId);
  112. $debugModel->setParams($mandatoryfields);
  113. $debugModel->setCreatedDatetime(date("Y-m-d H:i:s"));
  114. $debugModel->save();
  115. }
  116.  
  117. $en_mandatoryfields = $this->aes128Encrypt($mandatoryfields,$key);
  118. $en_returnurl = $this->aes128Encrypt($returnurl,$key);
  119. $en_referencenum = $this->aes128Encrypt($referenceNum,$key);
  120. $en_submerchantid = $this->aes128Encrypt($submerchantid,$key);
  121. $en_transaction_amount = $this->aes128Encrypt(1,$key);
  122. $en_paymode = $this->aes128Encrypt($paymode,$key);
  123. Mage::getSingleton('core/session')->setEazyPayOrdId($orderId);
  124.  
  125. $redirectURL="merchantid=$merchantid"
  126. ."&mandatory fields=$en_mandatoryfields"
  127. ."&optional fields="
  128. ."&returnurl=$en_returnurl"
  129. ."&Reference No=$en_referencenum"
  130. ."&submerchantid=$en_submerchantid&transaction amount=$en_transaction_amount"
  131. ."&paymode=$en_paymode";
  132. return $redirectURL;
  133. }
  134.  
  135. function aes128Encrypt($str,$key){
  136. $block = mcrypt_get_block_size('rijndael_128', 'ecb');
  137. $pad = $block - (strlen($str) % $block);
  138. $str .= str_repeat(chr($pad), $pad);
  139. return base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $str, MCRYPT_MODE_ECB));
  140. }
  141. }
  142. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement