mirror of
https://git.wownero.com/wownero/wownerowp.git
synced 2024-08-15 01:03:16 +00:00
Revise getamountinfo() function
Fixes typo along with other visual improvements such as converting atomic units to regular units
This commit is contained in:
parent
a39a959254
commit
43a23800b7
1 changed files with 10 additions and 13 deletions
|
@ -45,13 +45,11 @@ class Monero_Gateway extends WC_Payment_Gateway
|
||||||
|
|
||||||
add_filter( 'woocommerce_currencies', array($this,'add_my_currency') );
|
add_filter( 'woocommerce_currencies', array($this,'add_my_currency') );
|
||||||
add_filter('woocommerce_currency_symbol', 'add_my_currency_symbol', 10, 2);
|
add_filter('woocommerce_currency_symbol', 'add_my_currency_symbol', 10, 2);
|
||||||
|
|
||||||
add_action('woocommerce_email_before_order_table', array($this, 'email_instructions'), 10, 2);
|
add_action('woocommerce_email_before_order_table', array($this, 'email_instructions'), 10, 2);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
$this->monero_daemon = new Monero_Library($this->host . ':' . $this->port . '/json_rpc', $this->username, $this->password);
|
$this->monero_daemon = new Monero_Library($this->host . ':' . $this->port . '/json_rpc', $this->username, $this->password);
|
||||||
}
|
}
|
||||||
|
@ -60,7 +58,6 @@ add_filter('woocommerce_currency_symbol', 'add_my_currency_symbol', 10, 2);
|
||||||
$currencies['XMR'] = __('Monero','woocommerce');
|
$currencies['XMR'] = __('Monero','woocommerce');
|
||||||
return $currencies;
|
return $currencies;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function add_my_currency_symbol( $currency_symbol, $currency ) {
|
public function add_my_currency_symbol( $currency_symbol, $currency ) {
|
||||||
switch( $currency ) {
|
switch( $currency ) {
|
||||||
case 'XMR': $currency_symbol = 'XMR'; break;
|
case 'XMR': $currency_symbol = 'XMR'; break;
|
||||||
|
@ -69,7 +66,6 @@ public function add_my_currency_symbol( $currency_symbol, $currency ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function admin_options()
|
public function admin_options()
|
||||||
{
|
{
|
||||||
$this->log->add('Monero_gateway', '[SUCCESS] Monero Settings OK');
|
$this->log->add('Monero_gateway', '[SUCCESS] Monero Settings OK');
|
||||||
|
@ -399,14 +395,15 @@ public function add_my_currency_symbol( $currency_symbol, $currency ) {
|
||||||
}
|
}
|
||||||
return $message;
|
return $message;
|
||||||
}
|
}
|
||||||
public function getamountinfo(){
|
public function getamountinfo(){
|
||||||
$amount_wallet = $this->monero_daemon->getbalance();
|
$wallet_amount = $this->monero_daemon->getbalance();
|
||||||
|
$real_wallet_amount = $wallet_amount['balance'] / 1000000000000;
|
||||||
echo "Your amount is:".$account_wallet['balance']. "XMR </br>";
|
$real_amount_rounded = round($real_wallet_amount, 6);
|
||||||
echo "Unlocked balance:".$account_wallet['unlocked_balance']." </br>";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$unlocked_wallet_amount = $wallet_amount['unlocked_balance'] / 1000000000000;
|
||||||
|
$unlocked_amount_rounded = round($unlocked_wallet_amount, 6);
|
||||||
|
|
||||||
|
echo "Your balance is: ".$real_amount_rounded. " XMR </br>";
|
||||||
|
echo "Unlocked balance: ".$unlocked_amount_rounded." XMR </br>";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue