Plugin Directory

Changeset 2859112


Ignore:
Timestamp:
02/02/2023 04:56:09 PM (3 years ago)
Author:
cryptapi
Message:

v4.7.2 - minor fixes

Location:
cryptapi-payment-gateway-for-woocommerce
Files:
6 edited
7 copied

Legend:

Unmodified
Added
Removed
  • cryptapi-payment-gateway-for-woocommerce/tags/4.7.2/CryptAPI.php

    r2849231 r2859112  
    44Plugin URI: https://github.com/cryptapi/woocommerce-cryptapi
    55Description: Accept cryptocurrency payments on your WooCommerce website
    6 Version: 4.7.1
     6Version: 4.7.2
    77Requires at least: 5
    88Tested up to: 6.1.1
  • cryptapi-payment-gateway-for-woocommerce/tags/4.7.2/README.md

    r2849231 r2859112  
    310310* Improvements on the callback processing algorithm
    311311
     312#### 4.7.2
     313* Minor fixes
     314
    312315### Upgrade Notice
    313316#### 4.3
  • cryptapi-payment-gateway-for-woocommerce/tags/4.7.2/controllers/CryptAPI.php

    r2849231 r2859112  
    13341334        }
    13351335
    1336         $total_fee = $this->get_option( 'fee_order_percentage' ) == 'none' ? 0 : $this->get_option( 'fee_order_percentage' );
    1337 
    1338         $fee_order = WC()->cart->subtotal * $total_fee;
    1339 
    1340         if ( $total_fee !== 'none' || $this->add_blockchain_fee ) {
     1336        $total_fee = $this->get_option( 'fee_order_percentage' ) === 'none' ? 0 : (float) $this->get_option( 'fee_order_percentage' );
     1337
     1338        $fee_order = 0;
     1339
     1340        if ( $total_fee !== 0 || $this->add_blockchain_fee ) {
     1341
     1342            if ($total_fee !== 0) {
     1343                $fee_order = (float) WC()->cart->subtotal * $total_fee;
     1344            }
    13411345
    13421346            $selected = WC()->session->get( 'cryptapi_coin' );
  • cryptapi-payment-gateway-for-woocommerce/tags/4.7.2/readme.txt

    r2849231 r2859112  
    44Requires at least: 5
    55Tested up to: 6.1.1
    6 Stable tag: 4.7.1
     6Stable tag: 4.7.2
    77Requires PHP: 7.2
    88WC requires at least: 5.8
     
    319319* Minor fixes
    320320
     321= 4.7.2 =
     322* Minor fixes
     323
    321324== Upgrade Notice ==
    322325
  • cryptapi-payment-gateway-for-woocommerce/tags/4.7.2/utils/helper.php

    r2789271 r2859112  
    254254    public static function sig_fig($value, $digits)
    255255    {
    256         if ($value == 0) {
    257             $decimalPlaces = $digits - 1;
    258         } elseif ($value < 0) {
    259             $decimalPlaces = $digits - floor(log10($value * -1)) - 1;
    260         } else {
    261             $decimalPlaces = $digits - floor(log10($value)) - 1;
    262         }
    263 
    264         $answer = ($decimalPlaces > 0) ?
    265             number_format($value, $decimalPlaces, '.', '') : round($value, $decimalPlaces);
    266         return $answer;
     256        if (strpos((string) $value, '.') !== false) {
     257            if ($value[0] != '-') {
     258                return bcadd($value, '0.' . str_repeat('0', $digits) . '5', $digits);
     259            }
     260
     261            return bcsub($value, '0.' . str_repeat('0', $digits) . '5', $digits);
     262        }
     263
     264        return $value;
    267265    }
    268266
  • cryptapi-payment-gateway-for-woocommerce/trunk/CryptAPI.php

    r2849231 r2859112  
    44Plugin URI: https://github.com/cryptapi/woocommerce-cryptapi
    55Description: Accept cryptocurrency payments on your WooCommerce website
    6 Version: 4.7.1
     6Version: 4.7.2
    77Requires at least: 5
    88Tested up to: 6.1.1
  • cryptapi-payment-gateway-for-woocommerce/trunk/README.md

    r2849231 r2859112  
    310310* Improvements on the callback processing algorithm
    311311
     312#### 4.7.2
     313* Minor fixes
     314
    312315### Upgrade Notice
    313316#### 4.3
  • cryptapi-payment-gateway-for-woocommerce/trunk/controllers/CryptAPI.php

    r2849231 r2859112  
    13341334        }
    13351335
    1336         $total_fee = $this->get_option( 'fee_order_percentage' ) == 'none' ? 0 : $this->get_option( 'fee_order_percentage' );
    1337 
    1338         $fee_order = WC()->cart->subtotal * $total_fee;
    1339 
    1340         if ( $total_fee !== 'none' || $this->add_blockchain_fee ) {
     1336        $total_fee = $this->get_option( 'fee_order_percentage' ) === 'none' ? 0 : (float) $this->get_option( 'fee_order_percentage' );
     1337
     1338        $fee_order = 0;
     1339
     1340        if ( $total_fee !== 0 || $this->add_blockchain_fee ) {
     1341
     1342            if ($total_fee !== 0) {
     1343                $fee_order = (float) WC()->cart->subtotal * $total_fee;
     1344            }
    13411345
    13421346            $selected = WC()->session->get( 'cryptapi_coin' );
  • cryptapi-payment-gateway-for-woocommerce/trunk/readme.txt

    r2849231 r2859112  
    44Requires at least: 5
    55Tested up to: 6.1.1
    6 Stable tag: 4.7.1
     6Stable tag: 4.7.2
    77Requires PHP: 7.2
    88WC requires at least: 5.8
     
    319319* Minor fixes
    320320
     321= 4.7.2 =
     322* Minor fixes
     323
    321324== Upgrade Notice ==
    322325
  • cryptapi-payment-gateway-for-woocommerce/trunk/utils/helper.php

    r2789271 r2859112  
    254254    public static function sig_fig($value, $digits)
    255255    {
    256         if ($value == 0) {
    257             $decimalPlaces = $digits - 1;
    258         } elseif ($value < 0) {
    259             $decimalPlaces = $digits - floor(log10($value * -1)) - 1;
    260         } else {
    261             $decimalPlaces = $digits - floor(log10($value)) - 1;
    262         }
    263 
    264         $answer = ($decimalPlaces > 0) ?
    265             number_format($value, $decimalPlaces, '.', '') : round($value, $decimalPlaces);
    266         return $answer;
     256        if (strpos((string) $value, '.') !== false) {
     257            if ($value[0] != '-') {
     258                return bcadd($value, '0.' . str_repeat('0', $digits) . '5', $digits);
     259            }
     260
     261            return bcsub($value, '0.' . str_repeat('0', $digits) . '5', $digits);
     262        }
     263
     264        return $value;
    267265    }
    268266
Note: See TracChangeset for help on using the changeset viewer.