public function confirm_sent() { $this->load->model('checkout/order'); $order_id = $this->session->data['order_id']; $order = $this->model_checkout_order->getOrder($order_id); $current_default_currency = "USD"; $hazecoin_total = round($this->currency->convert($order['total'], $current_default_currency, "haze"), 4); require_once 'jsonRPCClient.php'; $hazecoin = new jsonRPCClient('http://' . $this->config->get('hazecoin_rpc_username') . ':' . $this->config->get('hazecoin_rpc_password') . '@' . $this->config->get('hazecoin_rpc_address') . ':' . $this->config->get('hazecoin_rpc_port') . '/'); try { $hazecoin_info = $hazecoin->getinfo(); } catch (Exception $e) { $this->data['error'] = true; } $received_amount = $hazecoin->getreceivedbyaccount($this->config->get('hazecoin_prefix') . '_' . $order_id, 0); if (round((double) $received_amount, 4) >= round((double) $hazecoin_total, 4)) { $order = $this->model_checkout_order->getOrder($order_id); $this->model_checkout_order->confirm($order_id, $this->config->get('hazecoin_order_status_id')); echo true; } else { echo false; } }
if ($loaded === true || $blockchain == 'multi') { if ($blockchain != 'multi') { $bitcoind = new jsonRPCClient("http://" . $rpc_options[$blockchain]['username'] . ":" . $rpc_options[$blockchain]['password'] . "@" . $rpc_options[$blockchain]['host'] . ":" . $rpc_options[$blockchain]['port'] . "/"); $raw = false; if ($debug && $bitcoind && $loaded) { $raw = $bitcoind->getinfo(); } } if ($call == 'address') { $obj = ["address" => false, "blockchain" => $blockchain, "hash" => "N/A", "tx_count" => 0, "received" => 0, "balance" => 0, "raw" => []]; if (isset($_GET['id']) && $_GET['id']) { $address = $_GET['id']; $obj['address'] = $address; $account_name = 'XXX_' . $address; $balance = $bitcoind->getbalance($account_name, 1, true); $received = $bitcoind->getreceivedbyaccount($account_name, 1); $address = $bitcoind->validateaddress($obj['address']); $txs = $bitcoind->listtransactions($account_name, 100, 0, true); foreach ($txs as $tx_key => $tx) { $raw_tx = $bitcoind->getrawtransaction($tx['txid'], 1); foreach ($raw_tx['vout'] as $output) { if ($output['scriptPubKey']['addresses'][0] == $_GET['id']) { $asm = explode(' ', $output['scriptPubKey']['asm']); foreach ($asm as $op) { if (substr($op, 0, 2) != 'OP') { $obj['hash'] = $op; } } } } }