Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(427)

Side by Side Diff: chrome/test/data/android/payments/dynamic_shipping.js

Issue 2028603004: Rename 'items' into 'displayItems' in PaymentDetails. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 /**
11 * Launches the PaymentRequest UI that offers free shipping in California and 11 * Launches the PaymentRequest UI that offers free shipping in California and
12 * $5.00 shipping in US. Does not allow shipping outside of US. 12 * $5.00 shipping in US. Does not allow shipping outside of US.
13 */ 13 */
14 function buy() { // eslint-disable-line no-unused-vars 14 function buy() { // eslint-disable-line no-unused-vars
15 try { 15 try {
16 var details = { 16 var details = {
17 items: [ 17 displayItems: [
18 { 18 {
19 id: 'sub', 19 id: 'sub',
20 label: 'Subtotal', 20 label: 'Subtotal',
21 amount: {currency: 'USD', value: '5.00'} 21 amount: {currency: 'USD', value: '5.00'}
22 }, 22 },
23 { 23 {
24 id: 'total', 24 id: 'total',
25 label: 'Total', 25 label: 'Total',
26 amount: {currency: 'USD', value: '5.00'} 26 amount: {currency: 'USD', value: '5.00'}
27 } 27 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 function updateDetails(details, addr) { 69 function updateDetails(details, addr) {
70 if (addr.regionCode === 'US') { 70 if (addr.regionCode === 'US') {
71 var shippingOption = { 71 var shippingOption = {
72 id: '', 72 id: '',
73 label: '', 73 label: '',
74 amount: {currency: 'USD', value: '0.00'} 74 amount: {currency: 'USD', value: '0.00'}
75 }; 75 };
76 if (addr.administrativeArea === 'CA') { 76 if (addr.administrativeArea === 'CA') {
77 shippingOption.id = 'ca'; 77 shippingOption.id = 'ca';
78 shippingOption.label = 'Free shipping in California'; 78 shippingOption.label = 'Free shipping in California';
79 details.items[details.items.length - 1].amount.value = '5.00'; 79 details.displayItems[details.displayItems.length - 1].amount.value =
80 '5.00';
80 } else { 81 } else {
81 shippingOption.id = 'us'; 82 shippingOption.id = 'us';
82 shippingOption.label = 'Standard shipping in US'; 83 shippingOption.label = 'Standard shipping in US';
83 shippingOption.amount.value = '5.00'; 84 shippingOption.amount.value = '5.00';
84 details.items[details.items.length - 1].amount.value = '10.00'; 85 details.items[details.items.length - 1].amount.value = '10.00';
85 } 86 }
86 if (details.items.length === 3) { 87 if (details.items.length === 3) {
87 details.items.splice(-1, 0, shippingOption); 88 details.items.splice(-1, 0, shippingOption);
88 } else { 89 } else {
89 details.items.splice(-2, 1, shippingOption); 90 details.items.splice(-2, 1, shippingOption);
90 } 91 }
91 details.shippingOptions = [shippingOption]; 92 details.shippingOptions = [shippingOption];
92 } else { 93 } else {
93 delete details.shippingOptions; 94 delete details.shippingOptions;
94 } 95 }
95 return details; 96 return details;
96 } 97 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698