mage2pro / ipay88

iPay88 integration with Magento 2
https://upwork.com/fl/mage2pro
7 stars 4 forks source link

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row #18

Closed bockers90 closed 4 years ago

bockers90 commented 4 years ago

Magento Version: Community Edition 2.2.3 Mage2Pro/iPay88 Version: 1.6.1

When returning to the the website at /dfe-ipay88/customerReturn, we are getting a 503 response and seeing an error processing report number.

When looking at the report in var/report we see the following error:

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (database.sales_order_status_history, CONSTRAINTSALES_ORDER_STATUS_HISTORY_PARENT_ID_SALES_ORDER_ENTITY_IDFOREIGN KEY (parent_id) REFERENCESsales_order(entity_id) ON DELETE), query was: INSERT INTOsales_order_status_history(is_customer_notified,is_visible_on_front,comment,status,entity_name) VALUES (?, ?, ?, ?, ?)

This is not happening for every customer, making it very difficult to test and replicate. We've also checked the logs for the orders this is happening for in var/log/mage2.pro and there are no errors in the customerReturn.json files.

The module is simply failing to save a record to the sales_order_status_history table.

This error is being thrown in the function df_order_comment and I believe it's because the customer's Session has not persisted when the customer returns to the store after being redirected to the external iPay88 payment gateway.

Please could you help explain why this might be happening and if possible, provide a patch/fix for this problem.

Thank you

dmitrii-fediuk commented 4 years ago

You can hire me in Upwork to analyze and solve your problem: upwork.com/fl/mage2pro