Skip to content
This repository was archived by the owner on Oct 4, 2019. It is now read-only.

Conversation

@emdashcodes
Copy link

This PR adds endpoints for getting a list of supported currencies, along with their name and symbol broken out. Includes tests.

It implements three new endpoints:

  • /wc/v3/data/currencies which returns a list of all supported currency codes, their currency name, and symbol as separate fields.
  • /wc/v3/data/currencies/$currency which returns a currency code, name, and symbol for a specific currency.
  • /wc/v3/data/currencies/current which returns a currency code, name, and symbol, for the currency that is currently being used on the site.

To Test:

  • Run phpunit and make sure all tests pass.
  • Visit /wc/v3/data/currencies/ using postman or another tool and look at responses.

Fixes #2.
See previous PR/discussion at #8.

Copy link
Contributor

@claudiosanches claudiosanches left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good and should now solve all use cases.
Great work!

),
'schema' => array( $this, 'get_public_item_schema' ),
) );
register_rest_route( $this->namespace, '/' . $this->rest_base . '/(?P<currency>[\w-]+)', array(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good and this is just a note, but this is a regex, so it's possible to limit to only 3 characters and should make easy for current.

@emdashcodes emdashcodes merged commit 6c7e95e into master Jun 6, 2017
@emdashcodes emdashcodes deleted the add/data-currency-endpoints branch June 6, 2017 16:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants