From 552792625da7ae5e2d1e0de843c029c3aef4b4d2 Mon Sep 17 00:00:00 2001 From: cryptochangements34 Date: Mon, 26 Feb 2018 19:02:32 -0600 Subject: [PATCH 1/2] Store some basic info in metadata This should help merchants with book keeping --- monero/include/monero_payments.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/monero/include/monero_payments.php b/monero/include/monero_payments.php index d733527..c9878fc 100644 --- a/monero/include/monero_payments.php +++ b/monero/include/monero_payments.php @@ -319,6 +319,11 @@ class Monero_Gateway extends WC_Payment_Gateway $currency = $order->get_currency(); $amount_xmr2 = $this->changeto($amount, $currency, $payment_id); $address = $this->address; + + $order->update_meta_data( "Payment ID", $payment_id); + $order->update_meta_data( "Amount requested (XMR)", $amount_xmr2); + $order->save(); + if (!isset($address)) { // If there isn't address (merchant missed that field!), $address will be the Monero address for donating :) $address = "44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A"; @@ -402,6 +407,10 @@ class Monero_Gateway extends WC_Payment_Gateway $payment_id = $this->set_paymentid_cookie(8); $currency = $order->get_currency(); $amount_xmr2 = $this->changeto($amount, $currency, $payment_id); + + $order->update_meta_data( "Payment ID", $payment_id); + $order->update_meta_data( "Amount requested (XMR)", $amount_xmr2); + $order->save(); $uri = "monero:$address?tx_payment_id=$payment_id"; $array_integrated_address = $this->monero_daemon->make_integrated_address($payment_id); From d0071b12a9c8d93c3c1ff4ba6aded6646a40f093 Mon Sep 17 00:00:00 2001 From: cryptochangements34 Date: Mon, 26 Feb 2018 19:03:57 -0600 Subject: [PATCH 2/2] remove no longer needed note --- monero/include/monero_payments.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/monero/include/monero_payments.php b/monero/include/monero_payments.php index c9878fc..f30056d 100644 --- a/monero/include/monero_payments.php +++ b/monero/include/monero_payments.php @@ -589,10 +589,10 @@ class Monero_Gateway extends WC_Payment_Gateway $order = wc_get_order($order_id); if($this->is_virtual_in_cart($order_id) == true){ - $order->update_status('completed', __('Payment has been received. Payment ID: ' . $payment_id, 'monero_gateway')); + $order->update_status('completed', __('Payment has been received.', 'monero_gateway')); } else{ - $order->update_status('processing', __('Payment has been received. Payment ID: ' . $payment_id, 'monero_gateway')); // Show payment id used for order + $order->update_status('processing', __('Payment has been received.', 'monero_gateway')); // Show payment id used for order } global $wpdb; $wpdb->query("DROP TABLE $payment_id"); // Drop the table from database after payment has been confirmed as it is no longer needed