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
Make sure your test site has a few orders
Create a couple of more orders where the customer's name is charge
Refund one of the transactions
Browse to Payments > Transactions and search for charge
It will show you all charge type transactions, and also a refund transaction.
Additional context
Came up while working on the View report links on the payment activity widget.
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 variousView 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
orrefund
.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 forcharge
is used in theCharges
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
ortypeIsNot
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
charge
Payments > Transactions
and search forcharge
charge
type transactions, and also arefund
transaction.Additional context
Came up while working on the
View report
links on the payment activity widget.