|
|
@ -2,6 +2,7 @@ package mx.gob.jumapacelaya.api; |
|
|
|
|
|
|
|
import com.nimbusds.jose.shaded.gson.*; |
|
|
|
import com.vaadin.flow.server.VaadinService; |
|
|
|
import mx.gob.jumapacelaya.models.JsonOrder; |
|
|
|
import mx.gob.jumapacelaya.models.RedmineUser; |
|
|
|
import mx.gob.jumapacelaya.models.Ticket; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
@ -276,23 +277,21 @@ public class RedmineClient { |
|
|
|
} |
|
|
|
|
|
|
|
public String createIssue(Map<String, String> issueDetails, String fileUploadToken, String fileName, String contentType, String apiKey) { |
|
|
|
Map<String, Object> payload = new HashMap<>(); |
|
|
|
Map<String, Object> issue = new HashMap<>(issueDetails); |
|
|
|
|
|
|
|
List<JsonOrder.FileUpload> uploads = new ArrayList<>(); |
|
|
|
if (fileUploadToken != null) { |
|
|
|
uploads.add(new JsonOrder.FileUpload(fileUploadToken, fileName, contentType)); |
|
|
|
} |
|
|
|
|
|
|
|
if (fileUploadToken != null) { |
|
|
|
List<Map<String, Object>> uploads = new ArrayList<>(); |
|
|
|
Map<String, Object> fileTokenMap = new HashMap<>(); |
|
|
|
fileTokenMap.put("filename", fileName); |
|
|
|
fileTokenMap.put("token", fileUploadToken); |
|
|
|
fileTokenMap.put("content_type", contentType); |
|
|
|
uploads.add(fileTokenMap); |
|
|
|
payload.put("uploads", uploads); |
|
|
|
} |
|
|
|
JsonOrder.IssueDetails issueDetail = new JsonOrder.IssueDetails( |
|
|
|
issueDetails.get("project_id"), |
|
|
|
issueDetails.get("subject"), |
|
|
|
issueDetails.get("description"), |
|
|
|
uploads |
|
|
|
); |
|
|
|
|
|
|
|
payload.put("issue", issueDetails); |
|
|
|
JsonOrder order = new JsonOrder(issueDetail); |
|
|
|
|
|
|
|
String jsonPayload = GSON.toJson(payload); |
|
|
|
String jsonPayload = GSON.toJson(order); |
|
|
|
|
|
|
|
try { |
|
|
|
RedmineUser user = (RedmineUser) VaadinService.getCurrentRequest().getWrappedSession().getAttribute("myaccount"); |
|
|
|