Closed Bug 924693 Opened 11 years ago Closed 11 years ago

payment callbacks do not appear on Android

Categories

(Firefox for Android Graveyard :: Web Apps (PWAs), defect)

All
Android
defect
Not set
normal

Tracking

(fennec+)

VERIFIED FIXED
Firefox 28
Tracking Status
fennec + ---

People

(Reporter: kumar, Assigned: wesj)

References

Details

Attachments

(2 files, 1 obsolete file)

Attached file logcat.txt
callbacks such as mozPaymentProvider.paymentSuccess() and mozPaymentProvider.paymentFailed() do not exist on Firefox for Android. These are required to fulfill a payment. Details here: https://wiki.mozilla.org/WebAPI/WebPaymentProvider#API

STR:
- Install Firefox Nightly on an Android device
- Install the in-app payment tester from http://apploa.de/3b25a (manifest: http://inapp-pay-test.paas.allizom.org/manifest.webapp)
- Open the tester app from the Android home screen
- Edit the JWT textarea to make a simulation. Add {"simulate": {"result": "postback"}} to the request object so it looks something like:

{
  "iss": "323d34dc-b5cf-4822-8e47-6a4515dc74db",
  "aud": "marketplace.firefox.com",
  ...
  "request": {
    ...
    "simulate": {"result": "postback"}
  }
}

- Scroll out of the textarea and tap Pay
- When prompted to continue the simulation, tap continue

Expected: The payment window should call paymentSuccess() in the background, close, and return to the tester app. The tester app should say "postback received"

Actual: The payment window gets stuck because the paymentSuccess() function is undefined.

When making a real payment from the browser the same problem occurs. I added the STR with the tester only because it is an easier way to reproduce the error. In either case, it's serious because the user is charged money before the install fails.
Version: unspecified → Trunk
I was using today's Nightly Firefox
tracking-fennec: --- → ?
Blocks: 909896
Assignee: nobody → wjohnston
tracking-fennec: ? → +
Looks like this spec changed under us :( Updatin
Our code is compatible with the old spec -- it will try to find the first available callback but in this case it found neither. Let me know if you need any further info on the failure I ran into while testing.
Attached patch Use mozPaymentProvider (obsolete) — Splinter Review
Can you point me to the marketplace source code so I can see what they're doing? The simple provider here:

http://ferjm.github.io/simplepayprovider/page1.html

seems to work fine (with this patch). This patch just wraps our callback in a mozPaymentProvider object, which is consistent with what's done here [1] and here [2].

[1] http://mxr.mozilla.org/mozilla-central/source/webapprt/PaymentUIGlue.js#117
[2] http://mxr.mozilla.org/mozilla-central/source/b2g/chrome/content/payment.js#318
Attachment #819937 - Flags: review?(mark.finkle)
The Marketplace payment code is a bit ugly (it tries to work around bugs in older clients) but here are examples:
https://github.com/mozilla/webpay/blob/master/media/js/pay/pay.js#L217
https://github.com/mozilla/webpay/blob/master/media/js/pay/cancel.js#L20

Is that what you were looking for? 

Do the steps to reproduce in comment #0 help you test your patch? You can add this to cover the paymentFailed() code:
 
"simulate": {"result": "chargeback", "reason": "refund"}
Comment on attachment 819937 [details] [diff] [review]
Use mozPaymentProvider

Is this really a patch?
Comment on attachment 819937 [details] [diff] [review]
Use mozPaymentProvider

not a patch
Attachment #819937 - Flags: review?(mark.finkle) → review-
Wes said on IRC that the patch isn't yet working, he's still looking at it
Attached patch PatchSplinter Review
Apparently we need to add these slightly earlier? Doing this in the capture phase fixes the problem for me.
Attachment #819937 - Attachment is obsolete: true
Attachment #829636 - Flags: review?
Attachment #829636 - Flags: review? → review?(mark.finkle)
Attachment #829636 - Flags: review?(mark.finkle) → review+
Thanks, Wes. Any ideas when this patch will be available in Fennec Nightly?
(In reply to Kumar McMillan [:kumar] from comment #11)
> Thanks, Wes. Any ideas when this patch will be available in Fennec Nightly?

This patch has not been merged to mozilla-central yet. When it does, this bug will be closed. The next Nightly after the merge to mozilla-central will have the fix.

ETA: Look for it in the Nov 12th Nightly
(In reply to Mark Finkle (:mfinkle) from comment #12)

> ETA: Look for it in the Nov 12th Nightly

Ugh. I mean Nov 13th.
https://hg.mozilla.org/mozilla-central/rev/e21068210bfb
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 28
Thanks. I tested both a postback and chargeback in today's Nightly. The callbacks are closing the window as expected. However, they are not passing callback arguments to the DOMRequest properly. I opened bug 938304 for that.
Status: RESOLVED → VERIFIED
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: