Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Getting the reserved order Id from within payment method model? 
 
parkin_m
Jr. Member
 
Total Posts:  18
Joined:  2008-12-01
 

Hey there,

Checkout_Model_Type_Onepage reserves an order id when saveOrder() is called, which is great for us! What we want to do is use this order number (which will be unique as far as I can tell) as the merchant reference for the payment gateway, to speed up the credit controls job of matching orders to credit card transactions.

$this->getQuote()->reserveOrderId(); inside Onepage::saveOrder() is working as failed transactions are skipping order numbers, but the problem we are having is how to get this reserved order Id from within the payment model that extends Mage_Payment_Model_Method_Cc
(i.e in the capture method) so it can be sent to the credit card merchant.

Any help would be great!

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
Manos Dilaverakis
Member
 
Total Posts:  49
Joined:  2009-02-25
 

You can get the order id as it appears in your admin panel by doing

$payment->getOrder()->increment_id
in your Model where $payment is the Varien_Object that is passed to your capture/authorize/whatever functions.

In fact you might want to poke around $payment and the object $payment->getOrder() returns since they carry a lot of useful data.

 
Magento Community Magento Community
Magento Community
Magento Community
 
parkin_m
Jr. Member
 
Total Posts:  18
Joined:  2008-12-01
 

This increment_id is not incremented when an exception is thrown within the Payment_Model_Method_Cc, as I presumed it would be!

I have had a look at the public functions of the Order object with no luck ( print_r(get_class_methods($payment->getOrder()),true); )

Any ideas?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top