1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_DATA_MODEL_PAYMENTS_EWALLET_H_
#define COMPONENTS_AUTOFILL_CORE_BROWSER_DATA_MODEL_PAYMENTS_EWALLET_H_
#include <cstdint>
#include <string>
#include <string_view>
#include "base/containers/flat_set.h"
#include "components/autofill/core/browser/data_model/payments/payment_instrument.h"
class GURL;
namespace autofill {
// An ewallet is a form of payment that facilitates a push payment to the
// merchant rather than a pull payment from the merchant. In the case of a pull
// payment, the merchant collects payment information from the user and
// initiates the payment with the issuer. Example: credit cards. For a push
// payment, the payment is initiated from the issuer side, to a payment target
// indicating the recipient merchant. Ewallets fall into that category. Ewallets
// are typically already linked to a user's bank account. This class consists of
// the details for a user's ewallet, and this data is synced from the Google
// Payments server.
class Ewallet {
public:
Ewallet(int64_t instrument_id,
std::u16string nickname,
GURL display_icon_url,
std::u16string ewallet_name,
std::u16string account_display_name,
base::flat_set<std::u16string> supported_payment_link_uris,
bool is_fido_enrolled);
Ewallet(const Ewallet& other);
Ewallet& operator=(const Ewallet& other);
~Ewallet();
friend std::strong_ordering operator<=>(const Ewallet&, const Ewallet&);
friend bool operator==(const Ewallet&, const Ewallet&);
const std::u16string& ewallet_name() const { return ewallet_name_; }
const std::u16string& account_display_name() const {
return account_display_name_;
}
const base::flat_set<std::u16string>& supported_payment_link_uris() const {
return supported_payment_link_uris_;
}
const PaymentInstrument& payment_instrument() const {
return payment_instrument_;
}
// Checks if the ewallet supports the given payment link by supported payment
// link URI regexes match.
bool SupportsPaymentLink(std::string_view payment_link) const;
private:
// Name of the ewallet provider.
std::u16string ewallet_name_;
// Display name of the ewallet account.
std::u16string account_display_name_;
// Chrome matches the payment links on web pages against the list of payment
// link URI regexes. The regex matching approach makes it possible to launch
// new payment methods without requiring any client side changes. More details
// on payment links can be found at
// https://github.com/aneeshali/paymentlink/blob/main/docs/explainer.md.
base::flat_set<std::u16string> supported_payment_link_uris_;
// Fields common for all types of payment instruments.
PaymentInstrument payment_instrument_;
};
} // namespace autofill
#endif // COMPONENTS_AUTOFILL_CORE_BROWSER_DATA_MODEL_PAYMENTS_EWALLET_H_
|