Fix bugs of arguments validation + removing code duplication
There was a bug as a result of the copy past from previous functions while adding two new methods:
- GetHistoryUserIncomingRequests
- GetHistoryUserOutgoingRequests
Since those functions doesn't require anymore an additional status parameter, the check during invocation, which required two parameters become obsolete, e.g.:
if len(args) != 2 {
errMsg := fmt.Sprintf("parameters[GetUserOutgoingRequestsByStatus:]
Invalid number of arguments, expected 2 while got %d", len(args))
logger.Error(errMsg)
return shim.Error(errMsg)
}
Moreover code to build resulting list of users offers was duplicated. This commit takes care to fix the bug of arguments validation and also cleans up duplications by extracting the logic into single place.