From 8ff6da2d5212cc7310570b9f37bf11ec1dabee4f Mon Sep 17 00:00:00 2001 From: cryptochangements34 Date: Fri, 8 Jun 2018 15:08:55 -0500 Subject: [PATCH] always use integrated addresses --- monero/include/monero_payments.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/monero/include/monero_payments.php b/monero/include/monero_payments.php index b34f793..7eded4e 100644 --- a/monero/include/monero_payments.php +++ b/monero/include/monero_payments.php @@ -343,7 +343,7 @@ class Monero_Gateway extends WC_Payment_Gateway echo ""; $order = wc_get_order($order_id); $amount = floatval(preg_replace('#[^\d.]#', '', $order->get_total())); - $payment_id = $this->set_paymentid_cookie(32); + $payment_id = $this->set_paymentid_cookie(8); $currency = $order->get_currency(); $amount_xmr2 = $this->changeto($amount, $currency, $payment_id); $address = $this->address; @@ -356,8 +356,14 @@ class Monero_Gateway extends WC_Payment_Gateway // If there isn't address (merchant missed that field!), $address will be the Monero address for donating :) $address = "44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A"; } - $uri = "monero:$address?tx_payment_id=$payment_id"; + $decoded_address = $this->cryptonote->decode_address($address); + $pub_spendKey = $decoded_address['spendKey']; + $pub_viewKey = $decoded_address['viewKey']; + $integrated_addr = $this->cryptonote->integrated_addr_from_keys($pub_spendKey, $pub_viewKey, $payment_id); + + $uri = "monero:$address?tx_payment_id=$payment_id"; + if($this->zero_confirm){ $this->verify_zero_conf($payment_id, $amount_xmr2, $order_id); } @@ -366,7 +372,7 @@ class Monero_Gateway extends WC_Payment_Gateway } if($this->confirmed == false) { - echo "

We are waiting for your transaction to be confirmed

"; + echo "

We are waiting for your transaction to be confirmed

"; } if($this->confirmed) { @@ -375,7 +381,6 @@ class Monero_Gateway extends WC_Payment_Gateway echo " -

*don't forget to include the payment ID in your transaction

@@ -399,12 +404,10 @@ class Monero_Gateway extends WC_Payment_Gateway
Send:
".$amount_xmr2."
- Payment ID: -
".$payment_id."
To this address: -
".$address."
+
".$integrated_addr."
Or scan QR: