Automattic / woocommerce-payments

Accept payments via credit card. Manage transactions within WordPress.
https://wordpress.org/plugins/woocommerce-payments/
Other
175 stars 69 forks source link

[Bug] Reporting: Edge case of users with name `charge` or `refund` appearing in unexpected search results #8783

Open nagpai opened 6 months ago

nagpai commented 6 months ago

We recently enabled exact search by type to allow searching / filtering multiple types. This was done as a part of a requirement to have relevant transactions displayed for various View report links within the Payment activity widget. We can now get transactions of multiple types by passing each type as a search param. This however introduces a technical debt.

While this solution does help us to get the required results ( i.e. Transactions of specific multiple types ), it introduces a bug for edge cases where users have a first or last name as charge or refund .

E.g. if we have a user whose name is charge, and they get a refund. The refund transaction will appear within a search for charge . The search param for charge is used in the Charges tile of the Payment activity widget and that would end up showing the refund transaction of Mr. / Mrs./ charge !

The method to use exact search of type names to filter out multiple types, is best a temporary one.

Long term solution

A probable robust solution would involve making the filter component accept multiple typeIs or typeIsNot parameters via an array. This involves more complex changes, but it will help us overcome the bug explained above. Further, it will also help us implement merchant-facing enhancements, such as the advanced filter allowing multiple types for include/exclude filters.

Steps to reproduce bug

Additional context

Came up while working on the View report links on the payment activity widget.

jessy-p commented 5 months ago

This is not a priority for 7.9 as it is a super edge case.