updateTransactionDetails

The WordPress Core updateTransactionDetails function.

Description

updateTransactionDetails( $order ); 

Parameters (1)

0. $order
The order.

Usage

  1. if ( !function_exists( 'updateTransactionDetails' ) ) { 
  2. require_once '/callback_novalnet2woocommerce.php'; 
  3.  
  4. // The order. 
  5. $order = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = updateTransactionDetails($order); 
  9.  

Defined (1)

The function is defined in the following location(s).

/callback_novalnet2woocommerce.php  
  1. function updateTransactionDetails($order) { 
  2. global $lineBreak, $request, $org_tid, $wpdb, $txn_status_code, $invoiceAllowed; 
  3. $lineBreak = "\n"; 
  4.  
  5. $payment_method = $order->payment_method; 
  6.  
  7. $query = $wpdb->get_results("SELECT option_value FROM ". $wpdb->options . " WHERE option_name = 'woocommerce_".$payment_method."_settings'"); 
  8.  
  9. $config_settings = unserialize($query[0]->option_value); 
  10.  
  11. $comments = html_entity_decode($order->payment_method_title, ENT_QUOTES, 'UTF-8') . $lineBreak; 
  12. $comments .= 'Novalnet Transaction ID : ' . $org_tid . $lineBreak; 
  13. if(isset($request['test_mode']) && $request['test_mode']) 
  14. $comments .= 'Test Order' . $lineBreak; 
  15.  
  16. if($order->customer_note) 
  17. $order->customer_note .= $new_line; 
  18.  
  19. $order->customer_note .= html_entity_decode($comments, ENT_QUOTES, 'UTF-8'); 
  20.  
  21. $nn_order_notes = array( 
  22. 'ID' => $order->id,  
  23. 'post_excerpt' => $order->customer_note 
  24. ); 
  25.  
  26. wp_update_post($nn_order_notes); 
  27.  
  28. $order->add_order_note($order->customer_note); 
  29.  
  30. update_post_meta($order->id, '_nn_total_amount', $order->order_total); 
  31. update_post_meta($order->id, '_nn_order_tid', $org_tid); 
  32.  
  33. $txn_status_code = getTransactionStatus($order->id); 
  34.  
  35. if($txn_status_code == 100) { 
  36. $order->update_status($config_settings['set_order_status']); 
  37. if(!in_array($request['payment_type'], $invoiceAllowed)) 
  38. update_post_meta($order->id, '_nn_callback_amount', $order->order_total*100); 
  39.  
  40. return true;