Closed Bug 1385187 Opened 2 years ago Closed 2 years ago

Reject PaymentRequest.show() with NotSupportedError DOMException if no supported method of payment

Categories

(Core :: DOM: Web Payments, enhancement)

enhancement
Not set

Tracking

()

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 --- fixed

People

(Reporter: ben.tian, Assigned: edenchuang)

References

(Blocks 1 open bug)

Details

(Keywords: dev-doc-complete)

Attachments

(2 files, 5 obsolete files)

18.36 KB, patch
edenchuang
: review+
Details | Diff | Splinter Review
7.56 KB, patch
edenchuang
: review+
Details | Diff | Splinter Review
Per step 12, section 4.3 in spec [1]:
"If this consultation produced no supported method of paying, then reject acceptPromise with a "NotSupportedError" DOMException, and set the user agent's payment request is showing boolean to false."

Correspondent web platform test in [2] results in TIMEOUT on current implementation. Need to reject promise with NotSupportedError.


[1] https://w3c.github.io/payment-request/#show()-method
[2] https://w3c-test.org/payment-request/payment-request-show-method.https.html
Assignee: nobody → echuang
Reject PaymentRequest.show() with NotSupportedError DOMException if no supported method.                                                                              
  1. Create a new action response status PAYMENT_NOTSUPPORTED.                 
  2. Create canMakePayment() in PaymentRequestService and run it before launching UI. If canMakePayment() returns false, send PAYMENT_NOTSUPPORTED back to content process.                                                  
  3. If chrome process returns PAYMENT_NOTSUPPORTED when calling showPayment(), throw NotSupportedError DOMException to merchant side.
Attachment #8894237 - Attachment is obsolete: true
Attachment #8899657 - Flags: review?(amarchesini)
Adding a test testCannotSupportShow() to test the implementation.
Attachment #8894238 - Attachment is obsolete: true
Attachment #8899659 - Flags: review?(amarchesini)
Attachment #8899659 - Flags: review?(amarchesini) → review+
Comment on attachment 8899657 [details] [diff] [review]
Bug 1385187 - Reject PaymentRequest.show() with NotSupportedError DOMException if no supported method. r?baku

Review of attachment 8899657 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/payments/PaymentRequestManager.cpp
@@ +600,5 @@
>                                    response.data(),
>                                    response.payerName(),
>                                    response.payerEmail(),
> +                                  response.payerPhone(),
> +                                  rejectedReason);

should we have rejectedReason to NS_OK in case it is accepted?
Attachment #8899657 - Flags: review?(amarchesini) → review+
Take the suggestions mentioned in comment 7.

And get rid of unnecessary method isAccepted() in nsIPaymentActionResponse.idl.
Attachment #8901032 - Flags: review?(amarchesini)
Attachment #8901032 - Flags: review?(amarchesini) → review+
Merge two patches into one patch.
Attachment #8899657 - Attachment is obsolete: true
Attachment #8901032 - Attachment is obsolete: true
Attachment #8901676 - Flags: review+
Keywords: checkin-needed
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/3425efb154af
Reject PaymentRequest.show() with NotSupportedError DOMException if no supported method. r=baku
https://hg.mozilla.org/integration/mozilla-inbound/rev/50742a96dced
Mochitest for rejecting PaymentRequest.show() with NotSupportedError DOMException if no supported method. r=baku
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/3425efb154af
https://hg.mozilla.org/mozilla-central/rev/50742a96dced
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
Setting this to ddc, as I'm pretty sure the wording already included at

https://developer.mozilla.org/en-US/docs/Web/API/PaymentRequest/show#Exceptions

Covers this case.
You need to log in before you can comment on or make changes to this bug.