Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ECP-9199] Order edit flow breaks when using Adyen plugin #485

Open
wannevancamp opened this issue Apr 25, 2024 · 6 comments
Open

[ECP-9199] Order edit flow breaks when using Adyen plugin #485

wannevancamp opened this issue Apr 25, 2024 · 6 comments
Assignees

Comments

@wannevancamp
Copy link
Contributor

wannevancamp commented Apr 25, 2024

Describe the bug
When editing an order in the Shopware admin a 500 is thrown.

Uncaught PHP Exception Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException: "An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (db24301.adyen_payment, CONSTRAINT fk.adyen_payment.order_transaction_id FOREIGN KEY (order_transaction_id) REFERENCES order_transaction (id))" at /.../vendor/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php line 56 {"exception":"[object] (Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException(code: 1451): An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (db24301.adyen_payment, CONSTRAINT fk.adyen_payment.order_transaction_id FOREIGN KEY (order_transaction_id) REFERENCES order_transaction (id)) at /.../vendor/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php:56)\n[previous exception] [object] (Doctrine\DBAL\Driver\PDO\Exception(code: 1451): SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (db24301.adyen_payment, CONSTRAINT fk.adyen_payment.order_transaction_id FOREIGN KEY (order_transaction_id) REFERENCES order_transaction (id)) at /.../vendor/doctrine/dbal/src/Driver/PDO/Exception.php:28)\n[previous exception] [object] (PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (db24301.adyen_payment, CONSTRAINT fk.adyen_payment.order_transaction_id FOREIGN KEY (order_transaction_id) REFERENCES order_transaction (id)) at /v.../vendor/doctrine/dbal/src/Driver/PDO/Statement.php:121)"} []

Solution
The adyen_payment table needs to be versioned because there is a reference tot the order_tranaction table.

Versions
Shopware version: all
Plugin version: all

To Reproduce
Steps to reproduce the behavior:

  1. Go to the order detail page in the Shopware admin
  2. Click on edit order
  3. Edit order ex. add a tag.
  4. Order can't be safed
  5. See error

Expected behavior
Order can be saved

@RokPopov RokPopov changed the title Order edit flow breaks when using Adyen plugin [ECP-9199] Order edit flow breaks when using Adyen plugin May 16, 2024
@RokPopov
Copy link
Contributor

Hi @wannevancamp,

Thank you for reporting this issue. I create an internal ticket to investigate and come up with a solution. Once the solution is implemented and merged with the develop branch, this ticket will automatically be closed.

Kind regards,
Rok

@RokPopov RokPopov self-assigned this May 16, 2024
@romaneckert
Copy link

Hello @RokPopov, Hello @wannevancamp

I have noticed a similar error in this context. If you open the order in the Shopware backend and close and reopen it, Shopware tries to delete the previous version. The same error is generated. As a result, every time you open the order in the Shopware backend, a new version of the order is created in the database, even though nothing has changed.

Tested Versions
Shopware version: 6.5.8.11
Plugin version: 3.15.0

API Call:
/api/_action/version/{{versionId}}/order/{{orderId}}

{
    "errors": [
        {
            "code": "1451",
            "status": "500",
            "title": "Internal Server Error",
            "detail": "An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (`shop`.`adyen_payment`, CONSTRAINT `fk.adyen_payment.order_transaction_id` FOREIGN KEY (`order_transaction_id`) REFERENCES `order_transaction` (`id`))"
        }
    ]
}

This is a very critical bug and should be fixed as soon as possible.

Kind regards

@alessandroaussems
Copy link

@RokPopov Almost 3 months later... Any update on this?

@adyen-integrations-support

Hey @wannevancamp,

Please note that our team tried to reproduce the issue and we were not able to get the same issue as you described.
Can you please give us more information so our team can investigate further?

Do you still experience the same issue at the moment? What is the plugin and system version you are using? It would be helpful if you can share screenshots and screencasts with us.

Thank you!

@cwittstock
Copy link

We have the same issue, when we change the state of an order:

[2024-10-14T07:54:07.933219+00:00] request.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException: "An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (`shopware_safety_live`.`adyen_payment`, CONSTRAINT `fk.adyen_payment.order_transaction_id` FOREIGN KEY (`order_transaction_id`) REFERENCES `order_transaction` (`id`))" at ExceptionConverter.php line 56 {"exception":"[object] (Doctrine\\DBAL\\Exception\\ForeignKeyConstraintViolationException(code: 1451): An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (`shopware_safety_live`.`adyen_payment`, CONSTRAINT `fk.adyen_payment.order_transaction_id` FOREIGN KEY (`order_transaction_id`) REFERENCES `order_transaction` (`id`)) at /.../vendor/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php:56)\n[previous exception] [object] (Doctrine\\DBAL\\Driver\\PDO\\Exception(code: 1451): SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (`shopware_safety_live`.`adyen_payment`, CONSTRAINT `fk.adyen_payment.order_transaction_id` FOREIGN KEY (`order_transaction_id`) REFERENCES `order_transaction` (`id`)) at /.../vendor/doctrine/dbal/src/Driver/PDO/Exception.php:28)\n[previous exception] [object] (PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (`shopware_safety_live`.`adyen_payment`, CONSTRAINT `fk.adyen_payment.order_transaction_id` FOREIGN KEY (`order_transaction_id`) REFERENCES `order_transaction` (`id`)) at /.../vendor/doctrine/dbal/src/Driver/PDO/Statement.php:130)"} []

Shopware Version: 6.5.8.14
Adyen Plugin: 3.16.1

What else do you need to identify the problem?

@Gugiman
Copy link

Gugiman commented Oct 15, 2024

We also get this error.
I can't determine on which processes exactly but it appears on several occasions while running.
But all in relation to the order being processed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants