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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 */ | 60 */ |
61 function updateDetails(details, addr) { | 61 function updateDetails(details, addr) { |
62 if (addr.country === 'US') { | 62 if (addr.country === 'US') { |
63 var shippingOption = { | 63 var shippingOption = { |
64 id: '', | 64 id: '', |
65 label: '', | 65 label: '', |
66 amount: {currency: 'USD', value: '0.00'}, | 66 amount: {currency: 'USD', value: '0.00'}, |
67 selected: true | 67 selected: true |
68 }; | 68 }; |
69 if (addr.region === 'CA') { | 69 if (addr.region === 'CA') { |
70 shippingOption.id = 'ca'; | 70 shippingOption.id = 'californiaShippingOption'; |
71 shippingOption.label = 'Free shipping in California'; | 71 shippingOption.label = 'Free shipping in California'; |
72 details.total.amount.value = '5.00'; | 72 details.total.amount.value = '5.00'; |
73 } else { | 73 } else { |
74 shippingOption.id = 'us'; | 74 shippingOption.id = 'usShippingOption'; |
75 shippingOption.label = 'Standard shipping in US'; | 75 shippingOption.label = 'Standard shipping in US'; |
76 shippingOption.amount.value = '5.00'; | 76 shippingOption.amount.value = '5.00'; |
77 details.total.amount.value = '10.00'; | 77 details.total.amount.value = '10.00'; |
78 } | 78 } |
79 if (details.displayItems.length === 1) { | 79 if (details.displayItems.length === 1) { |
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 |