Skip to content

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

Merged
merged 8 commits into from
Feb 5, 2025
Merged

Conversation

javifernandez
Copy link
Member

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.

javifernandez and others added 7 commits January 20, 2025 02:16
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.
@mshin-wolvic mshin-wolvic requested a review from ns-mshin January 20, 2025 01:21
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.
Copy link

@ns-mshin ns-mshin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mshin-wolvic mshin-wolvic requested review from ns-mshin and removed request for ns-mshin January 21, 2025 05:20
Copy link
Member

@svillar svillar left a 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.

@svillar svillar merged commit 69920fd into wolvic Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants