webapprt/test/chrome/mozpay.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <head>
michael@0 4 <meta charset="utf-8">
michael@0 5 </head>
michael@0 6 <body>
michael@0 7 <script>
michael@0 8 // Payload
michael@0 9 // {
michael@0 10 // "aud": "mockpayprovider.phpfogapp.com",
michael@0 11 // "iss": "Enter you app key here!",
michael@0 12 // "request": {
michael@0 13 // "name": "Piece of Cake",
michael@0 14 // "price": "10.50",
michael@0 15 // "priceTier": 1,
michael@0 16 // "productdata": "transaction_id=86",
michael@0 17 // "currencyCode": "USD",
michael@0 18 // "description": "Virtual chocolate cake to fill your virtual tummy"
michael@0 19 // },
michael@0 20 // "exp": 1352232792,
michael@0 21 // "iat": 1352229192,
michael@0 22 // "typ": "mock/payments/inapp/v1"
michael@0 23 // }
michael@0 24 var jwt = "eyJhbGciOiAiSFMyNTYiLCAidHlwIjogIkpXVCJ9.eyJhdWQiOiAibW9j" +
michael@0 25 "a3BheXByb3ZpZGVyLnBocGZvZ2FwcC5jb20iLCAiaXNzIjogIkVudGVyI" +
michael@0 26 "HlvdSBhcHAga2V5IGhlcmUhIiwgInJlcXVlc3QiOiB7Im5hbWUiOiAiUG" +
michael@0 27 "llY2Ugb2YgQ2FrZSIsICJwcmljZSI6ICIxMC41MCIsICJwcmljZVRpZXI" +
michael@0 28 "iOiAxLCAicHJvZHVjdGRhdGEiOiAidHJhbnNhY3Rpb25faWQ9ODYiLCAi" +
michael@0 29 "Y3VycmVuY3lDb2RlIjogIlVTRCIsICJkZXNjcmlwdGlvbiI6ICJWaXJ0d" +
michael@0 30 "WFsIGNob2NvbGF0ZSBjYWtlIHRvIGZpbGwgeW91ciB2aXJ0dWFsIHR1bW" +
michael@0 31 "15In0sICJleHAiOiAxMzUyMjMyNzkyLCAiaWF0IjogMTM1MjIyOTE5Miw" +
michael@0 32 "gInR5cCI6ICJtb2NrL3BheW1lbnRzL2luYXBwL3YxIn0.QZxc62USCy4U" +
michael@0 33 "IyKIC1TKelVhNklvk-Ou1l_daKntaFI";
michael@0 34
michael@0 35 var request = navigator.mozPay(jwt);
michael@0 36 request.onsuccess = function onsuccess() {
michael@0 37 document.getElementById("msg").textContent = "Success.";
michael@0 38 };
michael@0 39 request.onerror = function onerror() {
michael@0 40 document.getElementById("msg").textContent = request.error.name;
michael@0 41 };
michael@0 42 </script>
michael@0 43 <p id="msg">Webapp waiting to be paid...</p>
michael@0 44 </body>
michael@0 45 </html>

mercurial