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 22 matching lines...) Expand all Loading... |
33 resp.complete('success') | 33 resp.complete('success') |
34 .then(function() { | 34 .then(function() { |
35 print( | 35 print( |
36 resp.shippingOption + '<br>' + | 36 resp.shippingOption + '<br>' + |
37 JSON.stringify( | 37 JSON.stringify( |
38 toDictionary(resp.shippingAddress), undefined, 2) + | 38 toDictionary(resp.shippingAddress), undefined, 2) + |
39 '<br>' + resp.methodName + '<br>' + | 39 '<br>' + resp.methodName + '<br>' + |
40 JSON.stringify(resp.details, undefined, 2)); | 40 JSON.stringify(resp.details, undefined, 2)); |
41 }) | 41 }) |
42 .catch(function(error) { | 42 .catch(function(error) { |
43 print(error.message); | 43 print(error); |
44 }); | 44 }); |
45 }) | 45 }) |
46 .catch(function(error) { | 46 .catch(function(error) { |
47 print(error.message); | 47 print(error); |
48 }); | 48 }); |
49 } catch (error) { | 49 } catch (error) { |
50 print(error.message); | 50 print(error.message); |
51 } | 51 } |
52 } | 52 } |
53 | 53 |
54 /** | 54 /** |
55 * Updates the shopping cart with the appropriate shipping prices according to | 55 * Updates the shopping cart with the appropriate shipping prices according to |
56 * the shipping address. | 56 * the shipping address. |
57 * @param {object} details - The shopping cart. | 57 * @param {object} details - The shopping cart. |
(...skipping 22 matching lines...) Expand all Loading... |
80 details.displayItems.splice(0, 0, shippingOption); | 80 details.displayItems.splice(0, 0, shippingOption); |
81 } else { | 81 } else { |
82 details.displayItems.splice(0, 1, shippingOption); | 82 details.displayItems.splice(0, 1, shippingOption); |
83 } | 83 } |
84 details.shippingOptions = [shippingOption]; | 84 details.shippingOptions = [shippingOption]; |
85 } else { | 85 } else { |
86 delete details.shippingOptions; | 86 delete details.shippingOptions; |
87 } | 87 } |
88 return details; | 88 return details; |
89 } | 89 } |
OLD | NEW |