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 toDictionary:false */ | 8 /* global toDictionary:false */ |
9 | 9 |
10 /** | 10 /** |
(...skipping 15 matching lines...) Expand all Loading... |
26 evt.updateWith(new Promise(function(resolve) { | 26 evt.updateWith(new Promise(function(resolve) { |
27 resolve(updateDetails(details, request.shippingAddress)); | 27 resolve(updateDetails(details, request.shippingAddress)); |
28 })); | 28 })); |
29 }); | 29 }); |
30 | 30 |
31 request.show() | 31 request.show() |
32 .then(function(resp) { | 32 .then(function(resp) { |
33 resp.complete('success') | 33 resp.complete('success') |
34 .then(function() { | 34 .then(function() { |
35 print( | 35 print( |
36 JSON.stringify(resp.totalAmount, undefined, 2) + '<br>' + | |
37 resp.shippingOption + '<br>' + | 36 resp.shippingOption + '<br>' + |
38 JSON.stringify( | 37 JSON.stringify( |
39 toDictionary(resp.shippingAddress), undefined, 2) + | 38 toDictionary(resp.shippingAddress), undefined, 2) + |
40 '<br>' + resp.methodName + '<br>' + | 39 '<br>' + resp.methodName + '<br>' + |
41 JSON.stringify(resp.details, undefined, 2)); | 40 JSON.stringify(resp.details, undefined, 2)); |
42 }) | 41 }) |
43 .catch(function(error) { | 42 .catch(function(error) { |
44 print(error.message); | 43 print(error.message); |
45 }); | 44 }); |
46 }) | 45 }) |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 details.displayItems.splice(0, 0, shippingOption); | 80 details.displayItems.splice(0, 0, shippingOption); |
82 } else { | 81 } else { |
83 details.displayItems.splice(0, 1, shippingOption); | 82 details.displayItems.splice(0, 1, shippingOption); |
84 } | 83 } |
85 details.shippingOptions = [shippingOption]; | 84 details.shippingOptions = [shippingOption]; |
86 } else { | 85 } else { |
87 delete details.shippingOptions; | 86 delete details.shippingOptions; |
88 } | 87 } |
89 return details; | 88 return details; |
90 } | 89 } |
OLD | NEW |