Class RetroclaimPresenter<T extends RetroclaimView>
- 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.orders.ui.retroclaim.RetroclaimPresenter<T>
-
- Type Parameters:
T- type of theRetroclaimView
- All Implemented Interfaces:
MvpPresenter<T>
public class RetroclaimPresenter<T extends RetroclaimView> extends LcePresenter<T>
Presenter used forRetroclaimFragment
-
-
Constructor Summary
Constructors Constructor Description RetroclaimPresenter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidclaimOrder(OrderFields fields)Call to claim order usingOrderFieldsprotected voidclaimOrder(java.lang.String id, java.lang.String placeId, java.lang.String date, java.lang.String register, java.lang.Double subtotal, java.lang.Double chargedAmount, java.lang.Double totalAmount, java.lang.String lastDigits)Call to claim order using specific fieldsprotected ListenerModelgetClaimListener()Returns an instance of theListenerModelforBaseDataandRetroclaimOverride this method to change default behavior of the listenerprotected OrdersAPIgetOrdersAPI()Get the current instance ofOrdersAPIvoidloadData()Load initial view data.protected voidonClaimFailed(int errorCode, java.lang.String error)Called after a failed request on Retroclaimprotected voidonClaimSuccess(Retroclaim data)Called after a successful request on RetroclaimvoidsubmitRetroclaim(java.lang.String transactionId, java.lang.String placeId, java.lang.String date, java.lang.String registerName, java.lang.String lastDigits, java.lang.Double subtotal, java.lang.Double chargedAmout, java.lang.Double total)Method to validate the transaction fields and then submit request for retroclaim if all is validprotected intvalidateChargedAmount(double chargedAmount)Validation method for the charged amountprotected intvalidateDate(java.lang.String date)Validation method for the transaction dateprotected intvalidateLastDigit(java.lang.String lastDigit)Validation method for the last 4 digits of the credit cardprotected intvalidatePlaceId(java.lang.String placeId)Validation method for the place idprotected intvalidateRegister(java.lang.String registerId)Validation method for the register idprotected intvalidateSubtotal(double subtotal)Validation method for the subtotalprotected intvalidateTotalAmount(double totalAmount)Validation method for the total amountprotected intvalidateTransactionId(java.lang.String transactionId)Validation method for transaction id-
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
-
-
-
-
Method Detail
-
loadData
public void loadData()
Description copied from class:LcePresenterLoad initial view data.- Specified by:
loadDatain classLcePresenter<T extends RetroclaimView>
-
getOrdersAPI
protected OrdersAPI getOrdersAPI()
Get the current instance ofOrdersAPI- Returns:
OrdersAPIused on this presenter
-
submitRetroclaim
public void submitRetroclaim(@Nullable java.lang.String transactionId, @NonNull java.lang.String placeId, @NonNull java.lang.String date, @Nullable java.lang.String registerName, @Nullable java.lang.String lastDigits, @Nullable java.lang.Double subtotal, @Nullable java.lang.Double chargedAmout, @Nullable java.lang.Double total)Method to validate the transaction fields and then submit request for retroclaim if all is valid- Parameters:
transactionId-String- transaction id of the claimplaceId-String- place / store id of the claimdate-String- date of the claimregisterName-String- id of the registerlastDigits-String- last 4 digits of the credit card usedsubtotal-Double- subtotal amountchargedAmout-Double- charged amounttotal-Double- total amount
-
validateTransactionId
protected int validateTransactionId(java.lang.String transactionId)
Validation method for transaction id- Parameters:
transactionId- transaction id- Returns:
- String resource id of the error, 0 if no error
-
validatePlaceId
protected int validatePlaceId(java.lang.String placeId)
Validation method for the place id- Parameters:
placeId- place id- Returns:
- String resource id of the error, 0 if no error
-
validateDate
protected int validateDate(java.lang.String date)
Validation method for the transaction date- Parameters:
date- date of the transaction- Returns:
- String resource id of the error, 0 if no error
-
validateRegister
protected int validateRegister(java.lang.String registerId)
Validation method for the register id- Parameters:
registerId- register id- Returns:
- String resource id of the error, 0 if no error
-
validateSubtotal
protected int validateSubtotal(double subtotal)
Validation method for the subtotal- Parameters:
subtotal- subtotal amount of the transaction- Returns:
- String resource id of the error, 0 if no error
-
validateLastDigit
protected int validateLastDigit(java.lang.String lastDigit)
Validation method for the last 4 digits of the credit card- Parameters:
lastDigit- last 4 digits of the credit card- Returns:
- String resource id of the error, 0 if no error
-
validateChargedAmount
protected int validateChargedAmount(double chargedAmount)
Validation method for the charged amount- Parameters:
chargedAmount- charged amount- Returns:
- String resource id of the error, 0 if no error
-
validateTotalAmount
protected int validateTotalAmount(double totalAmount)
Validation method for the total amount- Parameters:
totalAmount- total amount- Returns:
- String resource id of the error, 0 if no error
-
claimOrder
protected void claimOrder(@Nullable java.lang.String id, @NonNull java.lang.String placeId, @NonNull java.lang.String date, @Nullable java.lang.String register, @Nullable java.lang.Double subtotal, @Nullable java.lang.Double chargedAmount, @Nullable java.lang.Double totalAmount, @Nullable java.lang.String lastDigits)Call to claim order using specific fields- Parameters:
id- the id of the transactionplaceId- the id of the place where transaction was madedate- the date of the transactionregister- the register / terminal id where the transaction was madesubtotal- the subtotal amount of the transactionchargedAmount- the charged amounttotalAmount- the total amountlastDigits- the last digitss
-
claimOrder
protected void claimOrder(OrderFields fields)
Call to claim order usingOrderFields- Parameters:
fields-OrderFields
-
onClaimSuccess
protected void onClaimSuccess(Retroclaim data)
Called after a successful request on Retroclaim- Parameters:
data- Claim information
-
onClaimFailed
protected void onClaimFailed(int errorCode, java.lang.String error)Called after a failed request on Retroclaim- Parameters:
errorCode- code of the errorerror- error message
-
getClaimListener
protected ListenerModel getClaimListener()
Returns an instance of theListenerModelforBaseDataandRetroclaimOverride this method to change default behavior of the listener- Returns:
- listener for Claim response
-
-