diff --git a/monero/include/monero_payments.php b/monero/include/monero_payments.php
index b327da4..066ffb4 100644
--- a/monero/include/monero_payments.php
+++ b/monero/include/monero_payments.php
@@ -3,7 +3,16 @@
class Monero_Gateway extends WC_Payment_Gateway
{
-
+ 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()
{
@@ -53,6 +62,7 @@ class Monero_Gateway extends WC_Payment_Gateway
'process_admin_options'
));
}
+ $this->monero_daemon = new jsonRPCClient($this->host . ':' . $this->port . '/json_rpc');
}
public function admin_options()
@@ -180,7 +190,13 @@ class Monero_Gateway extends WC_Payment_Gateway
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)
{
$order = wc_get_order($order_id);
@@ -188,8 +204,9 @@ class Monero_Gateway extends WC_Payment_Gateway
$currency = $order->currency;
$amount_xmr2 = $this->changeto($amount, $currency);
$address = $this->address;
- $payment_id = bin2hex(openssl_random_pseudo_bytes(32));
+ $payment_id = bin2hex(openssl_random_pseudo_bytes(8));
$uri = "monero:$address?amount=$amount?payment_id=$payment_id";
+ $array_integrated_address = $this->make_integrated_address($payment_id);
// Generate a QR code
echo "";
@@ -206,9 +223,8 @@ class Monero_Gateway extends WC_Payment_Gateway