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

Unified Diff: components/payments/currency_formatter.h

Issue 2621033003: [Payments] Currency formatter for order amounts. (Closed)
Patch Set: Initial Created 3 years, 11 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: components/payments/currency_formatter.h
diff --git a/components/payments/currency_formatter.h b/components/payments/currency_formatter.h
new file mode 100644
index 0000000000000000000000000000000000000000..54d1906b5feb3ddd3183058b240c6131907c1d87
--- /dev/null
+++ b/components/payments/currency_formatter.h
@@ -0,0 +1,28 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_PAYMENTS_CURRENCY_FORMATTER_H_
+#define COMPONENTS_PAYMENTS_CURRENCY_FORMATTER_H_
+
+#include <string>
+
+#include "third_party/icu/source/common/unicode/locid.h"
+
+namespace payments {
+
+// Formats the |amount| according to the |currency_code|, which typically
+// adheres to [ISO4217] (for example, "USD" for US Dollars). The result will NOT
+// contain the currency code, nor a subset of it. Rather, the caller of this
+// function should display the currency code separately. Note that |amount|
+// and |currency_code| should have been validated (as part of
+// payment_details_validation.h) before this is called, but this function will
+// still do light validation, and return |amount| in failure cases. The return
+// value may contain non-breaking space.
+const std::string FormatAmountForCurrency(const std::string& amount,
please use gerrit instead 2017/01/11 18:29:30 The "const" keyword here does not seem to server a
Mathieu 2017/01/11 22:22:26 Done.
+ const std::string& currency_code,
+ const icu::Locale& locale);
+
+} // namespace payments
+
+#endif // COMPONENTS_PAYMENTS_CURRENCY_FORMATTER_H_

Powered by Google App Engine
This is Rietveld 408576698