mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fix payment field values formatting.
Regression was introduced in e6b9a07163
.
Fixes #27318.
This commit is contained in:
parent
30d5b7fd66
commit
893e14cc39
1 changed files with 2 additions and 1 deletions
|
@ -217,10 +217,10 @@ struct SimpleFieldState {
|
||||||
const FieldConfig &config,
|
const FieldConfig &config,
|
||||||
const QString &parsed,
|
const QString &parsed,
|
||||||
const QString &countryIso2) {
|
const QString &countryIso2) {
|
||||||
static const auto RegExp = QRegularExpression("[^0-9]\\.");
|
|
||||||
if (config.type == FieldType::Country) {
|
if (config.type == FieldType::Country) {
|
||||||
return countryIso2;
|
return countryIso2;
|
||||||
} else if (config.type == FieldType::Money) {
|
} else if (config.type == FieldType::Money) {
|
||||||
|
static const auto RegExp = QRegularExpression("[^0-9\\.]");
|
||||||
const auto rule = LookupCurrencyRule(config.currency);
|
const auto rule = LookupCurrencyRule(config.currency);
|
||||||
const auto real = QString(parsed).replace(
|
const auto real = QString(parsed).replace(
|
||||||
QChar(rule.decimal),
|
QChar(rule.decimal),
|
||||||
|
@ -236,6 +236,7 @@ struct SimpleFieldState {
|
||||||
int64(base::SafeRound(real * std::pow(10., rule.exponent))));
|
int64(base::SafeRound(real * std::pow(10., rule.exponent))));
|
||||||
} else if (config.type == FieldType::CardNumber
|
} else if (config.type == FieldType::CardNumber
|
||||||
|| config.type == FieldType::CardCVC) {
|
|| config.type == FieldType::CardCVC) {
|
||||||
|
static const auto RegExp = QRegularExpression("[^0-9]");
|
||||||
return QString(parsed).replace(RegExp, QString());
|
return QString(parsed).replace(RegExp, QString());
|
||||||
}
|
}
|
||||||
return parsed;
|
return parsed;
|
||||||
|
|
Loading…
Add table
Reference in a new issue