package Ġnet . gin i . pay . gin ipay business . review Ċ Ċ import Ġnet . gin i . pay . gin ipay business . review . model . Payment Details Ċ import Ġnet . gin i . pay . gin ipay business . util . isNumber Ċ import Ġnet . gin i . pay . gin ipay business . util . isValid I ban Ċ Ċ internal Ġenum Ġclass ĠPayment Field Ġ{ ĠRe cipient , ĠI ban , ĠAmount , ĠPurpose Ġ} Ċ Ċ internal Ġsealed Ġclass ĠValidation Message ( val Ġfield : ĠPayment Field ) Ġ{ ĊĠĠĠ Ġclass ĠEmpty ( field : ĠPayment Field ): ĠValidation Message ( field ) ĊĠĠĠ Ġobject ĠInvalid I ban : ĠValidation Message ( Payment Field . I ban ) ĊĠĠĠ Ġobject ĠInvalid Currency : ĠValidation Message ( Payment Field . Amount ) ĊĠĠĠ Ġobject ĠNo Currency : ĠValidation Message ( Payment Field . Amount ) ĊĠĠĠ Ġobject ĠAmount Format : ĠValidation Message ( Payment Field . Amount ) Ċ } Ċ Ċ internal Ġfun ĠPayment Details . validate (): ĠList < Validation Message > Ġ= Ġmutable ListOf < Validation Message >(). apply Ġ{ ĊĠĠĠ Ġadd All ( validate Recipient ( this @ validate . recipient )) ĊĠĠĠ Ġadd All ( validate I ban ( this @ validate . ib an )) ĊĠĠĠ Ġadd All ( validate Amount ( this @ validate . amount )) ĊĠĠĠ Ġadd All ( validate Purpose ( this @ validate . purpose )) Ċ } Ċ Ċ internal Ġfun Ġvalidate Recipient ( recipient : ĠString ): ĠList < Validation Message > Ġ= Ġmutable ListOf < Validation Message >(). apply Ġ{ ĊĠĠĠ Ġif Ġ( recipient . trim (). isEmpty ()) Ġadd ( Validation Message . Empty ( Payment Field . Recipient )) Ċ } Ċ Ċ internal Ġfun Ġvalidate I ban ( ib an : ĠString ): ĠList < Validation Message > Ġ= Ġmutable ListOf < Validation Message >(). apply Ġ{ ĊĠĠĠ Ġif Ġ( ib an . trim (). isEmpty ()) Ġadd ( Validation Message . Empty ( Payment Field . I ban )) ĊĠĠĠ Ġif Ġ(! isValid I ban ( ib an . trim ())) Ġadd ( Validation Message . Invalid I ban ) Ċ } Ċ Ċ internal Ġfun Ġvalidate Amount ( amount : ĠString ): ĠList < Validation Message > Ġ= Ġmutable ListOf < Validation Message >(). apply Ġ{ ĊĠĠĠ Ġif Ġ( amount . trim (). isEmpty ()) Ġadd ( Validation Message . Empty ( Payment Field . Amount )) ĊĠĠĠ Ġif Ġ(! amount . trim (). isNumber ()) Ġadd ( Validation Message . Amount Format ) Ċ } Ċ Ċ internal Ġfun Ġvalidate Purpose ( purpose : ĠString ): ĠList < Validation Message > Ġ= Ġmutable ListOf < Validation Message >(). apply Ġ{ ĊĠĠĠ Ġif Ġ( purpose . trim (). isEmpty ()) Ġadd ( Validation Message . Empty ( Payment Field . Purpose )) Ċ } Ċ