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

Fix coding standards & introduce GitHub action. #147

Merged
merged 16 commits into from
Dec 15, 2023
Merged

Conversation

peterwilsoncc
Copy link
Contributor

@peterwilsoncc peterwilsoncc commented Jul 25, 2023

Issue: #89

Ticket:

Slack Thread:


Description

  • Fixes all the coding standards warnings and errors for the plugin.
  • Introduces a GitHub action for sniffing the coding standards.

Most of the missing @since annotations were for really old functions so I used the version number 1.4.13 as that was the earliest available tag in the check-in so I could be sure that the functions were included in that version.

Most of the changes are cosmetic but there are a few changes that might have side effects:

  • changes to strict comparisons
  • yoda-ing comparisons
  • changes to recommended functions (eg json_encode to wp_json_encode)

I left this line unchanged as modifying it requires a significant refactor that is probably best done as a dedicated PR to make sure nothing breaks.

I also left urlencode calls as is, I didn't want to risk the payfast API chocking on %20 in place of +.

Steps to Test

This changes much of the plugin, there are main class includes 513 changes (about 1/3rd of the file). The following items should be checked:

  • Purchases
    • Standard
    • Pre-order
    • Subscription
    • Subscription renewal
    • Subscription cancellation
    • Unsuccessful payment
  • Privacy exports
    • Standard orders removed
    • Inactive subscriptions removed
    • Active subscription retained (needed for cancelling)

Documentation

  • This PR needs documentation (has the "Documentation" label).

Changelog Entry

Dev - Resolve coding standards issues.

Closes #89 .

@peterwilsoncc peterwilsoncc self-assigned this Jul 25, 2023
@peterwilsoncc peterwilsoncc force-pushed the fix/89-phpcs-sniffs branch 3 times, most recently from 3d9f17e to 7efa4d6 Compare July 25, 2023 04:56
@peterwilsoncc peterwilsoncc changed the title Fix/89 phpcs sniffs Fix coding standards & introduce GitHub action. Jul 25, 2023
@vikrampm1 vikrampm1 added this to the Future Release milestone Jul 25, 2023
@peterwilsoncc peterwilsoncc requested a review from dkotter July 25, 2023 23:28

steps:
- name: Checkout
uses: actions/checkout@v2
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggest we update this to v3

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in 9e59aff.

*
* @return string
*/
protected function _generate_parameter_string( $api_data, $sort_data_before_merge = true, $skip_empty_values = true ) {
protected function _generate_parameter_string( $api_data, $sort_data_before_merge = true, $skip_empty_values = true ) { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore
Copy link
Contributor

Choose a reason for hiding this comment

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

Wondering if we should globally disable this rule since we're having to ignore that on multiple lines within this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wondering if we should globally disable this rule since we're having to ignore that on multiple lines within this file?

Done in aac4e4d. I excluded the rule for this file only as none of the other files were affected.

@dkotter dkotter requested a review from ankitguptaindia July 31, 2023 16:38
@vikrampm1
Copy link
Contributor

@ankitguptaindia This has been in QA status for a while now, so bumping this up in your queue.

@ankitguptaindia
Copy link
Member

Hello @peterwilsoncc Could you please fix the conflict in this PR?

# Conflicts:
#	.github/workflows/php-compatibility.yml
#	gateway-payfast.php
@peterwilsoncc
Copy link
Contributor Author

@ankitguptaindia The merge conflicts are resolved.

@ankitguptaindia
Copy link
Member

ankitguptaindia commented Oct 7, 2023

Simple Product Purchase:

  • Order Updated. ✅
  • ITN Updated ✅

Subscription Purchase:

  • Order Updated ✅
  • ITN Updated ✅

Renewal Subscription (from customer side):

  • Order Updated ✅
  • ITN Updated ✅

Subscription Cancellation:

  • From Customer Side ✅

Subscription Reactivation and Payment (from customer side):

  • Order Updated ✅
  • ITN Updated ✅

Unsuccessful Payment:

  • Order Updated ✅

Canceled Transactions: ✅

Screenshot 2023-10-07 at 5 29 59 PM


QA Updates - WIP

Remains - Pre-order, Privacy exports (need to discuss with Dev)

@peterwilsoncc
Copy link
Contributor Author

@ankitguptaindia Following up your slack message re:privacy exports:

Firstly, I made a typo and meant erasing private data, wp-admin/erase-personal-data.php.

The plugin ties in to the WordPress functionality for erasing data and will remove a customers orders when their email is entered on the screen above.

Subscriptions

  • Orders containing active or on-hold subscriptions are retained
  • Orders containing subscriptions with other status are removed, the payfast payment token is deleted first. Source code.

Pre-orders

  • Pre-orders are deleted and the pre-order tokens are removed as part of this, this is to ensure the user is not charged when the pre-order release date arrives.

@ankitguptaindia
Copy link
Member

I tested this PR by following the provided instructions. I encountered some issues during the testing, but these issues are not specific to the changes made in this PR. I was able to reproduce these issues with older versions of the PayFast extension, including versions 1.5.0, 1.5.5, and 1.5.8. I have reported these issues separately for further discussion and potential fixes.

The issues reported are as follows:

The PR functions the same way as the stable version of this extension.

@jeffpaul
Copy link
Contributor

@faisal-alvi when we get back to the PHPCS work, please look at merging in or pulling across work from @peterwilsoncc's PR here into #160 so that we've got a single PR that handles these updates for PayFast... thanks!

@faisal-alvi
Copy link
Member

#160 is merged in the trunk, we can now merge the trunk here and proceed with the pending work.

@jeffpaul
Copy link
Contributor

jeffpaul commented Dec 4, 2023

@faisal-alvi would you please help take over this PR to handle that trunk merge & getting any additional/helpful changes from this PR ready for final review/merge?

@faisal-alvi faisal-alvi requested a review from dkotter December 12, 2023 08:54
@vikrampm1 vikrampm1 modified the milestones: Future Release, 1.6.1 Dec 15, 2023
@vikrampm1 vikrampm1 marked this pull request as ready for review December 15, 2023 12:31
@vikrampm1 vikrampm1 merged commit 9567bbc into trunk Dec 15, 2023
5 checks passed
@vikrampm1 vikrampm1 deleted the fix/89-phpcs-sniffs branch December 15, 2023 12:31
@vikrampm1 vikrampm1 mentioned this pull request Jan 5, 2024
21 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.

Add PHPCS GitHub Action and resolve PHPCS errors
6 participants