Credit Cards Transactions can not be Completed
If you try to checkout with credit card, the button complete payment does not work.
Reproduce:
Fill basket, go to Checkout choose credit card Confirm Fill in credit card credentials Press the button complete payment
Where to reprudce:
Can be reproduce on an system that uses our latest plugin version 4.0.1 with the WooCommerce version 7.8.1 and PHP Version 8.x
What happens:
[Thu Jun 29 11:20:57.328633 2023] [php:error] [pid 2699598] [client 84.173.62.43:59911] PHP Fatal error: Uncaught TypeError: call_user_func_array(): Argument #1 (closed) ($callback) must be a valid callback, non-static method Crefopay_Payment_Solution::credit_card_payment() cannot be called statically in /var/www/html/sandbox/woocommerce/wp-includes/class-wp-hook.php:308\nStack trace:\n#0 /var/www/html/sandbox/woocommerce/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()\n#1 /var/www/html/sandbox/woocommerce/wp-includes/plugin.php(517): WP_Hook->do_action()\n#2 /var/www/html/sandbox/woocommerce/wp-admin/admin-ajax.php(203): do_action()\n#3 {main}\n thrown in /var/www/html/sandbox/woocommerce/wp-includes/class-wp-hook.php on line 308, referer: https://mi-devel.pay-dev.de/sandbox/woocommerce/kasse/order-pay/1001/?key=wc_order_Pdd8BTwJPCPoa&order=1001
Das Problem, das in der angegebenen Fehlermeldung auftritt, liegt in einem PHP-Code. Es scheint, dass eine statische Methode namens "credit_card_payment()" in der Klasse "Crefopay_Payment_Solution" aufgerufen wird, jedoch wird sie als ungültiger Rückruf (callback) behandelt. Die Funktion "call_user_func_array()" erwartet einen gültigen Rückruf, der entweder ein Funktionsname als Zeichenkette oder ein Array mit einem Objekt und dem Methodennamen sein kann.
Der Fehler tritt auf, weil die Methode "credit_card_payment()" als nicht statisch definiert ist, aber versucht wird, sie statisch aufzurufen. Dies ist in PHP nicht zulässig.
Um das Problem zu beheben, müsste der Code so angepasst werden, dass die Methode entweder als statisch definiert wird und somit statisch aufgerufen werden kann, oder der Aufruf der Methode als nicht statisch behandelt wird.
How to solve this
This: public function credit_card_payment() must be renamed to this: public static function credit_card_payment()
Where to find in code:
Line 330: public function credit_card_payment()