Updates this to work with updated library class
This commit is contained in:
parent
f835a9e771
commit
f67eb9afbd
@ -5,14 +5,6 @@ class Monero_Gateway extends WC_Payment_Gateway
|
|||||||
{
|
{
|
||||||
private $monero_daemon;
|
private $monero_daemon;
|
||||||
|
|
||||||
private function _run($method,$params = null) {
|
|
||||||
$result = $this->monero_daemon->_run($method, $params);
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
private function _print($json){
|
|
||||||
$json_encoded = json_encode($json, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
|
||||||
echo $json_encoded;
|
|
||||||
}
|
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -62,7 +54,7 @@ class Monero_Gateway extends WC_Payment_Gateway
|
|||||||
'process_admin_options'
|
'process_admin_options'
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
$this->monero_daemon = new jsonRPCClient($this->host . ':' . $this->port . '/json_rpc');
|
$this->monero_daemon = new Monero_Library($this->host . ':' . $this->port . '/json_rpc');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function admin_options()
|
public function admin_options()
|
||||||
@ -146,7 +138,8 @@ class Monero_Gateway extends WC_Payment_Gateway
|
|||||||
{
|
{
|
||||||
$xmr_live_price = $this->retriveprice($currency);
|
$xmr_live_price = $this->retriveprice($currency);
|
||||||
$new_amount = $amount / $xmr_live_price;
|
$new_amount = $amount / $xmr_live_price;
|
||||||
return $new_amount;
|
$rounded_amount = round($new_amount, 12); //the moneo wallet can't handle decimals smaller than 0.000000000001
|
||||||
|
return $rounded_amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -190,13 +183,6 @@ class Monero_Gateway extends WC_Payment_Gateway
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function make_integrated_address($payment_id)
|
|
||||||
{
|
|
||||||
$integrate_address_parameters = array('payment_id' => $payment_id);
|
|
||||||
$integrate_address_method = $this->_run('make_integrated_address', $integrate_address_parameters);
|
|
||||||
return $integrate_address_method;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function instruction($order_id)
|
public function instruction($order_id)
|
||||||
{
|
{
|
||||||
$order = wc_get_order($order_id);
|
$order = wc_get_order($order_id);
|
||||||
@ -206,7 +192,8 @@ class Monero_Gateway extends WC_Payment_Gateway
|
|||||||
$address = $this->address;
|
$address = $this->address;
|
||||||
$payment_id = bin2hex(openssl_random_pseudo_bytes(8));
|
$payment_id = bin2hex(openssl_random_pseudo_bytes(8));
|
||||||
$uri = "monero:$address?amount=$amount?payment_id=$payment_id";
|
$uri = "monero:$address?amount=$amount?payment_id=$payment_id";
|
||||||
$array_integrated_address = $this->make_integrated_address($payment_id);
|
$array_integrated_address = $this->monero_daemon->make_integrated_address($payment_id);
|
||||||
|
|
||||||
// Generate a QR code
|
// Generate a QR code
|
||||||
echo "<link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css'>";
|
echo "<link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css'>";
|
||||||
|
|
||||||
@ -256,8 +243,7 @@ class Monero_Gateway extends WC_Payment_Gateway
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>";
|
||||||
";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user