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

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

Issue 2410143003: Add currencySystem field to PaymentCurrencyAmount (Closed)
Patch Set: Fix tests in Win builds 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..d5cb3dc4ab0909423f587eb1d0fdaf996db3a4fa 100644
--- a/third_party/WebKit/Source/modules/payments/PaymentsValidators.cpp
+++ b/third_party/WebKit/Source/modules/payments/PaymentsValidators.cpp
@@ -14,7 +14,27 @@ static const int maxiumStringLength = 2048;
bool PaymentsValidators::isValidCurrencyCodeFormat(
const String& code,
+ const String& system,
String* optionalErrorMessage) {
+ if (system == "urn:iso:std:iso:4217") {
+ if (ScriptRegexp("^[A-Z]{3}$", TextCaseSensitive).match(code) == 0)
+ return true;
+
+ if (optionalErrorMessage)
+ *optionalErrorMessage = "'" + code +
+ "' is not a valid ISO 4217 currency code, should "
+ "be 3 upper case letters [A-Z]";
+
+ return false;
+ }
+
+ if (!KURL(KURL(), system).isValid()) {
+ if (optionalErrorMessage)
+ *optionalErrorMessage = "The currency system is not a valid URL";
+
+ return false;
+ }
+
if (code.length() <= maxiumStringLength)
return true;

Powered by Google App Engine
This is Rietveld 408576698