chromium/components/autofill/core/browser/data_model/iban.cc

// Copyright 2022 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/data_model/iban.h"

#include <string_view>

#include "base/containers/fixed_flat_map.h"
#include "base/notreached.h"
#include "base/strings/strcat.h"
#include "base/strings/utf_string_conversions.h"
#include "base/uuid.h"
#include "components/autofill/core/browser/autofill_field.h"
#include "components/autofill/core/browser/data_model/payments_metadata.h"
#include "components/autofill/core/browser/metrics/payments/iban_metrics.h"
#include "components/autofill/core/common/autofill_clock.h"
#include "components/autofill/core/common/autofill_regexes.h"

namespace autofill {

namespace {

// This prefix and suffix length are for local-based IBANs only. Server-based
// IBANs should generally use the same value but the client will respect
// whatever it receives from the server.
static constexpr int kPrefixLength =;
static constexpr int kSuffixLength =;

// This method does the following steps:
// 1. Move the four initial characters to the end of the string.
// 2. Replace each letter in with two digits, thereby expanding the string,
//    where 'A' = 10, 'B' = 11, ..., 'Z' = 35.
// 3. Treat the converted string as decimal and get the remainder of it on
//    division by 97.
//
// The algorithm is from:
// https://en.wikipedia.org/wiki/International_Bank_Account_Number#Modulo_operation_on_IBAN
int GetRemainderOfIbanValue(const std::u16string& stripped_value) {}

std::u16string RemoveIbanSeparators(std::u16string_view value) {}

}  // namespace

constexpr char16_t kCapitalizedIbanPattern[] =;
// Unicode characters used in IBAN value obfuscation:
//  - \u2022 - Bullet.
//  - \u2006 - SIX-PER-EM SPACE (small space between bullets).
constexpr char16_t kEllipsisOneDot =;
constexpr char16_t kEllipsisOneSpace =;

Iban::Iban() :{}

Iban::Iban(const Guid& guid)
    :{}

Iban::Iban(const InstrumentId& instrument_id)
    :{}

Iban::Iban(const Iban& iban) :{}

Iban::~Iban() = default;

Iban& Iban::operator=(const Iban& iban) = default;

PaymentsMetadata Iban::GetMetadata() const {}

// static
bool Iban::IsValid(const std::u16string& value) {}

// static
std::string Iban::GetCountryCode(const std::u16string& iban_value) {}

// static
bool Iban::IsIbanApplicableInCountry(const std::string& country_code) {}

// static
Iban::IbanSupportedCountry Iban::GetIbanSupportedCountry(
    std::string_view country_code) {}

// static
// IBAN lengths taken from:
// https://en.wikipedia.org/wiki/International_Bank_Account_Number#IBAN_formats_by_country.
size_t Iban::GetLengthOfIbanCountry(IbanSupportedCountry supported_country) {}

bool Iban::SetMetadata(const PaymentsMetadata& metadata) {}

std::u16string Iban::GetRawInfo(FieldType type) const {}

void Iban::SetRawInfoWithVerificationStatus(FieldType type,
                                            const std::u16string& value,
                                            VerificationStatus status) {}

void Iban::GetSupportedTypes(FieldTypeSet* supported_types) const {}

bool Iban::IsEmpty(const std::string& app_locale) const {}

int Iban::Compare(const Iban& iban) const {}

bool Iban::operator==(const Iban& iban) const {}

void Iban::set_identifier(const absl::variant<Guid, InstrumentId>& identifier) {}

const std::string& Iban::guid() const {}

int64_t Iban::instrument_id() const {}

void Iban::set_value(const std::u16string& value) {}

void Iban::set_nickname(const std::u16string& nickname) {}

void Iban::set_prefix(std::u16string prefix) {}

void Iban::set_suffix(std::u16string suffix) {}

bool Iban::IsValid() {}

std::string Iban::GetCountryCode() const {}

void Iban::RecordAndLogUse() {}

std::u16string Iban::GetIdentifierStringForAutofillDisplay(
    bool is_value_masked) const {}

bool Iban::MatchesPrefixAndSuffix(const Iban& iban) const {}

std::ostream& operator<<(std::ostream& os, const Iban& iban) {}

}  // namespace autofill