monero-integrations / monerowp

Monero WooCommerce Plugin for Wordpress
MIT License
105 stars 74 forks source link

Internal Server Error - Checkout #97

Closed ghost closed 3 years ago

ghost commented 3 years ago

I installed plugin on my WordPress with Woo-commerce located in Tor with onion address. Everything is configured. But on checkout page when I hit "Place Order" there is error message displayed: Internal Server Error.

Info from logs:

2021/05/13 09:36:35 [error] 16899#16899: *11 FastCGI sent in stderr: "PHP message: PHP Warning: Attempt to read property "rate" on null in /var/www/website/wp-content/plugins/monero-woocommerce-gateway/include/class-monero-gateway.php on line 757PHP message: PHP Fatal error: Uncaught DivisionByZeroError: Division by zero in /var/www/website/wp-content/plugins/monero-woocommerce-gateway/include/class-monero-gateway.php:238

Stack trace:

#0 /var/www/website/wp-content/plugins/woocommerce/includes/class-wc-checkout.php(971): Monero_Gateway->process_payment()

#1 /var/www/website/wp-content/plugins/woocommerce/includes/class-wc-checkout.php(1186): WC_Checkout->process_order_payment()

#2 /var/www/website/wp-content/plugins/woocommerce/includes/class-wc-ajax.php(466): WC_Checkout->process_checkout()

#3 /var/www/website/wp-includes/class-wp-hook.php(292): WC_AJAX::checkout()

#4 /var/www/website/wp-includes/class-wp-hook.php(316): WP_Hook->apply_filters()

#5 /var/www/website/wp-includes/plugin.php(484): WP_Hook->do_action() `

6 /var/www/website/wp-content/plugins/woocommerce/includes/class-wc-ajax.php(90): do_action()`

#7 /var/www/website/wp-includes/class-wp-hook.php(292): WC_AJAX::do_wc_ajax()

#8 /var/www/website/wp-includes/class-wp-hook.php(316): WP_Hook->apply_fil" while reading response header from upstream, client: 127.0.0.1, server: toraddress.onion, request: "POST /?wc-ajax=checkout HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "toraddress.onion", referrer: "http://toraddress.onion/checkout/"

Probably plugin can't get proper Monero price from ???somewhere??? Because when I put shortcode [monero-price currency="USD"] it shows 1 XMR = 0.00000 USD

logs: 2021/05/13 09:47:45 [error] 16899#16899: *48 FastCGI sent in stderr: "PHP message: PHP Warning: Attempt to read property "rate" on null in /var/www/website/wp-content/plugins/monero-woocommerce-gateway/include/class-monero-gateway.php on line 757" while reading upstream, client: 127.0.0.1, server: toraddress.onion, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "toraddress.onion", referrer: "http://toraddress.onion/checkout/"

The issue is probably related to this: include/class-monero-gateway.php $currencies = implode(',', self::$currencies); $api_link = 'https://min-api.cryptocompare.com/data/price?fsym=XMR&tsyms='.$currencies.'&extraParams=monero_woocommerce';

When I visit cryptocompare API link i see json with line:

Message | "You are over your rate limit please upgrade your account!"

serhack commented 3 years ago

Unfortunately cryptocompare API recently added rate limit for commercial projects. I'll probably change the API price to Coingecko.

ghost commented 3 years ago

Awesome. Cant wait another release with all updates and bug fixes. Fingers crossed. You are the only person who created free, working Monero plugin for WooCommerce.

serhack commented 3 years ago

Fixed.