Magento Fatal error: Call to a member function getBillingAddress() on a non-object in /Abstract.php on line 689 -
i'm getting following error: fatal error: call member function getbillingaddress() on non-object in /data/web/public/app/code/core/mage/payment/model/method/abstract.php on line 689
i'm on magento 1.9.1.1. have problem different magento installation on different server. both same versions 1.9.1.1.
this error happens, when manage customers page, you'll want create order specific customer. happens registerd customer.
could core magento bug? , how fix it?
all appreciated!
abstract.php
/** * payment method abstract model * * @author magento core team <core@magentocommerce.com> */ abstract class mage_payment_model_method_abstract extends varien_object { const action_order = 'order'; const action_authorize = 'authorize'; const action_authorize_capture = 'authorize_capture'; const status_unknown = 'unknown'; const status_approved = 'approved'; const status_error = 'error'; const status_declined = 'declined'; const status_void = 'void'; const status_success = 'success'; /** * bit masks specify different payment method checks. * @see mage_payment_model_method_abstract::isapplicabletoquote */ const check_use_for_country = 1; const check_use_for_currency = 2; const check_use_checkout = 4; const check_use_for_multishipping = 8; const check_use_internal = 16; const check_order_total_min_max = 32; const check_recurring_profiles = 64; const check_zero_total = 128; protected $_code; protected $_formblocktype = 'payment/form'; protected $_infoblocktype = 'payment/info'; /** * payment method features * @var bool */ protected $_isgateway = false; protected $_canorder = false; protected $_canauthorize = false; protected $_cancapture = false; protected $_cancapturepartial = false; protected $_cancaptureonce = false; protected $_canrefund = false; protected $_canrefundinvoicepartial = false; protected $_canvoid = false; protected $_canuseinternal = true; protected $_canusecheckout = true; protected $_canuseformultishipping = true; protected $_isinitializeneeded = false; protected $_canfetchtransactioninfo = false; protected $_canreviewpayment = false; protected $_cancreatebillingagreement = false; protected $_canmanagerecurringprofiles = true; /** * todo: whether captured transaction may voided gateway * may happen when amount captured, not settled * @var bool */ protected $_cancancelinvoice = false; /** * fields should replaced in debug '***' * * @var array */ protected $_debugreplaceprivatedatakeys = array(); public function __construct() { } /** * check order availability * * @return bool */ public function canorder() { return $this->_canorder; } /** * check authorise availability * * @return bool */ public function canauthorize() { return $this->_canauthorize; } /** * check capture availability * * @return bool */ public function cancapture() { return $this->_cancapture; } /** * check partial capture availability * * @return bool */ public function cancapturepartial() { return $this->_cancapturepartial; } /** * check whether capture can performed once , no further capture possible * * @return bool */ public function cancaptureonce() { return $this->_cancaptureonce; } /** * check refund availability * * @return bool */ public function canrefund() { return $this->_canrefund; } /** * check partial refund availability invoice * * @return bool */ public function canrefundpartialperinvoice() { return $this->_canrefundinvoicepartial; } /** * check void availability * * @param varien_object $payment * @return bool */ public function canvoid(varien_object $payment) { return $this->_canvoid; } /** * using internal pages input payment data * can used in admin * * @return bool */ public function canuseinternal() { return $this->_canuseinternal; } /** * can used in regular checkout * * @return bool */ public function canusecheckout() { return $this->_canusecheckout; } /** * using multiple shipping address * * @return bool */ public function canuseformultishipping() { return $this->_canuseformultishipping; } /** * can edit order (renew order) * * @return bool */ public function canedit() { return true; } /** * check fetch transaction info availability * * @return bool */ public function canfetchtransactioninfo() { return $this->_canfetchtransactioninfo; } /** * check whether payment method instance can create billing agreements * * @return bool */ public function cancreatebillingagreement() { return $this->_cancreatebillingagreement; } /** * fetch transaction info * * @param mage_payment_model_info $payment * @param string $transactionid * @return array */ public function fetchtransactioninfo(mage_payment_model_info $payment, $transactionid) { return array(); } /** * retrieve payment system relation flag * * @return bool */ public function isgateway() { return $this->_isgateway; } /** * flag if need run payment initialize while order place * * @return bool */ public function isinitializeneeded() { return $this->_isinitializeneeded; } /** * check billing country allowed payment method * * @return bool */ public function canuseforcountry($country) { /* specific country, flag set 1 */ if($this->getconfigdata('allowspecific')==1){ $availablecountries = explode(',', $this->getconfigdata('specificcountry')); if(!in_array($country, $availablecountries)){ return false; } } return true; } /** * check method processing base currency * * @param string $currencycode * @return boolean */ public function canuseforcurrency($currencycode) { return true; } /** * check manage billing agreements availability * * @return bool */ public function canmanagebillingagreements() { return ($this instanceof mage_payment_model_billing_agreement_methodinterface); } /** * whether can manage recurring profiles * * @return bool */ public function canmanagerecurringprofiles() { return $this->_canmanagerecurringprofiles && ($this instanceof mage_payment_model_recurring_profile_methodinterface); } /** * retrieve model helper * * @return mage_payment_helper_data */ protected function _gethelper() { return mage::helper('payment'); } /** * retrieve payment method code * * @return string */ public function getcode() { if (empty($this->_code)) { mage::throwexception(mage::helper('payment')->__('cannot retrieve payment method code.')); } return $this->_code; } /** * retrieve block type method form generation * * @return string */ public function getformblocktype() { return $this->_formblocktype; } /** * retrieve block type display method information * * @return string */ public function getinfoblocktype() { return $this->_infoblocktype; } /** * retrieve payment iformation model object * * @return mage_payment_model_info */ public function getinfoinstance() { $instance = $this->getdata('info_instance'); if (!($instance instanceof mage_payment_model_info)) { mage::throwexception(mage::helper('payment')->__('cannot retrieve payment information object instance.')); } return $instance; } /** * validate payment method information object * * @return mage_payment_model_abstract */ public function validate() { /** * validate payment method allowed billing country or not */ $paymentinfo = $this->getinfoinstance(); if ($paymentinfo instanceof mage_sales_model_order_payment) { $billingcountry = $paymentinfo->getorder()->getbillingaddress()->getcountryid(); } else { $billingcountry = $paymentinfo->getquote()->getbillingaddress()->getcountryid(); } if (!$this->canuseforcountry($billingcountry)) { mage::throwexception(mage::helper('payment')->__('selected payment type not allowed billing country.')); } return $this; } /** * order payment abstract method * * @param varien_object $payment * @param float $amount * * @return mage_payment_model_abstract */ public function order(varien_object $payment, $amount) { if (!$this->canorder()) { mage::throwexception(mage::helper('payment')->__('order action not available.')); } return $this; } /** * authorize payment abstract method * * @param varien_object $payment * @param float $amount * * @return mage_payment_model_abstract */ public function authorize(varien_object $payment, $amount) { if (!$this->canauthorize()) { mage::throwexception(mage::helper('payment')->__('authorize action not available.')); } return $this; } /** * capture payment abstract method * * @param varien_object $payment * @param float $amount * * @return mage_payment_model_abstract */ public function capture(varien_object $payment, $amount) { if (!$this->cancapture()) { mage::throwexception(mage::helper('payment')->__('capture action not available.')); } return $this; } /** * set capture transaction id invoice informational purposes * @param mage_sales_model_order_invoice $invoice * @param mage_sales_model_order_payment $payment * @return mage_payment_model_method_abstract */ public function processinvoice($invoice, $payment) { $invoice->settransactionid($payment->getlasttransid()); return $this; } /** * set refund transaction id payment object informational purposes * candidate deprecated: * there can multiple refunds per payment, payment.refund_transaction_id doesn't make big sense * * @param mage_sales_model_order_invoice $invoice * @param mage_sales_model_order_payment $payment * @return mage_payment_model_method_abstract */ public function processbeforerefund($invoice, $payment) { $payment->setrefundtransactionid($invoice->gettransactionid()); return $this; } /** * refund specified amount payment * * @param varien_object $payment * @param float $amount * * @return mage_payment_model_abstract */ public function refund(varien_object $payment, $amount) { if (!$this->canrefund()) { mage::throwexception(mage::helper('payment')->__('refund action not available.')); } return $this; } /** * set transaction id creditmemo informational purposes * @param mage_sales_model_order_creditmemo $creditmemo * @param mage_sales_model_order_payment $payment * @return mage_payment_model_method_abstract */ public function processcreditmemo($creditmemo, $payment) { $creditmemo->settransactionid($payment->getlasttransid()); return $this; } /** * cancel payment abstract method * * @param varien_object $payment * * @return mage_payment_model_abstract */ public function cancel(varien_object $payment) { return $this; } /** * @deprecated after 1.4.0.0-alpha3 * method doesn't make sense, because invoice must not void entire authorization * there should method invoice cancellation * @param mage_sales_model_order_invoice $invoice * @param mage_sales_model_order_payment $payment * @return mage_payment_model_method_abstract */ public function processbeforevoid($invoice, $payment) { $payment->setvoidtransactionid($invoice->gettransactionid()); return $this; } /** * void payment abstract method * * @param varien_object $payment * * @return mage_payment_model_abstract */ public function void(varien_object $payment) { if (!$this->canvoid($payment)) { mage::throwexception(mage::helper('payment')->__('void action not available.')); } return $this; } /** * whether method can accept or deny payment * * @param mage_payment_model_info $payment * * @return bool */ public function canreviewpayment(mage_payment_model_info $payment) { return $this->_canreviewpayment; } /** * attempt accept payment under review * * @param mage_payment_model_info $payment * @return bool * @throws mage_core_exception */ public function acceptpayment(mage_payment_model_info $payment) { if (!$this->canreviewpayment($payment)) { mage::throwexception(mage::helper('payment')->__('the payment review action unavailable.')); } return false; } /** * attempt deny payment under review * * @param mage_payment_model_info $payment * @return bool * @throws mage_core_exception */ public function denypayment(mage_payment_model_info $payment) { if (!$this->canreviewpayment($payment)) { mage::throwexception(mage::helper('payment')->__('the payment review action unavailable.')); } return false; } /** * retrieve payment method title * * @return string */ public function gettitle() { return $this->getconfigdata('title'); } /** * retrieve information payment configuration * * @param string $field * @param int|string|null|mage_core_model_store $storeid * * @return mixed */ public function getconfigdata($field, $storeid = null) { if (null === $storeid) { $storeid = $this->getstore(); } $path = 'payment/'.$this->getcode().'/'.$field; return mage::getstoreconfig($path, $storeid); } /** * assign data info model instance * * @param mixed $data * @return mage_payment_model_info */ public function assigndata($data) { if (is_array($data)) { $this->getinfoinstance()->adddata($data); } elseif ($data instanceof varien_object) { $this->getinfoinstance()->adddata($data->getdata()); } return $this; } /** * parepare info instance save * * @return mage_payment_model_abstract */ public function preparesave() { return $this; } /** * check whether payment method can used * * todo: payment method instance not supposed know quote * * @param mage_sales_model_quote|null $quote * * @return bool */ public function isavailable($quote = null) { $checkresult = new stdclass; $isactive = (bool)(int)$this->getconfigdata('active', $quote ? $quote->getstoreid() : null); $checkresult->isavailable = $isactive; $checkresult->isdeniedinconfig = !$isactive; // future use in observers mage::dispatchevent('payment_method_is_active', array( 'result' => $checkresult, 'method_instance' => $this, 'quote' => $quote, )); if ($checkresult->isavailable && $quote) { $checkresult->isavailable = $this->isapplicabletoquote($quote, self::check_recurring_profiles); } return $checkresult->isavailable; } /** * check whether payment method applicable quote * purposed allow use in controllers logic implemented in blocks before * * @param mage_sales_model_quote $quote * @param int|null $checksbitmask * @return bool */ public function isapplicabletoquote($quote, $checksbitmask) { if ($checksbitmask & self::check_use_for_country) { if (!$this->canuseforcountry($quote->getbillingaddress()->getcountry())) { return false; } } if ($checksbitmask & self::check_use_for_currency) { if (!$this->canuseforcurrency($quote->getstore()->getbasecurrencycode())) { return false; } } if ($checksbitmask & self::check_use_checkout) { if (!$this->canusecheckout()) { return false; } } if ($checksbitmask & self::check_use_for_multishipping) { if (!$this->canuseformultishipping()) { return false; } } if ($checksbitmask & self::check_use_internal) { if (!$this->canuseinternal()) { return false; } } if ($checksbitmask & self::check_order_total_min_max) { $total = $quote->getbasegrandtotal(); $mintotal = $this->getconfigdata('min_order_total'); $maxtotal = $this->getconfigdata('max_order_total'); if (!empty($mintotal) && $total < $mintotal || !empty($maxtotal) && $total > $maxtotal) { return false; } } if ($checksbitmask & self::check_recurring_profiles) { if (!$this->canmanagerecurringprofiles() && $quote->hasrecurringitems()) { return false; } } if ($checksbitmask & self::check_zero_total) { $total = $quote->getbasesubtotal() + $quote->getshippingaddress()->getbaseshippingamount(); if ($total < 0.0001 && $this->getcode() != 'free' && !($this->canmanagerecurringprofiles() && $quote->hasrecurringitems()) ) { return false; } } return true; } /** * method executed instead of authorize or capture * if flag isinitializeneeded set true * * @param string $paymentaction * @param object $stateobject * * @return mage_payment_model_abstract */ public function initialize($paymentaction, $stateobject) { return $this; } /** * config payment action url * used universalize payment actions when processing payment place * * @return string */ public function getconfigpaymentaction() { return $this->getconfigdata('payment_action'); } /** * log debug data file * * @param mixed $debugdata */ protected function _debug($debugdata) { if ($this->getdebugflag()) { mage::getmodel('core/log_adapter', 'payment_' . $this->getcode() . '.log') ->setfilterdatakeys($this->_debugreplaceprivatedatakeys) ->log($debugdata); } } /** * define if debugging enabled * * @return bool */ public function getdebugflag() { return $this->getconfigdata('debug'); } /** * used call debug method not payment method context * * @param mixed $debugdata */ public function debugdata($debugdata) { $this->_debug($debugdata); } }
Comments
Post a Comment