Get Authors Role

As an alternative to “current_user_can” WordPress provides “user_can” which will take a User object or ID as a parameter. Combining your top code and the bottom code with the new function it would look like this:

$author_user = $wp_query->get_queried_object(); // the queried object in 'author.php' should be an author user

if (user_can($author_user, 'buyer')) { 
  get_template_part( 'buyer', 'edit' );
} else if (user_can($author_user, 'courier')) { 
  get_template_part( 'courier', 'edit' );
} else if (user_can($author_user, 'banned')) { 
  get_template_part( 'account', 'banned' ); 
} else {
  // etc...
}