From 31a0a8e5759c9b24a9de21bb4494301d50e49526 Mon Sep 17 00:00:00 2001 From: Adrian Hope-Bailie Date: Tue, 29 Mar 2016 15:16:32 +0200 Subject: [PATCH] Update definition of CurrencyAmount to match WG resolution #57 Updated definition to allow for flexible currency identifiers and not allow negative amounts --- specs/paymentrequest.html | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/specs/paymentrequest.html b/specs/paymentrequest.html index f0734b71..84fc7fad 100644 --- a/specs/paymentrequest.html +++ b/specs/paymentrequest.html @@ -295,17 +295,17 @@

PaymentRequest constructor

{ "id": "basket", "label": "Sub-total", - "amount": { "currencyCode": "USD", "value" : "55.00" }, // US$55.00 + "amount": { "currency": "USD", "amount" : "55.00" }, // US$55.00 }, { "id": "tax", "label": "Sales Tax", - "amount": { "currencyCode": "USD", "value" : "5.00" }, // US$5.00 + "amount": { "currency": "USD", "amount" : "5.00" }, // US$5.00 }, { "id": "total", "label": "Total due", - "amount": { "currencyCode": "USD", "value" : "60.00" }, // US$60.00 + "amount": { "currency": "USD", "amount" : "60.00" }, // US$60.00 } ] } @@ -578,8 +578,8 @@

Internal Slots

CurrencyAmount

 dictionary CurrencyAmount {
-  required DOMString currencyCode;
-  required DOMString value;
+  required DOMString currency;
+  required DOMString amount;
 };
       

@@ -587,19 +587,20 @@

CurrencyAmount

The following fields MUST be supplied for a CurrencyAmount to be valid:

-
currencyCode
+
currency
- currencyCode is a string containing a three-letter alphabetic code for the - currency as defined by [[!ISO4217]]. For example, "USD" for US Dollars. + currency is a string containing a currency identifier. The most common + identifiers are three-letter alphabetic codes as defined by [[!ISO4217]] (for example, + "USD" for US Dollars) however any string is considered valid and + user agents MUST not attempt to validate this string.
-
value
+
amount
A string containing the decimal monetary value. If a decimal separator is needed then the string - MUST use a single U+002E FULL STOP character as the decimal separator. The string MUST begin - with a single U+002D HYPHEN-MINUS character if the value is negative. All other characters must + MUST use a single U+002E FULL STOP character as the decimal separator. All other characters must be characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9).
- The string should match the regular expression ^-?[0-9]+(\.[0-9]+)?$. + The string should match the regular expression ^[0-9]+(\.[0-9]+)?$.
@@ -607,8 +608,8 @@

CurrencyAmount

The following example shows how to represent US$55.00.

 {
-  "currencyCode": "USD",
-  "value" : "55.00"
+  "currency": "USD",
+  "amount" : "55.00"
 }