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

Add credentials validation and required field notice for Payfast in sandbox environment. #260

Merged
merged 5 commits into from
Nov 1, 2024

Conversation

iamdharmesh
Copy link
Member

@iamdharmesh iamdharmesh commented Oct 1, 2024

All Submissions:

  • Does your code follow the WooCommerce Sniffs variant of WordPress coding standards?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully run tests with your changes locally?
  • Will this change require new documentation or changes to existing documentation?

Changes proposed in this Pull Request:

This PR adds credentials validation in the Payfast payment settings when the settings are saved and displays a corresponding notice. It also makes changes to show a required credentials field notice when the credentials are blank, and it prevents Payfast from appearing on the front-end checkout page. Previously, this required notice was only implemented for the production environment. This PR ensures it works for the sandbox environment as well.

Closes #216

Steps to test the changes in this Pull Request:

  1. Remove all Payfast credentials from the settings and save the settings.
  2. Verify that a notice with the required fields error is visible.
  3. Try saving invalid credentials and verify that the merchant is prompted with an invalid credentials error.

Changelog entry

Add - Credentials validation and required field notice for PayFast in the sandbox environment.

@iamdharmesh iamdharmesh self-assigned this Oct 1, 2024
@iamdharmesh iamdharmesh added this to the Future Release milestone Oct 1, 2024
@iamdharmesh iamdharmesh requested a review from dkotter October 1, 2024 09:41
@ankitguptaindia
Copy link
Member

QA Status: Needs feedback

Thanks, @iamdharmesh, for the fixes! I’ve identified scenarios that need to be addressed.

Fields Required Tests:

  • When all fields are empty, it shows the correct message. ✅
  • When any single field is empty and others are filled, it displays a notice. ✅
  • When fields are empty and settings are saved, the PayFast option should not appear on the checkout page. ✅

Credentials Verification:

  • When invalid credentials are entered, it should display an error. ✅
  • When invalid credentials are entered, the PayFast option should not be visible on the checkout page. ⚠️

When the admin adds invalid credentials, a warning notice is displayed in the backend, but the PayFast payment option still appears on the checkout page. Is it possible to hide the PayFast option on the frontend when the credentials are invalid?

Recording.913.mp4

@iamdharmesh
Copy link
Member Author

Thanks for testing this @ankitguptaindia,

When the admin adds invalid credentials, a warning notice is displayed in the backend, but the PayFast payment option still appears on the checkout page. Is it possible to hide the PayFast option on the frontend when the credentials are invalid?

Sure, I had added normal credentials validation to show only notice. But now I have updated it to strict validation where notice will be keep showing and payment gateway will not display in the front-end until merchant enter the correct credentials. Could you please help to check once now.

Thank you.

@ankitguptaindia
Copy link
Member

QA/Test Report-

Testing Environment -

  • WordPress: 6.6.2
  • Theme active on store: Twenty Twenty-Four Version: 1.2
  • WooCommerce - Version 9.3.3
  • PHP: 8.3
  • Web Server: Nginx
  • Browser: Chrome - Version 129
  • OS: macOS Sonoma 14.6.1

Test Results -

Fields Required Tests:

  • When all fields are empty, it shows the correct message. ✅
  • When any single field is empty and others are filled, it displays a notice. ✅
  • When fields are empty and settings are saved, the PayFast option should not appear on the checkout page. ✅

Credentials Verification:

  • When invalid credentials are entered, it should display an error. ✅
  • When invalid credentials are entered, the PayFast option should not be visible on the checkout page. ✅

@ankitguptaindia
Copy link
Member

Regression+Smoke Test Report-

Testing Environment -

  • WordPress: 6.3.2
  • Theme: Twenty Twenty-Four Version: 1.2
  • WooCommerce - Version 9.3.3
  • PHP: 8.3
  • Web Server: Nginx
  • Browser: Chrome - Version 129
  • OS: macOS Sonoma 14.5

Tested with Archive File created via woorelease command.

  • Composer version - v2.3.5
  • npm version - v10.1.0
  • node version - v20.7.0

Please note that this plugin has been tested with the build created by the specified versions ☝🏼 of Composer, Node, and NPM.

Status- Working as expected. Ready to merge 🚀

@vikrampm1 vikrampm1 modified the milestones: Future Release, 1.6.8 Nov 1, 2024
@vikrampm1 vikrampm1 marked this pull request as ready for review November 1, 2024 15:55
@vikrampm1 vikrampm1 merged commit 672ff9e into trunk Nov 1, 2024
5 checks passed
@vikrampm1 vikrampm1 deleted the fix/216 branch November 1, 2024 15:55
@vikrampm1 vikrampm1 mentioned this pull request Nov 1, 2024
19 tasks
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.

Credential validation
4 participants