I am writing a payment module for our payment gateway,I am a java programmer and new to php,so please forgive for my poor php skill. I have setted the new order status with pending and payment action with Authorise and Capture in my module.Then I want to change the order status to processing after payment approved in capture method with the code below
$payment->setStatus(self::STATUS_SUCCESS);
$order->addStatusToHistory(
Mage_Sales_Model_Order::STATE_PROCESSING,'payment success',false
);
But I found that the order status always is changed to pending after the payment like this
How do I fix this bug?please help me,Thank you!
BTW,if I change the new order status with processing,even if the payment failed,the order still will be changed to processing,that's not what I want.