Skip to content

Commit

Permalink
remove insert_order failure case
Browse files Browse the repository at this point in the history
  • Loading branch information
anktd committed Mar 24, 2023
1 parent 25cfd3e commit cc9550d
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions php/Blockonomics.php
Original file line number Diff line number Diff line change
Expand Up @@ -521,10 +521,7 @@ public function create_and_insert_new_order_on_underpayment($order){
// Some error in Address Generation from API, return the same array.
return $order;
}
if (!$this->insert_order($order)) {
// insert_order fails if duplicate address found. Ensures no duplicate orders in the database
return array("error"=>__("Duplicate Address Error. This is a Temporary error, please try again", 'blockonomics-bitcoin-payments'));
}
$this->insert_order($order);
$this->record_address($order['order_id'], $order['crypto'], $order['address']);
return $order;
}
Expand Down Expand Up @@ -702,7 +699,7 @@ public function get_order_by_id_and_crypto($order_id, $crypto){
}


// Inserts a new order in blockonomics_payments table
// Inserts a new row in blockonomics_payments table
public function insert_order($order){
global $wpdb;
$wpdb->hide_errors();
Expand Down Expand Up @@ -737,10 +734,7 @@ public function process_order($order_id, $crypto){
// Some error in Address Generation from API, return the same array.
return $order;
}
if (!$this->insert_order($order)) {
// insert_order fails if duplicate address found. Ensures no duplicate orders in the database
return array("error"=>__("Duplicate Address Error. This is a Temporary error, please try again", 'blockonomics-bitcoin-payments'));
}
$this->insert_order($order);
$this->record_address($order_id, $crypto, $order['address']);
}
return $order;
Expand Down

0 comments on commit cc9550d

Please sign in to comment.