vnwalletui / com.venuenext.vnwalletui.view / QRViewModel

QRViewModel

class QRViewModel : AndroidViewModel, PaymentHandler

Constructors

<init>

QRViewModel(application: Application)

Properties

awardRules

lateinit var awardRules: List<AwardsRule>

eventLiveData

val eventLiveData: LiveData<Events>

paymentOptions

lateinit var paymentOptions: List<PaymentOption>

stateLiveData

val stateLiveData: LiveData<State>

sthLiveData

val sthLiveData: LiveData<TicketingAccount?>

Functions

acceptQrCode

fun acceptQrCode(qrCode: String): Unit

eventHandled

fun eventHandled(): Unit

getPaymentMethod

Gets the primary payment method

suspend fun getPaymentMethod(forceRefresh: Boolean): PaymentMethod?

getPaymentMethodLiveData

fun getPaymentMethodLiveData(): LiveData<PaymentMethod>

getPaymentType

fun getPaymentType(isVirtualCurrencyEnabled: Boolean, hasCreditCard: Boolean, isVirtualCurrencyToggleVisible: Boolean): PaymentType?

getQrImage

fun getQrImage(paymentType: PaymentType): Bitmap?

registerViewLifecycleOwner

Listens for a loyalty user change in the database.

fun registerViewLifecycleOwner(owner: LifecycleOwner): Unit

removePaymentMethod

Removes the stored payment method

suspend fun removePaymentMethod(): Unit

savePaymentMethod

suspend fun savePaymentMethod(payment: PaymentResult): Unit

setInitialQrViewState

fun setInitialQrViewState(forceRefresh: Boolean): Job

setPaymentMethod

fun setPaymentMethod(paymentMethod: PaymentMethod?): Unit

setPermissionStatus

fun setPermissionStatus(isCameraPermissionGranted: Boolean): Unit

toggleCameraQRCode

fun toggleCameraQRCode(): Unit

updateIsCameraSurfaceReady

fun updateIsCameraSurfaceReady(isAvailable: Boolean): Unit

updateIsVirtualCurrencyToggleVisible

fun updateIsVirtualCurrencyToggleVisible(isToggleVisible: Boolean): Unit

updatePaymentMethodSelectionClicked

Use LiveData<PaymentMethod?> to register for payment selection updates

fun updatePaymentMethodSelectionClicked(paymentNavigator: PaymentMethodNavigator, onPaymentMethodRemovalFailed: (Exception) -> Unit): Unit

virtualCurrencyToggled

fun virtualCurrencyToggled(checked: Boolean): Unit