Commit Graph

9 Commits

Author SHA1 Message Date
Nestor Soriano 436a3db6e4 Fix code standards errors 2021-02-16 09:23:50 +01:00
Nestor Soriano 00d6dc40f7 Fix wrong caching of taxonomy in terms and attributes controllers.
The WC_REST_Terms_Controller and WC_REST_Product_Attributes_V1_Controller
classes have a get_taxonomy method that gets the name of the taxonomy
to process from a taxonomy id passed in the request, but once the
taxonomy name has been obtained it's cached and sbsequently reused.
The problem is that these controller instances are reused if more than
one request is processed programmatically, and thus the taxonomy that
was cached once is always used even if the new request specifies a
different taxonomy id.

The fix consists of using a dictionary of taxonomy id - taxonomy name
instead of one single taxonomy for caching.

In the case of WC_REST_Terms_Controller there's a protected $taxonomy
property that needs to be kept for compatibility, it's now set to
the last taxonomy name that has been introduced in the dictionary.
2021-02-12 15:12:58 +01:00
vedanshujain b0cc43a188 More for individual fields in responses for V2 and V3 products and orders endpoints. 2021-01-06 16:04:56 +05:30
vedanshujain e546c237b7 Add tests for checking all fields are returned even requested individually. 2021-01-06 15:12:55 +05:30
vedanshujain 1fdc24daa9 Add unit test for verifying that all expected fields are present. 2021-01-06 14:19:26 +05:30
jonathansadowski 1e267980e8
Merge pull request #28723 from woocommerce/feature/issue-27208
Feature/issue 27208
2021-01-05 14:00:55 -06:00
roykho b25f01d2f3
Add unit tests 2021-01-05 08:14:39 -08:00
vedanshujain 818e24d5c5 Add protection around `func_get_arg` method for backward compatibility.
We are using func_get_arg method to receive argument in a backward compatible way since we cannot modify function signature to add more params even with default params. Earlier I was hoping to use DI to create another child class with modified signature and load it depending upon where we are executing from, however since we had to revert DI, we add this workaround to unblock #27735.
2020-12-28 14:10:22 +05:30
vedanshujain 62ae94d93e Add shipping, tax and fee lines to refund response for better information. 2020-11-11 18:47:48 +05:30