//here is i handling result fun sendReport() { val pd = ProgressDialog(this) pd.setMessage("Sending...") pd.show() ReportService.send(collectReportData()) .success { println(it.reason) } .alwaysUi { pd.dismiss() } .successUi { MyAlert.showWithCustomAction(this, "Отчет успешно отправлен", action = { mainMenu() }) } .failUi { onSendFail(collectReportData()) } } //This is sending function object ReportService { fun send(report: Report): Promise { println("message before task") return task { ReportRemoteRepository.save(report); } } } //This is my repository object ReportRemoteRepository: RemoteRepository() { override fun save(entity: Serializable) : Response { println("report repo: save ") return super.apiObject.sendReport(super.sessionId, entity as Report) } //And this is retrofit function @POST("/photoreport/reports") fun sendReport(@Header("sessionid") sessionId: String, @Body report: Report): Response