Changeset 2196872
- Timestamp:
- 11/19/2019 10:11:50 PM (6 years ago)
- Location:
- woo-xrp/trunk
- Files:
-
- 6 edited
-
includes/class-wcxrp-gateway.php (modified) (2 diffs)
-
includes/class-wcxrp-rates.php (modified) (1 diff)
-
js/checkout.js (modified) (3 diffs)
-
languages/woocommerce-xrp.pot (modified) (1 diff)
-
readme.txt (modified) (3 diffs)
-
woocommerce-xrp.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
woo-xrp/trunk/includes/class-wcxrp-gateway.php
r2062352 r2196872 7 7 * @class WC_Gateway_XRP 8 8 * @extends WC_Payment_Gateway 9 * @version 1.1. 29 * @version 1.1.3 10 10 * @package WooCommerce/Classes/Payment 11 11 * @author Jesper Wallin … … 49 49 /* supported currencies */ 50 50 $this->currencies = [ 51 'USD','JPY','BGN','CZK','DKK','GBP','HUF','PLN','RON','SEK','CHF', 52 'ISK','NOK','HRK','RUB','TRY','AUD','BRL','CAD','CNY','HKD','IDR', 53 'ILS','INR','KRW','MXN','MYR','NZD','PHP','SGD','THB','ZAR','EUR' 51 'USD','JPY','BGN','CZK','DKK','GBP','HUF','PLN','RON','SEK', 52 'CHF','ISK','NOK','HRK','RUB','TRY','AUD','BRL','CAD','CNY', 53 'HKD','IDR','ILS','INR','KRW','MXN','MYR','NZD','PHP','SGD', 54 'THB','ZAR','EUR','XRP' 54 55 ]; 55 56 -
woo-xrp/trunk/includes/class-wcxrp-rates.php
r2062352 r2196872 145 145 public function get_rate($exchange, array $exchanges) 146 146 { 147 /* don't bother if we're using XRP as base currency */ 148 if ($this->base_currency === 'XRP') { 149 return 1; 150 } 151 147 152 /* call the rate dynamically if it's in the exchanges list */ 148 153 if (isset($exchanges[$exchange]) && -
woo-xrp/trunk/js/checkout.js
r2059248 r2196872 1 jQuery(document).ready(function($) { 1 jQuery(document).ready(function($) 2 { 3 var use_x_account = 0; 2 4 3 function wc_gateway_xrp_qrcode(account, tag, amount) { 5 function wc_gateway_xrp_qrcode(account, tag, amount) 6 { 4 7 $('#wc_xrp_qrcode').empty(); 8 if (account.substring(0,1) == 'r') { 9 var qrdata = account + "?dt=" + tag + "&amount=" + amount; 10 } else { 11 var qrdata = account + "?amount=" + amount; 12 } 5 13 var qrcode = new QRCode(document.getElementById("wc_xrp_qrcode"), { 6 text: "https://ripple.com/send?to=" + account + "&dt=" + tag + "&amount=" + amount,14 text: qrdata, 7 15 width: 256, 8 16 height: 256, … … 13 21 } 14 22 15 var pollTimer = setInterval(function(){ 23 function update_balance() 24 { 16 25 jQuery.ajax({ 17 26 "url": ajax_object.ajax_url, 18 "data": { "action": "xrp_checkout", "order_id": ajax_object.order_id }, 27 "data": { 28 "action": "xrp_checkout", 29 "order_id": ajax_object.order_id 30 }, 19 31 "method": "POST", 20 32 "dataType": "json", 21 33 "success": function(data) { 22 34 var regenqr=false; 35 if (use_x_account) { 36 data.xrp_account = data.xrp_x_account; 37 } 23 38 if ($('#xrp_account').text() != data.xrp_account) { 24 39 $('#xrp_account').text(data.xrp_account); … … 46 61 $('#wc_xrp_qrcode').empty(); 47 62 } else if (regenqr) { 48 wc_gateway_xrp_qrcode(data.xrp_account, data.tag, data.xrp_remaining); 63 wc_gateway_xrp_qrcode( 64 data.xrp_account, 65 data.tag, 66 data.xrp_remaining 67 ); 49 68 } 50 69 } 51 70 }); 52 }, 4000); 71 } 72 73 $('#wc_xrp_qrcode, #xrp_account').on('click', function() 74 { 75 if (use_x_account) { 76 use_x_account = 0; 77 } else { 78 use_x_account = 1; 79 } 80 81 update_balance(); 82 }); 83 84 var pollTimer = setInterval(update_balance, 4000); 53 85 54 86 wc_gateway_xrp_qrcode( -
woo-xrp/trunk/languages/woocommerce-xrp.pot
r2059248 r2196872 20 20 21 21 #. Plugin URI of the plugin 22 msgid "http://github.com/ empatogen/woocommerce-xrp"22 msgid "http://github.com/zelest/woocommerce-xrp" 23 23 msgstr "" 24 24 -
woo-xrp/trunk/readme.txt
r2195016 r2196872 4 4 Tags: woo, woocommerce, xrp, gateway, cryptocurrency 5 5 Requires at least: 5.1 6 Tested up to: 5. 36 Tested up to: 5.1.1 7 7 Requires PHP: 7.0 8 8 Stable tag: trunk … … 52 52 == Changelog == 53 53 54 = 1.1.3 = 55 * Add support for the new [X-addresses](https://xrpaddress.info/). 56 * Change the XRP-address in the QR-code to support more wallets. 57 54 58 = 1.1.2 = 55 59 * Add the decentralized exchange. (DEX) … … 89 93 == Upgrade notice == 90 94 91 = 1.1.2 = 92 This version prevents certain themes from breaking the XRP address on the checkout page. It also adds the decentralized exchange that lives on the XRP Ledger. 95 = 1.1.3 = 96 * Add support for the new [X-addresses](https://xrpaddress.info/). 97 * Change the XRP-address in the QR-code to support more wallets. 93 98 94 99 == Acknowledgments == -
woo-xrp/trunk/woocommerce-xrp.php
r2062352 r2196872 2 2 /** 3 3 * Plugin Name: WooCommerce XRP 4 * Plugin URI: http://github.com/ empatogen/woocommerce-xrp4 * Plugin URI: http://github.com/zelest/woocommerce-xrp 5 5 * Description: A payment gateway for WooCommerce to accept <a href="https://ripple.com/xrp">XRP</a> payments. 6 * Version: 1.1. 26 * Version: 1.1.3 7 7 * Author: Jesper Wallin 8 8 * Author URI: https://ifconfig.se/ … … 30 30 31 31 /* define constants */ 32 define('WCXRP_VERSION', '1.1. 2');32 define('WCXRP_VERSION', '1.1.3'); 33 33 define('WCXRP_TEXTDOMAIN', 'wc-gateway-xrp'); 34 34 define('WCXRP_NAME', 'Woocommerce XRP'); … … 140 140 } 141 141 142 $account = $x_account = trim( 143 get_option('woocommerce_xrp_settings')['xrp_account'] 144 ); 145 146 $url = sprintf( 147 'https://xrpaddress.info/api/encode/%s/%d', 148 $account, 149 (int)$order->get_meta('destination_tag', true) 150 ); 151 152 if (($x_account = get_transient($url)) === false) { 153 $res = wp_remote_get($url); 154 if (!is_wp_error($res) && $res['response']['code'] === 200 && 155 (($json = json_decode($res['body'])) !== null) && 156 isset($json->address)) { 157 $x_account = $json->address; 158 set_transient($url, $x_account, 3600); 159 } 160 } 161 142 162 $tag = $order->get_meta('destination_tag', true); 143 163 $xrp_total = round($order->get_meta('total_amount', true), 6); … … 147 167 148 168 $result = [ 149 'xrp_account' => get_option('woocommerce_xrp_settings')['xrp_account'], 169 'xrp_account' => $account, 170 'xrp_x_account' => $x_account, 150 171 'tag' => $tag, 151 172 'xrp_total' => $xrp_total,
Note: See TracChangeset
for help on using the changeset viewer.