Plugin Directory

Changeset 2466373


Ignore:
Timestamp:
02/01/2021 12:01:17 PM (5 years ago)
Author:
infinitools
Message:

Version update, new features added

Location:
decentralized-bitcoin-cryptodec-payment-gateway-for-woocommerce
Files:
84 added
7 edited

Legend:

Unmodified
Added
Removed
  • decentralized-bitcoin-cryptodec-payment-gateway-for-woocommerce/trunk/README.txt

    r2465371 r2466373  
    55Requires at least: 4.6
    66Tested up to: 5.6
    7 Stable tag: 4.3
     7Stable tag: 1.0.2
    88Requires PHP: 6.0
    99License: GPLv2 or later
     
    2626
    2727* Transaction ID request form on Checkout
     28* Force Customers to provide Transaction ID (optional)
    2829* Assign single wallet to a customer to simplify recurring payments
    2930* You control your wallets, you control your keys
     
    6566== Changelog ==
    6667
     68= 1.0.2 Jan 28, 2021 =
     69* add extra options: Force Transaction ID
     70* Check for double Transaction ID
     71
    6772= 1.0.1 Jan 28, 2021 =
    6873* Initial release
  • decentralized-bitcoin-cryptodec-payment-gateway-for-woocommerce/trunk/admin/options.php

    r2465865 r2466373  
    77    $itls_wc_pay_gw_x1x_options = array (
    88
    9     'tab-popup' => array (
     9    'tab-general' => array (
     10        'name' => 'CryptoDEC Settings',
     11        'options' => array (
     12
     13
     14            'itls_txid_force' => array(
     15
     16                'name' => 'itls_txid_force',
     17                'type' => 'check',
     18                'print' => __('Force Transaction ID'),
     19                'help' => 'Switch (On/Off) if you want to force customers to enter Transactio ID. Default: Off.',
     20                'data' => 'bool',
     21                'value' => '0',
     22
     23            ),
     24
     25
     26
     27
     28        )
     29    ),
     30
     31    'tab-btc' => array (
    1032        'name' => 'Bitcoin BTC',
    1133        'options' => array (
  • decentralized-bitcoin-cryptodec-payment-gateway-for-woocommerce/trunk/cryptodec-payment-gateway.php

    r2465341 r2466373  
    66 * Author: ITLS
    77 * Author URI: https://ampae.com
    8  * Version: 1.0.1
     8 * Version: 1.0.2
    99 * Text Domain: decentralized-bitcoin-cryptodec-payment-gateway-for-woocommerce
    1010 *
     
    4646    'full_name'         => 'CryptoDecPaymentGateway',
    4747    'full_author'       => 'ITLS',
    48     'version'           => '1.0.1',
     48    'version'           => '1.0.2',
    4949
    5050    'settings_version'  => '3',
     
    139139function ITLS_cryptodec_uninstall()
    140140{
     141    include_once(dirname(__FILE__). '/inc/model-setup.php');
    141142    ITLS_cd_drop_payment_table();
    142143}
  • decentralized-bitcoin-cryptodec-payment-gateway-for-woocommerce/trunk/inc/itls-btc-wp-class.php

    r2465865 r2466373  
    4444        public function get_qr_code($walletAddress, $cryptoTotal)
    4545        {
    46             $writeDir = plugin_dir_path(__FILE__) . '../tmp/';
    47             $readDir = plugin_dir_url(__FILE__) . '../tmp/';
     46            //$writeDir = plugin_dir_path(__FILE__) . '../tmp/';
     47            //$readDir = plugin_dir_url(__FILE__) . '../tmp/';
    4848
    4949            $qrData = $walletAddress;
  • decentralized-bitcoin-cryptodec-payment-gateway-for-woocommerce/trunk/inc/itls-crypto-dec-payment-gateway-class.php

    r2466184 r2466373  
    3838                        <?php $this->generate_settings_html(); ?>
    3939                    </table>
    40                     <a href=<?php echo get_site_url() . '/wp-admin/admin.php?page=itls-cryptodecpaymentgateway-options-page#itls-cryptodec-gw-adm-tab-popup'?>>Crypto DEC Plugin Settings</a>
     40                    <a href=<?php echo get_site_url() . '/wp-admin/admin.php?page=itls-cryptodecpaymentgateway-options-page#itls-cryptodec-gw-adm-tab-general'?>>Crypto DEC Plugin Settings</a>
    4141                </div>
    4242                <?php
  • decentralized-bitcoin-cryptodec-payment-gateway-for-woocommerce/trunk/inc/plugin.php

    r2465341 r2466373  
    33function cryptodec_checkout_process()
    44{
     5    global $itls_wc_pay_gw_x1x_data;
    56
    67    if ($_POST['payment_method'] != 'cryptodec_gateway') {
     
    89    }
    910
     11    //$txid_force = true;
     12
     13    $oName = $itls_wc_pay_gw_x1x_data['options_name'];
     14    $options = get_option($oName);
     15    $txid_force = $options['itls_txid_force'];
    1016
    1117    $cryptodec_transaction_id = sanitize_text_field($_POST['cryptodec_transaction_id']);
    12     /*
    13             if( !isset($cryptodec_transaction_id) || empty($cryptodec_transaction_id) )
    14                 wc_add_notice( esc_html__( 'Please enter your transaction ID', 'decentralized-bitcoin-cryptodec-payment-gateway-for-woocommerce' ), 'error' );
    15 
    16     */
     18
     19    if ($txid_force) {
     20        if (!isset($cryptodec_transaction_id) || empty($cryptodec_transaction_id)) {
     21            wc_add_notice(esc_html__('Please enter your transaction ID', 'decentralized-bitcoin-cryptodec-payment-gateway-for-woocommerce'), 'error');
     22        } else {
     23            if (ITLS_cd_is_hash_count($cryptodec_transaction_id) > 0) {
     24                wc_add_notice(esc_html__('This Transaction ID has been already processed, please provide another Transaction ID', 'decentralized-bitcoin-cryptodec-payment-gateway-for-woocommerce'), 'error');
     25            }
     26        }
     27    }
    1728
    1829    $wallet = sanitize_text_field($_POST['cryptodec_best_btc_wallet']);
     
    2637        wc_add_notice(esc_html__('Only HEX HASH is acceptable', 'decentralized-bitcoin-cryptodec-payment-gateway-for-woocommerce'), 'error');
    2738    }
    28 
    2939}
    3040
    3141    add_action('woocommerce_checkout_process', 'cryptodec_checkout_process');
    3242
    33     function action_checkout_order_processed( $order_id, $posted_data, $order ) {
    34           //TODO: check if wallet is ours!
    35           //      check if amount is adequate
    36           //      before adding to db !!!
    37           //      fix coin !!!
    38       $hash_by = 'NOPE';
    39       $coin = 'BTC';
    40       $status = 'PENDING';
    41 
    42       $wallet = get_post_meta($order_id, '_cryptodec_best_btc_wallet', true);
    43       $total = get_post_meta($order_id, '_cryptodec_total', true);
    44       $hash = get_post_meta($order_id, '_cryptodec_transaction_id', true);
    45 
    46       if ( ITLS_cd_is_hash_count($hash) > 0 ) {
    47           $hash = '';
    48       }
    49 
    50       if (strlen($hash) > 15) {
    51           $hash_by = 'USER';
    52       }
    53       ITLS_cd_put_payment($wallet, $coin, $order_id, $total, $hash, $hash_by, $status);
     43    function action_checkout_order_processed($order_id, $posted_data, $order)
     44    {
     45        //TODO: check if wallet is ours!
     46        //      check if amount is adequate
     47        //      before adding to db !!!
     48        //      fix coin !!!
     49        $hash_by = 'NOPE';
     50        $coin = 'BTC';
     51        $status = 'PENDING';
     52
     53        $wallet = get_post_meta($order_id, '_cryptodec_best_btc_wallet', true);
     54        $total = get_post_meta($order_id, '_cryptodec_total', true);
     55        $hash = get_post_meta($order_id, '_cryptodec_transaction_id', true);
     56
     57        if (ITLS_cd_is_hash_count($hash) > 0) {
     58            $hash = '';
     59        }
     60
     61        if (strlen($hash) > 15) {
     62            $hash_by = 'USER';
     63        }
     64        ITLS_cd_put_payment($wallet, $coin, $order_id, $total, $hash, $hash_by, $status);
    5465    }
    5566    add_action('woocommerce_checkout_order_processed', 'action_checkout_order_processed', 10, 3);
     
    96107        $my_wallet = get_post_meta($order->id, '_cryptodec_best_btc_wallet', true);
    97108        $my_total = get_post_meta($order->id, '_cryptodec_total', true);
    98         $transaction = get_post_meta($order->id, '_cryptodec_transaction_id', true);
    99 ?>
     109        $transaction = get_post_meta($order->id, '_cryptodec_transaction_id', true); ?>
    100110        <div class="form-field form-field-wide">
    101111            <img src='<?php echo plugin_dir_url(__FILE__) . '../assets/images/logo-gw.png'; ?>' alt="CryptoDec">
     
    133143        $qrCode = $itls_btc_wp->get_qr_code($wallet, 0);
    134144
    135         $order = wc_get_order( $order_id );
     145        $order = wc_get_order($order_id);
    136146        $status = $order->get_status();
    137147
     
    157167<?php
    158168if ($status!=='completed') {
    159 ?>
     169            ?>
    160170                  <th>QR Code</th>
    161171                  <td><img height="120" width="120" style="display: block;  max-width:120px;  max-height:120px;  width: auto;  height: auto;" src=<?php echo $qrCode; ?> /></td>
    162172<?php
    163 } else {
    164 ?>
     173        } else {
     174            ?>
    165175
    166176                  <th>Date Paid</th>
     
    168178
    169179<?php
    170 }
    171 ?>
     180        } ?>
    172181              </tr>
    173182            </tbody>
     
    175184<?php
    176185    }
     186
     187add_action('show_user_profile', 'cryptodec_user_profile_field');
     188add_action('edit_user_profile', 'cryptodec_user_profile_field');
     189
     190function cryptodec_user_profile_field($user)
     191{
     192    $tmp = '';
     193    if (!current_user_can('edit_user', $user_id)) {
     194        $tmp = ' disabled';
     195    } ?>
     196    <h3>CryptoDEC</h3>
     197    <table class="form-table">
     198        <tr>
     199            <th><label for="best_btc_wallet">BTC Wallet Assigned:</label></th>
     200            <td>
     201                <input name="best_btc_wallet" id="best_btc_wallet" value="<?php echo esc_attr(get_the_author_meta('best_btc_wallet', $user->ID)); ?>" class="regular-text" type="text" <?php echo $tmp; ?>>
     202            </td>
     203        </tr>
     204    </table>
     205<?php
     206}
     207
     208add_action('edit_user_profile_update', 'save_cryptodec_user_profile_field');
     209function save_cryptodec_user_profile_field($user_id)
     210{
     211    if (current_user_can('edit_user', $user_id)) {
     212        update_user_meta(absint($user_id), 'best_btc_wallet', wp_kses_post($_POST['best_btc_wallet']));
     213    } else {
     214        return false;
     215    }
     216}
  • decentralized-bitcoin-cryptodec-payment-gateway-for-woocommerce/trunk/lib/itls-wp-helper-class.php

    r2465341 r2466373  
    4444
    4545
     46
    4647        /**
    4748         * Pull the feed
Note: See TracChangeset for help on using the changeset viewer.