| 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 var first; | 10 var first; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 * Checks for existence of Bob Pay twice. | 36 * Checks for existence of Bob Pay twice. |
| 37 */ | 37 */ |
| 38 function buy() { // eslint-disable-line no-unused-vars | 38 function buy() { // eslint-disable-line no-unused-vars |
| 39 first = null; | 39 first = null; |
| 40 second = null; | 40 second = null; |
| 41 | 41 |
| 42 try { | 42 try { |
| 43 new PaymentRequest( | 43 new PaymentRequest( |
| 44 [{supportedMethods: ['https://bobpay.com']}], | 44 [{supportedMethods: ['https://bobpay.com']}], |
| 45 {total: {label: 'Total', amount: {currency: 'USD', value: '5.00'}}}) | 45 {total: {label: 'Total', amount: {currency: 'USD', value: '5.00'}}}) |
| 46 .canMakeActivePayment() | 46 .canMakePayment() |
| 47 .then(function(result) { printFirst(result); }) | 47 .then(function(result) { printFirst(result); }) |
| 48 .catch(function(error) { printFirst(error); }); | 48 .catch(function(error) { printFirst(error); }); |
| 49 } catch (error) { | 49 } catch (error) { |
| 50 printFirst(error); | 50 printFirst(error); |
| 51 } | 51 } |
| 52 | 52 |
| 53 try { | 53 try { |
| 54 new PaymentRequest( | 54 new PaymentRequest( |
| 55 [{supportedMethods: ['https://bobpay.com']}], | 55 [{supportedMethods: ['https://bobpay.com']}], |
| 56 {total: {label: 'Total', amount: {currency: 'USD', value: '5.00'}}}) | 56 {total: {label: 'Total', amount: {currency: 'USD', value: '5.00'}}}) |
| 57 .canMakeActivePayment() | 57 .canMakePayment() |
| 58 .then(function(result) { printSecond(result); }) | 58 .then(function(result) { printSecond(result); }) |
| 59 .catch(function(error) { printSecond(error); }); | 59 .catch(function(error) { printSecond(error); }); |
| 60 } catch (error) { | 60 } catch (error) { |
| 61 printSecond(error); | 61 printSecond(error); |
| 62 } | 62 } |
| 63 } | 63 } |
| 64 | 64 |
| 65 /** | 65 /** |
| 66 * Checks for existence of Bob Pay and AlicePay. | 66 * Checks for existence of Bob Pay and AlicePay. |
| 67 */ | 67 */ |
| 68 function otherBuy() { // eslint-disable-line no-unused-vars | 68 function otherBuy() { // eslint-disable-line no-unused-vars |
| 69 first = null; | 69 first = null; |
| 70 second = null; | 70 second = null; |
| 71 | 71 |
| 72 try { | 72 try { |
| 73 new PaymentRequest( | 73 new PaymentRequest( |
| 74 [{supportedMethods: ['https://bobpay.com']}], | 74 [{supportedMethods: ['https://bobpay.com']}], |
| 75 {total: {label: 'Total', amount: {currency: 'USD', value: '5.00'}}}) | 75 {total: {label: 'Total', amount: {currency: 'USD', value: '5.00'}}}) |
| 76 .canMakeActivePayment() | 76 .canMakePayment() |
| 77 .then(function(result) { printFirst(result); }) | 77 .then(function(result) { printFirst(result); }) |
| 78 .catch(function(error) { printFirst(error); }); | 78 .catch(function(error) { printFirst(error); }); |
| 79 } catch (error) { | 79 } catch (error) { |
| 80 printFirst(error); | 80 printFirst(error); |
| 81 } | 81 } |
| 82 | 82 |
| 83 try { | 83 try { |
| 84 new PaymentRequest( | 84 new PaymentRequest( |
| 85 [{supportedMethods: ['https://alicepay.com']}], | 85 [{supportedMethods: ['https://alicepay.com']}], |
| 86 {total: {label: 'Total', amount: {currency: 'USD', value: '5.00'}}}) | 86 {total: {label: 'Total', amount: {currency: 'USD', value: '5.00'}}}) |
| 87 .canMakeActivePayment() | 87 .canMakePayment() |
| 88 .then(function(result) { printSecond(result); }) | 88 .then(function(result) { printSecond(result); }) |
| 89 .catch(function(error) { printSecond(error); }); | 89 .catch(function(error) { printSecond(error); }); |
| 90 } catch (error) { | 90 } catch (error) { |
| 91 printSecond(error); | 91 printSecond(error); |
| 92 } | 92 } |
| 93 } | 93 } |
| OLD | NEW |