Plugin Directory

Changeset 903309


Ignore:
Timestamp:
04/27/2014 12:59:42 AM (12 years ago)
Author:
gesman
Message:

Fix for error getting exchange rate for certain rare currencies

Location:
bitcoin-payments-for-woocommerce/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • bitcoin-payments-for-woocommerce/trunk/bitcoinway-woocommerce.php

    r899647 r903309  
    66Plugin URI: http://www.bitcoinway.com/
    77Description: Bitcoin Payments for WooCommerce plugin allows you to accept payments in bitcoins for physical and digital products at your WooCommerce-powered online store.
    8 Version: 3.03
     8Version: 3.04
    99Author: BitcoinWay
    1010Author URI: http://www.bitcoinway.com/
  • bitcoin-payments-for-woocommerce/trunk/bwwc-bitcoin-gateway.php

    r899647 r903309  
    160160
    161161                        // Assemble error message.
    162                         $error_msg = "ERROR: Cannot determine exchange rates! {{{ERROR_MESSAGE}}} Make sure your PHP settings are configured properly and your server can (is allowed to) connect to external WEB services via PHP.";
     162                        $error_msg = "ERROR: Cannot determine exchange rates (for '$store_currency_code')! {{{ERROR_MESSAGE}}} Make sure your PHP settings are configured properly and your server can (is allowed to) connect to external WEB services via PHP.";
    163163                        $extra_error_message = "";
    164164                        $fns = array ('file_get_contents', 'curl_init', 'curl_setopt', 'curl_setopt_array', 'curl_exec');
  • bitcoin-payments-for-woocommerce/trunk/bwwc-include-all.php

    r899647 r903309  
    99if (!defined('BWWC_PLUGIN_NAME'))
    1010  {
    11   define('BWWC_VERSION',           '3.03');
     11  define('BWWC_VERSION',           '3.04');
    1212
    1313  //-----------------------------------------------
  • bitcoin-payments-for-woocommerce/trunk/bwwc-utils.php

    r899647 r903309  
    600600    $requested_cache_method_type = $rate_retrieval_method . '|' . $rate_type;
    601601    $ticker_string = "<span style='color:darkgreen;'>Current Rates for 1 Bitcoin (in {$currency_code})={{{EXCHANGE_RATE}}}</span>";
    602     $ticker_string_error = "<span style='color:red;background-color:#FFA'>WARNING: Cannot determine exchange rates! {{{ERROR_MESSAGE}}} Make sure your PHP settings are configured properly and your server can (is allowed to) connect to external WEB services via PHP.</span>";
     602    $ticker_string_error = "<span style='color:red;background-color:#FFA'>WARNING: Cannot determine exchange rates (for '$currency_code')! {{{ERROR_MESSAGE}}} Make sure your PHP settings are configured properly and your server can (is allowed to) connect to external WEB services via PHP.</span>";
    603603
    604604
     
    711711    $rate_obj = @json_decode(trim($result), true);
    712712
     713    if (!is_array($rate_obj))
     714        return false;
     715
     716
     717    if (@$rate_obj['24h_avg'])
     718        $rate_24h_avg = @$rate_obj['24h_avg'];
     719    else if (@$rate_obj['last'] && @$rate_obj['ask'] && @$rate_obj['bid'])
     720        $rate_24h_avg = ($rate_obj['last'] + $rate_obj['ask'] + $rate_obj['bid']) / 3;
     721    else
     722        $rate_24h_avg = @$rate_obj['last'];
    713723
    714724    switch ($rate_type)
    715725    {
    716         case 'vwap' :               return @$rate_obj['24h_avg'];
     726        case 'vwap' :               return $rate_24h_avg;
    717727        case 'realtime' :       return @$rate_obj['last'];
    718728        case 'bestrate' :
    719         default:                        return min (@$rate_obj['24h_avg'], @$rate_obj['last']);
     729        default:                        return min ($rate_24h_avg, @$rate_obj['last']);
    720730    }
    721731}
  • bitcoin-payments-for-woocommerce/trunk/readme.txt

    r899647 r903309  
    4747        WooCommerce -> Settings -> Checkout -> Bitcoin
    4848        and paste the value of Master Public Key into "Electrum wallet's Master Public Key" field.
    49 9.  Press [Save changes]
    50 10. If you do not see any errors - your store is ready for operation and to access payments in bitcoins!
     499.  Select "Bitcoin service provider" = "Your own Electrum wallet" and fill-in other settings at Bitcoin management panel.
     5010. Press [Save changes]
     5111. If you do not see any errors - your store is ready for operation and to access payments in bitcoins!
     5212. Please donate BTC to:  12fFTMkeu3mcunCtGHtWb7o5BcWA9eFx7R  or via Paypal to:  donate@bitcoinway.com
     53    All supporters will be acknowledged and listed within plugin repository!
    5154
    5255
     
    7780
    7881== Changelog ==
     82
     83= 3.04 =
     84* Fixed 'cannot determine exchange rates' error for certain rare currencies.
    7985
    8086= 3.03 =
Note: See TracChangeset for help on using the changeset viewer.