Closed jorgemd24 closed 1 month ago
Attention: Patch coverage is 77.50000%
with 9 lines
in your changes missing coverage. Please review.
Project coverage is 66.3%. Comparing base (
8f3231f
) to head (af40ca3
). Report is 148 commits behind head on update/shippings-settings-phase-1.
Files with missing lines | Patch % | Lines |
---|---|---|
...trollers/MerchantCenter/ShippingTimeController.php | 85.3% | 5 Missing :warning: |
src/DB/Table/ShippingTimeTable.php | 0.0% | 4 Missing :warning: |
@jorgemd24 I see one potential issue in the controller where you can set -1
as value for time
and 'max_time':
POST wp-json/wc/gla/mc/shipping/times
with {"country_code":"es, "max_time": -1,
time: -1 }
GET wp-json/wc/gla/mc/shipping/times/es
max_time
and time
as -1 Another potential issue I see is that we don't require time
and max_time
which is overrides as 0 is you don't set them.
POST wp-json/wc/gla/mc/shipping/times
with {"country_code":"es, "max_time": 1, time: 1 }
GET wp-json/wc/gla/mc/shipping/times/es
max_time
and time as 1POST wp-json/wc/gla/mc/shipping/times
with {"country_code":"es, "max_time": 2 }
GET wp-json/wc/gla/mc/shipping/times/es
max_time
2 but time as 0 (it shouldn't be 1?) Finally, one extra issue I see is that time
can be set as a bigger number that max_time
POST wp-json/wc/gla/mc/shipping/times
with {"country_code":"es, "max_time": 1, time: 2 }
GET wp-json/wc/gla/mc/shipping/times/es
max_time
1 and time
as 2Thanks, @puntope, for your helpful review! I've made the changes based on your comments. Could you please take another look? Thanks!
Changes proposed in this Pull Request:
Part of pcTzPl-2qP-p2
This PR updates the shipping time controllers to allow for updating and fetching the maximum shipping time, which will be used in a second PR that I’m currently working on for the UI.
Screenshots:
Detailed test instructions:
Prerequisites
/wc/gla/mc/shipping/times
request and check that themax_time
property is now included in the response.POST gla/mc/shipping/times
and the following body:{"country_code":"ES","time":2, "max_time": 3}
GET gla/mc/shipping/times/YOUR_COUNTRY
for exampleGET gla/mc/shipping/times/ES
and check that themax_time
property is now included.Additional details:
Changelog entry