package Ġcom . h azz . ku ang ji . mvp . presenter Ċ Ċ import Ġandroid . text . TextUtils Ċ import Ġcom . h azz . ku ang ji . mvp . contract . I Contract View Ċ import Ġcom . h azz . ku ang ji . mvp . model . Exchange Ċ import Ġcom . h azz . ku ang ji . mvp . model . Exchange Order Ċ import Ġcom . h azz . ku ang ji . net .* Ċ import Ġcom . h azz . ku ang ji . utils . Utils Ċ import Ġokhttp 3 . MediaType Ċ import Ġokhttp 3 . Multipart Body Ċ import Ġokhttp 3 . RequestBody Ċ import Ġjava . io . File Ċ import Ġkotlin . collections . HashMap Ċ Ċ class ĠExchange Sale Presenter ( view : ĠI Contract View . I Exchange Sale View ) Ġ: ĠBase Presenter < I Contract View . I Exchange Sale View >( view ) Ġ{ ĊĊĠĠĠ Ġfun Ġget Exchange () Ġ{ ĊĊĠĠĠĠĠĠĠ Ġval Ġexchange Ġ= ĠRet rofit Manager . service New . get Exchange () ĊĊĠĠĠĠĠĠĠ Ġdo Request ( exchange , Ġobject Ġ: ĠCallback < Exchange >( view ) Ġ{ ĊĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġoverride Ġfun Ġfailed ( t Base Result : ĠBase Result < Exchange >): ĠBoolean Ġ{ ĊĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġreturn Ġfalse ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġoverride Ġfun Ġsuccess ( t Base Result : ĠBase Result < Exchange >) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġview . get Exchange ( t Base Result . data !! ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġ}, Ġtrue ) ĊĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġfun Ġcommit Order ( file : ĠString , path : ĠString , Ġtype Coin : ĠString , Ġnum : ĠString , Ġprice : ĠString , Ġtype Pay : ĠString , Ġpassword : ĠString ) Ġ{ ĊĊĠĠĠĠĠĠĠ Ġvar Ġfile Body Ġ= ĠRequest Body . create ( MediaType . parse (" multipart / form - data "), ĠFile ( file )); ĊĠĠĠĠĠĠĠ Ġvar Ġrequest Body Ġ= ĠMultip art Body . Part . create FormData (" file ", Ġ" image . png ", Ġfile Body ) ĊĊĠĠĠĠĠĠĠ Ġvar Ġmap Ġ= ĠHashMap < String , ĠString >() ĊĠĠĠĠĠĠĠ Ġmap [" type Coin "] Ġ= Ġtype Coin ĊĠĠĠĠĠĠĠ Ġmap [" num "] Ġ= Ġnum ĊĠĠĠĠĠĠĠ Ġmap [" price "] Ġ= Ġprice ĊĠĠĠĠĠĠĠ Ġmap [" type Pay "] Ġ= Ġtype Pay ĊĠĠĠĠĠĠĠ Ġmap [" path "] Ġ= Ġpath ĊĠĠĠĠĠĠĠ Ġmap [" password "] Ġ= ĠUtils . encrypt MD 5 ( password ) ĊĠĠĠĠĠĠĠ Ġdo Request ( if Ġ(! TextUtils . isEmpty ( file )) ĠRet rofit Manager . service . commit Order Sale ( map , Ġrequest Body ) Ġelse ĠRet rofit Manager . service . commit Order Sale ( map ), Ġobject Ġ: ĠCallback < Exchange Order >( view ) Ġ{ ĊĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġoverride Ġfun Ġfailed ( t Base Result : ĠBase Result < Exchange Order >): ĠBoolean Ġ{ ĊĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġreturn Ġfalse ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġoverride Ġfun Ġsuccess ( t Base Result : ĠBase Result < Exchange Order >) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġt Base Result . data ?. let Ġ{ Ġview . commit ( it ) Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġ}, Ġtrue ) ĊĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġfun Ġcommit Order ( price : ĠString , Ġnum : ĠString , Ġtype Pay : ĠString , Ġtype Coin : ĠString , Ġbank Code : ĠString , Ġbank Name : ĠString , Ġbank Type : ĠString , password : ĠString ) Ġ{ ĊĊĠĠĠĠĠĠĠ Ġvar Ġmap Ġ= ĠHashMap < String , ĠString >() ĊĠĠĠĠĠĠĠ Ġmap [" type Coin "] Ġ= Ġtype Coin ĊĠĠĠĠĠĠĠ Ġmap [" num "] Ġ= Ġnum ĊĠĠĠĠĠĠĠ Ġmap [" price "] Ġ= Ġprice ĊĠĠĠĠĠĠĠ Ġmap [" type Pay "] Ġ= Ġtype Pay ĊĠĠĠĠĠĠĠ Ġmap [" bank Code "] Ġ= Ġbank Code ĊĠĠĠĠĠĠĠ Ġmap [" bank Name "] Ġ= Ġbank Name ĊĠĠĠĠĠĠĠ Ġmap [" bank Type "] Ġ= Ġbank Type ĊĠĠĠĠĠĠĠ Ġmap [" password "] Ġ= ĠUtils . encrypt MD 5 ( password ) ĊĊĠĠĠĠĠĠĠ Ġval Ġexchange Ġ= ĠRet rofit Manager . service . commit Order Sale ( map ) ĊĊĠĠĠĠĠĠĠ Ġdo Request ( exchange , Ġobject Ġ: ĠCallback < Exchange Order >( view ) Ġ{ ĊĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġoverride Ġfun Ġfailed ( t Base Result : ĠBase Result < Exchange Order >): ĠBoolean Ġ{ ĊĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġreturn Ġfalse ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġoverride Ġfun Ġsuccess ( t Base Result : ĠBase Result < Exchange Order >) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġt Base Result . data ?. let Ġ{ Ġview . commit ( it ) Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġ}, Ġtrue ) ĊĊĠĠĠ Ġ} ĊĊ Ċ }