Accept any string for currency code in PaymentRequest
Reported by
sideshowbarker@gmail.com,
Aug 11 2016
|
||||||||
Issue descriptionUserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2825.0 Safari/537.36 Steps to reproduce the problem: 1. Open https://sideshowbarker.net/tests/payment-request/invalid-currency.html What is the expected behavior? You should see this: *Test passes* The Payment Request API spec states that "any string is considered valid" for the currency field. Called PaymentRequest constructor with value "x" for the currency field: new PaymentRequest([{supportedMethods: ['foo']}], {total: {label: 'bar', amount: {currency: 'x', value: '0'}}}) ... and as expected, browser did not throw. What went wrong? Instead of the expected behavior I get this: *Test fails* The Payment Request API spec states that "any string is considered valid" for the currency field. Called PaymentRequest constructor with value "x" for the currency field: new PaymentRequest([{supportedMethods: ['foo']}], {total: {label: 'bar', amount: {currency: 'x', value: '0'}}}) ... but browser threw: TypeError: Failed to construct 'PaymentRequest': 'x' is not a valid ISO 4217 currency code, should be 3 upper case letters [A-Z] Did this work before? N/A Chrome version: 54.0.2825.0 Channel: canary OS Version: OS X 10.11.6 Flash Version:
,
Aug 11 2016
,
Aug 12 2016
As far at the “Accept any non-empty string” title of the issue: Since the spec literally says (non-normatively) “any string is considered valid” (which means that empty string is also “valid”) and otherwise nowhere specifies that the value cannot be the empty string, I think implementations must also accept the empty string here (unless/until the spec is updated to say otherwise).
,
Aug 12 2016
Specs are silly things :-)
,
Aug 23 2016
Do we need to implement the conclusion in https://github.com/w3c/browser-payment-api/issues/185 ? rouslan@ Shall I start working on this?
,
Aug 23 2016
sanjoy.pal, go ahead and start working on this. Currently we display prices in UI as "USD $5.00". For currencies with very long codes, we need to decide how to display them. I propose that we truncate around 6 characters. For example:
{currency: "bobpay", value: "5.00"}------>"bobpay 5.00" (6 characters)
{currency: "alicepaycoins", value: "5.00"}------>"alice... 5.00" (5 characters + ellipsys)
,
Aug 23 2016
,
Aug 23 2016
Speaking of https://github.com/w3c/browser-payment-api/issues/185, let's not implement that until it's in the spec. Just implement "Any string can be a currency code."
,
Aug 24 2016
,
Sep 1 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/25156023212b2fa380ccb48b2597549119003ec2 commit 25156023212b2fa380ccb48b2597549119003ec2 Author: sanjoy.pal <sanjoy.pal@samsung.com> Date: Thu Sep 01 01:12:12 2016 Accept any string for currency code in PaymentRequest. BUG= 636723 , 640847 Review-Url: https://codereview.chromium.org/2271113002 Cr-Commit-Position: refs/heads/master@{#415831} [modify] https://crrev.com/25156023212b2fa380ccb48b2597549119003ec2/chrome/android/java/src/org/chromium/chrome/browser/payments/CurrencyStringFormatter.java [modify] https://crrev.com/25156023212b2fa380ccb48b2597549119003ec2/chrome/android/junit/src/org/chromium/chrome/browser/payments/CurrencyStringFormatterTest.java [modify] https://crrev.com/25156023212b2fa380ccb48b2597549119003ec2/third_party/WebKit/LayoutTests/payments/payment-request-interface.html [modify] https://crrev.com/25156023212b2fa380ccb48b2597549119003ec2/third_party/WebKit/Source/modules/payments/PaymentRequestDetailsTest.cpp [modify] https://crrev.com/25156023212b2fa380ccb48b2597549119003ec2/third_party/WebKit/Source/modules/payments/PaymentsValidators.cpp [modify] https://crrev.com/25156023212b2fa380ccb48b2597549119003ec2/third_party/WebKit/Source/modules/payments/PaymentsValidators.h [modify] https://crrev.com/25156023212b2fa380ccb48b2597549119003ec2/third_party/WebKit/Source/modules/payments/PaymentsValidatorsTest.cpp [modify] https://crrev.com/25156023212b2fa380ccb48b2597549119003ec2/third_party/WebKit/public/platform/modules/payments/payment_request.mojom
,
Sep 8 2016
Currency code for RTL language
,
Sep 8 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/394b1d9222e816e1fbe03b9c8e51f8cb2fb59e8c commit 394b1d9222e816e1fbe03b9c8e51f8cb2fb59e8c Author: sanjoy.pal <sanjoy.pal@samsung.com> Date: Thu Sep 08 05:50:00 2016 Currency code exceeding 6 chars will be ellipsized. BUG= 636723 , 640847 Review-Url: https://codereview.chromium.org/2281913002 Cr-Commit-Position: refs/heads/master@{#417201} [modify] https://crrev.com/394b1d9222e816e1fbe03b9c8e51f8cb2fb59e8c/chrome/android/java/src/org/chromium/chrome/browser/payments/CurrencyStringFormatter.java [modify] https://crrev.com/394b1d9222e816e1fbe03b9c8e51f8cb2fb59e8c/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java [modify] https://crrev.com/394b1d9222e816e1fbe03b9c8e51f8cb2fb59e8c/chrome/android/javatests/src/org/chromium/chrome/browser/payments/CurrencyStringFormatterTest.java [modify] https://crrev.com/394b1d9222e816e1fbe03b9c8e51f8cb2fb59e8c/chrome/android/junit/src/org/chromium/chrome/browser/payments/CurrencyStringFormatterTest.java
,
Sep 8 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/394b1d9222e816e1fbe03b9c8e51f8cb2fb59e8c commit 394b1d9222e816e1fbe03b9c8e51f8cb2fb59e8c Author: sanjoy.pal <sanjoy.pal@samsung.com> Date: Thu Sep 08 05:50:00 2016 Currency code exceeding 6 chars will be ellipsized. BUG= 636723 , 640847 Review-Url: https://codereview.chromium.org/2281913002 Cr-Commit-Position: refs/heads/master@{#417201} [modify] https://crrev.com/394b1d9222e816e1fbe03b9c8e51f8cb2fb59e8c/chrome/android/java/src/org/chromium/chrome/browser/payments/CurrencyStringFormatter.java [modify] https://crrev.com/394b1d9222e816e1fbe03b9c8e51f8cb2fb59e8c/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java [modify] https://crrev.com/394b1d9222e816e1fbe03b9c8e51f8cb2fb59e8c/chrome/android/javatests/src/org/chromium/chrome/browser/payments/CurrencyStringFormatterTest.java [modify] https://crrev.com/394b1d9222e816e1fbe03b9c8e51f8cb2fb59e8c/chrome/android/junit/src/org/chromium/chrome/browser/payments/CurrencyStringFormatterTest.java
,
Sep 16 2016
,
Jun 27 2017
|
||||||||
►
Sign in to add a comment |
||||||||
Comment 1 by rsesek@chromium.org
, Aug 11 2016