Changeset 2844569
- Timestamp:
- 01/06/2023 12:42:11 PM (3 years ago)
- Location:
- cryptapi-payment-gateway-for-woocommerce
- Files:
-
- 5 edited
- 7 copied
-
tags/4.6.9 (copied) (copied from cryptapi-payment-gateway-for-woocommerce/trunk)
-
tags/4.6.9/CryptAPI.php (copied) (copied from cryptapi-payment-gateway-for-woocommerce/trunk/CryptAPI.php) (1 diff)
-
tags/4.6.9/README.md (copied) (copied from cryptapi-payment-gateway-for-woocommerce/trunk/README.md) (1 diff)
-
tags/4.6.9/controllers/CryptAPI.php (copied) (copied from cryptapi-payment-gateway-for-woocommerce/trunk/controllers/CryptAPI.php) (14 diffs)
-
tags/4.6.9/define.php (copied) (copied from cryptapi-payment-gateway-for-woocommerce/trunk/define.php) (1 diff)
-
tags/4.6.9/readme.txt (copied) (copied from cryptapi-payment-gateway-for-woocommerce/trunk/readme.txt) (4 diffs)
-
tags/4.6.9/static/payment.js (copied) (copied from cryptapi-payment-gateway-for-woocommerce/trunk/static/payment.js)
-
trunk/CryptAPI.php (modified) (1 diff)
-
trunk/README.md (modified) (1 diff)
-
trunk/controllers/CryptAPI.php (modified) (14 diffs)
-
trunk/define.php (modified) (1 diff)
-
trunk/readme.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cryptapi-payment-gateway-for-woocommerce/tags/4.6.9/CryptAPI.php
r2838073 r2844569 4 4 Plugin URI: https://github.com/cryptapi/woocommerce-cryptapi 5 5 Description: Accept cryptocurrency payments on your WooCommerce website 6 Version: 4.6. 86 Version: 4.6.9 7 7 Requires at least: 5 8 Tested up to: 6. 0.28 Tested up to: 6.1.1 9 9 WC requires at least: 5.8 10 WC tested up to: 7. 0.010 WC tested up to: 7.2.2 11 11 Requires PHP: 7.2 12 12 Author: cryptapi -
cryptapi-payment-gateway-for-woocommerce/tags/4.6.9/README.md
r2838073 r2844569 299 299 * Minor fixes 300 300 301 #### 4.6.9 302 * Minor fixes 303 301 304 ### Upgrade Notice 302 305 #### 4.3 -
cryptapi-payment-gateway-for-woocommerce/tags/4.6.9/controllers/CryptAPI.php
r2838073 r2844569 540 540 $qr_code_data = CryptAPI\Helper::get_static_qrcode( $addr_in, $selected, '', $this->qrcode_size ); 541 541 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 ); 543 545 $order->add_meta_data( 'cryptapi_address', $addr_in ); 544 546 $order->add_meta_data( 'cryptapi_total', CryptAPI\Helper::sig_fig( $crypto_total, 6 ) ); … … 606 608 $already_paid_fiat = $calc['already_paid_fiat']; 607 609 608 $min_tx = floatval( $order->get_meta( 'cryptapi_min' ));610 $min_tx = (float) $order->get_meta( 'cryptapi_min' ); 609 611 610 612 $remaining_pending = $calc['remaining_pending']; … … 637 639 'order_history' => json_decode( $order->get_meta( 'cryptapi_history' ), true ), 638 640 'counter' => (string) $counter_calc, 639 'crypto_total' => floatval( $order->get_meta( 'cryptapi_total' )),641 'crypto_total' => (float) $order->get_meta( 'cryptapi_total' ), 640 642 'already_paid' => $already_paid, 641 643 'remaining' => $remaining_pending <= 0 ? 0 : $remaining_pending, 642 644 '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, 644 646 'fiat_symbol' => get_woocommerce_currency_symbol(), 645 647 ]; … … 686 688 687 689 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' ); 691 693 692 694 $crypto_coin = strtoupper( $order->get_meta( 'cryptapi_currency' ) ); … … 757 759 758 760 if ( $remaining > 0 ) { 759 if ( $remaining < $min_tx ) {761 if ( $remaining <= $min_tx ) { 760 762 $order->add_order_note( __( 'Payment detected and confirmed. Customer still need to send', 'cryptapi' ) . ' ' . $min_tx . $crypto_coin, false ); 761 763 } else { … … 765 767 } 766 768 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 ) { 795 804 $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'] ); 796 805 } else { 797 806 $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'] ); 798 807 } 799 $order->save_meta_data(); 808 809 $order->save(); 800 810 801 811 if ( ! $validation ) { … … 861 871 echo 'display: none'; 862 872 } 863 ?>; width: <?php echo intval( $this->qrcode_size )+ 20; ?>px;">873 ?>; width: <?php echo (int) $this->qrcode_size + 20; ?>px;"> 864 874 <?php 865 875 if ( $crypto_allowed_value == true ) { … … 962 972 </div> 963 973 <?php 964 if ( intval( $this->refresh_value_interval )!= 0 ) {974 if ( (int) $this->refresh_value_interval != 0 ) { 965 975 ?> 966 976 <div class="ca_time_refresh"> … … 984 994 </div> 985 995 <?php 986 if ( intval( $this->order_cancelation_timeout ) != 0 ) {996 if ( (int) $this->order_cancelation_timeout !== 0 ) { 987 997 ?> 988 998 <span class="ca_notification_cancel" data-text="<?php echo __( 'Order will be cancelled in less than a minute.', 'cryptapi' ); ?>"> … … 1021 1031 <?php 1022 1032 } 1023 if ( $total == 0 ) {1033 if ( $total === 0 ) { 1024 1034 ?> 1025 1035 <style> … … 1106 1116 */ 1107 1117 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; 1110 1120 1111 1121 if ( $order_timeout === 0 && $value_refresh === 0 ) { … … 1129 1139 $history = json_decode( $order->get_meta( 'cryptapi_history' ), true ); 1130 1140 1131 $min_tx = floatval( $order->get_meta( 'cryptapi_min' ));1141 $min_tx = (float) $order->get_meta( 'cryptapi_min' ); 1132 1142 1133 1143 $calc = $this->calc_order( $history, $order->get_meta( 'cryptapi_total' ), $order->get_meta( 'cryptapi_total_fiat' ) ); … … 1192 1202 1193 1203 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 1199 1209 ]; 1200 1210 } … … 1285 1295 ?> 1286 1296 <tr valign="top"> 1287 1288 1297 <th scope="row" class="titledesc"> 1289 1298 <input style="display: inline-block; margin-bottom: -4px;" type="checkbox" -
cryptapi-payment-gateway-for-woocommerce/tags/4.6.9/define.php
r2838073 r2844569 1 1 <?php 2 2 3 define('CRYPTAPI_PLUGIN_VERSION', '4.6. 8');3 define('CRYPTAPI_PLUGIN_VERSION', '4.6.9'); 4 4 define('CRYPTAPI_PLUGIN_PATH', plugin_dir_path(__FILE__)); 5 5 define('CRYPTAPI_PLUGIN_URL', plugin_dir_url(__FILE__)); -
cryptapi-payment-gateway-for-woocommerce/tags/4.6.9/readme.txt
r2838073 r2844569 3 3 Tags: crypto payments, woocommerce, payment gateway, crypto, payment, pay with crypto, payment request, bitcoin, bnb, usdt, ethereum, monero, litecoin, bitcoin cash, shib, doge 4 4 Requires at least: 5 5 Tested up to: 6. 0.26 Stable tag: 4.6. 85 Tested up to: 6.1.1 6 Stable tag: 4.6.9 7 7 Requires PHP: 7.2 8 8 WC requires at least: 5.8 9 WC tested up to: 7. 0.09 WC tested up to: 7.2.2 10 10 License: MIT 11 11 … … 28 28 * (BCH) Bitcoin Cash 29 29 * (LTC) Litecoin 30 * (XMR) Monero31 30 * (TRX) Tron 32 31 * (BNB) Binance Coin … … 34 33 * (SHIB) Shiba Inu 35 34 * (DOGE) Dogecoin 35 * (MATIC) Matic 36 36 37 37 … … 309 309 * Minor fixes 310 310 311 = 4.6.9 = 312 * Minor fixes 313 311 314 == Upgrade Notice == 312 315 -
cryptapi-payment-gateway-for-woocommerce/trunk/CryptAPI.php
r2838073 r2844569 4 4 Plugin URI: https://github.com/cryptapi/woocommerce-cryptapi 5 5 Description: Accept cryptocurrency payments on your WooCommerce website 6 Version: 4.6. 86 Version: 4.6.9 7 7 Requires at least: 5 8 Tested up to: 6. 0.28 Tested up to: 6.1.1 9 9 WC requires at least: 5.8 10 WC tested up to: 7. 0.010 WC tested up to: 7.2.2 11 11 Requires PHP: 7.2 12 12 Author: cryptapi -
cryptapi-payment-gateway-for-woocommerce/trunk/README.md
r2838073 r2844569 299 299 * Minor fixes 300 300 301 #### 4.6.9 302 * Minor fixes 303 301 304 ### Upgrade Notice 302 305 #### 4.3 -
cryptapi-payment-gateway-for-woocommerce/trunk/controllers/CryptAPI.php
r2838073 r2844569 540 540 $qr_code_data = CryptAPI\Helper::get_static_qrcode( $addr_in, $selected, '', $this->qrcode_size ); 541 541 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 ); 543 545 $order->add_meta_data( 'cryptapi_address', $addr_in ); 544 546 $order->add_meta_data( 'cryptapi_total', CryptAPI\Helper::sig_fig( $crypto_total, 6 ) ); … … 606 608 $already_paid_fiat = $calc['already_paid_fiat']; 607 609 608 $min_tx = floatval( $order->get_meta( 'cryptapi_min' ));610 $min_tx = (float) $order->get_meta( 'cryptapi_min' ); 609 611 610 612 $remaining_pending = $calc['remaining_pending']; … … 637 639 'order_history' => json_decode( $order->get_meta( 'cryptapi_history' ), true ), 638 640 'counter' => (string) $counter_calc, 639 'crypto_total' => floatval( $order->get_meta( 'cryptapi_total' )),641 'crypto_total' => (float) $order->get_meta( 'cryptapi_total' ), 640 642 'already_paid' => $already_paid, 641 643 'remaining' => $remaining_pending <= 0 ? 0 : $remaining_pending, 642 644 '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, 644 646 'fiat_symbol' => get_woocommerce_currency_symbol(), 645 647 ]; … … 686 688 687 689 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' ); 691 693 692 694 $crypto_coin = strtoupper( $order->get_meta( 'cryptapi_currency' ) ); … … 757 759 758 760 if ( $remaining > 0 ) { 759 if ( $remaining < $min_tx ) {761 if ( $remaining <= $min_tx ) { 760 762 $order->add_order_note( __( 'Payment detected and confirmed. Customer still need to send', 'cryptapi' ) . ' ' . $min_tx . $crypto_coin, false ); 761 763 } else { … … 765 767 } 766 768 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 ) { 795 804 $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'] ); 796 805 } else { 797 806 $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'] ); 798 807 } 799 $order->save_meta_data(); 808 809 $order->save(); 800 810 801 811 if ( ! $validation ) { … … 861 871 echo 'display: none'; 862 872 } 863 ?>; width: <?php echo intval( $this->qrcode_size )+ 20; ?>px;">873 ?>; width: <?php echo (int) $this->qrcode_size + 20; ?>px;"> 864 874 <?php 865 875 if ( $crypto_allowed_value == true ) { … … 962 972 </div> 963 973 <?php 964 if ( intval( $this->refresh_value_interval )!= 0 ) {974 if ( (int) $this->refresh_value_interval != 0 ) { 965 975 ?> 966 976 <div class="ca_time_refresh"> … … 984 994 </div> 985 995 <?php 986 if ( intval( $this->order_cancelation_timeout ) != 0 ) {996 if ( (int) $this->order_cancelation_timeout !== 0 ) { 987 997 ?> 988 998 <span class="ca_notification_cancel" data-text="<?php echo __( 'Order will be cancelled in less than a minute.', 'cryptapi' ); ?>"> … … 1021 1031 <?php 1022 1032 } 1023 if ( $total == 0 ) {1033 if ( $total === 0 ) { 1024 1034 ?> 1025 1035 <style> … … 1106 1116 */ 1107 1117 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; 1110 1120 1111 1121 if ( $order_timeout === 0 && $value_refresh === 0 ) { … … 1129 1139 $history = json_decode( $order->get_meta( 'cryptapi_history' ), true ); 1130 1140 1131 $min_tx = floatval( $order->get_meta( 'cryptapi_min' ));1141 $min_tx = (float) $order->get_meta( 'cryptapi_min' ); 1132 1142 1133 1143 $calc = $this->calc_order( $history, $order->get_meta( 'cryptapi_total' ), $order->get_meta( 'cryptapi_total_fiat' ) ); … … 1192 1202 1193 1203 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 1199 1209 ]; 1200 1210 } … … 1285 1295 ?> 1286 1296 <tr valign="top"> 1287 1288 1297 <th scope="row" class="titledesc"> 1289 1298 <input style="display: inline-block; margin-bottom: -4px;" type="checkbox" -
cryptapi-payment-gateway-for-woocommerce/trunk/define.php
r2838073 r2844569 1 1 <?php 2 2 3 define('CRYPTAPI_PLUGIN_VERSION', '4.6. 8');3 define('CRYPTAPI_PLUGIN_VERSION', '4.6.9'); 4 4 define('CRYPTAPI_PLUGIN_PATH', plugin_dir_path(__FILE__)); 5 5 define('CRYPTAPI_PLUGIN_URL', plugin_dir_url(__FILE__)); -
cryptapi-payment-gateway-for-woocommerce/trunk/readme.txt
r2838073 r2844569 3 3 Tags: crypto payments, woocommerce, payment gateway, crypto, payment, pay with crypto, payment request, bitcoin, bnb, usdt, ethereum, monero, litecoin, bitcoin cash, shib, doge 4 4 Requires at least: 5 5 Tested up to: 6. 0.26 Stable tag: 4.6. 85 Tested up to: 6.1.1 6 Stable tag: 4.6.9 7 7 Requires PHP: 7.2 8 8 WC requires at least: 5.8 9 WC tested up to: 7. 0.09 WC tested up to: 7.2.2 10 10 License: MIT 11 11 … … 28 28 * (BCH) Bitcoin Cash 29 29 * (LTC) Litecoin 30 * (XMR) Monero31 30 * (TRX) Tron 32 31 * (BNB) Binance Coin … … 34 33 * (SHIB) Shiba Inu 35 34 * (DOGE) Dogecoin 35 * (MATIC) Matic 36 36 37 37 … … 309 309 * Minor fixes 310 310 311 = 4.6.9 = 312 * Minor fixes 313 311 314 == Upgrade Notice == 312 315
Note: See TracChangeset
for help on using the changeset viewer.