package Ġcom . sw ire pay . android _ sdk . checkout . view model Ċ Ċ import Ġandroid . util . Log Ċ import Ġandroidx . lifecycle . Mutable LiveData Ċ import Ġandroidx . lifecycle . ViewModel Ċ import Ġandroidx . lifecycle . viewModel Scope Ċ import Ġcom . sw ire pay . android _ sdk . Sw ire pay Sdk Ċ import Ġcom . sw ire pay . android _ sdk . Utility Ċ import Ġcom . sw ire pay . android _ sdk . checkout . model .* Ċ import Ġcom . sw ire pay . android _ sdk . model . Order Info Ċ import Ġcom . sw ire pay . android _ sdk . ret rofit . ApiClient Ċ import Ġcom . sw ire pay . android _ sdk . ret rofit . Api Interface Ċ import Ġkotlinx . coroutines . Dispatch ers Ċ import Ġkotlinx . coroutines . launch Ċ Ċ class ĠViewModel Card Payment ( Ċ ) Ġ: ĠViewModel () Ġ{ ĊĠĠĠ Ġval Ġlive Card Response : ĠMutable LiveData < Card Response > Ġ= ĠMutable LiveData () ĊĠĠĠ Ġval Ġlive Error Messages : ĠMutable LiveData < String > Ġ= ĠMutable LiveData () ĊĊĠĠĠ Ġfun Ġupdate CV V ( card Info : ĠCard Info , Ġcard Gid : ĠString ?) Ġ= ĊĠĠĠĠĠĠĠ ĠviewModel Scope . launch ( Dispatch ers . IO ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval ĠapiClient Ġ= ĠApi Client . ret rofit . create ( Api Interface :: class . java ) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġresponse Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠapiClient . update CV V ( card Gid , Ġcard Info , ĠSw ire pay Sdk . apiKey !! ). execute () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( response . is Successful Ġ&& Ġresponse . body () Ġ!= Ġnull ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġcard Response Ġ= Ġresponse . body () !!. entity ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġlive Card Response . post Value ( card Response ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġlive Error Messages . post Value ( Utility . getError Msg ( response )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠLog . d (" sdk _ test ", Ġ" up i - payment - session : Ġ${ response . message () }") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} Ċ }