[w3c/browser-payment-api] Ambiguity in "Process payment methods:" (#458)

In the construction of PaymentRequest, for "Process payment methods", sub-step reads:

> Let serializedData be the result of JSON-serializing paymentMethod.data into a string, if the data member of paymentMethod is present, or null if it is not. Rethrow any exceptions.

Which translates to:

```JS
let serializedData = JSON.strigify(paymentMethod.data || null);
```
@domenic, is that correct? If so, for cases where null, `JSON.parse(serializedData)` at any later point will then result in the string "null". 

Or is actually supposed to be:

```JS
let serializedData = paymentMethod.data ? JSON.strigify(paymentMethod.data) : null;
```

In which case, we should change this to:

> If the data member of paymentMethod is present, let serializedData be the result of JSON-serializing paymentMethod.data into a string. Rethrow any exceptions. Otherwise,  let serializedData be null.

Yes, not having "Let serializedData ... " at the start is not as nice... but can be fixed.    


-- 
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/issues/458

Received on Thursday, 16 March 2017 08:05:30 UTC