finish the createorder function