#!/usr/bin/php getTransactions(0, array('type' => 'Debit_MP'), $limit); $aAllAPDebitTxs = $transaction->getTransactions(0, array('type' => 'Debit_AP'), $limit); $aAllDebitTxs = array_merge($aAllMPDebitTxs, $aAllAPDebitTxs); // Fetch transactions from RPC $aListTransactions = $bitcoin->listtransactions('', $rpclimit); // We don't need to loop through non-send transaction types foreach ($aListTransactions as $key => $aTransaction) { if ($aTransaction['category'] != 'send') { unset($aListTransactions[$key]); } } // Initilize counters $total=count($aListTransactions); $found=0; $notfound=0; // Output mask and header $mask = "| %15.15s | %-15.15s | %-34.34s | %20.20s | %10.10s | %-64.64s |" . PHP_EOL; printf($mask, 'TX-DB-ID', 'Username', 'Address', 'Amount', 'Status', 'TX-RPC-ID'); // Loop through our DB records foreach ($aAllDebitTxs as $aDebitTx) { $bFound = false; $txid = 'n/a'; foreach($aListTransactions as $key => $aTransaction) { if (isset($aTransaction['address']) && $aTransaction['address'] == $aDebitTx['coin_address'] && ((string)($aTransaction['amount'] + $aTransaction['fee']) == (string)($aDebitTx['amount'] * -1) || // Check against transaction - Fee total (string)($aTransaction['amount'] + $config['txfee_manual']) == (string)($aDebitTx['amount'] * -1) || // Check against txfee_manual deducted (string)($aTransaction['amount'] + $config['txfee_auto']) == (string)($aDebitTx['amount'] * -1) || // Check against txfee_auto deducted (string)($aTransaction['amount'] + $customtxfee) == (string)($aDebitTx['amount'] * -1) || // Check against transaction - default fee in MPOS (string)$aTransaction['amount'] == (string)($aDebitTx['amount'] * -1)) // Check against actual value ) { unset($aListTransactions[$key]); $found++; $bFound = true; $status = 'FOUND'; $txid = $aTransaction['txid']; } } if (!$bFound) $status = 'MISSING'; printf($mask, $aDebitTx['id'], $aDebitTx['username'], $aDebitTx['coin_address'], $aDebitTx['amount'], $status, $txid); } // Small summary echo PHP_EOL . 'Please be aware that transaction prior to a transaction fee change may be marked as MISSING.' . PHP_EOL; echo 'See help on how to apply a custom transaction fee that can also be checked against.' . PHP_EOL; echo PHP_EOL . 'Summary: ' . PHP_EOL; echo ' DB Debit Transaction Limit: ' . $limit . PHP_EOL; echo ' RPC Transaction Limit: ' . $rpclimit . PHP_EOL; echo ' Custom TX Fee Checked: ' . $customtxfee . PHP_EOL; echo ' Total Send TX Records: ' . $total . PHP_EOL; echo ' Total Debit Records: ' . count($aAllDebitTxs) . PHP_EOL; echo ' Total Records Found: ' . $found . PHP_EOL;