function add_transaction()
{
    $json_trans = $_GET['trans'];
    $transaction = json_decode($json_trans);
    $total = $transaction->total;
    $phone_number = $transaction->phoneNumber;
    $phone_number = "'" . $phone_number . "'";
    $product_barcodes = $transaction->productBarcode;
    include_once 'transaction.php';
    $obj = new transaction();
    if (!$obj->connect()) {
        $json = "Failed to connect to the database.";
        echo $json;
    }
    if ($obj->add_transaction($phone_number, $total)) {
        include_once 'order.php';
        $order_obj = new order();
        $order_obj->connect();
        $trans_id = $obj->get_insert_id();
        $order_obj->add_orders($trans_id, $product_barcodes);
        if ($total > 500) {
            //            $message = "You have a 10% discount the next time you purchase.";
            //            send_smsgh($phone_number, $message);
        }
        $json = "The transaction was added.";
        echo $json;
    } else {
        $json = "The transaction was not added.";
        echo $json;
    }
}