Givewp: fix: improve deletion of test data

Created on 7 Dec 2017  路  3Comments  路  Source: impress-org/givewp

Issue Overview

Currently deleting the test data at Donations > Tools > Data (tab) deletes donations made when give is in test mode, but not donations made with the test gateway in live mode.

Expected Behavior

Test donations of all types should be deleted.

Current Behavior

Only donations that are made in test mode are deleted.

Possible Solution

Add a check for test gateway during the deletion process.
Related to this, it would be nice to "wipe the slate clean" of _only donation data_ and NOT delete the forms. For when (for example) you want to delete all data but leave forms.

Steps to Reproduce (for bugs)

  1. Create donations in both test and live mode (payment gateways -> enabled/disabled) while using the test gateway.
  2. navigate to donations > tools > data (tab) and delete the Test payments
  3. navigate back to Donations > Donations
  4. only donations made while give is in test mode are deleted.

Acceptance Criteria

  • [x] When Delete Test Donations is selected, it deletes all donations where _give_payment_mode === test (where test indicates any donation made while in Test Mode)
  • [x] When Delete Test Donations is selected, it also deletes all donations where _give_payment_gateway === manual (where manual indicates a donation through the Test Donation gateway).
  • [x] The description reads: Deletes all donations made in Test Mode and all donations made through the Test Donation gateway in Live Mode.
  • [x] The same donations are deleted when Delete Test Donors and Donations is selected.

Most helpful comment

Here's my understanding of what @Benunc is asking to delete when Delete Test Donations is selected:

  • All donations made through any gateway while Test Mode is enabled.

    • This means delete all donations where _give_payment_mode = test.

  • In addition, all donations made with the Test Donation gateway in Live mode.

    • This means delete all donations where _give_payment_gateway = manual.

Acceptance criteria have been updated accordingly.

All 3 comments

@kevinwhoffman Actually, I am confused with this issue behavior. Because if a user selects Delete Test Donations from Donations > Tools > Data (tab) then it should delete the all the test donations NOT all(live + test) types of donations. It is intended behavior.

Please let me know your thoughts on this.

Here's my understanding of what @Benunc is asking to delete when Delete Test Donations is selected:

  • All donations made through any gateway while Test Mode is enabled.

    • This means delete all donations where _give_payment_mode = test.

  • In addition, all donations made with the Test Donation gateway in Live mode.

    • This means delete all donations where _give_payment_gateway = manual.

Acceptance criteria have been updated accordingly.

@kakshak There are 2 queries that need modified. Add a meta query with 'relation' => 'OR' to look for either of the two meta keys as described above.

This query runs whenever Delete Test Donations is selected:
https://github.com/impress-org/give/blob/f3cb229d3d020e00c06e47208b4919790249072f/includes/admin/tools/data/class-give-tools-delete-test-transactions.php#L187-L192

This query runs whenever Delete Test Donors and Donations is selected:
https://github.com/impress-org/give/blob/f3cb229d3d020e00c06e47208b4919790249072f/includes/admin/tools/data/class-give-tools-delete-test-donors.php#L167-L175

Was this page helpful?
0 / 5 - 0 ratings