Alexandre
Alexandre

Reputation: 3170

Get order id in a custom payment method: Mage_Payment_Model_Method_Abstract

I am working on a new payment method for shop and I am stuck in the method can refund. In this function I would need to find a way to get the order id of the invoice to refund. How should I proceed?

  class Company_Module_Model_Standard extends Mage_Payment_Model_Method_Abstract
  {
    (...)
    public function canRefund() // we need a way to get the orderId
    {
      $client = $this->_getCLient();
      $client->loadOrder($orderId); // <------ here I would need the order id or increment id
      $ret = $client->canRefund();
      return $ret;
    }
    (...)
  }

I hope you can help me.

Upvotes: 0

Views: 908

Answers (1)

Kalpesh
Kalpesh

Reputation: 5685

Try this:

$paymentInfo = $this->getInfoInstance();
$orderId = $paymentInfo->getOrder()->getRealOrderId();

Upvotes: 1

Related Questions