package Ġadapter . presenter Ċ Ċ import Ġuse case . purchase . Purchase Response Ċ import Ġuse case . shared . UseCase Output Ċ Ċ /** Ċ Ġ* ĠA Ġpresenter Ġwhich Ġprocesses Ġoutput Ġdata Ġcoming Ġfrom Ġpurchase - related Ġuse Ġcases . Ċ Ġ* Ċ Ġ* Ġ@ author ĠN ic ola ĠLas agn i Ġon Ġ 1 2 / 0 8 / 2 0 2 1 . Ċ Ġ*/ Ċ class ĠRe ceipt Presenter ( private Ġval Ġoutput : ĠPres enter Output ) Ġ: ĠUse Case Output < Purchase Response > Ġ{ ĊĊĠĠĠ Ġoverride Ġfun Ġhandle Response ( response : ĠPurchase Response ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġreceipt Ġ= Ġresponse . receipt ĊĠĠĠĠĠĠĠ Ġval ĠstringBuilder Ġ= ĠStringBuilder () ĊĠĠĠĠĠĠĠ ĠstringBuilder . append Line (" Purchase ĠRe ceipt ") ĊĠĠĠĠĠĠĠ Ġfor Ġ( product Ġin Ġreceipt . product In B ask ets ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġproduct Name Ġ= Ġif Ġ( product . imported ) Ġ" imported Ġ" Ġ+ Ġproduct . name Ġelse Ġproduct . name ĊĠĠĠĠĠĠĠĠĠĠĠ ĠstringBuilder . append Line ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ"${ product . quantity } Ġ$ product Name : Ġ${ product . shelf Price In cluding Tax es . format To Two Decimal s () }" ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ ĠstringBuilder . append Line (" Sales ĠT axes : Ġ${ receipt . total Sales Tax es . format To Two Decimal s () }") ĊĠĠĠĠĠĠĠ ĠstringBuilder . append Line (" Total : Ġ${ receipt . total Price . format To Two Decimal s () }") ĊĠĠĠĠĠĠĠ Ġoutput . render ViewModel ( String ViewModel ( string Builder . toString ())) ĊĠĠĠ Ġ} Ċ } Ċ