Skip to content

Commit

Permalink
use getbalance to confirm sent bitcoins
Browse files Browse the repository at this point in the history
  • Loading branch information
btcgear committed May 22, 2013
1 parent 5905034 commit dcd5b64
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion upload/catalog/controller/payment/bitcoin.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public function confirm_sent() {
$order = $this->model_checkout_order->getOrder($order_id);
$current_default_currency = $this->config->get('config_currency');
$bitcoin_total = $order['bitcoin_total'];
$bitcoin_address = $order['bitcoin_address'];
require_once('jsonRPCClient.php');
$bitcoin = new jsonRPCClient('http://'.$this->config->get('bitcoin_rpc_username').':'.$this->config->get('bitcoin_rpc_password').'@'.$this->config->get('bitcoin_rpc_address').':'.$this->config->get('bitcoin_rpc_port').'/');

Expand All @@ -85,7 +86,7 @@ public function confirm_sent() {
}

try {
$received_amount = $bitcoin->getreceivedbyaccount($this->config->get('bitcoin_prefix').'_'.$order_id,0);
$received_amount = $bitcoin->getbalance($bitcoin_address,0);
if(round((float)$received_amount,4) >= round((float)$bitcoin_total,4)) {
$order = $this->model_checkout_order->getOrder($order_id);
$this->model_checkout_order->confirm($order_id, $this->config->get('bitcoin_order_status_id'));
Expand Down

0 comments on commit dcd5b64

Please sign in to comment.