/**
     * Deletes "junk" transactions that were probably added by bots. There might be TONS
     * of these, so we are very careful to NOT select (which the models do even when deleting),
     * and so we only use wpdb directly and NOT do any joins.
     * The downside to this approach is that is addons are listening for object deletions
     * on EEM_Base::delete() they won't be notified of this.
     * @global WPDB $wpdb
     * @return mixed
     */
    public function delete_junk_transactions()
    {
        /** @type WPDB $wpdb */
        global $wpdb;
        $deleted = false;
        $time_to_leave_alone = apply_filters('FHEE__EEM_Transaction__delete_junk_transactions__time_to_leave_alone', WEEK_IN_SECONDS);
        /**
         * This allows code to filter the query arguments used for retrieving the transaction IDs to delete.
         * Useful for plugins that want to exclude transactions matching certain query parameters.
         * The query parameters should be in the format accepted by the EEM_Base model queries.
         */
        $ids_query = apply_filters('FHEE__EEM_Transaction__delete_junk_transactions__initial_query_args', array(0 => array('STS_ID' => EEM_Transaction::failed_status_code, 'TXN_timestamp' => array('<', time() - $time_to_leave_alone))), $time_to_leave_alone);
        /**
         * This filter is for when code needs to filter the list of transaction ids that represent transactions
         * about to be deleted based on some other criteria that isn't easily done via the query args filter.
         */
        $txn_ids = apply_filters('FHEE__EEM_Transaction__delete_junk_transactions__transaction_ids_to_delete', EEM_Transaction::instance()->get_col($ids_query, 'TXN_ID'), $time_to_leave_alone);
        //now that we have the ids to delete
        if (!empty($txn_ids) && is_array($txn_ids)) {
            // first, make sure these TXN's are removed the "ee_locked_transactions" array
            EEM_Transaction::unset_locked_transactions($txn_ids);
            // let's get deletin'...
            // Why no wpdb->prepare?  Because the data is trusted.
            // We got the ids from the original query to get them FROM
            // the db (which is sanitized) so no need to prepare them again.
            $query = '
				DELETE
				FROM ' . $this->table() . '
				WHERE
					TXN_ID IN ( ' . implode(",", $txn_ids) . ')';
            $deleted = $wpdb->query($query);
        }
        if ($deleted) {
            /**
             * Allows code to do something after the transactions have been deleted.
             */
            do_action('AHEE__EEM_Transaction__delete_junk_transactions__successful_deletion', $txn_ids);
        }
        return $deleted;
    }