Rewrite plugin to v3.0#69
Conversation
| jQuery('#monero_toast').append(toast); | ||
| toast.animate({ "right": "12px" }, "fast"); | ||
| setInterval(function() { | ||
| toast.animate({ "right": "-400px" }, "fast", function() { |
There was a problem hiding this comment.
Correct, negative values are valid for top, left, bottom, right and are used to hide something off screen.
There was a problem hiding this comment.
To hide something on screen: display: none.
There was a problem hiding this comment.
Alright, well you're not understanding why -400px is used... The notification is animated off-screen. Please don't resort to personal attacks.
There was a problem hiding this comment.
I'm sorry. My intent was not to attack you on personal. However I appreciate your work.
| }; | ||
| setInterval(monero_fetchDetails, 30000); | ||
| monero_updateDetails(); | ||
| new ClipboardJS('.clipboard').on('success', function(e) { |
There was a problem hiding this comment.
I do not know why you need to add some random JS library for "Clipboarding".
There was a problem hiding this comment.
Because it's not standard across browsers, and mobile platforms, which is why clipboard.js exists in the first place. Originally I did not use a library and it wasn't cross-platform.
There was a problem hiding this comment.
Why do you have to copy a string on mobile when you can click on a link monero:// which will open a Monero wallet (Monerujo and Cakewallet supports monero:// )?
There was a problem hiding this comment.
If this is a serious objection, then clipboarding can be done the way the masari plugin does it, however clipboard.js isn't a heavy framework, but I understand if you want to drop it.
| Group=moneroservices | ||
| WorkingDirectory=/opt/monero-wallets | ||
| Type=simple | ||
| ExecStart=/opt/monero-bin/monero-wallet-rpc --wallet-file /opt/monero-wallets/woocommerce --rpc-bind-port 18080 --password-file /opt/monero-wallets/woocommerce.password --disable-rpc-login --log-file /var/log/monero-wallet.log |
There was a problem hiding this comment.
--disable-rpc-login ? Do you know what will happen if the rpc-login is disabled?
There was a problem hiding this comment.
Am I missing where the original WP plugin used authorization? Not being snarky.
| add_action('wp', 'monero_activate_cron'); | ||
| function monero_activate_cron() { | ||
| if(!wp_next_scheduled('monero_update_event')) { | ||
| wp_schedule_event(time(), 'one_minute', 'monero_update_event'); |
There was a problem hiding this comment.
The problem with the way the current plugin works is that it only does payment checking logic when the order confirmation page is refreshed. So if a user leaves the order confirmation page, then their order will never confirm. Cron is necessary for allowing users to leave the page, and still have their order confirmed, especially if a merchant sets confirms to 10+. If you feel once a minute is too often, that can be changed.
There was a problem hiding this comment.
Imagine having running 200 cronjobs at the same time. I still disagree for running cronjobs when users leaves the order confirmation page.
There was a problem hiding this comment.
To be clear, the plugin only runs one cronjob for all payments. It does two things:
- Fetches the price so live exchange rates can be displayed on the site, or used for displaying prices in XMR on the frontend
- Checks for pending orders, and if there are any, checks for payments
There was a problem hiding this comment.
We have already had a sort of cronjob for live exchange rates.
There was a problem hiding this comment.
I did not see that anywhere in the code grep -Ri cron monerowp returns nothing.
This may be a disagreement of how the plugin should work. In my opinion if a merchant wants to require 10 confirms, it's not nice to make the user stay on the order confirmation for 20 minutes (at least, could be more), and if they close it, the payment never confirms.
There was a problem hiding this comment.
I know this PR is closed, but for the time that you re-look at this code I wanted to add:
Right now the current plugin actually runs the same payment checking code that this cron job does every 17 seconds, so this code should actually be more efficient.
There was a problem hiding this comment.
This, or something like this, is critical to include indeed. It is unacceptable that the page cannot be closed or the order will not fulfill.
| @@ -1,9 +1,9 @@ | |||
| === Monero WooCommerce Extension === | |||
| Contributors: serhack | |||
| Contributors: serhack, mosu-forge | |||
There was a problem hiding this comment.
If this PR is merged, then he is indeed a contributor and this should be here.
|
In particular, you are using mixed content. Some variables are sent to database without a prevent escaping. "Rewriting" is a very big word. You should simplify things, not adding Javascript framework and libraries to random. Moving and splitting the code in multiple files is not "rewriting a payment gateway". |
|
@serhack responded to all the comments above, except the license / author questions. If there's a place I did not escape a MySql statement, that should be updated, can you point it out please? There is a lot more than moving and splitting code, if you don't want to call it a re-write, then that's okay, just call it a version bump. |
I disagree on splitting code into multiple files. |
There are only a few key places I split code:
|
|
It's simple! XMR payments by Mosu works like a charm. |
|
Personally I do agree with some of the splitting into several files. Having all the code (including inline HTML/CSS/JS) is rather messy |
|
I disagree, but I love community input. I recognize Monero Integrations Payment gateway for woocommerce has some issues on UX. |
|
This seems to be a larger rewrite, at first glance. Looks like a proper effort! Maybe OP of the project and @mosu-forge can talk together and adapt this PR to a mergeable state, with respect to Copyright and small code cleanups and all that. Otherwise why not fork it and keep developing anyways? :) |
|
I'm reopening this. |
|
This will be the base for the next version the third one. I'll include some features like subaddresses integration and I'll try to avoid as much as possible any JS framework. |
|
This, or something like this, is critical to get working correctly. The current WP plugin is broken as is, and many of the griefs I had of the old one are addressed here. |
v3.0 includes major reworking of how the plugin works: