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

Revamp for PHP 8.x and Magento 2 #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

napoly
Copy link

@napoly napoly commented Mar 28, 2024

should resolve: #12

  • adds number of confirmation ability
  • switches to sub-addresses
  • added zero unlock time for tx

For a live demonstration that can be tested, please run a Monero wallet RPC locally (host.docker.internal) and follow the manual setup instructions for Dockerized Magento available at https://github.com/napoly/docker-monero-magento/tree/monero-integration.

@serhack
Copy link
Member

serhack commented Jun 22, 2024

Hey sorry for the wait, but I didn't get any notifications about this :( Did you already try to run it?

@napoly
Copy link
Author

napoly commented Jun 23, 2024

Hey!.. no worries.. yes, there shouldn't be a problem to run it in docker if you follow https://github.com/napoly/docker-monero-magento/tree/monero-integration?tab=readme-ov-file#manual-setup

composer.json Show resolved Hide resolved
@napoly napoly requested a review from serhack October 9, 2024 03:30
$xmr_subaddress = $this->monero_daemon->create_address(0);
setcookie('xmr_subaddress', $xmr_subaddress['address'], time() + 2700);
} else {
$xmr_subaddress = ['address' => $_COOKIE['xmr_subaddress']];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parse the address before set it to $xmr_subaddress otherwise it's an input that might be controlled by an attacker (nothing too sensitive, but..)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sanitized and validated.. pls check

$address_index = $address_index['index']['minor'];
}
else {
return $txs;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's something odd here..

Write

if(!isset(...)){
    return $txs;
}

and move the other branch after that check :) better readability

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done thnx

$txs = $this->check_payment_rpc($payment_id);

// If num_confirmations is 0, simply check if payment has been received
if ($num_confirmations == 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good, I'm thinking about we might want to show something in the settings if num_confirmations == 0. Also, I don't see any check for num_confirmations < 0. Are we sure nobody can actually set that value?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added more info and validation validate-zero-or-greater so it looks like:
lowerthanzero

if(isset($_GET['first'])){

if (isset($_GET['first'])) {
$first = $_GET['first'];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking that we might want to parse and validate all the fields..

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion! I’ve added some basic sanitation for the fields to address potential issues. However, I believe this section might not even be necessary, as the data is already provided and validated in the previous step. Not really part of the bounty.. just fyi
shipping_step
payment_step

Copy link
Member

@serhack serhack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review my comments and adjust as necessary.

Thanks a lot for the contribution!

 - adds number of confirmation ability
 - switches to sub-addresses
 - added zero unlock time for tx
@napoly
Copy link
Author

napoly commented Oct 24, 2024

Thanks! It's still a very rough MVP, but it would be great to hook it up on Packagist so folks can try it out and provide feedback.

@napoly napoly requested a review from serhack October 24, 2024 07:42
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.

Payment Module does not Show up (In admin panel)
2 participants