mirror of
https://git.wownero.com/wownero/wownerowp.git
synced 2024-08-15 01:03:16 +00:00
Update monero_payments.php
This commit is contained in:
parent
9f8fee17eb
commit
380cd24527
1 changed files with 11 additions and 2 deletions
|
@ -16,6 +16,7 @@ class Monero_Gateway extends WC_Payment_Gateway
|
||||||
private $non_rpc = false;
|
private $non_rpc = false;
|
||||||
private $zero_cofirm = false;
|
private $zero_cofirm = false;
|
||||||
private $cryptonote;
|
private $cryptonote;
|
||||||
|
private $testnet = false;
|
||||||
|
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
|
@ -41,6 +42,8 @@ class Monero_Gateway extends WC_Payment_Gateway
|
||||||
$this->use_viewKey = $this->get_option('use_viewKey');
|
$this->use_viewKey = $this->get_option('use_viewKey');
|
||||||
$this->use_rpc = $this->get_option('use_rpc');
|
$this->use_rpc = $this->get_option('use_rpc');
|
||||||
|
|
||||||
|
$env = $this->get_option('environment');
|
||||||
|
|
||||||
if($this->use_viewKey == 'yes')
|
if($this->use_viewKey == 'yes')
|
||||||
{
|
{
|
||||||
$this->non_rpc = true;
|
$this->non_rpc = true;
|
||||||
|
@ -53,6 +56,12 @@ class Monero_Gateway extends WC_Payment_Gateway
|
||||||
{
|
{
|
||||||
$this->zero_confirm = true;
|
$this->zero_confirm = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($env == 'yes')
|
||||||
|
{
|
||||||
|
$this->testnet = true;
|
||||||
|
}
|
||||||
|
|
||||||
// After init_settings() is called, you can get the settings and load them into variables, e.g:
|
// After init_settings() is called, you can get the settings and load them into variables, e.g:
|
||||||
// $this->title = $this->get_option('title' );
|
// $this->title = $this->get_option('title' );
|
||||||
$this->init_settings();
|
$this->init_settings();
|
||||||
|
@ -662,7 +671,7 @@ class Monero_Gateway extends WC_Payment_Gateway
|
||||||
}
|
}
|
||||||
public function verify_non_rpc($payment_id, $amount, $order_id)
|
public function verify_non_rpc($payment_id, $amount, $order_id)
|
||||||
{
|
{
|
||||||
$tools = new NodeTools();
|
$tools = new NodeTools($this->testnet);
|
||||||
$bc_height = $tools->get_last_block_height();
|
$bc_height = $tools->get_last_block_height();
|
||||||
|
|
||||||
$block_difference = $this->last_block_seen($bc_height);
|
$block_difference = $this->last_block_seen($bc_height);
|
||||||
|
@ -737,7 +746,7 @@ class Monero_Gateway extends WC_Payment_Gateway
|
||||||
|
|
||||||
public function verify_zero_conf($payment_id, $amount, $order_id)
|
public function verify_zero_conf($payment_id, $amount, $order_id)
|
||||||
{
|
{
|
||||||
$tools = new NodeTools();
|
$tools = new NodeTools($this->testnet);
|
||||||
$txs_from_mempool = $tools->get_mempool_txs();;
|
$txs_from_mempool = $tools->get_mempool_txs();;
|
||||||
$tx_count = count($txs_from_mempool['data']['txs']);
|
$tx_count = count($txs_from_mempool['data']['txs']);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
Loading…
Reference in a new issue