From 6eaeb19eff62cf6a29c12c2c7b9bdb9c6efafa7d Mon Sep 17 00:00:00 2001 From: Ade Bateman Date: Thu, 28 Apr 2016 14:58:16 -0700 Subject: [PATCH 1/2] Remove issue #119 note and assert that total should be non-negative --- specs/paymentrequest.html | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/specs/paymentrequest.html b/specs/paymentrequest.html index 6a46ec7e..17bb9f88 100644 --- a/specs/paymentrequest.html +++ b/specs/paymentrequest.html @@ -601,13 +601,6 @@

CurrencyAmount

required DOMString value; }; -
- The resolution of the WG per Issue #57 defined - a format for currencies and amounts that lacked support for negative values. The format below adds this - capability in a way that is not common for financial messaging standards (using signed numbers). The - rationale for negative numbers is to support discounts. The group is still discussing whether functionality - to support discounts might be implemented in a different manner (e.g., via a transaction type). -

A CurrencyAmount dictionary is used to supply monetary amounts. The following fields MUST be supplied for a CurrencyAmount to be valid: @@ -663,6 +656,10 @@

PaymentDetails dictionary

total
This PaymentItem contains the total amount of the payment request. +

+ total MUST be a non-negative value. This means that the total.amount.value + field MUST NOT begin with a U+002D HYPHEN-MINUS character. +

displayItems
From 71df90ce04fcad819c0ffd4d873e0d811436efae Mon Sep 17 00:00:00 2001 From: Ade Bateman Date: Thu, 28 Apr 2016 18:44:54 -0700 Subject: [PATCH 2/2] Throw if total is missing from the constructor or is negative. --- specs/paymentrequest.html | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/specs/paymentrequest.html b/specs/paymentrequest.html index 17bb9f88..b6eae175 100644 --- a/specs/paymentrequest.html +++ b/specs/paymentrequest.html @@ -390,8 +390,12 @@

PaymentRequest constructor

  • - If details does not contain a sequence of items with length greater - than zero, then throw a TypeError. + If details does not contain a value for total, then throw a + TypeError. +
  • +
  • + If the first character of details.total.amount.value is U+002D HYPHEN-MINUS, then throw a + TypeError. total MUST be a non-negative amount.
  • For each PaymentMethodData in methodData, if the data field