Update class-monero-gateway.php

This commit is contained in:
itssteven 2019-01-11 16:56:33 +00:00 committed by SerHack
parent f7d1f9b968
commit ba395d507e

View File

@ -404,14 +404,33 @@ class Monero_Gateway extends WC_Payment_Gateway
protected static function check_payment_rpc($payment_id) protected static function check_payment_rpc($payment_id)
{ {
$txs = array(); $txs = array();
$payments = self::$monero_wallet_rpc->get_all_payments($payment_id); $address_index = self::$wownero_wallet_rpc->get_address_index($payment_id);
foreach($payments as $payment) { if(isset($address_index['index']['minor'])){
$address_index = $address_index['index']['minor'];
}
else {
self::$log->add('Wownero_Gateway', '[ERROR] Couldn\'t get address index of subaddress: ' . $payment_id);
return $txs;
}
$payments = self::$wownero_wallet_rpc->get_transfers(array( 'in' => true, 'pool' => true, 'subaddr_indices' => array($address_index)));
if(isset($payments['in'])) {
foreach($payments['in'] as $payment) {
$txs[] = array( $txs[] = array(
'amount' => $payment['amount'], 'amount' => $payment['amount'],
'txid' => $payment['tx_hash'], 'txid' => $payment['txid'],
'height' => $payment['block_height'] 'height' => $payment['height']
); );
} }
}
if(isset($payments['pool'])) {
foreach($payments['pool'] as $payment) {
$txs[] = array(
'amount' => $payment['amount'],
'txid' => $payment['txid'],
'height' => $payment['height']
);
}
}
return $txs; return $txs;
} }