Closed Bug 805130 Opened 12 years ago Closed 12 years ago

Add error codes for validation failures in navigator.mozPay()

Categories

(Core :: DOM: Device Interfaces, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 800511
blocking-basecamp +

People

(Reporter: kumar, Assigned: ferjm)

References

(Blocks 1 open bug)

Details

(Keywords: dev-doc-needed, feature, Whiteboard: [feature-complete])

Attachments

(1 file, 1 obsolete file)

When a developer is creating JWTs to initiate payment they will make mistakes. Their only feedback is an error code sent to their failure() callback. This bug is about adding a unique error code for all the possible validation failures so that a developer knows what he did wrong and can make the correction.

For example, when a developer creates a JWT with an unknown typ they should receive an error code for that. Instead there is only a debug message that is not visible to them: http://mxr.mozilla.org/mozilla-central/source/dom/payment/Payment.jsm#268

See the in-app payment spec: https://wiki.mozilla.org/WebAPI/WebPayment#In-app_payment It does not yet document how error codes are sent to the callback.

+++ This bug was initially created as a clone of Bug #800511 +++
Depends on: 805132
Blocks: 805132
No longer depends on: 805132
No longer blocks: 805123
No longer depends on: 800511
Blocking nom - developers need to understand what happens if an in-app payment fails and why.
blocking-basecamp: --- → ?
Having some sort of error feedback is a blocker.  Using the error console is fine.
blocking-basecamp: ? → +
Assignee: nobody → ferjmoreno
(In reply to Kumar McMillan [:kumar] from comment #0)
> When a developer is creating JWTs to initiate payment they will make
> mistakes. Their only feedback is an error code sent to their failure()
> callback. This bug is about adding a unique error code for all the possible
> validation failures so that a developer knows what he did wrong and can make
> the correction.
> 
> For example, when a developer creates a JWT with an unknown typ they should
> receive an error code for that. Instead there is only a debug message that
> is not visible to them:
> http://mxr.mozilla.org/mozilla-central/source/dom/payment/Payment.jsm#268
> 

Note that currently the validation is done for *all* the JWTs that are passed to nav.mozPay() call. If there is an error validating one of the JWTs, we *don't* fire the error callback, but continue validating the next JWT, trying to find a valid payment request. We only fire the error callback with the "NO_VALID_PAYMENT_REQUEST_FOUND" when *all* the JWT validations fails.

Are you proposing that we fire the error callback with the first JWT validation error, exposing the exact error and discarding the rest of JWTs (if available)?
After discussing this with Kumar via IRC, we agreed to trigger the error callback with every JWT validation error, along with a detailed error code, with the exception of a wrong 'typ' value. That way we would provide enough information about a wrong payment request while we would still be allowing to use a default set of JWTs that might work in different B2G devices (with different allowed payment providers).
Blocks: basecamp-payments
No longer blocks: marketplace-payments
Attached patch WIP (obsolete) (deleted) — Splinter Review
Attached patch WIP (deleted) — Splinter Review
Attachment #677141 - Attachment is obsolete: true
Whiteboard: [feature-complete]
Keywords: feature
Even if there have been a decision about removing the client side validation code, I still would like to add some more error information. I'll be doing it as part of bug 800511 patches, so I am closing this one as a dup.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: