[英]Vaadin JavaScript API Integration
I am looking for any type of help, generic or specific, producing a Vaadin client-side Java implementation of the Braintree Payments API for the client library. 我正在寻找任何类型的帮助(通用的或特定的),以为客户端库生成Braintree Payments API的Vaadin 客户端 Java实现。
I can do all the server-side Java requirements of the Braintree protocol and also do RPC between a piece of inline JavaScript code yet it fails to use the Braintree .js API. 我可以满足Braintree协议的所有服务器端Java要求,也可以在一段内联JavaScript代码之间进行RPC,但它无法使用Braintree .js API。
The client side code, all summarized in here , suggests using their "hosted fields" to which I am open as well as their Drop-In UI. 客户端代码(均在此处进行了总结)建议使用我打开的“托管字段”以及它们的Drop-In UI。 Anything goes, really.
真的,任何事情都会发生。
hostedFieldsInstance.tokenize(function (tokenizeErr, payload) {
if (tokenizeErr) {
// Handle error in Hosted Fields tokenization
return;
}
// Put `payload.nonce` into the `payment-method-nonce` input, and then
// submit the form. Alternatively, you could send the nonce to your server
// with AJAX.
document.querySelector('input[name="payment-method-nonce"]').value = payload.nonce;
It should also be possible to directly tokenize the credit card information which is the most crucial step for me to continue. 还应该有可能直接标记信用卡信息 ,这对我来说是最重要的一步。 This should be a different process to integrate in Vaadin, perhaps someone knew this way better?
在Vaadin中整合应该是一个不同的过程,也许有人更了解这种方式?
How would I go about something like this? 我将如何处理这样的事情?
The easiest and fastest way may be using a AbstractJavascriptComponent or AbstractJavasciptExtension. 最简单,最快的方法可能是使用AbstractJavascriptComponent或AbstractJavasciptExtension。 These are subclass-able and provide a easy way to link JS code to a component you can manipulate server side.
这些是可子类化的,并提供了一种将JS代码链接到可以在服务器端进行操作的组件的简便方法。 AbstractJavascriptComponent might be the best of the two because they give you a div element that you can control completely with js without vaadin touching it.
AbstractJavascriptComponent可能是两者中最好的,因为它们为您提供了一个div元素,您可以使用js完全控制它,而无需vaadin对其进行操作。 This is easier IMO because you can avoid GWT and using there connector classes.
这可以简化IMO,因为您可以避免使用GWT并使用那里的连接器类。
Here are some links to get you started 这里有一些链接可以帮助您入门
https://vaadin.com/blog/-/blogs/vaadin-7-loves-javascript-components https://vaadin.com/blog/-/blogs/vaadin-7-loves-javascript-components
https://vaadin.com/wiki/-/wiki/Main/Integrating%20a%20JavaScript%20library%20as%20an%20extension https://vaadin.com/wiki/-/wiki/Main/Integrating%20a%20JavaScript%20library%20as%20an%20extension
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.