RadarsofthouseDev / billwerk-plus-pay-for-magento2

Billwerk+ Pay for Magento 2
GNU General Public License v3.0
1 stars 12 forks source link

ApplePay is showing even in unsupported browser/devices #18

Closed sm131313 closed 2 months ago

sm131313 commented 3 months ago

Magento 2.4.6-p6 Billwerk V 1.2.46 Aheadworks One page checkout (https://aheadworks.com/one-step-checkout-extension-for-magento-2)

We went from -p5 (everything working fine) to -p6 and now start to see Apple Pay showing up on the frontend in checkout, e.g. in Google Chrome PC or in Android. Did not happen prior to it. Apple Pay should only be visible in supported devices/browsers.

I believe this happened after the latest critical p6 patch that patched the checkout for exploitation.

beautycos commented 3 months ago

We see exactly same issue.

sm131313 commented 3 months ago

Our developer investigated a bit more and found it could also come along with radarsofthouse/reepay upgrade from 1.2.44 to 1.2.46 since we updated it the same time as we patched. The extension has removed user agent check that was present before (I don't know, maybe they add something new that doesn't work properly now). Possibly (guessing only) it is described as "Removed PHP payment validation" https://github.com/RadarsofthouseDev/billwerk-plus-payment-for-magento2/releases/tag/1.2.46)

I think it's better if investigated properly and fixed.

beautycos commented 3 months ago

I think it could be due to the update for reepay module, as it should fix a problem where Google Pay doesnt show in checkout. But yes we also patched and updated reepay module today, so it is still also possible it could be the patch.

RadarsofthouseDev commented 3 months ago

@sm131313 Could you please send me your website URL to support@radarsofthouse.dk? I just want to check something on Aheadworks one-step-checkout.

beautycos commented 3 months ago

@RadarsofthouseDev we use onestepcheckout ( https://www.onestepcheckout.com/magento-2 ) and have same issue.

RadarsofthouseDev commented 3 months ago

@beautycos Noted. I will check onestepcheckout as well.

sm131313 commented 3 months ago

User-agent check method was removed in the newest version:

file: vendor/radarsofthouse/reepay/Model/Reepayapplepay.php

public function isAvailable(\Magento\Quote\Api\Data\CartInterface $quote = null) { $user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ''; if (stripos($user_agent, 'Edg') !== false) { return false; } elseif (stripos($user_agent, 'Chrome') !== false) { return false; } elseif (stripos($user_agent, 'Safari') !== false) { return parent::isAvailable($quote); } else { return false; } }

RadarsofthouseDev commented 3 months ago

User-agent check method was removed in the newest version:

file: vendor/radarsofthouse/reepay/Model/Reepayapplepay.php

public function isAvailable(\Magento\Quote\Api\Data\CartInterface $quote = null) { $user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ''; if (stripos($user_agent, 'Edg') !== false) { return false; } elseif (stripos($user_agent, 'Chrome') !== false) { return false; } elseif (stripos($user_agent, 'Safari') !== false) { return parent::isAvailable($quote); } else { return false; } }

@sm131313 @beautycos Yes, we have removed the PHP validation since it is not the same as the validation on the generic payment window. We removed the PHP validation for both Apple Pay and Google Pay. The right solution is that we need to implement the JavaScript validation that Billwerk+ provided.

Reference to Billwerk+ documentation:

Now, I can make it work with the standard checkout of Magento, but I could not test it with onestepcheckout. I need help from you guys to test the code on Aheadworks one-step-checkout and onestepcheckout.com. I'm making a .patch file and will send it to you guys via email soon.

RadarsofthouseDev commented 2 months ago

@sm131313 and @beautycos Thank you for your collaboration in testing the patch with onestepcheckout. I have updated the module to V 1.2.47. I will close this issue now.