[w3c/browser-payment-api] Remove issue #119 note and assert that total should be non-negative (#168)

`CurrentAmount` defines a monetary value. It is currently used in two places in the PaymentRequest API:
* In the total field indicating the total amount of the payment request; and
* In the `displayItems` collection that contain optional line items to be displayed by the user agent.

For the first version of the specification, I propose that we shouldn't try to address the meaning of a negative total. Changing the direction of the payment request and supporting things like refunds should be out of scope (at least for now). This means that we should assert that total must be a non-negative number.

A common use case for the `displayItems` will be to show discounts. These are commonly shown on web pages as negative amounts. For example, here is a recent order summary from a transaction I made:

![image](https://cloud.githubusercontent.com/assets/2166064/14902858/513aa794-0d52-11e6-84ce-238f5eb80194.png)

There has been some discussion about whether the API should use "[financial industry norms and  existing payment messaging standards like ISO20022 and ISO8583](https://github.com/w3c/browser-payment-api/issues/119#issue-145613354)." This would presumably lead us to use terms like debit and credit for values. However, we're not designing an API for the financial industry - we're designing it for web developers who are trying to construct the UX shown above. In the PaymentRequest API, negative amounts are only ever used for display. In the checkout case, for example, it is clear what a negative number means here. Web developers will be more confused if we ask them to think in terms of debit and credit.

I believe we should keep the current spec text for negative amounts. It is simple determine if a value is negative (by testing whether the first character is U+002D HYPHEN-MINUS). It is more succinct than requiring an additional field in the dictionary to indicate a negative value. Web developers will readily understand what it is for.

This pull request removes the issue #119 note and asserts that total must be non-negative.

Fixes #119.



You can view, comment on, or merge this pull request online at:

  https://github.com/w3c/browser-payment-api/pull/168

-- Commit Summary --

  * Remove issue #119 note and assert that total should be non-negative

-- File Changes --

    M specs/paymentrequest.html (11)

-- Patch Links --

https://github.com/w3c/browser-payment-api/pull/168.patch
https://github.com/w3c/browser-payment-api/pull/168.diff

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/browser-payment-api/pull/168

Received on Thursday, 28 April 2016 22:06:46 UTC