0

I recently install the PayU plugin downloaded from the PayU website. After installing the plugin my website is working fine and also I have the payment options on the checkout page for PayU payment but when I select payment option as "PayU" I get following errors:

Fatal error: Call to a member function getFirstname() on a non-object in /var/www/html/app/code/local/Gfgrisales/Payu/Model/Payu.php on line 120

I tried to look at the code at line number 120 in file Payu.php and it looks like this:

$params = array(
    'merchantId'            =>      $merchant_id,
    'referenceCode'         =>      $orderIncrementId,
    'description'           =>      $ProductName,
    'amount'                =>      $paymentAmount,
    'tax'                   =>      $tax,
    'taxReturnBase'         =>      $taxReturnBase,
    'signature'             =>      $signature,
    'accountId'             =>      $account_id,
    'currency'              =>      $currency,

    'buyerFullName'         =>      $order->getShippingAddress()->getFirstname().' '.$order->getShippingAddress()->getLastname(),
    'buyerEmail'            =>      $order->getCustomerEmail(),
    'shippingAddress'       =>      $order->getShippingAddress()->getStreet1().' '.$order->getShippingAddress()->getStreet2(),
    'shippingCity'          =>      $order->getShippingAddress()->getCity(),
    'telephone'             =>      $order->getShippingAddress()->getTelephone(),

    'payerFullName'         =>      $order->getBillingAddress()->getFirstname().' '.$order->getBillingAddress()->getLastname(),
    'billingAddress'        =>      $order->getBillingAddress()->getStreet1().' '.$order->getBillingAddress()->getStreet2(),
    'billingCity'           =>      $order->getBillingAddress()->getCity(),
    'payerPhone'            =>      $order->getBillingAddress()->getTelephone(),

    'test'                  =>      $test,
    'confirmationUrl'       =>      Mage::getUrl('payu/payment/notify'),
    'responseUrl'           =>      Mage::getUrl('payu/payment/success'),
    'extra1'                =>      $extra1,
    //'gateway_url'         =>      $gateway_url,
);

as I am newbie in Magento and PHP i can't find how to fix the above issue. Also it will be great if someone can explain that why this issue happens.

Thanks in advance.

0

Looking at your error message, it seems that $order->getShippingAddress() is not an object : this is why you get this error.

You will have to find why your order does not have a shipping address.

If you look app/code/core/Mage/Sales/Model/Order.php:getShippingAddress(), the method can return an object $address but it can also return false. In your case, it seems that the return is false.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.