Plugin Directory

Changeset 2844569


Ignore:
Timestamp:
01/06/2023 12:42:11 PM (3 years ago)
Author:
cryptapi
Message:

v4.6.9 - minor bugfixes

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

Legend:

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

    r2838073 r2844569  
    44Plugin URI: https://github.com/cryptapi/woocommerce-cryptapi
    55Description: Accept cryptocurrency payments on your WooCommerce website
    6 Version: 4.6.8
     6Version: 4.6.9
    77Requires at least: 5
    8 Tested up to: 6.0.2
     8Tested up to: 6.1.1
    99WC requires at least: 5.8
    10 WC tested up to: 7.0.0
     10WC tested up to: 7.2.2
    1111Requires PHP: 7.2
    1212Author: cryptapi
  • cryptapi-payment-gateway-for-woocommerce/tags/4.6.9/README.md

    r2838073 r2844569  
    299299* Minor fixes
    300300
     301#### 4.6.9
     302* Minor fixes
     303
    301304### Upgrade Notice
    302305#### 4.3
  • cryptapi-payment-gateway-for-woocommerce/tags/4.6.9/controllers/CryptAPI.php

    r2838073 r2844569  
    540540                $qr_code_data       = CryptAPI\Helper::get_static_qrcode( $addr_in, $selected, '', $this->qrcode_size );
    541541
    542                 $order->add_meta_data( 'cryptapi_nonce', $nonce );
     542                $order->add_meta_data( 'cryptapi_version', CRYPTAPI_PLUGIN_VERSION );
     543                $order->add_meta_data( 'cryptapi_php_version', PHP_VERSION );
     544                $order->add_meta_data( 'cryptapi_nonce', $nonce );
    543545                $order->add_meta_data( 'cryptapi_address', $addr_in );
    544546                $order->add_meta_data( 'cryptapi_total', CryptAPI\Helper::sig_fig( $crypto_total, 6 ) );
     
    606608            $already_paid_fiat = $calc['already_paid_fiat'];
    607609
    608             $min_tx = floatval( $order->get_meta( 'cryptapi_min' ) );
     610            $min_tx = (float) $order->get_meta( 'cryptapi_min' );
    609611
    610612            $remaining_pending = $calc['remaining_pending'];
     
    637639                'order_history'     => json_decode( $order->get_meta( 'cryptapi_history' ), true ),
    638640                'counter'           => (string) $counter_calc,
    639                 'crypto_total'      => floatval( $order->get_meta( 'cryptapi_total' ) ),
     641                'crypto_total'      => (float) $order->get_meta( 'cryptapi_total' ),
    640642                'already_paid'      => $already_paid,
    641643                'remaining'         => $remaining_pending <= 0 ? 0 : $remaining_pending,
    642644                'fiat_remaining'    => $remaining_fiat <= 0 ? 0 : $remaining_fiat,
    643                 'already_paid_fiat' => floatval( $already_paid_fiat ) <= 0 ? 0 : floatval( $already_paid_fiat ),
     645                'already_paid_fiat' => $already_paid_fiat <= 0 ? 0 : $already_paid_fiat,
    644646                'fiat_symbol'       => get_woocommerce_currency_symbol(),
    645647            ];
     
    686688
    687689    function process_callback_data( $data, $order, $validation = false ) {
    688         $paid = floatval( $data['value_coin'] );
    689 
    690         $min_tx = floatval( $order->get_meta( 'cryptapi_min' ) );
     690        $paid = (float) $data['value_coin'];
     691
     692        $min_tx = (float) $order->get_meta( 'cryptapi_min' );
    691693
    692694        $crypto_coin = strtoupper( $order->get_meta( 'cryptapi_currency' ) );
     
    757759
    758760            if ( $remaining > 0 ) {
    759                 if ( $remaining < $min_tx ) {
     761                if ( $remaining <= $min_tx ) {
    760762                    $order->add_order_note( __( 'Payment detected and confirmed. Customer still need to send', 'cryptapi' ) . ' ' . $min_tx . $crypto_coin, false );
    761763                } else {
     
    765767        }
    766768
    767         if ( $remaining_pending <= 0 ) {
    768             if ( $remaining <= 0 ) {
    769                 $order->payment_complete( $data['address_in'] );
    770                 if ( $this->virtual_complete ) {
    771                     $count_products = count( $order->get_items() );
    772                     $count_virtual  = 0;
    773                     foreach ( $order->get_items() as $order_item ) {
    774                         $item     = wc_get_product( $order_item->get_product_id() );
    775                         $item_obj = $item->get_type() === 'variable' ? wc_get_product( $order_item['variation_id'] ) : $item;
    776 
    777                         if ( $item_obj->is_virtual() ) {
    778                             $count_virtual += 1;
    779                         }
    780                     }
    781                     if ( $count_virtual === $count_products ) {
    782                         $order->update_status( 'completed' );
    783                     }
    784                 }
    785                 $order->save();
    786             }
    787             if ( ! $validation ) {
    788                 die( "*ok*" );
    789             } else {
    790                 return;
    791             }
    792         }
    793 
    794         if ( $remaining_pending < $min_tx ) {
     769        if ( $remaining <= 0 ) {
     770            /**
     771             * Changes the order Status to Paid
     772             */
     773            $order->payment_complete( $data['address_in'] );
     774
     775            if ( $this->virtual_complete ) {
     776                $count_products = count( $order->get_items() );
     777                $count_virtual  = 0;
     778                foreach ( $order->get_items() as $order_item ) {
     779                    $item     = wc_get_product( $order_item->get_product_id() );
     780                    $item_obj = $item->get_type() === 'variable' ? wc_get_product( $order_item['variation_id'] ) : $item;
     781
     782                    if ( $item_obj->is_virtual() ) {
     783                        $count_virtual += 1;
     784                    }
     785                }
     786                if ( $count_virtual === $count_products ) {
     787                    $order->update_status( 'completed' );
     788                }
     789            }
     790
     791            $order->save();
     792
     793            if ( ! $validation ) {
     794                die( "*ok*" );
     795            } else {
     796                return;
     797            }
     798        }
     799
     800        /**
     801         * Refreshes the QR Code. If payment is marked as completed, it won't get here.
     802         */
     803        if ( $remaining <= $min_tx ) {
    795804            $order->update_meta_data( 'cryptapi_qr_code_value', CryptAPI\Helper::get_static_qrcode( $order->get_meta( 'cryptapi_address' ), $order->get_meta( 'cryptapi_currency' ), $min_tx, $this->qrcode_size )['qr_code'] );
    796805        } else {
    797806            $order->update_meta_data( 'cryptapi_qr_code_value', CryptAPI\Helper::get_static_qrcode( $order->get_meta( 'cryptapi_address' ), $order->get_meta( 'cryptapi_currency' ), $remaining_pending, $this->qrcode_size )['qr_code'] );
    798807        }
    799         $order->save_meta_data();
     808
     809        $order->save();
    800810
    801811        if ( ! $validation ) {
     
    861871                            echo 'display: none';
    862872                        }
    863                         ?>; width: <?php echo intval( $this->qrcode_size ) + 20; ?>px;">
     873                        ?>; width: <?php echo (int) $this->qrcode_size + 20; ?>px;">
    864874                            <?php
    865875                            if ( $crypto_allowed_value == true ) {
     
    962972                            </div>
    963973                            <?php
    964                             if ( intval( $this->refresh_value_interval ) != 0 ) {
     974                            if ( (int) $this->refresh_value_interval != 0 ) {
    965975                                ?>
    966976                                <div class="ca_time_refresh">
     
    984994                        </div>
    985995                        <?php
    986                         if ( intval( $this->order_cancelation_timeout ) != 0 ) {
     996                        if ( (int) $this->order_cancelation_timeout !== 0 ) {
    987997                            ?>
    988998                            <span class="ca_notification_cancel" data-text="<?php echo __( 'Order will be cancelled in less than a minute.', 'cryptapi' ); ?>">
     
    10211031                    <?php
    10221032                }
    1023                 if ( $total == 0 ) {
     1033                if ( $total === 0 ) {
    10241034                    ?>
    10251035                    <style>
     
    11061116     */
    11071117    function ca_cronjob($force = false, $order_id = '') {
    1108         $order_timeout = intval( $this->order_cancelation_timeout );
    1109         $value_refresh = intval( $this->refresh_value_interval );
     1118        $order_timeout = (int) $this->order_cancelation_timeout;
     1119        $value_refresh = (int) $this->refresh_value_interval;
    11101120
    11111121        if ( $order_timeout === 0 && $value_refresh === 0 ) {
     
    11291139            $history = json_decode( $order->get_meta( 'cryptapi_history' ), true );
    11301140
    1131             $min_tx = floatval( $order->get_meta( 'cryptapi_min' ) );
     1141            $min_tx = (float) $order->get_meta( 'cryptapi_min' );
    11321142
    11331143            $calc = $this->calc_order( $history, $order->get_meta( 'cryptapi_total' ), $order->get_meta( 'cryptapi_total_fiat' ) );
     
    11921202
    11931203        return [
    1194             'already_paid'      => floatval( $already_paid ),
    1195             'already_paid_fiat' => floatval( $already_paid_fiat ),
    1196             'remaining'         => floatval( $remaining ),
    1197             'remaining_pending' => floatval( $remaining_pending ),
    1198             'remaining_fiat'    => floatval( $remaining_fiat )
     1204            'already_paid'      => (float) $already_paid,
     1205            'already_paid_fiat' => (float) $already_paid_fiat,
     1206            'remaining'         => (float) $remaining,
     1207            'remaining_pending' => (float) $remaining_pending,
     1208            'remaining_fiat'    => (float) $remaining_fiat
    11991209        ];
    12001210    }
     
    12851295        ?>
    12861296        <tr valign="top">
    1287 
    12881297            <th scope="row" class="titledesc">
    12891298                <input style="display: inline-block; margin-bottom: -4px;" type="checkbox"
  • cryptapi-payment-gateway-for-woocommerce/tags/4.6.9/define.php

    r2838073 r2844569  
    11<?php
    22
    3 define('CRYPTAPI_PLUGIN_VERSION', '4.6.8');
     3define('CRYPTAPI_PLUGIN_VERSION', '4.6.9');
    44define('CRYPTAPI_PLUGIN_PATH', plugin_dir_path(__FILE__));
    55define('CRYPTAPI_PLUGIN_URL', plugin_dir_url(__FILE__));
  • cryptapi-payment-gateway-for-woocommerce/tags/4.6.9/readme.txt

    r2838073 r2844569  
    33Tags: crypto payments, woocommerce, payment gateway, crypto, payment, pay with crypto, payment request, bitcoin, bnb, usdt, ethereum, monero, litecoin, bitcoin cash, shib, doge
    44Requires at least: 5
    5 Tested up to: 6.0.2
    6 Stable tag: 4.6.8
     5Tested up to: 6.1.1
     6Stable tag: 4.6.9
    77Requires PHP: 7.2
    88WC requires at least: 5.8
    9 WC tested up to: 7.0.0
     9WC tested up to: 7.2.2
    1010License: MIT
    1111
     
    2828* (BCH) Bitcoin Cash
    2929* (LTC) Litecoin
    30 * (XMR) Monero
    3130* (TRX) Tron
    3231* (BNB) Binance Coin
     
    3433* (SHIB) Shiba Inu
    3534* (DOGE) Dogecoin
     35* (MATIC) Matic
    3636
    3737
     
    309309* Minor fixes
    310310
     311= 4.6.9 =
     312* Minor fixes
     313
    311314== Upgrade Notice ==
    312315
  • cryptapi-payment-gateway-for-woocommerce/trunk/CryptAPI.php

    r2838073 r2844569  
    44Plugin URI: https://github.com/cryptapi/woocommerce-cryptapi
    55Description: Accept cryptocurrency payments on your WooCommerce website
    6 Version: 4.6.8
     6Version: 4.6.9
    77Requires at least: 5
    8 Tested up to: 6.0.2
     8Tested up to: 6.1.1
    99WC requires at least: 5.8
    10 WC tested up to: 7.0.0
     10WC tested up to: 7.2.2
    1111Requires PHP: 7.2
    1212Author: cryptapi
  • cryptapi-payment-gateway-for-woocommerce/trunk/README.md

    r2838073 r2844569  
    299299* Minor fixes
    300300
     301#### 4.6.9
     302* Minor fixes
     303
    301304### Upgrade Notice
    302305#### 4.3
  • cryptapi-payment-gateway-for-woocommerce/trunk/controllers/CryptAPI.php

    r2838073 r2844569  
    540540                $qr_code_data       = CryptAPI\Helper::get_static_qrcode( $addr_in, $selected, '', $this->qrcode_size );
    541541
    542                 $order->add_meta_data( 'cryptapi_nonce', $nonce );
     542                $order->add_meta_data( 'cryptapi_version', CRYPTAPI_PLUGIN_VERSION );
     543                $order->add_meta_data( 'cryptapi_php_version', PHP_VERSION );
     544                $order->add_meta_data( 'cryptapi_nonce', $nonce );
    543545                $order->add_meta_data( 'cryptapi_address', $addr_in );
    544546                $order->add_meta_data( 'cryptapi_total', CryptAPI\Helper::sig_fig( $crypto_total, 6 ) );
     
    606608            $already_paid_fiat = $calc['already_paid_fiat'];
    607609
    608             $min_tx = floatval( $order->get_meta( 'cryptapi_min' ) );
     610            $min_tx = (float) $order->get_meta( 'cryptapi_min' );
    609611
    610612            $remaining_pending = $calc['remaining_pending'];
     
    637639                'order_history'     => json_decode( $order->get_meta( 'cryptapi_history' ), true ),
    638640                'counter'           => (string) $counter_calc,
    639                 'crypto_total'      => floatval( $order->get_meta( 'cryptapi_total' ) ),
     641                'crypto_total'      => (float) $order->get_meta( 'cryptapi_total' ),
    640642                'already_paid'      => $already_paid,
    641643                'remaining'         => $remaining_pending <= 0 ? 0 : $remaining_pending,
    642644                'fiat_remaining'    => $remaining_fiat <= 0 ? 0 : $remaining_fiat,
    643                 'already_paid_fiat' => floatval( $already_paid_fiat ) <= 0 ? 0 : floatval( $already_paid_fiat ),
     645                'already_paid_fiat' => $already_paid_fiat <= 0 ? 0 : $already_paid_fiat,
    644646                'fiat_symbol'       => get_woocommerce_currency_symbol(),
    645647            ];
     
    686688
    687689    function process_callback_data( $data, $order, $validation = false ) {
    688         $paid = floatval( $data['value_coin'] );
    689 
    690         $min_tx = floatval( $order->get_meta( 'cryptapi_min' ) );
     690        $paid = (float) $data['value_coin'];
     691
     692        $min_tx = (float) $order->get_meta( 'cryptapi_min' );
    691693
    692694        $crypto_coin = strtoupper( $order->get_meta( 'cryptapi_currency' ) );
     
    757759
    758760            if ( $remaining > 0 ) {
    759                 if ( $remaining < $min_tx ) {
     761                if ( $remaining <= $min_tx ) {
    760762                    $order->add_order_note( __( 'Payment detected and confirmed. Customer still need to send', 'cryptapi' ) . ' ' . $min_tx . $crypto_coin, false );
    761763                } else {
     
    765767        }
    766768
    767         if ( $remaining_pending <= 0 ) {
    768             if ( $remaining <= 0 ) {
    769                 $order->payment_complete( $data['address_in'] );
    770                 if ( $this->virtual_complete ) {
    771                     $count_products = count( $order->get_items() );
    772                     $count_virtual  = 0;
    773                     foreach ( $order->get_items() as $order_item ) {
    774                         $item     = wc_get_product( $order_item->get_product_id() );
    775                         $item_obj = $item->get_type() === 'variable' ? wc_get_product( $order_item['variation_id'] ) : $item;
    776 
    777                         if ( $item_obj->is_virtual() ) {
    778                             $count_virtual += 1;
    779                         }
    780                     }
    781                     if ( $count_virtual === $count_products ) {
    782                         $order->update_status( 'completed' );
    783                     }
    784                 }
    785                 $order->save();
    786             }
    787             if ( ! $validation ) {
    788                 die( "*ok*" );
    789             } else {
    790                 return;
    791             }
    792         }
    793 
    794         if ( $remaining_pending < $min_tx ) {
     769        if ( $remaining <= 0 ) {
     770            /**
     771             * Changes the order Status to Paid
     772             */
     773            $order->payment_complete( $data['address_in'] );
     774
     775            if ( $this->virtual_complete ) {
     776                $count_products = count( $order->get_items() );
     777                $count_virtual  = 0;
     778                foreach ( $order->get_items() as $order_item ) {
     779                    $item     = wc_get_product( $order_item->get_product_id() );
     780                    $item_obj = $item->get_type() === 'variable' ? wc_get_product( $order_item['variation_id'] ) : $item;
     781
     782                    if ( $item_obj->is_virtual() ) {
     783                        $count_virtual += 1;
     784                    }
     785                }
     786                if ( $count_virtual === $count_products ) {
     787                    $order->update_status( 'completed' );
     788                }
     789            }
     790
     791            $order->save();
     792
     793            if ( ! $validation ) {
     794                die( "*ok*" );
     795            } else {
     796                return;
     797            }
     798        }
     799
     800        /**
     801         * Refreshes the QR Code. If payment is marked as completed, it won't get here.
     802         */
     803        if ( $remaining <= $min_tx ) {
    795804            $order->update_meta_data( 'cryptapi_qr_code_value', CryptAPI\Helper::get_static_qrcode( $order->get_meta( 'cryptapi_address' ), $order->get_meta( 'cryptapi_currency' ), $min_tx, $this->qrcode_size )['qr_code'] );
    796805        } else {
    797806            $order->update_meta_data( 'cryptapi_qr_code_value', CryptAPI\Helper::get_static_qrcode( $order->get_meta( 'cryptapi_address' ), $order->get_meta( 'cryptapi_currency' ), $remaining_pending, $this->qrcode_size )['qr_code'] );
    798807        }
    799         $order->save_meta_data();
     808
     809        $order->save();
    800810
    801811        if ( ! $validation ) {
     
    861871                            echo 'display: none';
    862872                        }
    863                         ?>; width: <?php echo intval( $this->qrcode_size ) + 20; ?>px;">
     873                        ?>; width: <?php echo (int) $this->qrcode_size + 20; ?>px;">
    864874                            <?php
    865875                            if ( $crypto_allowed_value == true ) {
     
    962972                            </div>
    963973                            <?php
    964                             if ( intval( $this->refresh_value_interval ) != 0 ) {
     974                            if ( (int) $this->refresh_value_interval != 0 ) {
    965975                                ?>
    966976                                <div class="ca_time_refresh">
     
    984994                        </div>
    985995                        <?php
    986                         if ( intval( $this->order_cancelation_timeout ) != 0 ) {
     996                        if ( (int) $this->order_cancelation_timeout !== 0 ) {
    987997                            ?>
    988998                            <span class="ca_notification_cancel" data-text="<?php echo __( 'Order will be cancelled in less than a minute.', 'cryptapi' ); ?>">
     
    10211031                    <?php
    10221032                }
    1023                 if ( $total == 0 ) {
     1033                if ( $total === 0 ) {
    10241034                    ?>
    10251035                    <style>
     
    11061116     */
    11071117    function ca_cronjob($force = false, $order_id = '') {
    1108         $order_timeout = intval( $this->order_cancelation_timeout );
    1109         $value_refresh = intval( $this->refresh_value_interval );
     1118        $order_timeout = (int) $this->order_cancelation_timeout;
     1119        $value_refresh = (int) $this->refresh_value_interval;
    11101120
    11111121        if ( $order_timeout === 0 && $value_refresh === 0 ) {
     
    11291139            $history = json_decode( $order->get_meta( 'cryptapi_history' ), true );
    11301140
    1131             $min_tx = floatval( $order->get_meta( 'cryptapi_min' ) );
     1141            $min_tx = (float) $order->get_meta( 'cryptapi_min' );
    11321142
    11331143            $calc = $this->calc_order( $history, $order->get_meta( 'cryptapi_total' ), $order->get_meta( 'cryptapi_total_fiat' ) );
     
    11921202
    11931203        return [
    1194             'already_paid'      => floatval( $already_paid ),
    1195             'already_paid_fiat' => floatval( $already_paid_fiat ),
    1196             'remaining'         => floatval( $remaining ),
    1197             'remaining_pending' => floatval( $remaining_pending ),
    1198             'remaining_fiat'    => floatval( $remaining_fiat )
     1204            'already_paid'      => (float) $already_paid,
     1205            'already_paid_fiat' => (float) $already_paid_fiat,
     1206            'remaining'         => (float) $remaining,
     1207            'remaining_pending' => (float) $remaining_pending,
     1208            'remaining_fiat'    => (float) $remaining_fiat
    11991209        ];
    12001210    }
     
    12851295        ?>
    12861296        <tr valign="top">
    1287 
    12881297            <th scope="row" class="titledesc">
    12891298                <input style="display: inline-block; margin-bottom: -4px;" type="checkbox"
  • cryptapi-payment-gateway-for-woocommerce/trunk/define.php

    r2838073 r2844569  
    11<?php
    22
    3 define('CRYPTAPI_PLUGIN_VERSION', '4.6.8');
     3define('CRYPTAPI_PLUGIN_VERSION', '4.6.9');
    44define('CRYPTAPI_PLUGIN_PATH', plugin_dir_path(__FILE__));
    55define('CRYPTAPI_PLUGIN_URL', plugin_dir_url(__FILE__));
  • cryptapi-payment-gateway-for-woocommerce/trunk/readme.txt

    r2838073 r2844569  
    33Tags: crypto payments, woocommerce, payment gateway, crypto, payment, pay with crypto, payment request, bitcoin, bnb, usdt, ethereum, monero, litecoin, bitcoin cash, shib, doge
    44Requires at least: 5
    5 Tested up to: 6.0.2
    6 Stable tag: 4.6.8
     5Tested up to: 6.1.1
     6Stable tag: 4.6.9
    77Requires PHP: 7.2
    88WC requires at least: 5.8
    9 WC tested up to: 7.0.0
     9WC tested up to: 7.2.2
    1010License: MIT
    1111
     
    2828* (BCH) Bitcoin Cash
    2929* (LTC) Litecoin
    30 * (XMR) Monero
    3130* (TRX) Tron
    3231* (BNB) Binance Coin
     
    3433* (SHIB) Shiba Inu
    3534* (DOGE) Dogecoin
     35* (MATIC) Matic
    3636
    3737
     
    309309* Minor fixes
    310310
     311= 4.6.9 =
     312* Minor fixes
     313
    311314== Upgrade Notice ==
    312315
Note: See TracChangeset for help on using the changeset viewer.