| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 The Chromium Authors. All rights reserved. | 2 * Copyright 2016 The Chromium Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 /* global PaymentRequest:false */ | 7 /* global PaymentRequest:false */ |
| 8 | 8 |
| 9 var request; | 9 var request; |
| 10 | 10 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 print(JSON.stringify(resp, undefined, 2)); | 75 print(JSON.stringify(resp, undefined, 2)); |
| 76 }).catch(function(error) { | 76 }).catch(function(error) { |
| 77 print(error); | 77 print(error); |
| 78 }); | 78 }); |
| 79 } catch (error) { | 79 } catch (error) { |
| 80 print(error.message); | 80 print(error.message); |
| 81 } | 81 } |
| 82 } | 82 } |
| 83 | 83 |
| 84 /** | 84 /** |
| 85 * Launches the PaymentRequest UI which accepts only Android Pay and does not |
| 86 * require any other information. |
| 87 */ |
| 88 function androidPaySkipUiBuy() { // eslint-disable-line no-unused-vars |
| 89 try { |
| 90 request = new PaymentRequest( |
| 91 [{supportedMethods: ['https://android.com/pay']}], { |
| 92 total: {label: 'Total', amount: {currency: 'USD', value: '5.00'}}, |
| 93 }); |
| 94 request.show() |
| 95 .then(function(resp) { |
| 96 return resp.complete('success'); |
| 97 }).then(function() { |
| 98 print(JSON.stringify(resp, undefined, 2)); |
| 99 }).catch(function(error) { |
| 100 print(error); |
| 101 }); |
| 102 } catch (error) { |
| 103 print(error.message); |
| 104 } |
| 105 } |
| 106 |
| 107 /** |
| 85 * Launches the PaymentRequest UI which accepts only an unsupported payment | 108 * Launches the PaymentRequest UI which accepts only an unsupported payment |
| 86 * method. | 109 * method. |
| 87 */ | 110 */ |
| 88 function noSupported() { // eslint-disable-line no-unused-vars | 111 function noSupported() { // eslint-disable-line no-unused-vars |
| 89 try { | 112 try { |
| 90 request = new PaymentRequest( | 113 request = new PaymentRequest( |
| 91 [{supportedMethods: ['https://randompay.com']}], { | 114 [{supportedMethods: ['https://randompay.com']}], { |
| 92 total: {label: 'Total', amount: {currency: 'USD', value: '5.00'}}, | 115 total: {label: 'Total', amount: {currency: 'USD', value: '5.00'}}, |
| 93 shippingOptions: [{ | 116 shippingOptions: [{ |
| 94 id: 'freeShippingOption', | 117 id: 'freeShippingOption', |
| (...skipping 23 matching lines...) Expand all Loading... |
| 118 try { | 141 try { |
| 119 request.abort().then(function() { | 142 request.abort().then(function() { |
| 120 print('Aborted'); | 143 print('Aborted'); |
| 121 }).catch(function() { | 144 }).catch(function() { |
| 122 print('Cannot abort'); | 145 print('Cannot abort'); |
| 123 }); | 146 }); |
| 124 } catch (error) { | 147 } catch (error) { |
| 125 print(error.message); | 148 print(error.message); |
| 126 } | 149 } |
| 127 } | 150 } |
| OLD | NEW |