@HtmlImport(value="frontend://webapi/payment.html") @Tag(value="rap-payment") public class Payment extends JavascriptTemplate<Payment.PaymentTemplateModel>
| Modifier and Type | Class and Description |
|---|---|
static interface |
Payment.PaymentTemplateModel |
static class |
Payment.Result
The different results the payment completion can have.
|
| Constructor and Description |
|---|
Payment(com.vaadin.flow.component.HasElement parent) |
| Modifier and Type | Method and Description |
|---|---|
void |
complete(Payment.Result result,
Consumer<JavascriptError> onErrorOccurred)
This method can be used to show the user that the transaction is complete.
|
void |
requestPayment(List<PaymentRequestMethodData> methodData,
PaymentRequestDetails details,
PaymentRequestOptions options,
Consumer<PaymentResult> onResultReceived,
Consumer<JavascriptError> onErrorReceived)
Request the browser to display the payment interface.
|
void |
retry(PaymentValidationError errorFields,
Consumer<PaymentResult> onResultReceived,
Consumer<JavascriptError> onErrorOccurred)
This method can be used if a payment request failed and the error is recoverable.
|
clearConsumers, notifyConsumers, registerConsumer, registerConsumer, unregisterAllConsumers, unregisterAllConsumersgetModel, getModelType, getModelType, getStateNode, initModel, isSupportedClassaddListener, fireEvent, from, get, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getUI, hasListener, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, set, setElement, setId, setVisiblepublic void requestPayment(List<PaymentRequestMethodData> methodData, PaymentRequestDetails details, PaymentRequestOptions options, Consumer<PaymentResult> onResultReceived, Consumer<JavascriptError> onErrorReceived)
methodData - A List of different payment methods that are accepted. Currently only basic-card is available.details - Details such as total and a list of items. This is to show the user the list of items that he will
receive, once the transaction is over.options - Various options such as requesting the user to input his email or phone number.onResultReceived - The callback triggered when the dialog was successful and the user clicked on pay. It will consume a
PaymentResult that contains information needed for the payment.onErrorReceived - The callback triggered when the dialog was aborted by the user or something else went wrong. It will
consume the JavaScript error that was thrown on the client side.public void retry(PaymentValidationError errorFields, Consumer<PaymentResult> onResultReceived, Consumer<JavascriptError> onErrorOccurred)
errorFields - The fields that made the error occur.onResultReceived - The callback triggered when the dialog was successful and the user clicked on pay. It will consume a
PaymentResult that contains information needed for the payment.onErrorOccurred - The callback triggered if the dialog fails again. It conumes the JavaScript error that is thrown on
the client side.public void complete(Payment.Result result, Consumer<JavascriptError> onErrorOccurred)
result - The result of the transaction. The Payment.Result enum is used for if the transaction has succeeded
or failed.onErrorOccurred - The callback triggered when something goes wrong and the payment can not be completed. It will consume
the JavaScript error thrown on the client side.Copyright © 2020 XDEV Software Corp.. All rights reserved.