Finally figured out why I get devided by zero errors: the MTgox address has a "data" prefix now.
I don't have enough knowledge to fix the code and write a patch, but this is what I figured out so far: The adress in line 371 in uc_bitcoin.module should be https://data.mtgox.com/api/1/BTC' . $order->currency . '/ticker'. Furthermore, there should be some code added to handle situations where the response code is not successful=200. For example handling code -110 which is returned if the MTgox address is wrong.
function uc_bitcoin_exchange_rate($order) {
...cut away some code...
if (in_array($order->currency, $mtGox_currencies)) { //line 371 of uc_bitcoin.module
if ($response = drupal_http_request('https://data.mtgox.com/api/1/BTC' . $order->currency . '/ticker')) {
if ($response->code == 200) {
$data = json_decode($response->data);
$rate = $data->return->avg->value;
}
} //missing code for response code that are not 200, like -110
}Maybe someone with more knowledge could write a patch and update the module?
For those who want to just use uc_bitcoin and are getting a devided by zero error: go to the uc_bitcoin module on your server. Open uc_bitcoin.module, look for line 371 and add "data." to the mtgox address used to lookup the latest exchange rate.
Comments
Comment #0.0
drsnuggles commentedupdate
Comment #0.1
drsnuggles commentedupdate
Comment #1
dgtlmoon commentedDamn how annoying, and right now data.mtgox.com is a wildcard hostname.
Anyway, committed a fix (2d39436) and made the error checking a little more heavy duty, thanks!
Comment #2
dgtlmoon commentedfixed in latest dev, queued in 7.x-1.32 release
Comment #3
drsnuggles commentedThanks for the fix!
Comment #4.0
(not verified) commentedupdate