PAYONE-GmbH / magento-1

PAYONE Payment Extension for Magento 1
22 stars 41 forks source link

Fatal error: Uncaught Error: Call to a member function hasForcedState() on boolean #66

Closed Elfen-Service closed 7 years ago

Elfen-Service commented 7 years ago

Hello,

if i see this correct, this happens to orders with payment method creditcard.

`Fatal error: Uncaught Error: Call to a member function hasForcedState() on boolean in app/code/core/Mage/Sales/Model/Order/Invoice.php:415 Stack trace:

0 app/code/community/Payone/Core/Model/Observer/TransactionStatus/InvoiceCreate.php(98): Mage_Sales_Model_Order_Invoice->pay()

1 app/code/core/Mage/Core/Model/App.php(1358): Payone_Core_Model_Observer_TransactionStatus_InvoiceCreate->onPaid(Object(Varien_Event_Observer))

2 app/code/core/Mage/Core/Model/App.php(1337): Mage_Core_Model_App->_callObserverMethod(Object(Payone_Core_Model_Observer_TransactionStatus_InvoiceCreate), 'onPaid', Object(Varien_Event_Observer))

3 app/Mage.php(448): Mage_Core_Model_App->dispatchEvent('payone_core_tra...', Array)

4 app/code/community/Payone/Core/Model/Service/TransactionStatus/Process.php(128): Mage::dispatchEvent('payone_core_tra...', Array)

5 /home/elfen in app/code/core/Mage/Sales/Model/Order/Invoice.php on line 415`

All creditcard orders have no invoice. We use authorization, so an invoice should be created automatically after an order is saved!? Because it is no possible to handle an complete order in sometimes less than 5min until the paid transaction comes in.

fjbender commented 7 years ago

Hi,

I'm not quite sure I understand the issue you've found here. On what event does the hasForcedState() error exactly occur? The invoice is generated as soon as the APPOINTED Transaction Status comes in and the cronjob is run.

Elfen-Service commented 7 years ago

Hi,

the postet message is an exception that occurs while the cronjob is running after the system got the paid transaction from PayOne.

Just now i looked into the code app/code/core/Mage/Sales/Model/Order/Invoice.php:415 ... So the error occures because of an not existing invoice for the order ...

I checked an order of today where no invoice was created (as always): 1) ordered @ 11:05:51 2) appointed came @ 11:06:12 and was updated @ 11:10:03 3) paid came @ 11:12:54 and was updated @ 11:15:03 (protocol status for the transaction is error without reason, log entries or similar) 4) error mail from the cronjob was sent @ 11:15:03 (protocol status for the transaction ist running while the error occured in the cronjob)

So if you say an invoice should be created when the appointed came in, this could be the problem ... But how to debug?

Thanks for help.

fjbender commented 7 years ago

I wanna take a look into our logs to see if I can reproduce the issue here - please send me some details on that very transaction (mid, txid) to integrations@payone.de.

Thanks for your cooperation.

fjbender commented 7 years ago

Solution: @Elfen-Service has mapped the Payone status APPOINTED on the Magento status payment_review, which resulted in $order->canInvoice() being false and the invoice not being created. Using another Magento state like pending_payment works.