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

[PIWOO-422] TypeError merchant capture feature #882

Merged
merged 7 commits into from
Apr 9, 2024
Merged

Conversation

inpsyde-maticluznar
Copy link
Collaborator

@inpsyde-maticluznar inpsyde-maticluznar commented Feb 6, 2024

Handles: PIWOO-422

In the Webhook method, we have to check if the payment object is a payment. If it is not, we don't have to run it.

@mmaymo Maybe it would be better to remove the Payment type from this function https://github.com/mollie/WooCommerce/blob/develop/src/MerchantCapture/MerchantCaptureModule.php#L156
and check here what kind of object we received. What do you think?

@mmaymo
Copy link
Collaborator

mmaymo commented Feb 6, 2024

It's true that the hook is only used by the merchant capture in our code now, so this would work.. but onWebhookAction the $payment object can be an order and we would then limit the use of that hook for other purposes (maybe some third party plugin could be using it and this could break them). The name of that variable leads to confusion, not only here.. we need to address that in the refactor. But I think it would be less prone to conflict if we remove the payment type in the merchant capture method, and if it's not what we want, then bail there.

@inpsyde-maticluznar
Copy link
Collaborator Author

It's true that the hook is only used by the merchant capture in our code now, so this would work.. but onWebhookAction the $payment object can be an order and we would then limit the use of that hook for other purposes (maybe some third party plugin could be using it and this could break them). The name of that variable leads to confusion, not only here.. we need to address that in the refactor. But I think it would be less prone to conflict if we remove the payment type in the merchant capture method, and if it's not what we want, then bail there.

Yes I agree. Thank you! I updated the code.

@mmaymo mmaymo merged commit 9190f9a into develop Apr 9, 2024
8 checks passed
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

Successfully merging this pull request may close these issues.

2 participants