| 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 /* global print:false */ | 8 /* global print:false */ |
| 9 | 9 |
| 10 /** | 10 /** |
| 11 * Checks for existence of a complete VISA credit card. | 11 * Checks for existence of a complete VISA credit card. |
| 12 */ | 12 */ |
| 13 function buy() { // eslint-disable-line no-unused-vars | 13 function buy() { // eslint-disable-line no-unused-vars |
| 14 try { | 14 try { |
| 15 var request = new PaymentRequest( | 15 var request = new PaymentRequest( |
| 16 [{supportedMethods: ['visa']}], | 16 [{supportedMethods: ['visa']}], |
| 17 {total: {label: 'Total', amount: {currency: 'USD', value: '5.00'}}}); | 17 {total: {label: 'Total', amount: {currency: 'USD', value: '5.00'}}}); |
| 18 request.canMakeActivePayment() | 18 request.canMakePayment() |
| 19 .then(function(result) { | 19 .then(function(result) { |
| 20 print(result); | 20 print(result); |
| 21 }) | 21 }) |
| 22 .catch(function(error) { | 22 .catch(function(error) { |
| 23 print(error); | 23 print(error); |
| 24 }); | 24 }); |
| 25 } catch (error) { | 25 } catch (error) { |
| 26 print(error.message); | 26 print(error.message); |
| 27 } | 27 } |
| 28 } | 28 } |
| 29 | 29 |
| 30 /** | 30 /** |
| 31 * Checks for existence of a complete MasterCard credit card. | 31 * Checks for existence of a complete MasterCard credit card. |
| 32 */ | 32 */ |
| 33 function other_buy() { // eslint-disable-line no-unused-vars | 33 function other_buy() { // eslint-disable-line no-unused-vars |
| 34 try { | 34 try { |
| 35 var request = new PaymentRequest( | 35 var request = new PaymentRequest( |
| 36 [{supportedMethods: ['mastercard']}], | 36 [{supportedMethods: ['mastercard']}], |
| 37 {total: {label: 'Total', amount: {currency: 'USD', value: '5.00'}}}); | 37 {total: {label: 'Total', amount: {currency: 'USD', value: '5.00'}}}); |
| 38 request.canMakeActivePayment() | 38 request.canMakePayment() |
| 39 .then(function(result) { | 39 .then(function(result) { |
| 40 print(result); | 40 print(result); |
| 41 }) | 41 }) |
| 42 .catch(function(error) { | 42 .catch(function(error) { |
| 43 print(error); | 43 print(error); |
| 44 }); | 44 }); |
| 45 } catch (error) { | 45 } catch (error) { |
| 46 print(error.message); | 46 print(error.message); |
| 47 } | 47 } |
| 48 } | 48 } |
| OLD | NEW |