I am using magento CE 1.9.3.1 and I would like to disable auto invoicing of orders placed by paypal. Tax point purposes I would like to invoice them manually in the magento backend myself like I do for the Purchase order orders.
Doing some research (Googling!) I found this:
stop auto-invoice of paypal orders
Now, this is nearly three years old from 2014 so is this still a viable solution for 1.9.3.1 ?
Or is there a more reliable solution ?
Update
I went and amended the registerCaptureNotification function in payment.php from prasantas answser below to the following:
$status = true;
$letsEmail = false;
if ($this->getIsTransactionPending()) {
$message = Mage::helper('sales')->__('Capturing amount of %s is pending approval on gateway.', $this->_formatPrice($amount));
$state = Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW;
$letsEmail = true;
if ($this->getIsFraudDetected()) {
$message = Mage::helper('sales')->__('Order is suspended as its capture amount %s is suspected to be fraudulent.', $this->_formatPrice($amount, $this->getCurrencyCode()));
$status = Mage_Sales_Model_Order::STATUS_FRAUD;
$letsEmail = false;
}
} else {
$message = Mage::helper('sales')->__('Registered notification about captured amount of %s.', $this->_formatPrice($amount));
$state = Mage_Sales_Model_Order::STATE_NEW;
$letsEmail = true;
if ($this->getIsFraudDetected()) {
$state = Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW;
$message = Mage::helper('sales')->__('Order is suspended as its capture amount %s is suspected to be fraudulent.', $this->_formatPrice($amount, $this->getCurrencyCode()));
$status = Mage_Sales_Model_Order::STATUS_FRAUD;
$letsEmail = false;
}
}
$transaction = $this->_addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE, $invoice, true);
$message = $this->_prependMessage($message);
$message = $this->_appendTransactionToMessage($transaction, $message);
$order->setState($state, $status, $message);
if ($letsEmail === true && !$order->getEmailSent()){
$order->queueNewOrderEmail()->addStatusHistoryComment(
Mage::helper('paypal')->__('Notified Customer')
)
->setIsCustomerNotified(true)
->save();
}
This is now sending order confirmation emails.
Update 2
I now have an order where customer paid via paypal and then it showed pending-payment, which changed to cancelled and back to pending.
I cannot cancel the order, ship, invoice or nothing. only options we have are to edit,hold or delete order.
Update 3
I have also noticed that paypal orders at random get cancelled.
Below is a screenshot of an orders status history and as it illustrates an order goes to pending payment first then to pending. From here 3 seconds later it is set to cancelled. Why is this ?
I enabled debug but nothing at all was recorded in the /var/log location. Looking at transaction history and and ipn history on paypal I can see that the payment has come through successfully and ipn was confirmed/completed.
I would now just like to know why sporadically (1 in 4 or so) the
paypal orders get cancelled even though paypal order was successfully
placed and paid for and payment information passed back to magento?
Best Answer
Create a file Wfh_DisableAutoInvoice.xml in app/etc/modules/ and put the following code.
Create a file config.xml in app/code/local/Wfh/DisableAutoInvoice/etc/ and put the following code.
Create a file Payment.php in app/code/local/Wfh/DisableAutoInvoice/Model/Sales/Order/ and put the following code.