T - the type of the fragment which is modified by this listener.public class FragmentFlowListener<T extends AbstractPaymentFragment> extends java.lang.Object implements OnTokenSelectionViewReady, OnErrorListener, OnPaymentFormValidationListener, OnPaymentFormViewReadyListener, OnPaymentContainerResizeListener, OnTransactionSuccessListener, OnTransactionFailureListener, OnTokenSelectedListener, OnBeforeLoadingPaymentMethodListener
FlowCoordinator to the fragment.
This class may be overridden to realize a custom behavior of the fragment.| Modifier | Constructor and Description |
|---|---|
protected |
FragmentFlowListener(T fragment,
PaymentContainerEnlarger enlarger,
FragmentTerminationListener fragmentTerminationListener,
android.view.ViewGroup fragmentView)
This method creates a new listener.
|
| Modifier and Type | Method and Description |
|---|---|
protected android.content.Context |
getContext() |
protected android.widget.Button |
getFormSubmitButton() |
protected T |
getFragment() |
protected android.view.ViewGroup |
getFragmentView() |
protected android.widget.Button |
getOtherPaymentMethodButton() |
protected PaymentContainerEnlarger |
getPaymentContainerEnlarger() |
void |
onBeforeLoadingPaymentMethod()
This method is invoked before the payment method list is loaded.
|
void |
onClientError(ClientError error)
This method is invoked when there was a client error.
|
void |
onHttpError(HttpError error)
This method is invoked when there occurred a HTTP error.
|
void |
onNetworkError(VolleyError error)
This methdo is invoked when the communication between the mobile device and the wallee API
fails.
|
void |
onPaymentContainerEnlarge()
This method is invoked when the provided view should be enlarged to render more complex
content (e.g.
|
void |
onPaymentContainerReduce()
This method is called when the view size can be reduced again.
|
void |
onPaymentFormViewReady(boolean userInputRequired)
This method is invoked when the payment form is ready.
|
void |
onServerError(ServerError error)
This method is invoked when there was an error which was caused by a bug within the wallee
platform itself.
|
void |
onTokenSelected(TokenVersion selectedTokenVersion)
This method is invoked when the user has chosen a token with which the payment should be
completed with.
|
void |
onTokenSelectionViewReady()
This method is invoked when the payment method selection view is loaded.
|
void |
onTransactionFailure(Transaction transaction,
FailureReason failureReason,
java.lang.String userFailureMessage)
This method is invoked when the transaction is considered as failed.
|
void |
onTransactionSuccess(Transaction transaction)
This method is called when the
transaction is considered as successful. |
void |
onValidationFailure(java.util.List<java.lang.String> errors)
This method is invoked when the validation fails.
|
void |
onValidationSuccess()
This method is invoked when the validation completed without errors.
|
protected void |
runOnUiThread(java.lang.Runnable task)
Short cut for
Activity.runOnUiThread(Runnable). |
void |
setFlowCoordinator(FlowCoordinator coordinator)
Sets the coordinator.
|
protected android.widget.Button |
setupFormSubmitButton()
This method setups a button which triggers the submit of the payment form.
|
protected android.widget.Button |
setupOtherPaymentMethodButton()
This method setups a button which triggers the switch form the token selection view to the
payment method selection view.
|
protected FragmentFlowListener(T fragment, PaymentContainerEnlarger enlarger, FragmentTerminationListener fragmentTerminationListener, android.view.ViewGroup fragmentView)
fragment - the fragment onto which the events should be mapped to.enlarger - the enlarge to use. The enlarge is responsible to enlarge
the fragment when more space is required.fragmentTerminationListener - the listener which acts up on the final state of the
payment flow.fragmentView - the view of the fragment which can be modified.public final void setFlowCoordinator(FlowCoordinator coordinator)
coordinator - the coordinatorprotected T getFragment()
protected PaymentContainerEnlarger getPaymentContainerEnlarger()
protected android.content.Context getContext()
protected void runOnUiThread(java.lang.Runnable task)
Activity.runOnUiThread(Runnable).task - the task which should be executed in the main thread.protected final android.widget.Button getFormSubmitButton()
protected final android.widget.Button getOtherPaymentMethodButton()
protected android.view.ViewGroup getFragmentView()
protected android.widget.Button setupFormSubmitButton()
protected android.widget.Button setupOtherPaymentMethodButton()
public void onValidationFailure(java.util.List<java.lang.String> errors)
OnPaymentFormValidationListeneronValidationFailure in interface OnPaymentFormValidationListenererrors - a list of error messages which may give more details about the failure.public void onValidationSuccess()
OnPaymentFormValidationListeneronValidationSuccess in interface OnPaymentFormValidationListenerpublic void onNetworkError(VolleyError error)
OnNetworkErrorListeneronNetworkError in interface OnNetworkErrorListenererror - the error which has been thrown. It may gives more details about what went
wrong.public void onClientError(ClientError error)
OnApiErrorListenerSo client error means that either the app user, the developer which invokes the web service API or the user which configured the space has done something wrong.
onClientError in interface OnApiErrorListenererror - the error which may gives more details about the issue.public void onServerError(ServerError error)
OnApiErrorListeneronServerError in interface OnApiErrorListenererror - the error which gives more details about the failure.public void onTokenSelectionViewReady()
OnTokenSelectionViewReadyonTokenSelectionViewReady in interface OnTokenSelectionViewReadypublic void onPaymentFormViewReady(boolean userInputRequired)
OnPaymentFormViewReadyListeneronPaymentFormViewReady in interface OnPaymentFormViewReadyListenerpublic void onHttpError(HttpError error)
OnHttpErrorListenerWebView.onHttpError in interface OnHttpErrorListenererror - the error which was thrown.public void onPaymentContainerEnlarge()
OnPaymentContainerResizeListeneronPaymentContainerEnlarge in interface OnPaymentContainerResizeListenerpublic void onPaymentContainerReduce()
OnPaymentContainerResizeListeneronPaymentContainerReduce in interface OnPaymentContainerResizeListenerpublic void onTransactionSuccess(Transaction transaction)
OnTransactionSuccessListenertransaction is considered as successful.
Be aware if someone is decompile the app this method can be also invoked. There is no guarantee that the invocation of this method is secured. Means someone can trigger it even the transaction is not successful. As such any action taken within this method it should only affect the user interface. To enable something or to grant something a webhook should be used to inform the app backend. So with other words: The implementor of this listener should not trigger something in the app backend. This should be done through a webhook.
onTransactionSuccess in interface OnTransactionSuccessListenertransaction - the transaction which succeeds.public void onTransactionFailure(Transaction transaction, FailureReason failureReason, java.lang.String userFailureMessage)
OnTransactionFailureListeneruserFailureMessage provides in any case a message localized to
the language of the user which explains to the app user what is going on.
The failureReason gives an explanation to the merchant resp. app developer. This
message may be logged. It can be also seen in the back office of wallee.
The implementor of this method may trigger a specific behavior in case of a failure. For example switch to a dedicated view which explains it.
onTransactionFailure in interface OnTransactionFailureListenertransaction - the transaction which failed.failureReason - the reason which explains to the merchant what went wrong. This
message may also help the app developer to understand what is going
wrong.userFailureMessage - this message is localized in the app user's language. It gives a
user friendly explanation what is going wrong.public void onTokenSelected(TokenVersion selectedTokenVersion)
OnTokenSelectedListeneronTokenSelected in interface OnTokenSelectedListenerselectedTokenVersion - the token which has been selected by the user to complete the
transaction with.public void onBeforeLoadingPaymentMethod()
OnBeforeLoadingPaymentMethodListeneronBeforeLoadingPaymentMethod in interface OnBeforeLoadingPaymentMethodListener