OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2017 The Chromium Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. |
| 5 */ |
| 6 |
| 7 /* global PaymentRequest:false */ |
| 8 |
| 9 /** |
| 10 * Launches the PaymentRequest UI with Bob Pay and basic-card as payment |
| 11 * methods. |
| 12 */ |
| 13 function buy() { // eslint-disable-line no-unused-vars |
| 14 try { |
| 15 new PaymentRequest( |
| 16 [{supportedMethods: ['https://bobpay.com', 'basic-card']}], |
| 17 { |
| 18 total: {label: 'Total', amount: {currency: 'USD', value: '5.00'}}, |
| 19 modifiers: [{ |
| 20 supportedMethods: ['https://bobpay.com'], |
| 21 total: { |
| 22 label: 'Total', |
| 23 amount: {currency: 'USD', value: '4.00'} |
| 24 }, |
| 25 additionalDisplayItems: [{ |
| 26 label: 'BobPay discount', |
| 27 amount: {currency: 'USD', value: '-1.00'} |
| 28 }], |
| 29 data: {discountProgramParticipantId: '86328764873265'} |
| 30 }], |
| 31 }) |
| 32 .show() |
| 33 .then(function(resp) { |
| 34 resp.complete('success') |
| 35 .then(function() { |
| 36 print( |
| 37 resp.methodName + '<br>' + |
| 38 JSON.stringify(resp.details, undefined, 2)); |
| 39 }) |
| 40 .catch(function(error) { |
| 41 print(error.message); |
| 42 }); |
| 43 }) |
| 44 .catch(function(error) { |
| 45 print(error.message); |
| 46 }); |
| 47 } catch (error) { |
| 48 print(error.message); |
| 49 } |
| 50 } |
OLD | NEW |