Class GiftcardAutoReloadPresenter<T extends GiftcardAutoReloadView>
- java.lang.Object
-
- com.cheetahdigital.uikit.architecture.mvp.MvpNullObjectBasePresenter<V>
-
- com.cheetahdigital.uikit.architecture.mvp.Presenter<V>
-
- com.cheetahdigital.uikit.architecture.lce.LcePresenter<T>
-
- com.cheetahdigital.giftcards.ui.auto_reload.GiftcardAutoReloadPresenter<T>
-
- Type Parameters:
T- An interface that extendsGiftcardAutoReloadView
- All Implemented Interfaces:
MvpPresenter<T>
public class GiftcardAutoReloadPresenter<T extends GiftcardAutoReloadView> extends LcePresenter<T>
This presenter class contains API calls to auto-reload a gift card. This is a child class ofLcePresenterwhich is bound to theGiftcardAutoReloadView, which means that this will be used to display theGiftcardobject to a view of typeGiftcardAutoReloadView
-
-
Constructor Summary
Constructors Constructor Description GiftcardAutoReloadPresenter(java.lang.String cardNumber)Constructor of this presenterGiftcardAutoReloadPresenter(java.lang.String cardNumber, GiftcardParams giftcardQueryParams, GiftcardParams clientTokenQueryParams)Constructor of this presenter
-
Method Summary
-
Methods inherited from class com.cheetahdigital.uikit.architecture.lce.LcePresenter
onLoadFailed, onLoadSuccess
-
Methods inherited from class com.cheetahdigital.uikit.architecture.mvp.MvpNullObjectBasePresenter
attachView, detachView, getView
-
-
-
-
Constructor Detail
-
GiftcardAutoReloadPresenter
public GiftcardAutoReloadPresenter(java.lang.String cardNumber)
Constructor of this presenter- Parameters:
cardNumber- code of gift card
-
GiftcardAutoReloadPresenter
public GiftcardAutoReloadPresenter(java.lang.String cardNumber, GiftcardParams giftcardQueryParams, GiftcardParams clientTokenQueryParams)Constructor of this presenter- Parameters:
cardNumber- code of gift cardgiftcardQueryParams- customGiftcardParamsfor giftcard API call inloadData()clientTokenQueryParams- customGiftcardParamsfor client token API call inloadData()
-
-
Method Detail
-
getClientTokenReceiver
protected ListenerModel<BaseModel<ClientToken>,ClientToken> getClientTokenReceiver()
Create a listener forGiftcardsAPI- Returns:
- listener to handle
GiftcardsAPIrequests
-
getGiftcardsReceivedListener
protected ListenerModel<BaseModel<Giftcard>,Giftcard> getGiftcardsReceivedListener()
Create a listener forGiftcardsAPI- Returns:
- listener to handle
GiftcardsAPIrequests
-
getUpdateAutoReloadListener
protected ListenerModel<BaseModel<Giftcard>,Giftcard> getUpdateAutoReloadListener()
Create a listener forGiftcardsAPI- Returns:
- listener to handle
GiftcardsAPIrequests
-
getGiftcardsAPI
protected GiftcardsAPI getGiftcardsAPI()
Get current instance ofGiftcardsAPI- Returns:
GiftcardsAPIused on this presenter
-
onClientTokenReceivedSuccess
protected void onClientTokenReceivedSuccess(ClientToken clientToken)
Called whenGiftcardsAPI.getGiftcardsClientToken(GiftcardParams, boolean, ListenerModel)was successful- Parameters:
clientToken- client token required for the Braintree SDK
-
onClientTokenReceivedFailure
protected void onClientTokenReceivedFailure(java.lang.String error)
Called whenGiftcardsAPI.getGiftcardsClientToken(GiftcardParams, boolean, ListenerModel)failed- Parameters:
error- error message
-
onGiftcardReceivedSuccess
protected void onGiftcardReceivedSuccess(Giftcard giftcard)
Called whenGiftcardsAPI.getGiftcard(GiftcardParams, boolean, ListenerModel)was successful- Parameters:
giftcard-Giftcard
-
onGiftcardReceivedFailure
protected void onGiftcardReceivedFailure(java.lang.String error)
Called whenGiftcardsAPI.getGiftcard(GiftcardParams, boolean, ListenerModel)failed- Parameters:
error- error message
-
onUpdateAutoReloadSuccess
protected void onUpdateAutoReloadSuccess(Giftcard giftcard)
Called whenGiftcardsAPI.updateGiftcard(GiftcardParams, GiftcardFields, ListenerModel)was successful- Parameters:
giftcard- updatedGiftcard
-
onUpdateAutoReloadFailure
protected void onUpdateAutoReloadFailure(java.lang.String error)
Called whenGiftcardsAPI.updateGiftcard(GiftcardParams, GiftcardFields, ListenerModel)failed- Parameters:
error- error message
-
loadData
public void loadData()
Description copied from class:LcePresenterLoad initial view data.- Specified by:
loadDatain classLcePresenter<T extends GiftcardAutoReloadView>
-
getClientToken
public java.lang.String getClientToken()
Returns the client token required for the Braintree SDK- Returns:
- client token required for the Braintree SDK
-
updateAutoReload
public void updateAutoReload(@NonNull java.lang.String nonce, boolean isAutoReload, @NonNull java.lang.String threshold, @NonNull java.lang.String reloadAmount)Updates the auto-reload configuration of the gift card Remember to set the followingGiftcardFields:- nonce using
GiftcardFields.setPaymentMethodNonce(String) - auto-reload using
GiftcardFields.setIsAutoReload(Boolean) - threshold amount using
GiftcardFields.setReloadThreshold(String) - reload amount using
GiftcardFields.setReloadAmount(String)
- Parameters:
nonce- value coming from braintreeisAutoReload-trueto set auto reload, else falsethreshold- value when to initiate an automatic payment to add money to the gift cardreloadAmount- amount to reload
- nonce using
-
updateAutoReload
public void updateAutoReload(@NonNull java.lang.String nonce, boolean isAutoReload, @NonNull java.lang.String threshold, @NonNull java.lang.String reloadAmount, GiftcardFields giftcardFields, GiftcardParams giftcardParams)Updates the auto-reload configuration of the gift card Remember to set the followingGiftcardFields:- nonce using
GiftcardFields.setPaymentMethodNonce(String) - auto-reload using
GiftcardFields.setIsAutoReload(Boolean) - threshold amount using
GiftcardFields.setReloadThreshold(String) - reload amount using
GiftcardFields.setReloadAmount(String)
- Parameters:
nonce- value coming from braintreeisAutoReload-trueto set auto reload, else falsethreshold- value when to initiate an automatic payment to add money to the gift cardreloadAmount- amount to reloadgiftcardFields-GiftcardFieldsto update the gift cardgiftcardParams-GiftcardParamsto use for updating the gift card
- nonce using
-
-