package Ġcom . r 3 . cord a . finance . cash . issuer . common . flows Ċ Ċ import Ġco . parallel universe . fib ers . Suspend able Ċ import Ġnet . cord a . core . contracts . Amount Ċ import Ġnet . cord a . core . contracts . Ins ufficient Balance Exception Ċ import Ġnet . cord a . core . flows . Final ity Flow Ċ import Ġnet . cord a . core . flows . Flow Logic Ċ import Ġnet . cord a . core . flows . Flow Session Ċ import Ġnet . cord a . core . flows . Start able By RPC Ċ import Ġnet . cord a . core . identity . Party Ċ import Ġnet . cord a . core . transactions . Signed Transaction Ċ import Ġnet . cord a . core . transactions . Transaction Builder Ċ import Ġnet . cord a . core . utilities . Progress Tracker Ċ import Ġnet . cord a . finance . contracts . asset . Cash Ċ import Ġnet . cord a . finance . flows . Cash Exception Ċ import Ġjava . util .* Ċ Ċ /** Ċ Ġ* ĠSimple Ġmove Ġcash Ġflow Ġfor Ġde mos . Ċ Ġ*/ Ċ @ Start able By RPC Ċ class ĠMove Cash ( val Ġrecipient : ĠParty , Ġval Ġamount : ĠAmount < Currency >) Ġ: ĠFlow Logic < Signed Transaction >() Ġ{ ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġ// ĠTODO : ĠAdd Ġthe Ġrest Ġof Ġthe Ġprogress Ġtracker . ĊĠĠĠĠĠĠĠ Ġobject ĠMOV ING Ġ: ĠProgress Tracker . Step (" Moving Ġcash .") ĊĊĠĠĠĠĠĠĠ Ġ@ Jvm Static ĊĠĠĠĠĠĠĠ Ġfun Ġtracker () Ġ= ĠProgress Tracker ( MOV ING ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġval Ġprogress Tracker : ĠProgress Tracker Ġ= Ġtracker () ĊĊĠĠĠ Ġ@ Suspend able ĊĠĠĠ Ġoverride Ġfun Ġcall (): ĠSigned Transaction Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġnot ary Ġ= Ġservice Hub . network Map Cache . not ary Id entities . first () ĊĠĠĠĠĠĠĠ Ġval Ġtransaction Builder Ġ= ĠTransaction Builder ( not ary Ġ= Ġnot ary ) ĊĠĠĠĠĠĠĠ Ġval Ġ(_, Ġkeys ) Ġ= Ġtry Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠCash . generate S pend ( services Ġ= Ġservice Hub , Ġtx Ġ= Ġtransaction Builder , Ġamount Ġ= Ġamount , Ġto Ġ= Ġrecipient , Ġour Identity Ġ= Ġour Identity And Cert ) ĊĠĠĠĠĠĠĠ Ġ} Ġcatch Ġ( e : ĠIns ufficient Balance Exception ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġthrow ĠCash Exception (" Ins ufficient Ġcash Ġfor Ġspend : Ġ${ e . message }", Ġe ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġledger Tx Ġ= Ġtransaction Builder . to Ledger Transaction ( service Hub ) ĊĠĠĠĠĠĠĠ Ġledger Tx . input States . forEach Ġ{ Ġlogger . info (( it Ġas ĠCash . State ). toString ()) Ġ} ĊĠĠĠĠĠĠĠ Ġlogger . info ( transaction Builder . to Wire Transaction ( service Hub ). toString ()) ĊĠĠĠĠĠĠĠ Ġval Ġsigned Transaction Ġ= Ġservice Hub . sign Initial Transaction ( transaction Builder , Ġkeys ) ĊĠĠĠĠĠĠĠ Ġprogress Tracker . current Step Ġ= ĠMOV ING ĊĠĠĠĠĠĠĠ Ġreturn Ġsub Flow ( Final ity Flow ( signed Transaction , Ġempty Set < Flow Session > ())) ĊĠĠĠ Ġ} Ċ }