3

I've developed a Payment Method extension for Magento. In this extension, I've added:

protected $_canRefund = true;

However, when I click an invoice and select Credit Memo, I can only see 'Refund Offline' and not 'Refund'. All tutorials I followed insist that I only have to change that value to true to activate the button (obviously I still have to implement the refund method and the actual refund procedure) but I can't see a way to do this.

If I, within a block on the order screen, execute this line $order->getPayment()->getMethodInstance()->canRefund(); it does indeed return true, but still no luck with the actual credit memo.

Edit

I've changed the title of the question to reflect my new find.
Basically, the reason it's not appearing is because my invoices aren't created with transaction IDs - I have no idea why, but this is my capture payment method that runs when generating an invoice:

public function capturePayment($order) {
    try {
        if (!$order->canInvoice()) {
            Mage::throwException(Mage::helper('core')->__('Cannot create an invoice.'));
        }
        $invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
        if (!$invoice->getTotalQty()) {
            Mage::throwException(Mage::helper('core')->__('Cannot create an invoice without products.'));
        }
        $invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
        $invoice->register();
        $transactionSave = Mage::getModel('core/resource_transaction')
               ->addObject($invoice)
               ->addObject($invoice->getOrder());
        $transactionSave->save();
        $order->setState('processing', 'payment_received', "Payment has been received", false);
        $order->save();
    } catch (Mage_Core_Exception $e) {
        Mage::throwException("Error Taking Payment, Please Try Again:\n" . $e);
    }
}

Why isn't a transaction ID being assigned to my capture?

Dan Hanly
  • 7,829
  • 13
  • 73
  • 134

1 Answers1

0

check below url

http://www.spinonesolutions.com/2009/10/magento-enable-paygate-refunds/ https://magento.stackexchange.com/questions/7846/capture-void-refund-not-showed-in-magento-admin-area

http://excellencemagentoblog.com/magento-create-custom-payment-method-api-based

hope this help you

Community
  • 1
  • 1
Shivam
  • 2,443
  • 17
  • 31