Skip to content

Currency conversion (multi-API support) #3093

@MonteShaffer

Description

@MonteShaffer

In Magento2, the webserviceex seems to constantly time out.

This seems to me to suggest a need for an option to select one or more services (possibly with a backup). It could be integrated into a cron task, which is currently configured "D"aily for webservice

See: http://stackoverflow.com/questions/3139879/how-do-i-get-currency-exchange-rates-via-an-api-such-as-google-finance

This contains several APIs solutions to get the currency rates:

https://currency-api.appspot.com/api/USD/EUR.json
note the above doesn't support multiple currencies like the hryvna
https://currency-api.appspot.com/api/USD/UAH.json

GOOGLE:

https://www.google.com/finance/converter?a=1&from=USD&to=UAH
the above is not RESTful but could be easily parsed in a cron script.

Here is an example of how to run from the CLI
http://www.linux-magazine.com/Online/Blogs/Productivity-Sauce/Simple-Bash-Currency-Converter

cconv() {
  wget -qO- "http://www.google.com/finance/converter?a=$1&from=$2&to=$3" |  sed '/res/!d;s/<[^>]*>//g';
}

YAHOO:

http://stackoverflow.com/questions/5777985/need-api-for-currency-converting
http://download.finance.yahoo.com/d/quotes.csv?s={{CURRENCY_FROM}}{{CURRENCY_TO}}=X&f=l1&e=.csv
again cron would need to parse

OR directly via YAHOO [RESTFUL]:
http://query.yahooapis.com/v1/public/yql?q=select%20%2a%20from%20yahoo.finance.xchange%20where%20pair%20in%20%28%22USDUAH%22%29&format=json&env=store://datatables.org/alltableswithkeys&callback=


Personally, I would suggest that the system is updated as follows:

Give users a selection of services:  [Initially, I would suggest Yahoo and Google]
For each service:  develop a cron script to get daily exchange rates 
                                             based on your current system's logic; 
                  for the Google version, since it is not RESTful, 
                                    you would just need to include a parser, 
                                    so "parsing" may be an feature for non-JSON feeds.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions