#include "components/autofill/core/browser/payments/test_payments_network_interface.h"
#include <memory>
#include <optional>
#include <unordered_map>
#include "base/json/json_reader.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "build/build_config.h"
#include "components/autofill/core/browser/personal_data_manager.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace autofill::payments {
namespace {
PaymentsRpcResult;
constexpr char kTestChallenge[] = …;
constexpr int kTestTimeoutSeconds = …;
}
TestPaymentsNetworkInterface::TestPaymentsNetworkInterface(
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_,
signin::IdentityManager* identity_manager,
PersonalDataManager* personal_data_manager)
: … { … }
TestPaymentsNetworkInterface::~TestPaymentsNetworkInterface() = default;
void TestPaymentsNetworkInterface::GetUnmaskDetails(
base::OnceCallback<void(PaymentsRpcResult,
PaymentsNetworkInterface::UnmaskDetails&)> callback,
const std::string& app_locale) { … }
void TestPaymentsNetworkInterface::UnmaskCard(
const UnmaskRequestDetails& unmask_request,
base::OnceCallback<void(PaymentsRpcResult, const UnmaskResponseDetails&)>
callback) { … }
void TestPaymentsNetworkInterface::GetCardUploadDetails(
const std::vector<AutofillProfile>& addresses,
const int detected_values,
const std::vector<ClientBehaviorConstants>& client_behavior_signals,
const std::string& app_locale,
base::OnceCallback<void(PaymentsRpcResult,
const std::u16string&,
std::unique_ptr<base::Value::Dict>,
std::vector<std::pair<int, int>>)> callback,
const int billable_service_number,
const int64_t billing_customer_number,
PaymentsNetworkInterface::UploadCardSource upload_card_source) { … }
void TestPaymentsNetworkInterface::UploadCard(
const payments::PaymentsNetworkInterface::UploadCardRequestDetails&
request_details,
base::OnceCallback<void(
PaymentsRpcResult,
const PaymentsNetworkInterface::UploadCardResponseDetails&)> callback) { … }
#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS)
void TestPaymentsNetworkInterface::MigrateCards(
const MigrationRequestDetails& details,
const std::vector<MigratableCreditCard>& migratable_credit_cards,
MigrateCardsCallback callback) { … }
#endif
void TestPaymentsNetworkInterface::SelectChallengeOption(
const SelectChallengeOptionRequestDetails& details,
base::OnceCallback<void(PaymentsRpcResult, const std::string&)> callback) { … }
void TestPaymentsNetworkInterface::GetVirtualCardEnrollmentDetails(
const GetDetailsForEnrollmentRequestDetails& request_details,
base::OnceCallback<void(PaymentsRpcResult,
const payments::PaymentsNetworkInterface::
GetDetailsForEnrollmentResponseDetails&)>
callback) { … }
void TestPaymentsNetworkInterface::UpdateVirtualCardEnrollment(
const TestPaymentsNetworkInterface::
UpdateVirtualCardEnrollmentRequestDetails& request_details,
base::OnceCallback<void(PaymentsRpcResult)> callback) { … }
void TestPaymentsNetworkInterface::ShouldReturnUnmaskDetailsImmediately(
bool should_return_unmask_details) { … }
void TestPaymentsNetworkInterface::AllowFidoRegistration(bool offer_fido_opt_in) { … }
void TestPaymentsNetworkInterface::AddFidoEligibleCard(std::string server_id,
std::string credential_id,
std::string relying_party_id) { … }
void TestPaymentsNetworkInterface::SetFidoRequestOptionsInUnmaskDetails(
std::string_view credential_id,
std::string_view relying_party_id) { … }
void TestPaymentsNetworkInterface::SetUploadCardResponseDetailsForUploadCard(
const PaymentsNetworkInterface::UploadCardResponseDetails&
upload_card_response_details) { … }
void TestPaymentsNetworkInterface::SetSaveResultForCardsMigration(
std::unique_ptr<std::unordered_map<std::string, std::string>> save_result) { … }
void TestPaymentsNetworkInterface::SetSupportedBINRanges(
std::vector<std::pair<int, int>> bin_ranges) { … }
void TestPaymentsNetworkInterface::SetUseInvalidLegalMessageInGetUploadDetails(
bool use_invalid_legal_message) { … }
void TestPaymentsNetworkInterface::SetUseLegalMessageWithMultipleLinesInGetUploadDetails(
bool use_legal_message_with_multiple_lines) { … }
std::unique_ptr<base::Value::Dict> TestPaymentsNetworkInterface::LegalMessage() { … }
}