package Ġnet . cord a . server . controllers Ċ Ċ import Ġnet . cord a . client . jackson . Jack son Support Ċ import Ġnet . cord a . core . contracts . Amount Ċ import Ġnet . cord a . core . messaging . start Flow Ċ import Ġnet . cord a . flows . Issue Cash Flow Ċ import Ġnet . cord a . server . Node RPC Connection Ċ import Ġorg . springframework . http . Response Entity Ċ import Ġorg . springframework . web . bind . annotation . PostMapping Ċ import Ġorg . springframework . web . bind . annotation . RequestMapping Ċ import Ġorg . springframework . web . bind . annotation . RequestParam Ċ import Ġorg . springframework . web . bind . annotation . RestController Ċ import Ġjava . util .* Ċ Ċ @ RestController Ċ @ RequestMapping ("/ cash ") Ċ class ĠCash Controller ( rpc : ĠNode RPC Connection ) Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġproxy Ġ= Ġrpc . proxy ĊĠĠĠ Ġprivate Ġval Ġmapper Ġ= ĠJack son Support . create Default Mapper ( proxy ) ĊĊĠĠĠ Ġ@ PostMapping ("/ issue ") ĊĠĠĠ Ġfun Ġissue (@ RequestParam (" amount ") Ġamount : ĠInt , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ@ RequestParam (" currency ") Ġcurrency : ĠString ) Ġ: ĠResponseEntity < String > Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġtry Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġcurrency Amount Ġ= ĠAmount ( amount . to Long () Ġ* Ġ 1 0 0 , ĠCurrency . getInstance ( currency )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġflow Progress Handle Ġ= Ġproxy . start Flow (:: Issue Cash Flow , Ġcurrency Amount ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġresult Ġ= Ġflow Progress Handle . returnValue . get () ĊĠĠĠĠĠĠĠĠĠĠĠ ĠResponseEntity . ok (). body ( mapper . writeValue AsString ( result )) ĊĠĠĠĠĠĠĠ Ġ} Ġcatch ( e : ĠException ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠResponseEntity . bad Request (). body ( e . message ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ }