-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update the shipping time controllers to handle the maximum shipping time #2590
Update the shipping time controllers to handle the maximum shipping time #2590
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## update/shippings-settings-phase-1 #2590 +/- ##
=====================================================================
+ Coverage 65.2% 66.3% +1.0%
- Complexity 4588 4598 +10
=====================================================================
Files 803 475 -328
Lines 23012 17927 -5085
Branches 1234 0 -1234
=====================================================================
- Hits 15012 11879 -3133
+ Misses 7833 6048 -1785
+ Partials 167 0 -167
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@jorgemd24 I see one potential issue in the controller where you can set
|
Another potential issue I see is that we don't require
|
Thanks, @puntope, for your helpful review! I've made the changes based on your comments. Could you please take another look? Thanks! |
protected function get_args_schema(): array { | ||
$schema = $this->get_schema_properties(); | ||
$schema['time']['required'] = true; | ||
$schema['max_time']['required'] = true; | ||
return $schema; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious. Why we cannot just add the 'required' in the array inside get_schema_properties
method ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was my initial approach, but the schema is shared between the GET
and POST
methods. If I make time
and max_time
required, the UI will also need to include those query parameters when fetching the times.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jorgemd24 for the adjustments validating the request.
Now LGTM
I left just one question regarding where we place the required arg.
8ffaa67
into
update/shippings-settings-phase-1
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