-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Creating new (duplicated) payments for order is causing problems with other modules. We should avoid this and instead create just new transactions.
When PayU module create a duplicated payment for one order, then we are unable to call Magento API to ger orders:
Call to: /rest/all/V1/orders
Query String:
searchCriteria[filter_groups][0][filters][0][condition_type] => gteq
searchCriteria[filter_groups][0][filters][0][field] => updated_at
searchCriteria[filter_groups][0][filters][0][value] => 2025-09-19 08:48:11
searchCriteria[pageSize] => 1000
searchCriteria[sortOrders][0][direction] => ASC
searchCriteria[sortOrders][0][field] => updated_at
This call cause exception:
Exception: Item (Magento\Sales\Model\Order\Interceptor) with the same ID "1002751" already exists. in /app/m/vendor/magento/framework/Data/Collection.php:414
Stack trace:
#0 /app/m/vendor/magento/framework/Data/Collection/AbstractDb.php(829): Magento\Framework\Data\Collection->addItem(Object(Magento\Sales\Model\Order\Interceptor))
#1 /app/m/vendor/magento/framework/Data/Collection/AbstractDb.php(802): Magento\Framework\Data\Collection\AbstractDb->loadWithFilter(false, false)
#2 /app/m/vendor/magento/framework/Data/Collection.php(340): Magento\Framework\Data\Collection\AbstractDb->load()
#3 /app/m/vendor/magento/module-sales/Model/OrderRepository.php(216): Magento\Framework\Data\Collection->getItems()
#4 /app/m/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Sales\Model\OrderRepository->getList(Object(Magento\Framework\Api\SearchCriteria))
#5 /app/m/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Sales\Model\OrderRepository\Interceptor->___callParent('getList', Array)
#6 /app/m/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Sales\Model\OrderRepository\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\Api\SearchCriteria))
#7 /app/m/generated/code/Magento/Sales/Model/OrderRepository/Interceptor.php(32): Magento\Sales\Model\OrderRepository\Interceptor->___callPlugins('getList', Array, Array)
#8 [internal function]: Magento\Sales\Model\OrderRepository\Interceptor->getList(Object(Magento\Framework\Api\SearchCriteria))
#9 /app/m/vendor/magento/module-webapi/Controller/Rest/SynchronousRequestProcessor.php(95): call_user_func_array(Array, Array)
#10 /app/m/vendor/magento/module-webapi/Controller/Rest.php(201): Magento\Webapi\Controller\Rest\SynchronousRequestProcessor->process(Object(Magento\Framework\Webapi\Rest\Request\Proxy))
#11 /app/m/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Webapi\Controller\Rest->dispatch(Object(Magento\Framework\App\Request\Http))
#12 /app/m/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Webapi\Controller\Rest\Interceptor->___callParent('dispatch', Array)
#13 /app/m/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Webapi\Controller\Rest\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#14 /app/m/generated/code/Magento/Webapi/Controller/Rest/Interceptor.php(23): Magento\Webapi\Controller\Rest\Interceptor->___callPlugins('dispatch', Array, Array)
#15 /app/m/vendor/magento/framework/App/Http.php(116): Magento\Webapi\Controller\Rest\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#16 /app/m/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\Http->launch()
#17 /app/m/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\Http\Interceptor->___callParent('launch', Array)
#18 /app/m/vendor/magento/module-application-performance-monitor/Plugin/ApplicationPerformanceMonitor.php(38): Magento\Framework\App\Http\Interceptor->Magento\Framework\Interception\{closure}()
#19 /app/m/vendor/magento/framework/Interception/Interceptor.php(135): Magento\ApplicationPerformanceMonitor\Plugin\ApplicationPerformanceMonitor->aroundLaunch(Object(Magento\Framework\App\Http\Interceptor), Object(Closure))
#20 /app/m/vendor/justbetter/magento2-sentry/Plugin/GlobalExceptionCatcher.php(112): Magento\Framework\App\Http\Interceptor->Magento\Framework\Interception\{closure}()
#21 /app/m/vendor/justbetter/magento2-sentry/Plugin/GlobalExceptionCatcher.php(60): JustBetter\Sentry\Plugin\GlobalExceptionCatcher->globalCatcher(Object(Magento\Framework\App\Http\Interceptor), Object(Closure))
#22 /app/m/vendor/magento/framework/Interception/Interceptor.php(135): JustBetter\Sentry\Plugin\GlobalExceptionCatcher->aroundLaunch(Object(Magento\Framework\App\Http\Interceptor), Object(Closure))
#23 /app/m/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\Http\Interceptor->Magento\Framework\Interception\{closure}()
#24 /app/m/generated/code/Magento/Framework/App/Http/Interceptor.php(23): Magento\Framework\App\Http\Interceptor->___callPlugins('launch', Array, NULL)
#25 /app/m/vendor/magento/framework/App/Bootstrap.php(264): Magento\Framework\App\Http\Interceptor->launch()
#26 /app/m/pub/index.php(107): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))
#27 {main}
Removing duplicated (old) records in sales_order_payment with the same parent_id (Order ID) is solving the issue:
DELETE p1 FROM sales_order_payment p1, sales_order_payment p2 WHERE p1.entity_id > p2.entity_id AND p1.parent_id = p2.parent_id
Metadata
Metadata
Assignees
Labels
No labels