mirror of
https://github.com/klzgrad/naiveproxy.git
synced 2024-11-28 16:26:10 +03:00
99 lines
3.6 KiB
Plaintext
99 lines
3.6 KiB
Plaintext
// Copyright 2016 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
module payments.mojom;
|
|
|
|
import "components/payments/mojom/payment_request_data.mojom";
|
|
import "mojo/public/mojom/base/time.mojom";
|
|
import "third_party/blink/public/mojom/manifest/manifest.mojom";
|
|
import "third_party/blink/public/mojom/payments/payment_request.mojom";
|
|
import "url/mojom/url.mojom";
|
|
|
|
enum PaymentHandlerStatus {
|
|
SUCCESS,
|
|
NOT_IMPLEMENTED,
|
|
NOT_FOUND,
|
|
NO_ACTIVE_WORKER,
|
|
STORAGE_OPERATION_FAILED,
|
|
FETCH_INSTRUMENT_ICON_FAILED,
|
|
FETCH_PAYMENT_APP_INFO_FAILED,
|
|
};
|
|
|
|
// This struct is provided to hold a payment instrument from render
|
|
// side (PaymentInstrument.idl).
|
|
struct PaymentInstrument {
|
|
string name;
|
|
array<blink.mojom.ManifestImageResource> icons;
|
|
string method;
|
|
string stringified_capabilities;
|
|
|
|
// Parsed basic-card specific capabilities.
|
|
// Below arrays are non-empty only if enabled_methods contains "basic-card".
|
|
array<BasicCardNetwork> supported_networks;
|
|
array<BasicCardType> supported_types;
|
|
};
|
|
|
|
// This interface provides implementation of PaymentInstruments.idl
|
|
// and PaymentManager.idl in render side. This interface is implemented
|
|
// by payment_manager.cc and runs in browser side.
|
|
interface PaymentManager {
|
|
// |context_url| is the url of the web page creating this interface.
|
|
// |service_worker_scope| is passed as string since it is from
|
|
// ServiceWorkerRegistration and the interface is used for
|
|
// ServiceWorkerRegistration.idl
|
|
Init(url.mojom.Url context_url, string service_worker_scope);
|
|
DeletePaymentInstrument(string instrument_key)
|
|
=> (PaymentHandlerStatus status);
|
|
GetPaymentInstrument(string instrument_key)
|
|
=> (PaymentInstrument instrument, PaymentHandlerStatus status);
|
|
KeysOfPaymentInstruments()
|
|
=> (array<string> keys, PaymentHandlerStatus status);
|
|
HasPaymentInstrument(string instrument_key)
|
|
=> (PaymentHandlerStatus status);
|
|
SetPaymentInstrument(string instrument_key, PaymentInstrument instrument)
|
|
=> (PaymentHandlerStatus status);
|
|
ClearPaymentInstruments()
|
|
=> (PaymentHandlerStatus status);
|
|
SetUserHint(string user_hint);
|
|
};
|
|
|
|
// This struct is provided to send payment request data to render side
|
|
// (CanMakePaymentEvent.idl).
|
|
struct CanMakePaymentEventData {
|
|
url.mojom.Url top_origin;
|
|
url.mojom.Url payment_request_origin;
|
|
array<PaymentMethodData> method_data;
|
|
array<PaymentDetailsModifier> modifiers;
|
|
};
|
|
|
|
// This struct is provided to send payment request data to render side
|
|
// (PaymentRequestEvent.idl).
|
|
struct PaymentRequestEventData {
|
|
url.mojom.Url top_origin;
|
|
url.mojom.Url payment_request_origin;
|
|
string payment_request_id;
|
|
array<PaymentMethodData> method_data;
|
|
PaymentCurrencyAmount total;
|
|
array<PaymentDetailsModifier> modifiers;
|
|
string instrument_key;
|
|
};
|
|
|
|
// This struct is provided to receive payment app response from render
|
|
// side (PaymentHandlerResponse.idl).
|
|
struct PaymentHandlerResponse {
|
|
string method_name;
|
|
string stringified_details;
|
|
};
|
|
|
|
// This interface is provided to pass a payment handler response from payment
|
|
// request event in renderer side to browser side by calling respondWith().
|
|
interface PaymentHandlerResponseCallback {
|
|
OnResponseForAbortPayment(bool payment_aborted,
|
|
mojo_base.mojom.Time dispatch_event_time);
|
|
OnResponseForCanMakePayment(bool can_make_payment,
|
|
mojo_base.mojom.Time dispatch_event_time);
|
|
OnResponseForPaymentRequest(PaymentHandlerResponse response,
|
|
mojo_base.mojom.Time dispatch_event_time);
|
|
};
|