Ċ import Ġjava . util .* Ċ import Ġjava . util . stream . Collectors Ċ Ċ @ javax . annotation . Generated ( value Ġ= Ġ[" decision . ft l ", Ġ" Pre B ure au Aff ord ability "]) Ċ @ com . gs . dm n . runtime . annotation . DR G Element ( ĊĠĠĠ Ġnamespace Ġ= Ġ"", ĊĠĠĠ Ġname Ġ= Ġ" Pre B ure au Aff ord ability ", ĊĠĠĠ Ġlabel Ġ= Ġ"", ĊĠĠĠ Ġelement Kind Ġ= Ġcom . gs . dm n . runtime . annotation . DR G Element Kind . DEC ISION , ĊĠĠĠ Ġexpression Kind Ġ= Ġcom . gs . dm n . runtime . annotation . Expression Kind . IN VOC ATION , ĊĠĠĠ Ġhit Policy Ġ= Ġcom . gs . dm n . runtime . annotation . Hit Policy . UNKNOWN , ĊĠĠĠ Ġrules Count Ġ= Ġ- 1 Ċ ) Ċ class ĠPre B ure au Aff ord ability ( val Ġpre B ure au Risk Category Ġ: ĠPre B ure au Risk Category Ġ= ĠPre B ure au Risk Category (), Ġval Ġrequired Monthly Install ment Ġ: ĠRequired Monthly Install ment Ġ= ĠRequired Monthly Install ment ()) Ġ: Ġcom . gs . dm n . runtime . Default DM N Base Decision () Ġ{ ĊĠĠĠ Ġfun Ġapply ( applicant Data : ĠString ?, Ġrequested Product : ĠString ?, Ġannotation Set _: Ġcom . gs . dm n . runtime . annotation . Annotation Set ): ĠBoolean ? Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġtry Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġapply ( applicant Data ?. let ({ Ġcom . gs . dm n . serialization . Json Serializer . OBJECT _ MAP PER . readValue ( it , Ġobject Ġ: Ġcom . fasterxml . jackson . core . type . Type Reference < type . T Applic ant Data Impl >() Ġ{}) Ġ}), Ġrequested Product ?. let ({ Ġcom . gs . dm n . serialization . Json Serializer . OBJECT _ MAP PER . readValue ( it , Ġobject Ġ: Ġcom . fasterxml . jackson . core . type . Type Reference < type . T Requested Product Impl >() Ġ{}) Ġ}), Ġannotation Set _, Ġcom . gs . dm n . runtime . listener . Logging EventListener ( LOGGER ), Ġcom . gs . dm n . runtime . external . Default External Function Executor (), Ġcom . gs . dm n . runtime . cache . Default Cache ()) ĊĠĠĠĠĠĠĠ Ġ} Ġcatch Ġ( e : ĠException ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġlog Error (" Cannot Ġapply Ġdecision Ġ' Pre B ure au Aff ord ability '", Ġe ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġnull ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġapply ( applicant Data : ĠString ?, Ġrequested Product : ĠString ?, Ġannotation Set _: Ġcom . gs . dm n . runtime . annotation . Annotation Set , Ġevent Listener _: Ġcom . gs . dm n . runtime . listener . EventListener , Ġexternal Executor _: Ġcom . gs . dm n . runtime . external . External Function Executor , Ġcache _: Ġcom . gs . dm n . runtime . cache . Cache ): ĠBoolean ? Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġtry Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġapply ( applicant Data ?. let ({ Ġcom . gs . dm n . serialization . Json Serializer . OBJECT _ MAP PER . readValue ( it , Ġobject Ġ: Ġcom . fasterxml . jackson . core . type . Type Reference < type . T Applic ant Data Impl >() Ġ{}) Ġ}), Ġrequested Product ?. let ({ Ġcom . gs . dm n . serialization . Json Serializer . OBJECT _ MAP PER . readValue ( it , Ġobject Ġ: Ġcom . fasterxml . jackson . core . type . Type Reference < type . T Requested Product Impl >() Ġ{}) Ġ}), Ġannotation Set _, Ġevent Listener _, Ġexternal Executor _, Ġcache _) ĊĠĠĠĠĠĠĠ Ġ} Ġcatch Ġ( e : ĠException ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġlog Error (" Cannot Ġapply Ġdecision Ġ' Pre B ure au Aff ord ability '", Ġe ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġnull ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġapply ( applicant Data : Ġtype . T Applic ant Data ?, Ġrequested Product : Ġtype . T Requested Product ?, Ġannotation Set _: Ġcom . gs . dm n . runtime . annotation . Annotation Set ): ĠBoolean ? Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġapply ( applicant Data , Ġrequested Product , Ġannotation Set _, Ġcom . gs . dm n . runtime . listener . Logging EventListener ( LOGGER ), Ġcom . gs . dm n . runtime . external . Default External Function Executor (), Ġcom . gs . dm n . runtime . cache . Default Cache ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġapply ( applicant Data : Ġtype . T Applic ant Data ?, Ġrequested Product : Ġtype . T Requested Product ?, Ġannotation Set _: Ġcom . gs . dm n . runtime . annotation . Annotation Set , Ġevent Listener _: Ġcom . gs . dm n . runtime . listener . EventListener , Ġexternal Executor _: Ġcom . gs . dm n . runtime . external . External Function Executor , Ġcache _: Ġcom . gs . dm n . runtime . cache . Cache ): ĠBoolean ? Ġ{ ĊĠĠĠĠĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ// ĠStart Ġdecision Ġ' Pre B ure au Aff ord ability ' ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġpre B ure au Aff ord ability StartTime _ Ġ= ĠSystem . currentTimeMillis () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġpre B ure au Aff ord ability Arguments _ Ġ= Ġcom . gs . dm n . runtime . listener . Arguments () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġpre B ure au Aff ord ability Arguments _. put (" Applic ant Data ", Ġapplic ant Data ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġpre B ure au Aff ord ability Arguments _. put (" Requested Product ", Ġrequested Product ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġevent Listener _. start DR G Element ( DR G _ ELEMENT _ METADATA , Ġpre B ure au Aff ord ability Arguments _) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġ// ĠApply Ġchild Ġdecisions ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġpre B ure au Risk Category : ĠString ? Ġ= Ġthis . pre B ure au Risk Category . apply ( applicant Data , Ġannotation Set _, Ġevent Listener _, Ġexternal Executor _, Ġcache _) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġrequired Monthly Install ment : Ġjava . math . BigDecimal ? Ġ= Ġthis . required Monthly Install ment . apply ( requested Product , Ġannotation Set _, Ġevent Listener _, Ġexternal Executor _, Ġcache _) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġ// ĠEvaluate Ġdecision Ġ' Pre B ure au Aff ord ability ' ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġoutput _: ĠBoolean ? Ġ= Ġevaluate ( applicant Data , Ġpre B ure au Risk Category , Ġrequired Monthly Install ment , Ġannotation Set _, Ġevent Listener _, Ġexternal Executor _, Ġcache _) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġ// ĠEnd Ġdecision Ġ' Pre B ure au Aff ord ability ' ĊĠĠĠĠĠĠĠĠĠĠĠ Ġevent Listener _. end DR G Element ( DR G _ ELEMENT _ METADATA , Ġpre B ure au Aff ord ability Arguments _, Ġoutput _, Ġ( System . currentTimeMillis () Ġ- Ġpre B ure au Aff ord ability StartTime _)) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn Ġoutput _ ĊĠĠĠĠĠĠĠ Ġ} Ġcatch Ġ( e : ĠException ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġlog Error (" Exception Ġcaught Ġin Ġ' Pre B ure au Aff ord ability ' Ġevaluation ", Ġe ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn Ġnull ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġapply ( pre B ure au Aff ord ability Request _: Ġproto . Pre B ure au Aff ord ability Request , Ġannotation Set _: Ġcom . gs . dm n . runtime . annotation . Annotation Set ): Ġproto . Pre B ure au Aff ord ability Response Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġapply ( pre B ure au Aff ord ability Request _, Ġannotation Set _, Ġcom . gs . dm n . runtime . listener . Logging EventListener ( LOGGER ), Ġcom . gs . dm n . runtime . external . Default External Function Executor (), Ġcom . gs . dm n . runtime . cache . Default Cache ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġapply ( pre B ure au Aff ord ability Request _: Ġproto . Pre B ure au Aff ord ability Request , Ġannotation Set _: Ġcom . gs . dm n . runtime . annotation . Annotation Set , Ġevent Listener _: Ġcom . gs . dm n . runtime . listener . EventListener , Ġexternal Executor _: Ġcom . gs . dm n . runtime . external . External Function Executor , Ġcache _: Ġcom . gs . dm n . runtime . cache . Cache ): Ġproto . Pre B ure au Aff ord ability Response Ġ{ ĊĠĠĠĠĠĠĠ Ġ// ĠCreate Ġarguments Ġfrom ĠRequest ĠMessage ĊĠĠĠĠĠĠĠ Ġval Ġapplic ant Data : Ġtype . T Applic ant Data ? Ġ= Ġtype . T Applic ant Data . to T Applic ant Data ( pre B ure au Aff ord ability Request _. get Applic ant Data ()) ĊĠĠĠĠĠĠĠ Ġval Ġrequested Product : Ġtype . T Requested Product ? Ġ= Ġtype . T Requested Product . to T Requested Product ( pre B ure au Aff ord ability Request _. get Requested Product ()) ĊĊĠĠĠĠĠĠĠ Ġ// ĠInvoke Ġapply Ġmethod ĊĠĠĠĠĠĠĠ Ġval Ġoutput _: ĠBoolean ? Ġ= Ġapply ( applicant Data , Ġrequested Product , Ġannotation Set _, Ġevent Listener _, Ġexternal Executor _, Ġcache _) ĊĊĠĠĠĠĠĠĠ Ġ// ĠConvert Ġoutput Ġto ĠResponse ĠMessage ĊĠĠĠĠĠĠĠ Ġval Ġbuilder _: Ġproto . Pre B ure au Aff ord ability Response . Builder Ġ= Ġproto . Pre B ure au Aff ord ability Response . newBuilder () ĊĠĠĠĠĠĠĠ Ġval Ġoutput Proto _ Ġ= Ġ( if Ġ( output _ Ġ== Ġnull ) Ġfalse Ġelse Ġoutput _ !! ) ĊĠĠĠĠĠĠĠ Ġbuilder _. set Pre B ure au Aff ord ability ( output Proto _) ĊĠĠĠĠĠĠĠ Ġreturn Ġbuilder _. build () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġinline Ġfun Ġevaluate ( applicant Data : Ġtype . T Applic ant Data ?, Ġpre B ure au Risk Category : ĠString ?, Ġrequired Monthly Install ment : Ġjava . math . BigDecimal ?, Ġannotation Set _: Ġcom . gs . dm n . runtime . annotation . Annotation Set , Ġevent Listener _: Ġcom . gs . dm n . runtime . listener . EventListener , Ġexternal Executor _: Ġcom . gs . dm n . runtime . external . External Function Executor , Ġcache _: Ġcom . gs . dm n . runtime . cache . Cache ): ĠBoolean ? Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠAff ord ability Calculation . Aff ord ability Calculation ( applicant Data ?. let ({ Ġit . monthly Ġas Ġtype . Monthly ? Ġ}) ?. let ({ Ġit . income Ġas Ġjava . math . BigDecimal ? Ġ}), Ġapplic ant Data ?. let ({ Ġit . monthly Ġas Ġtype . Monthly ? Ġ}) ?. let ({ Ġit . rep ay ments Ġas Ġjava . math . BigDecimal ? Ġ}), Ġapplic ant Data ?. let ({ Ġit . monthly Ġas Ġtype . Monthly ? Ġ}) ?. let ({ Ġit . exp enses Ġas Ġjava . math . BigDecimal ? Ġ}), Ġpre B ure au Risk Category , Ġrequired Monthly Install ment , Ġannotation Set _, Ġevent Listener _, Ġexternal Executor _, Ġcache _) Ġas ĠBoolean ? ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġval ĠD RG _ ELEMENT _ METADATA Ġ: Ġcom . gs . dm n . runtime . listener . DR G Element Ġ= Ġcom . gs . dm n . runtime . listener . DR G Element ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ"", ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" Pre B ure au Aff ord ability ", ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ"", ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcom . gs . dm n . runtime . annotation . DR G Element Kind . DEC ISION , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcom . gs . dm n . runtime . annotation . Expression Kind . IN VOC ATION , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcom . gs . dm n . runtime . annotation . Hit Policy . UNKNOWN , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ- 1 ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġ@ Jvm Static ĊĠĠĠĠĠĠĠ Ġfun Ġrequest ToMap ( pre B ure au Aff ord ability Request _: Ġproto . Pre B ure au Aff ord ability Request ): Ġkotlin . collections . Map < String , ĠAny ?> Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ// ĠCreate Ġarguments Ġfrom ĠRequest ĠMessage ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġapplic ant Data : Ġtype . T Applic ant Data ? Ġ= Ġtype . T Applic ant Data . to T Applic ant Data ( pre B ure au Aff ord ability Request _. get Applic ant Data ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġrequested Product : Ġtype . T Requested Product ? Ġ= Ġtype . T Requested Product . to T Requested Product ( pre B ure au Aff ord ability Request _. get Requested Product ()) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġ// ĠCreate Ġmap ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġmap _: Ġkotlin . collections . Mutable Map < String , ĠAny ?> Ġ= Ġmutable Map Of () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġmap _. put (" Applic ant Data ", Ġapplic ant Data ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġmap _. put (" Requested Product ", Ġrequested Product ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn Ġmap _ ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġ@ Jvm Static ĊĠĠĠĠĠĠĠ Ġfun Ġresponse To Output ( pre B ure au Aff ord ability Response _: Ġproto . Pre B ure au Aff ord ability Response ): ĠBoolean ? Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ// ĠExtract Ġand Ġconvert Ġoutput ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn Ġpre B ure au Aff ord ability Response _. get Pre B ure au Aff ord ability () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ } Ċ