Package com.ft.loyalty.viewModel

Types

| FTLCampaignsViewModel | class FTLCampaignsViewModel : AndroidViewModel
Copyright © 2019 FinTiv. All rights reserved. |
| FTLCustomerViewModel | class FTLCustomerViewModel : AndroidViewModel
Copyright © 2019 FinTiv. All rights reserved. |
| FTLPromoViewModel | class FTLPromoViewModel : AndroidViewModel
Copyright © 2019 FinTiv. All rights reserved. |
|FTLRewardViewModel | class FTLRewardViewModel : AndroidViewModel
Copyright © 2019 FinTiv. All rights reserved. |

FTLCampaignsViewModel

class FTLCampaignsViewModel : AndroidViewModel

Copyright © 2019 FinTiv. All rights reserved.

Constructors

| <init> | FTLCampaignsViewModel(context:Application)
Copyright © 2019 FinTiv. All rights reserved. |

Properties

| campaigns | var campaigns: MutableLiveData<ArrayList<FTLCampaign>> |
| context | val context:Application |
| error | var error: MutableLiveData<String> |

Functions

| getCampaignsFor | fun getCampaignsFor():Unit
Fetches all campaigns, observe campaigns field to get the response<ArrayList> otherwise observe error field to get the error response |

FTLCustomerViewModel

class FTLCustomerViewModel : AndroidViewModel

Copyright © 2019 FinTiv. All rights reserved.

Constructors

| <init> | FTLCustomerViewModel(context:Application)
Copyright © 2019 FinTiv. All rights reserved. |

Properties

| campaigns | var campaigns: MutableLiveData<List<FTLCampaign>> |
| code | var code: MutableLiveData<String> |
| context | val context:Application |
| error | var error: MutableLiveData<String> |
| logged | var logged: MutableLiveData<Boolean> |
| registered | var registered: MutableLiveData<String> |
| transactions | var transactions: MutableLiveData<List<FTLTransaction>> |

Functions

| fetchUserCampaigns | fun fetchUserCampaigns():Unit
Fetches customer’s campaigns observe campaigns field to get the response<List> |
| getBalanceForCampaign | fun getBalanceForCampaign(campaign:FTLCampaign):Unit
Gets balances for specific campaign of given customer, observe transactions field to get the response<List>, |
| getCustomerInfo | fun getCustomerInfo(code:String):Unit
Fetch customer info and update customer preferences observe logged field to get the response, in the case to fetch customer info preference call FTLoyalty.getCustomer |
| logCustomerOut | fun logCustomerOut():Unit
Locally deletes the logged customer & session |
| logCustomerWithUsername | fun logCustomerWithUsername(user:String, password:String):Unit
Login a user observe logged field to get the response, otherwise observe error field to get the error response |
| registerCustomerWithUsername | fun registerCustomerWithUsername(name:String, lastName:String, email:String, password:String):Unit
Registers customer, if campaigns have been fetched for the API user, registers the customer for all campaigns observe registered field to get the response, otherwise observe error field to get the error response |

FTLPromoViewModel

class FTLPromoViewModel : AndroidViewModel

Copyright © 2019 FinTiv. All rights reserved.

Constructors

| <init> | FTLPromoViewModel(context:Application)
Copyright © 2019 FinTiv. All rights reserved. |

Properties

| context | val context:Application |
| promos | var promos: MutableLiveData<ArrayList<FTLPromo>> |
| receiptTransaction | var receiptTransaction: MutableLiveData<>FTLReceipt> |

Functions

| getPromotionsFor | fun getPromotionsFor(campaign:FTLCampaign):Unit
Fetch promotions to an existing campaign observe promos field to get the response<ArrayList> |
| getUserEmail | fun getUserEmail():String
Fetch user email |
| recordPromotion | fun recordPromotion(campaign:FTLCampaign, promo:FTLPromo):Unit
Records a promotion for a customer in a given points-based campaigns observe receiptTransaction field to get the response |

FTLRewardViewModel

class FTLRewardViewModel : AndroidViewModel

Copyright © 2019 FinTiv. All rights reserved.

Constructors

| <init> | FTLRewardViewModel(context:Application)
Copyright © 2019 FinTiv. All rights reserved. |

Properties

| context | val context:Application |
| receiptTransaction | var receiptTransaction: MutableLiveData<FTLReceipt> |
| rewards | var rewards: MutableLiveData<ArrayList<FTLReward>> |

Functions

| fetchRewardsForCampaigns | fun fetchRewardsForCampaigns(campaign:FTLCampaign):Unit
Fetches the rewards available for the campaign, observe rewards field to get the response<ArrayList> |
| redeemReward | fun redeemReward(campaign:FTLCampaign, reward:FTLReward):Unit
Redeem a reward of a given campaign for a given customer, observe receiptTransaction field to get the response |