Commit Graph

25 Commits

Author SHA1 Message Date
Denis Dvali 15ad616a2f Pass request uri argument for more explicit function call. 2020-02-03 15:47:04 +03:00
Denis Dvali cdb611e924 Small refactor to improve readablity. 2020-01-30 12:56:52 +03:00
Denis Dvali ed918f5105 Adding fallback in case "Authorization" or "X-Woo-Signature" headers are not present.
Check if access token and request signature set in query arguments if the headers are missing.
2020-01-30 12:53:57 +03:00
Claudio Sanches 174a722adf
Merge pull request #25131 from woocommerce/remove-wccom-site-api-permalink-require
Remove permalink reliance
2019-12-03 17:48:23 -03:00
Claudio Sanches cbeb95379e Fixed PHPCS warnings and code clean up 2019-12-03 14:04:15 -03:00
Justas Butkus 34f54071bb Revert "Build the REST API URL before checking for wccom-site"
This reverts commit 0674b421ec.
2019-12-03 09:20:28 +02:00
Claudio Sanches 0674b421ec Build the REST API URL before checking for wccom-site 2019-12-02 17:37:48 -03:00
Justas Butkus e0613db386 Account for early start-up phase
Using `$wp` doesn't work in certain scenarios, where the entire system
didn't complete bootstrapping.
The raw query, after escaping the values, should sufficiently cater for
the need.
2019-12-02 21:56:42 +02:00
Justas Butkus dbc0c5ab85 Remove permalink reliance
Some sites don't have permalinks enabled (e.g. local dev environments) and
can't use the WC site API functionality.

The `rest_get_url_prefix` elsewhere is only used in permalink context (e.g.
`get_rest_url` uses it conditionally), while `$wp->query_vars` are always
populated, even in rewrite condition, thus making them more accessible.
2019-11-27 21:45:21 +02:00
Denis Dvali 4bc4faf7af Adding new explicit error codes for WC.COM installer API authentication errors. 2019-11-25 19:32:10 +03:00
Denis Dvali 234bb9139f Move "no permissions" error data (error code, message, http code) to
a constant within a dedicated error messages class.
2019-11-25 13:46:07 +03:00
Rommel Castro 67091782f8
Includes WC_WCCOM_Site_Installer_Requirements_Check class 2019-09-30 15:15:11 -06:00
Claudio Sanches eac2d39edf Better naming for REST API endpoints 2019-07-15 13:19:03 -03:00
Claudio Sanches 3fd0eb7391 Merge branch 'add/wccom-site-rest-api' of github.com:woocommerce/woocommerce into add/wccom-site-rest-api 2019-07-15 13:13:53 -03:00
Claudio Sanches 396bbe4cf5 Fixed doc blocks and coding standards 2019-07-15 13:13:16 -03:00
Akeda Bagus 3f9bbf5a3b
Replace __DIR__ with WC_ABSPATH. 2019-07-15 23:07:34 +07:00
Claudio Sanches d339a29468 Fixed standards 2019-07-15 12:58:41 -03:00
Akeda Bagus c8812a205b
Add helper method get_authorization_header.
This to support scenario in which HTTP_AUTHORIZATION being stripped
and use getallheaders as a fallback. This helper method is copied from
class-wc-rest-authentication.php.
2019-07-15 22:47:07 +07:00
Akeda Bagus 47db7588d7
Use hash_equals when checking access_token. 2019-07-15 22:03:31 +07:00
Akeda Bagus 0ffd4db630
Move authentication to WCCOM Site API to wccom-site main class. 2019-07-15 21:59:48 +07:00
Akeda Bagus 0891e0c85f
Remove extra docblock line. 2019-07-15 18:45:50 +07:00
Akeda Bagus f51265e58d
Add @since tag. 2019-07-15 15:42:36 +07:00
Akeda Bagus fc7cacb711
Fix coding standard issues. 2019-07-11 19:58:16 +07:00
Akeda Bagus 40201eb9c3
Register wccom-site rest in main class.
With API moved to its own package (see #23957), controllers for wccom-
site namespace are now registered in wccom-site main class.
2019-07-11 18:19:08 +07:00
Akeda Bagus d51e843190
Move WCCOM Site related files to `/wccom-site` directory.
Also use queue when installing products so API can respond immediately.
2019-07-11 16:01:53 +07:00