chromium/components/autofill/core/browser/webdata/payments/payments_sync_bridge_util.cc

// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/autofill/core/browser/webdata/payments/payments_sync_bridge_util.h"

#include "base/base64.h"
#include "base/check.h"
#include "base/functional/overloaded.h"
#include "base/pickle.h"
#include "base/ranges/algorithm.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "components/autofill/core/browser/autofill_data_util.h"
#include "components/autofill/core/browser/country_type.h"
#include "components/autofill/core/browser/data_model/autofill_offer_data.h"
#include "components/autofill/core/browser/data_model/autofill_wallet_usage_data.h"
#include "components/autofill/core/browser/data_model/bank_account.h"
#include "components/autofill/core/browser/data_model/credit_card.h"
#include "components/autofill/core/browser/data_model/credit_card_cloud_token_data.h"
#include "components/autofill/core/browser/data_model/iban.h"
#include "components/autofill/core/browser/data_model/payment_instrument.h"
#include "components/autofill/core/browser/payments/payments_customer_data.h"
#include "components/autofill/core/browser/webdata/payments/payments_autofill_table.h"
#include "components/autofill/core/common/autofill_payments_features.h"
#include "components/autofill/core/common/autofill_util.h"
#include "components/autofill/core/common/credit_card_network_identifiers.h"
#include "components/sync/protocol/entity_data.h"

TruncateUTF8;
AutofillWalletSpecifics;

namespace autofill {
namespace {

sync_pb::WalletMaskedCreditCard::WalletCardType WalletCardTypeFromCardNetwork(
    const std::string& network) {}

const char* CardNetworkFromWalletCardType(
    sync_pb::WalletMaskedCreditCard::WalletCardType type) {}

sync_pb::CardBenefit::CategoryBenefitType
CategoryBenefitTypeFromBenefitCategory(
    const CreditCardCategoryBenefit::BenefitCategory benefit_category) {}

CreditCardCategoryBenefit::BenefitCategory
BenefitCategoryFromCategoryBenefitType(
    const sync_pb::CardBenefit::CategoryBenefitType category_benefit_type) {}

// Creates a CreditCardBenefit from the specified `benefit_specifics` and
// `instrument_id`.
std::optional<CreditCardBenefit> CreditCardBenefitFromSpecifics(
    const sync_pb::CardBenefit& benefit_specifics,
    const int64_t instrument_id) {}

// Creates a vector of CreditCardBenefit from the specifies 'card_specifics`.
std::vector<CreditCardBenefit> CreditCardBenefitsFromCardSpecifics(
    const sync_pb::WalletMaskedCreditCard& card_specifics) {}

// Creates a CreditCard from the specified `card` specifics.
CreditCard CardFromSpecifics(const sync_pb::WalletMaskedCreditCard& card) {}

// Creates a PaymentCustomerData object corresponding to the sync datatype
// |customer_data|.
PaymentsCustomerData CustomerDataFromSpecifics(
    const sync_pb::PaymentsCustomerData& customer_data) {}

// Creates a CreditCardCloudTokenData object corresponding to the sync datatype
// |cloud_token_data|.
CreditCardCloudTokenData CloudTokenDataFromSpecifics(
    const sync_pb::WalletCreditCardCloudTokenData& cloud_token_data) {}

// Creates an IBAN from the specified `payment_instrument` specifics.
Iban IbanFromSpecifics(const sync_pb::PaymentInstrument& payment_instrument) {}

BankAccount::AccountType ConvertSyncAccountTypeToBankAccountType(
    sync_pb::BankAccountDetails::AccountType account_type) {}

sync_pb::BankAccountDetails::AccountType
ConvertBankAccountTypeToSyncBankAccountType(
    BankAccount::AccountType account_type) {}

sync_pb::PaymentInstrument::SupportedRail
ConvertPaymentInstrumentPaymentRailToSyncPaymentRail(
    PaymentInstrument::PaymentRail payment_rail) {}

}  // namespace

std::string GetStorageKeyForWalletMetadataTypeAndSpecificsId(
    sync_pb::WalletMetadataSpecifics::Type type,
    const std::string& specifics_id) {}

void SetAutofillWalletSpecificsFromServerCard(
    const CreditCard& card,
    AutofillWalletSpecifics* wallet_specifics,
    bool enforce_utf8) {}

void SetAutofillWalletSpecificsFromPaymentsCustomerData(
    const PaymentsCustomerData& customer_data,
    AutofillWalletSpecifics* wallet_specifics) {}

void SetAutofillWalletSpecificsFromCreditCardCloudTokenData(
    const CreditCardCloudTokenData& cloud_token_data,
    sync_pb::AutofillWalletSpecifics* wallet_specifics,
    bool enforce_utf8) {}

void SetAutofillWalletSpecificsFromMaskedIban(
    const Iban& iban,
    sync_pb::AutofillWalletSpecifics* wallet_specifics,
    bool enforce_utf8) {}

void SetAutofillWalletSpecificsFromCardBenefit(
    const CreditCardBenefit& benefit,
    bool enforce_utf8,
    sync_pb::AutofillWalletSpecifics& wallet_specifics) {}

void SetAutofillWalletUsageSpecificsFromAutofillWalletUsageData(
    const AutofillWalletUsageData& wallet_usage_data,
    sync_pb::AutofillWalletUsageSpecifics* wallet_usage_specifics) {}

void SetAutofillOfferSpecificsFromOfferData(
    const AutofillOfferData& offer_data,
    sync_pb::AutofillOfferSpecifics* offer_specifics) {}

AutofillOfferData AutofillOfferDataFromOfferSpecifics(
    const sync_pb::AutofillOfferSpecifics& offer_specifics) {}

sync_pb::AutofillWalletCredentialSpecifics
AutofillWalletCredentialSpecificsFromStructData(const ServerCvc& server_cvc) {}

ServerCvc AutofillWalletCvcStructDataFromWalletCredentialSpecifics(
    const sync_pb::AutofillWalletCredentialSpecifics&
        wallet_credential_specifics) {}

VirtualCardUsageData VirtualCardUsageDataFromUsageSpecifics(
    const sync_pb::AutofillWalletUsageSpecifics& usage_specifics) {}

BankAccount BankAccountFromWalletSpecifics(
    const sync_pb::PaymentInstrument& payment_instrument) {}

void SetAutofillWalletSpecificsFromBankAccount(
    const BankAccount& bank_account,
    sync_pb::AutofillWalletSpecifics* wallet_specifics) {}

void CopyRelevantWalletMetadataAndCvc(
    const PaymentsAutofillTable& table,
    std::vector<CreditCard>* cards_from_server) {}

void PopulateWalletTypesFromSyncData(
    const syncer::EntityChangeList& entity_data,
    std::vector<CreditCard>& wallet_cards,
    std::vector<Iban>& wallet_ibans,
    std::vector<PaymentsCustomerData>& customer_data,
    std::vector<CreditCardCloudTokenData>& cloud_token_data,
    std::vector<BankAccount>& bank_accounts,
    std::vector<CreditCardBenefit>& benefits,
    std::vector<sync_pb::PaymentInstrument>& payment_instruments) {}

template <class Item>
bool AreAnyItemsDifferent(const std::vector<std::unique_ptr<Item>>& old_data,
                          const std::vector<Item>& new_data) {}

template bool AreAnyItemsDifferent<>(
    const std::vector<std::unique_ptr<AutofillOfferData>>&,
    const std::vector<AutofillOfferData>&);

template bool AreAnyItemsDifferent<>(
    const std::vector<std::unique_ptr<CreditCardCloudTokenData>>&,
    const std::vector<CreditCardCloudTokenData>&);

template bool AreAnyItemsDifferent<>(const std::vector<BankAccount>&,
                                     const std::vector<BankAccount>&);

template <class Item>
bool AreAnyItemsDifferent(const std::vector<Item>& old_data,
                          const std::vector<Item>& new_data) {}

template bool AreAnyItemsDifferent<>(const std::vector<CreditCardBenefit>&,
                                     const std::vector<CreditCardBenefit>&);

bool IsOfferSpecificsValid(const sync_pb::AutofillOfferSpecifics specifics) {}

bool IsVirtualCardUsageDataSpecificsValid(
    const sync_pb::AutofillWalletUsageSpecifics::VirtualCardUsageData&
        specifics) {}

bool IsVirtualCardUsageDataSet(
    const VirtualCardUsageData& virtual_card_usage_data) {}

bool IsAutofillWalletCredentialDataSpecificsValid(
    const sync_pb::AutofillWalletCredentialSpecifics&
        wallet_credential_specifics) {}

bool AreMaskedBankAccountSupported() {}

bool IsEwalletAccountSupported() {}

}  // namespace autofill