-
Notifications
You must be signed in to change notification settings - Fork 9
Initial implementation of Web Payments feature #143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This patch adds onCreateNewPaymentHandler method in WebContentsObserver to deliver the payment handler's WebContents to Wolvic side.
The PaymentUiService should not re-use the WindowAndroid instance from the original WebContents and, instead, must create a new one for the main activity. Additionally, this change also implements the close() method, so that we can properly destroy the newly created WebContent instance for the payment handler.
We need to detect when the user dismiss the Payment Handler UI so that we can close properly the ongoing Payment Request. For now observing the the destruction of the PaymentHandler's WebContent instance is the only way we have to detect this situation.
This new class can be used to create instance of Tabs that can handle PaymentHandler work-flow. The Client interface provides an API to control the window's life-cycle.
c2a4ce7
to
11df912
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
a03875f
to
11df912
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still have doubts that the desktop approach is the best for our case. Using an intent as Chrome Android seems cleaner but I guess we can revisit that in the future.
This PR provides a very basic implementation of the Payment Request API and the minimum viable logic for the Payment Handlers.
In the latter case, it provides support just to launch a new tab that loads a service worker provided by the payment request.
A new modal window will be launched to load the service worker. This window is controlled by the WolvicPaymentUiService class, which will handle the service-worker result of the generate the payment request response.
A new ServiceTabLauncher class is implemented in Wolvic in order to launch this kind of modal dialogs.
Finally, this PR adds a new method in the WebContentsObserver to notify Wolvic when the new payment-handler WebContent instance is ready to be loaded in the modal window.