litecommerce / core

LiteCommerce
http://litecommerce.com
49 stars 37 forks source link

Impossible to use paymentReturn and Callback handlers #30

Closed justvovus closed 11 years ago

justvovus commented 12 years ago
ERROR: "23000" (code N/A)
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '4-order_id' for key 'iname'

This error appears during paymentReturn or Callback (depends what goes the second). In my case Callback goes after paymentReturn and fails with such error.

Problem is that both handlers are writing to the session cells table (xlite_session_cells) a same order. Here is log backtrace:

[26-May-2012 15:21:27] Error (code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '4-order_id' for key 'iname'
Server API: cgi-fcgi;
Request method: POST;
URI: /store/callback/0/txn_id_name-s_txnId?xid=jwtPiWoMX8KVtySLwHtPWGMC5xArjYka;
Backtrace: 
#0 /var/www/LiteCommerceShop/litecommerce/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php(236): XLite\Core\Statement->execute()
#1 /var/www/LiteCommerceShop/litecommerce/lib/Doctrine/ORM/UnitOfWork.php(708): Doctrine\ORM\Persisters\BasicEntityPersister->executeInserts()
#2 /var/www/LiteCommerceShop/litecommerce/lib/Doctrine/ORM/UnitOfWork.php(287): Doctrine\ORM\UnitOfWork->executeInserts(Object(Doctrine\ORM\Mapping\ClassMetadata))
#3 /var/www/LiteCommerceShop/litecommerce/lib/Doctrine/ORM/EntityManager.php(334): Doctrine\ORM\UnitOfWork->commit()
#4 /var/www/LiteCommerceShop/litecommerce/var/run/classes/XLite/Model/Repo/ARepo.php(465): Doctrine\ORM\EntityManager->flush()
#5 /var/www/LiteCommerceShop/litecommerce/var/run/classes/XLite/Model/Repo/ARepo.php(485): XLite\Model\Repo\ARepo->flushChanges()
#6 /var/www/LiteCommerceShop/litecommerce/var/run/classes/XLite/Model/Repo/SessionCell.php(60): XLite\Model\Repo\ARepo->insert(Array)
#7 /var/www/LiteCommerceShop/litecommerce/var/run/classes/XLite/Model/Session.php(237): XLite\Model\Repo\SessionCell->insertCell(4, 'order_id', 176)
#8 /var/www/LiteCommerceShop/litecommerce/var/run/classes/XLite/Model/Session.php(165): XLite\Model\Session->setCellValue('order_id', 176)
#9 /var/www/LiteCommerceShop/litecommerce/var/run/classes/XLite/Core/SessionAbstract.php(120): XLite\Model\Session->__set('order_id', 176)
#10 /var/www/LiteCommerceShop/litecommerce/var/run/classes/XLite/Model/Cart.php(117): XLite\Core\SessionAbstract->__set('order_id', 176)
#11 /var/www/LiteCommerceShop/litecommerce/var/run/classes/XLite/Controller/Customer/ACustomerAbstract.php(154): XLite\Model\Cart::getInstance()
#12 /var/www/LiteCommerceShop/litecommerce/var/run/classes/XLite/Controller/Customer/ACustomerAbstract.php(199): XLite\Controller\Customer\ACustomerAbstract->getCart()
#13 /var/www/LiteCommerceShop/litecommerce/var/run/classes/XLite/Controller/Customer/Callback.php(49): XLite\Controller\Customer\ACustomerAbstract->handleRequest()
#14 /var/www/LiteCommerceShop/litecommerce/var/run/classes/XLite.php(309): XLite\Controller\Customer\Callback->handleRequest()
#15 /var/www/LiteCommerceShop/litecommerce/var/run/classes/XLite.php(321): XLite->runController()
#16 [internal function]: XLite->getViewer()
#17 /var/www/LiteCommerceShop/litecommerce/var/run/classes/XLite/Model/CachingFactory.php(64): call_user_func_array(Array, Array)
#18 /var/www/LiteCommerceShop/litecommerce/var/run/classes/XLite/Core/CMSConnectorAbstract.php(197): XLite\Model\CachingFactory::getObjectFromCallback('XLite\Core\CMSC...', Object(XLite), 'getViewer')
#19 /var/www/LiteCommerceShop/litecommerce/var/run/classes/XLite/Core/CMSConnectorAbstract.php(246): XLite\Core\CMSConnectorAbstract->getViewer()
#20 /var/www/LiteCommerceShop/litecommerce/var/run/classes/XLite/Module/CDev/DrupalConnector/Drupal/Controller.php(290): XLite\Core\CMSConnectorAbstract->getWidget('\XLite\View\Loc...')
#21 /var/www/LiteCommerceShop/litecommerce/var/run/classes/XLite/Module/CDev/DrupalConnector/Drupal/Controller.php(351): XLite\Module\CDev\DrupalConnector\Drupal\Controller->setBreadcrumbs()
#22 /var/www/LiteCommerceShop/litecommerce/var/run/classes/XLite/Module/CDev/DrupalConnector/Drupal/Controller.php(168): XLite\Module\CDev\DrupalConnector\Drupal\Controller->performCommonActions()
#23 /var/www/LiteCommerceShop/litecommerce/classes/XLite/Module/CDev/DrupalConnector/Drupal/Include/Callbacks.php(38): XLite\Module\CDev\DrupalConnector\Drupal\Controller->getContent()
#24 [internal function]: lcConnectorGetControllerContent('0', 'txn_id_name-s_t...')
#25 /var/www/LiteCommerceShop/includes/menu.inc(516): call_user_func_array('lcConnectorGetC...', Array)
#26 /var/www/LiteCommerceShop/index.php(21): menu_execute_active_handler()
#27 {main}
justvovus commented 12 years ago

Hi @svowl I suppose "if cell exists" check works quite bad at classes/XLite/Model/Session.php(231) That check allows to update cell even it already exists.

justvovus commented 12 years ago

@svowl, please fix it in 1.0.24, it's very critical for my development.

svowl commented 12 years ago

We have created a ticket on this issue in our bugtracker system: http://bt.litecommerce.com/view.php?id=41457 The issue require some investigation. Please follow this ticket.

justvovus commented 12 years ago

@svowl thanks, perfect. But what possibility that it'll be fixed by end of June. We have release date in twenties of June and this issue is critical for us. Also can you provide any estimates for release of 1.0.24?

Best regards.

svowl commented 11 years ago

Please sorry for the delay with resolving the issue. https://github.com/litecommerce/core/commit/671942f If it is still actual for you, could you try to apply this patch to file src/var/run/classes/XLite/Model/Repo/SessionCell.php and check?