#include "components/payments/content/payment_request_spec.h"
#include <utility>
#include "base/check.h"
#include "base/containers/adapters.h"
#include "base/feature_list.h"
#include "base/notreached.h"
#include "base/observer_list.h"
#include "base/ranges/algorithm.h"
#include "base/stl_util.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "components/payments/content/payment_app.h"
#include "components/payments/content/payment_request_converter.h"
#include "components/payments/core/features.h"
#include "components/payments/core/method_strings.h"
#include "components/payments/core/payment_method_data.h"
#include "components/payments/core/payment_request_data_util.h"
#include "components/payments/core/payments_experimental_features.h"
#include "components/strings/grit/components_strings.h"
#include "content/public/common/content_features.h"
#include "ui/base/l10n/l10n_util.h"
namespace payments {
namespace {
void PopulateValidatedMethodData(
const std::vector<mojom::PaymentMethodDataPtr>& method_data_mojom,
std::vector<GURL>* url_payment_method_identifiers,
std::set<std::string>* payment_method_identifiers_set,
std::map<std::string, std::set<std::string>>* stringified_method_data) { … }
}
PaymentRequestSpec::PaymentRequestSpec(
mojom::PaymentOptionsPtr options,
mojom::PaymentDetailsPtr details,
std::vector<mojom::PaymentMethodDataPtr> method_data,
base::WeakPtr<Observer> observer,
const std::string& app_locale)
: … { … }
PaymentRequestSpec::~PaymentRequestSpec() { … }
void PaymentRequestSpec::UpdateWith(mojom::PaymentDetailsPtr details) { … }
void PaymentRequestSpec::Retry(
mojom::PaymentValidationErrorsPtr validation_errors) { … }
std::u16string PaymentRequestSpec::GetShippingAddressError(
autofill::FieldType type) { … }
std::u16string PaymentRequestSpec::GetPayerError(autofill::FieldType type) { … }
bool PaymentRequestSpec::has_shipping_address_error() const { … }
bool PaymentRequestSpec::has_payer_error() const { … }
void PaymentRequestSpec::RecomputeSpecForDetails() { … }
void PaymentRequestSpec::AddObserver(Observer* observer) { … }
void PaymentRequestSpec::RemoveObserver(Observer* observer) { … }
bool PaymentRequestSpec::IsInitialized() const { … }
bool PaymentRequestSpec::request_shipping() const { … }
bool PaymentRequestSpec::request_payer_name() const { … }
bool PaymentRequestSpec::request_payer_phone() const { … }
bool PaymentRequestSpec::request_payer_email() const { … }
PaymentShippingType PaymentRequestSpec::shipping_type() const { … }
std::u16string PaymentRequestSpec::GetFormattedCurrencyAmount(
const mojom::PaymentCurrencyAmountPtr& currency_amount) { … }
std::string PaymentRequestSpec::GetFormattedCurrencyCode(
const mojom::PaymentCurrencyAmountPtr& currency_amount) { … }
void PaymentRequestSpec::StartWaitingForUpdateWith(
PaymentRequestSpec::UpdateReason reason) { … }
bool PaymentRequestSpec::IsMixedCurrency() const { … }
const mojom::PaymentItemPtr& PaymentRequestSpec::GetTotal(
PaymentApp* selected_app) const { … }
std::vector<const mojom::PaymentItemPtr*> PaymentRequestSpec::GetDisplayItems(
PaymentApp* selected_app) const { … }
const std::vector<mojom::PaymentShippingOptionPtr>&
PaymentRequestSpec::GetShippingOptions() const { … }
bool PaymentRequestSpec::IsSecurePaymentConfirmationRequested() const { … }
bool PaymentRequestSpec::IsAppStoreBillingAlsoRequested() const { … }
base::WeakPtr<PaymentRequestSpec> PaymentRequestSpec::AsWeakPtr() { … }
const mojom::PaymentDetailsModifierPtr*
PaymentRequestSpec::GetApplicableModifier(PaymentApp* selected_app) const { … }
void PaymentRequestSpec::UpdateSelectedShippingOption(bool after_update) { … }
void PaymentRequestSpec::NotifyOnSpecUpdated() { … }
CurrencyFormatter* PaymentRequestSpec::GetOrCreateCurrencyFormatter(
const std::string& currency_code,
const std::string& locale_name) { … }
}