#include "components/facilitated_payments/core/util/pix_code_validator.h"
#include "base/functional/callback.h"
#include "base/strings/string_util.h"
#include "third_party/re2/src/re2/re2.h"
namespace payments::facilitated {
namespace {
constexpr char kSectionIdAndSizePattern[] = …;
constexpr char kPayloadFormatIndicatorFirstSectionId[] = …;
constexpr char kMerchantAccountInformationSectionId[] = …;
constexpr char kMerchantAccountInformationDynamicUrlSectionId[] = …;
constexpr char kAdditionalDataFieldTemplateSectionId[] = …;
constexpr char kCrc16LastSectionId[] = …;
constexpr char kPixCodeIndicatorLowercase[] = …;
struct SectionInfo { … };
bool ParseNextSection(std::string_view* code, SectionInfo* section_info) { … }
bool ContainsValidSections(std::string_view input) { … }
}
PixCodeValidator::PixCodeValidator() = default;
PixCodeValidator::~PixCodeValidator() = default;
bool PixCodeValidator::IsValidPixCode(std::string_view code) { … }
bool PixCodeValidator::ContainsPixIdentifier(std::string_view code) { … }
void PixCodeValidator::ValidatePixCode(
const std::string& input_text,
base::OnceCallback<void(std::optional<bool>)> callback) { … }
}