Changeset 2906505
- Timestamp:
- 05/01/2023 10:38:19 AM (3 years ago)
- Location:
- open-platform-gateway
- Files:
-
- 4 added
- 8 edited
-
tags/1.0.0/includes/class-wc-gateway-api-handler.php (modified) (4 diffs)
-
tags/1.0.0/includes/class-wc-gateway-open.php (modified) (5 diffs)
-
tags/1.0.0/js/open.js (added)
-
tags/1.0.0/js/sweetalert.min.js (added)
-
tags/1.0.0/woocommerce-gateway-open.php (modified) (5 diffs)
-
trunk/README.md (modified) (1 diff)
-
trunk/includes/class-wc-gateway-api-handler.php (modified) (4 diffs)
-
trunk/includes/class-wc-gateway-open.php (modified) (5 diffs)
-
trunk/js/open.js (added)
-
trunk/js/sweetalert.min.js (added)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/woocommerce-gateway-open.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
open-platform-gateway/tags/1.0.0/includes/class-wc-gateway-api-handler.php
r2856996 r2906505 44 44 { 45 45 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)); 47 47 $args = array( 48 48 'method' => $method, … … 50 50 'X-API-KEY' => self::$api_key, 51 51 'X-API-SIGNATURE' => $hash, 52 'X-API-TIMESTAMP' => self::get_timestamp(), 52 53 'Content-Type' => 'application/json' 53 54 ) … … 99 100 public static function create_wallet($metadata = null): array 100 101 { 101 $nonce = self::get_timestamp();102 103 102 $args = array( 104 'timestamp' => strval($nonce),105 103 'metadata' => $metadata 106 104 ); … … 119 117 { 120 118 return self::send_request('wallet/details', "", array(), 'GET'); 119 121 120 } 122 121 -
open-platform-gateway/tags/1.0.0/includes/class-wc-gateway-open.php
r2856996 r2906505 47 47 $this->debug = 'yes' === $this->get_option('debug', 'no'); 48 48 $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'); 51 51 52 52 self::$log_enabled = $this->debug; … … 125 125 'client_managed' => array( 126 126 'title' => __('Customer Managed', 'woocommerce'), 127 'label' => __('Enable encrypted password', 'open'),127 'label' => __('Enable customer managed addresses', 'open'), 128 128 'type' => 'checkbox', 129 129 'default' => 'yes', 130 130 'desc_tip' => true, 131 131 ), 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 // ), 138 138 'testmode' => array( 139 139 'title' => __('Test mode', 'woocommerce'), … … 213 213 'test' => $this->testmode, 214 214 'clientManaged' => empty($this->clientManaged) ? false : true, 215 'clientPassword' => $this->clientPassword,215 //'clientPassword' => $this->clientPassword, 216 216 ); 217 217 … … 228 228 $order->save(); 229 229 230 // apply_filters('process_payment_redirect', $order->get_checkout_payment_url(true), $order)231 230 return array( 232 231 'result' => 'success', … … 421 420 } 422 421 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 }432 422 } -
open-platform-gateway/tags/1.0.0/woocommerce-gateway-open.php
r2856996 r2906505 28 28 require_once 'includes/class-wc-gateway-api-handler.php'; 29 29 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); 30 32 add_filter('woocommerce_valid_order_statuses_for_payment', 'oppg_wc_status_valid_for_payment', 10, 2); 31 33 add_action('open_check_orders', 'oppg_wc_check_orders'); 32 add_action('wp_enqueue_scripts', 'oppg_scripts');33 34 add_filter('woocommerce_payment_gateways', 'oppg_wc_add_open_class'); 34 35 add_filter('wc_order_statuses', 'oppg_wc_add_status'); … … 62 63 register_deactivation_hook(__FILE__, 'oppg__deactivation'); 63 64 65 function 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 } 64 75 65 76 function oppg_scripts() … … 67 78 wp_enqueue_script( 68 79 'qrcode', 69 plugins_url(' js/qrcode.min.js#deferload', __FILE__),80 plugins_url('/js/qrcode.min.js#deferload', __FILE__), 70 81 array('jquery') 71 82 ); 72 83 wp_enqueue_script( 73 84 'clipboard', 74 plugins_url(' js/clipboard.min.js#deferload', __FILE__),85 plugins_url('/js/clipboard.min.js#deferload', __FILE__), 75 86 array('jquery') 76 87 ); 77 88 wp_enqueue_script( 78 89 '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 82 104 } 83 105 … … 237 259 <td>' . esc_html($address['blockchain']) . '</td> 238 260 <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>'; 242 270 } 243 271 … … 245 273 246 274 $table_display_row .= '<tr> 247 <td>' . esc_html($order['order Key']) . '</td>275 <td>' . esc_html($order['order_key']) . '</td> 248 276 <td>' . esc_html($order['amount'] . ' ' . $order['currency']) . '</td> 249 <td>' . esc_html($order['total Paid'] . ' ' . $order['currency']) . '</td>277 <td>' . esc_html($order['total_paid'] . ' ' . $order['currency']) . '</td> 250 278 <td>' . $table_inner_display_[$index] . '</td> 251 279 </tr>'; -
open-platform-gateway/trunk/README.md
r2695739 r2906505 45 45 To use this plugin with your WooCommerce store you will need: 46 46 47 * [WordPress] (tested up to 4.9.7)47 * [WordPress] (tested up to 6.1.1) 48 48 * [WooCommerce] (tested up to 3.4.3) 49 49 -
open-platform-gateway/trunk/includes/class-wc-gateway-api-handler.php
r2856996 r2906505 44 44 { 45 45 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)); 47 47 $args = array( 48 48 'method' => $method, … … 50 50 'X-API-KEY' => self::$api_key, 51 51 'X-API-SIGNATURE' => $hash, 52 'X-API-TIMESTAMP' => self::get_timestamp(), 52 53 'Content-Type' => 'application/json' 53 54 ) … … 99 100 public static function create_wallet($metadata = null): array 100 101 { 101 $nonce = self::get_timestamp();102 103 102 $args = array( 104 'timestamp' => strval($nonce),105 103 'metadata' => $metadata 106 104 ); … … 119 117 { 120 118 return self::send_request('wallet/details', "", array(), 'GET'); 119 121 120 } 122 121 -
open-platform-gateway/trunk/includes/class-wc-gateway-open.php
r2856996 r2906505 47 47 $this->debug = 'yes' === $this->get_option('debug', 'no'); 48 48 $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'); 51 51 52 52 self::$log_enabled = $this->debug; … … 125 125 'client_managed' => array( 126 126 'title' => __('Customer Managed', 'woocommerce'), 127 'label' => __('Enable encrypted password', 'open'),127 'label' => __('Enable customer managed addresses', 'open'), 128 128 'type' => 'checkbox', 129 129 'default' => 'yes', 130 130 'desc_tip' => true, 131 131 ), 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 // ), 138 138 'testmode' => array( 139 139 'title' => __('Test mode', 'woocommerce'), … … 213 213 'test' => $this->testmode, 214 214 'clientManaged' => empty($this->clientManaged) ? false : true, 215 'clientPassword' => $this->clientPassword,215 //'clientPassword' => $this->clientPassword, 216 216 ); 217 217 … … 228 228 $order->save(); 229 229 230 // apply_filters('process_payment_redirect', $order->get_checkout_payment_url(true), $order)231 230 return array( 232 231 'result' => 'success', … … 421 420 } 422 421 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 }432 422 } -
open-platform-gateway/trunk/readme.txt
r2856996 r2906505 2 2 Contributors: open platform 3 3 Plugin URL: https://commerce.openfuture.io/ 4 Tags: open, payment, woo, woocommerce, ecommerce, bitcoin, ethereum, blockchain, crypto, cryptocurrency4 Tags: payment, woocommerce, blockchain payment, ecommerce, bitcoin, ethereum, blockchain, crypto, cryptocurrency 5 5 Requires at least: 3.0 6 6 Requires PHP: 5.6 -
open-platform-gateway/trunk/woocommerce-gateway-open.php
r2856996 r2906505 28 28 require_once 'includes/class-wc-gateway-api-handler.php'; 29 29 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); 30 32 add_filter('woocommerce_valid_order_statuses_for_payment', 'oppg_wc_status_valid_for_payment', 10, 2); 31 33 add_action('open_check_orders', 'oppg_wc_check_orders'); 32 add_action('wp_enqueue_scripts', 'oppg_scripts');33 34 add_filter('woocommerce_payment_gateways', 'oppg_wc_add_open_class'); 34 35 add_filter('wc_order_statuses', 'oppg_wc_add_status'); … … 62 63 register_deactivation_hook(__FILE__, 'oppg__deactivation'); 63 64 65 function 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 } 64 75 65 76 function oppg_scripts() … … 67 78 wp_enqueue_script( 68 79 'qrcode', 69 plugins_url(' js/qrcode.min.js#deferload', __FILE__),80 plugins_url('/js/qrcode.min.js#deferload', __FILE__), 70 81 array('jquery') 71 82 ); 72 83 wp_enqueue_script( 73 84 'clipboard', 74 plugins_url(' js/clipboard.min.js#deferload', __FILE__),85 plugins_url('/js/clipboard.min.js#deferload', __FILE__), 75 86 array('jquery') 76 87 ); 77 88 wp_enqueue_script( 78 89 '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 82 104 } 83 105 … … 237 259 <td>' . esc_html($address['blockchain']) . '</td> 238 260 <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>'; 242 270 } 243 271 … … 245 273 246 274 $table_display_row .= '<tr> 247 <td>' . esc_html($order['order Key']) . '</td>275 <td>' . esc_html($order['order_key']) . '</td> 248 276 <td>' . esc_html($order['amount'] . ' ' . $order['currency']) . '</td> 249 <td>' . esc_html($order['total Paid'] . ' ' . $order['currency']) . '</td>277 <td>' . esc_html($order['total_paid'] . ' ' . $order['currency']) . '</td> 250 278 <td>' . $table_inner_display_[$index] . '</td> 251 279 </tr>';
Note: See TracChangeset
for help on using the changeset viewer.