Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(831)

Unified Diff: third_party/WebKit/Source/modules/payments/PaymentsValidators.cpp

Issue 2410143003: Add currencySystem field to PaymentCurrencyAmount (Closed)
Patch Set: Add currencySystem field to PaymentCurrencyAmount Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/payments/PaymentsValidators.cpp
diff --git a/third_party/WebKit/Source/modules/payments/PaymentsValidators.cpp b/third_party/WebKit/Source/modules/payments/PaymentsValidators.cpp
index 9a9a3d6b897f957a51a5e870a3d4bc7cf98833f9..645fe2413edd443bf29e7954b2cb2369898594e0 100644
--- a/third_party/WebKit/Source/modules/payments/PaymentsValidators.cpp
+++ b/third_party/WebKit/Source/modules/payments/PaymentsValidators.cpp
@@ -14,7 +14,31 @@ static const int maxiumStringLength = 2048;
bool PaymentsValidators::isValidCurrencyCodeFormat(
const String& code,
+ const String& system,
String* optionalErrorMessage) {
+ KURL currencySystemUrl = KURL(KURL(), system);
+ if (!currencySystemUrl.isValid()) {
please use gerrit instead 2016/10/12 23:35:50 Inline "currencySystemUrl": if (!KURL(KURL(), sys
pals 2016/10/13 09:30:38 Done.
+ if (optionalErrorMessage) {
please use gerrit instead 2016/10/12 23:35:49 Let's use {} in the same way as the rest of the fi
pals 2016/10/13 09:30:38 Done.
+ *optionalErrorMessage = "The currency system is not a valid url";
+ }
+
+ return false;
+ }
+
+ if (system == "urn:iso:std:iso:4217") {
please use gerrit instead 2016/10/12 23:35:50 This is a URN, which is different from URL. Theref
pals 2016/10/13 09:30:38 Done.
+ if (ScriptRegexp("^[A-Z]{3}$", TextCaseSensitive).match(code) == 0)
+ return true;
+
+ if (optionalErrorMessage) {
please use gerrit instead 2016/10/12 23:35:50 No need for {}
pals 2016/10/13 09:30:38 Done.
+ *optionalErrorMessage =
+ "'" + code +
+ "' is not a valid ISO 4217 "
+ "currency code, should be 3 upper case letters [A-Z]";
+ }
+
+ return false;
+ }
+
if (code.length() <= maxiumStringLength)
return true;

Powered by Google App Engine
This is Rietveld 408576698