Plugin Directory

Changeset 2906505


Ignore:
Timestamp:
05/01/2023 10:38:19 AM (3 years ago)
Author:
physcom
Message:

Added wallet address view on WooCommerce Settings Page

Location:
open-platform-gateway
Files:
4 added
8 edited

Legend:

Unmodified
Added
Removed
  • open-platform-gateway/tags/1.0.0/includes/class-wc-gateway-api-handler.php

    r2856996 r2906505  
    4444    {
    4545
    46         //self::log('Open Platform Request Args for ' . $endpoint . ': ' . print_r($params, true));
     46        self::log('Open Platform Request Args for ' . $endpoint . ': ' . print_r($params, true));
    4747        $args = array(
    4848            'method' => $method,
     
    5050                'X-API-KEY' => self::$api_key,
    5151                'X-API-SIGNATURE' => $hash,
     52                'X-API-TIMESTAMP' => self::get_timestamp(),
    5253                'Content-Type' => 'application/json'
    5354            )
     
    99100    public static function create_wallet($metadata = null): array
    100101    {
    101         $nonce = self::get_timestamp();
    102 
    103102        $args = array(
    104             'timestamp' => strval($nonce),
    105103            'metadata' => $metadata
    106104        );
     
    119117    {
    120118        return self::send_request('wallet/details', "", array(), 'GET');
     119
    121120    }
    122121
  • open-platform-gateway/tags/1.0.0/includes/class-wc-gateway-open.php

    r2856996 r2906505  
    4747        $this->debug = 'yes' === $this->get_option('debug', 'no');
    4848        $this->testmode = 'yes' === $this->get_option('testmode');
    49         $this->clientManaged = 'yes' === $this->get_option('client_managed');
    50         $this->clientPassword = $this->get_option('client_password');
     49        // $this->clientManaged = 'yes' === $this->get_option('client_managed');
     50        // $this->clientPassword = $this->get_option('client_password');
    5151
    5252        self::$log_enabled = $this->debug;
     
    125125            'client_managed' => array(
    126126                'title'       => __('Customer Managed', 'woocommerce'),
    127                 'label'       => __('Enable encrypted password', 'open'),
     127                'label'       => __('Enable customer managed addresses', 'open'),
    128128                'type'        => 'checkbox',
    129129                'default'     => 'yes',
    130130                'desc_tip'    => true,
    131131            ),
    132             'client_password' => array(
    133                 'title' => __('Master password', 'open'),
    134                 'type' => 'text',
    135                 'default' => '',
    136                 'description' => 'Client encryption password',
    137             ),
     132            // 'client_password' => array(
     133            //     'title' => __('Master password', 'open'),
     134            //     'type' => 'text',
     135            //     'default' => '',
     136            //     'description' => 'Client encryption password',
     137            // ),
    138138            'testmode' => array(
    139139                'title'       => __('Test mode', 'woocommerce'),
     
    213213            'test' => $this->testmode,
    214214            'clientManaged' => empty($this->clientManaged) ? false : true,
    215             'clientPassword' => $this->clientPassword,
     215            //'clientPassword' => $this->clientPassword,
    216216        );
    217217
     
    228228        $order->save();
    229229
    230         // apply_filters('process_payment_redirect', $order->get_checkout_payment_url(true), $order)
    231230        return array(
    232231            'result'     => 'success',
     
    421420    }
    422421
    423     public static function encrypt(string $data, string $password)
    424     {
    425         return wallet_encrypt($data, $password);
    426     }
    427 
    428     public static function decrypt($data, $password)
    429     {
    430         return wallet_decrypt($data, $password);
    431     }
    432422}
  • open-platform-gateway/tags/1.0.0/woocommerce-gateway-open.php

    r2856996 r2906505  
    2828            require_once 'includes/class-wc-gateway-api-handler.php';
    2929            add_action('init', 'oppg_wc_register_blockchain_status');
     30            add_action('admin_enqueue_scripts', 'oppg_scripts');
     31            add_filter('script_loader_tag', 'moduleTypeScripts', 10, 2);
    3032            add_filter('woocommerce_valid_order_statuses_for_payment', 'oppg_wc_status_valid_for_payment', 10, 2);
    3133            add_action('open_check_orders', 'oppg_wc_check_orders');
    32             add_action('wp_enqueue_scripts', 'oppg_scripts');
    3334            add_filter('woocommerce_payment_gateways', 'oppg_wc_add_open_class');
    3435            add_filter('wc_order_statuses', 'oppg_wc_add_status');
     
    6263register_deactivation_hook(__FILE__, 'oppg__deactivation');
    6364
     65function moduleTypeScripts($tag, $handle)
     66{
     67    $tyype = wp_scripts()->get_data($handle, 'type');
     68
     69    if ($tyype) {
     70        $tag = str_replace('src', 'type="' . esc_attr($tyype) . '" src', $tag);
     71    }
     72
     73    return $tag;
     74}
    6475
    6576function oppg_scripts()
     
    6778    wp_enqueue_script(
    6879        'qrcode',
    69         plugins_url('js/qrcode.min.js#deferload', __FILE__),
     80        plugins_url('/js/qrcode.min.js#deferload', __FILE__),
    7081        array('jquery')
    7182    );
    7283    wp_enqueue_script(
    7384        'clipboard',
    74         plugins_url('js/clipboard.min.js#deferload', __FILE__),
     85        plugins_url('/js/clipboard.min.js#deferload', __FILE__),
    7586        array('jquery')
    7687    );
    7788    wp_enqueue_script(
    7889        'sweetalert',
    79         plugins_url('js/sweetalert.min.js#deferload', __FILE__),
    80         array('jquery')
    81     );
     90        'https://cdn.jsdelivr.net/npm/[email protected]/dist/sweetalert2.all.min.js',
     91        array('jquery')
     92    );
     93    wp_enqueue_script(
     94        'open',
     95        plugins_url('/js/open.js', __FILE__),
     96        array('jquery')
     97    );
     98    wp_enqueue_script(
     99        'crypto',
     100        'https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/crypto-js.min.js',
     101        array('open')
     102    );
     103
    82104}
    83105
     
    237259                <td>' . esc_html($address['blockchain']) . '</td>
    238260                <td><a href="' . esc_html($url) . 'widget/trx/address/' . $address['address'] . '" target="_blank">' . esc_attr($address['address']) . '</a></td>
    239                 <td>' . esc_html($address['rate']) . '</td>
    240                 <td><button>Transfer</button></td>
    241                 </tr>';
     261                <td>' . esc_html($address['rate']) . '</td>';
     262                if($address['encrypted'] != ''){
     263                    $table_inner_display_[$index]  .=
     264                    '<td>     
     265                        <span id="btnDialog" class="encrypt button-secondary" onclick="myFunction(\'' . $address['encrypted'] . '\')">Decrypt</span>
     266                    </td>';
     267                }
     268               
     269                $table_inner_display_[$index]  .='</tr>';
    242270            }
    243271
     
    245273
    246274            $table_display_row  .= '<tr>
    247             <td>' . esc_html($order['orderKey']) . '</td>
     275            <td>' . esc_html($order['order_key']) . '</td>
    248276            <td>' . esc_html($order['amount'] . ' ' . $order['currency']) . '</td>
    249             <td>' . esc_html($order['totalPaid'] . ' ' . $order['currency']) . '</td>
     277            <td>' . esc_html($order['total_paid'] . ' ' . $order['currency']) . '</td>
    250278            <td>' . $table_inner_display_[$index] . '</td>
    251279            </tr>';
  • open-platform-gateway/trunk/README.md

    r2695739 r2906505  
    4545To use this plugin with your WooCommerce store you will need:
    4646
    47 * [WordPress] (tested up to 4.9.7)
     47* [WordPress] (tested up to 6.1.1)
    4848* [WooCommerce] (tested up to 3.4.3)
    4949
  • open-platform-gateway/trunk/includes/class-wc-gateway-api-handler.php

    r2856996 r2906505  
    4444    {
    4545
    46         //self::log('Open Platform Request Args for ' . $endpoint . ': ' . print_r($params, true));
     46        self::log('Open Platform Request Args for ' . $endpoint . ': ' . print_r($params, true));
    4747        $args = array(
    4848            'method' => $method,
     
    5050                'X-API-KEY' => self::$api_key,
    5151                'X-API-SIGNATURE' => $hash,
     52                'X-API-TIMESTAMP' => self::get_timestamp(),
    5253                'Content-Type' => 'application/json'
    5354            )
     
    99100    public static function create_wallet($metadata = null): array
    100101    {
    101         $nonce = self::get_timestamp();
    102 
    103102        $args = array(
    104             'timestamp' => strval($nonce),
    105103            'metadata' => $metadata
    106104        );
     
    119117    {
    120118        return self::send_request('wallet/details', "", array(), 'GET');
     119
    121120    }
    122121
  • open-platform-gateway/trunk/includes/class-wc-gateway-open.php

    r2856996 r2906505  
    4747        $this->debug = 'yes' === $this->get_option('debug', 'no');
    4848        $this->testmode = 'yes' === $this->get_option('testmode');
    49         $this->clientManaged = 'yes' === $this->get_option('client_managed');
    50         $this->clientPassword = $this->get_option('client_password');
     49        // $this->clientManaged = 'yes' === $this->get_option('client_managed');
     50        // $this->clientPassword = $this->get_option('client_password');
    5151
    5252        self::$log_enabled = $this->debug;
     
    125125            'client_managed' => array(
    126126                'title'       => __('Customer Managed', 'woocommerce'),
    127                 'label'       => __('Enable encrypted password', 'open'),
     127                'label'       => __('Enable customer managed addresses', 'open'),
    128128                'type'        => 'checkbox',
    129129                'default'     => 'yes',
    130130                'desc_tip'    => true,
    131131            ),
    132             'client_password' => array(
    133                 'title' => __('Master password', 'open'),
    134                 'type' => 'text',
    135                 'default' => '',
    136                 'description' => 'Client encryption password',
    137             ),
     132            // 'client_password' => array(
     133            //     'title' => __('Master password', 'open'),
     134            //     'type' => 'text',
     135            //     'default' => '',
     136            //     'description' => 'Client encryption password',
     137            // ),
    138138            'testmode' => array(
    139139                'title'       => __('Test mode', 'woocommerce'),
     
    213213            'test' => $this->testmode,
    214214            'clientManaged' => empty($this->clientManaged) ? false : true,
    215             'clientPassword' => $this->clientPassword,
     215            //'clientPassword' => $this->clientPassword,
    216216        );
    217217
     
    228228        $order->save();
    229229
    230         // apply_filters('process_payment_redirect', $order->get_checkout_payment_url(true), $order)
    231230        return array(
    232231            'result'     => 'success',
     
    421420    }
    422421
    423     public static function encrypt(string $data, string $password)
    424     {
    425         return wallet_encrypt($data, $password);
    426     }
    427 
    428     public static function decrypt($data, $password)
    429     {
    430         return wallet_decrypt($data, $password);
    431     }
    432422}
  • open-platform-gateway/trunk/readme.txt

    r2856996 r2906505  
    22Contributors: open platform
    33Plugin URL: https://commerce.openfuture.io/
    4 Tags: open, payment, woo, woocommerce, ecommerce, bitcoin, ethereum, blockchain, crypto, cryptocurrency
     4Tags: payment, woocommerce, blockchain payment, ecommerce, bitcoin, ethereum, blockchain, crypto, cryptocurrency
    55Requires at least: 3.0
    66Requires PHP: 5.6
  • open-platform-gateway/trunk/woocommerce-gateway-open.php

    r2856996 r2906505  
    2828            require_once 'includes/class-wc-gateway-api-handler.php';
    2929            add_action('init', 'oppg_wc_register_blockchain_status');
     30            add_action('admin_enqueue_scripts', 'oppg_scripts');
     31            add_filter('script_loader_tag', 'moduleTypeScripts', 10, 2);
    3032            add_filter('woocommerce_valid_order_statuses_for_payment', 'oppg_wc_status_valid_for_payment', 10, 2);
    3133            add_action('open_check_orders', 'oppg_wc_check_orders');
    32             add_action('wp_enqueue_scripts', 'oppg_scripts');
    3334            add_filter('woocommerce_payment_gateways', 'oppg_wc_add_open_class');
    3435            add_filter('wc_order_statuses', 'oppg_wc_add_status');
     
    6263register_deactivation_hook(__FILE__, 'oppg__deactivation');
    6364
     65function moduleTypeScripts($tag, $handle)
     66{
     67    $tyype = wp_scripts()->get_data($handle, 'type');
     68
     69    if ($tyype) {
     70        $tag = str_replace('src', 'type="' . esc_attr($tyype) . '" src', $tag);
     71    }
     72
     73    return $tag;
     74}
    6475
    6576function oppg_scripts()
     
    6778    wp_enqueue_script(
    6879        'qrcode',
    69         plugins_url('js/qrcode.min.js#deferload', __FILE__),
     80        plugins_url('/js/qrcode.min.js#deferload', __FILE__),
    7081        array('jquery')
    7182    );
    7283    wp_enqueue_script(
    7384        'clipboard',
    74         plugins_url('js/clipboard.min.js#deferload', __FILE__),
     85        plugins_url('/js/clipboard.min.js#deferload', __FILE__),
    7586        array('jquery')
    7687    );
    7788    wp_enqueue_script(
    7889        'sweetalert',
    79         plugins_url('js/sweetalert.min.js#deferload', __FILE__),
    80         array('jquery')
    81     );
     90        'https://cdn.jsdelivr.net/npm/[email protected]/dist/sweetalert2.all.min.js',
     91        array('jquery')
     92    );
     93    wp_enqueue_script(
     94        'open',
     95        plugins_url('/js/open.js', __FILE__),
     96        array('jquery')
     97    );
     98    wp_enqueue_script(
     99        'crypto',
     100        'https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/crypto-js.min.js',
     101        array('open')
     102    );
     103
    82104}
    83105
     
    237259                <td>' . esc_html($address['blockchain']) . '</td>
    238260                <td><a href="' . esc_html($url) . 'widget/trx/address/' . $address['address'] . '" target="_blank">' . esc_attr($address['address']) . '</a></td>
    239                 <td>' . esc_html($address['rate']) . '</td>
    240                 <td><button>Transfer</button></td>
    241                 </tr>';
     261                <td>' . esc_html($address['rate']) . '</td>';
     262                if($address['encrypted'] != ''){
     263                    $table_inner_display_[$index]  .=
     264                    '<td>     
     265                        <span id="btnDialog" class="encrypt button-secondary" onclick="myFunction(\'' . $address['encrypted'] . '\')">Decrypt</span>
     266                    </td>';
     267                }
     268               
     269                $table_inner_display_[$index]  .='</tr>';
    242270            }
    243271
     
    245273
    246274            $table_display_row  .= '<tr>
    247             <td>' . esc_html($order['orderKey']) . '</td>
     275            <td>' . esc_html($order['order_key']) . '</td>
    248276            <td>' . esc_html($order['amount'] . ' ' . $order['currency']) . '</td>
    249             <td>' . esc_html($order['totalPaid'] . ' ' . $order['currency']) . '</td>
     277            <td>' . esc_html($order['total_paid'] . ' ' . $order['currency']) . '</td>
    250278            <td>' . $table_inner_display_[$index] . '</td>
    251279            </tr>';
Note: See TracChangeset for help on using the changeset viewer.