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

Side by Side Diff: components/autofill/browser/wallet/wallet_client.cc

Issue 14836006: Deprecate Carts in Wallet code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebasing Created 7 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/autofill/browser/wallet/wallet_client.h" 5 #include "components/autofill/browser/wallet/wallet_client.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 } 171 }
172 172
173 NOTREACHED(); 173 NOTREACHED();
174 return AutofillMetrics::UNKNOWN_REQUIRED_ACTION; 174 return AutofillMetrics::UNKNOWN_REQUIRED_ACTION;
175 } 175 }
176 176
177 // Keys for JSON communication with the Online Wallet server. 177 // Keys for JSON communication with the Online Wallet server.
178 const char kAcceptedLegalDocumentKey[] = "accepted_legal_document"; 178 const char kAcceptedLegalDocumentKey[] = "accepted_legal_document";
179 const char kApiKeyKey[] = "api_key"; 179 const char kApiKeyKey[] = "api_key";
180 const char kAuthResultKey[] = "auth_result"; 180 const char kAuthResultKey[] = "auth_result";
181 const char kCartKey[] = "cart";
182 const char kEncryptedOtpKey[] = "encrypted_otp"; 181 const char kEncryptedOtpKey[] = "encrypted_otp";
183 const char kErrorTypeKey[] = "wallet_error.error_type"; 182 const char kErrorTypeKey[] = "wallet_error.error_type";
184 const char kFeatureKey[] = "feature"; 183 const char kFeatureKey[] = "feature";
185 const char kGoogleTransactionIdKey[] = "google_transaction_id"; 184 const char kGoogleTransactionIdKey[] = "google_transaction_id";
186 const char kInstrumentIdKey[] = "instrument_id"; 185 const char kInstrumentIdKey[] = "instrument_id";
187 const char kInstrumentKey[] = "instrument"; 186 const char kInstrumentKey[] = "instrument";
188 const char kInstrumentEscrowHandleKey[] = "instrument_escrow_handle"; 187 const char kInstrumentEscrowHandleKey[] = "instrument_escrow_handle";
189 const char kInstrumentExpMonthKey[] = "instrument.credit_card.exp_month"; 188 const char kInstrumentExpMonthKey[] = "instrument.credit_card.exp_month";
190 const char kInstrumentExpYearKey[] = "instrument.credit_card.exp_year"; 189 const char kInstrumentExpYearKey[] = "instrument.credit_card.exp_year";
191 const char kInstrumentPhoneNumberKey[] = "instrument_phone_number"; 190 const char kInstrumentPhoneNumberKey[] = "instrument_phone_number";
192 const char kMerchantDomainKey[] = "merchant_domain"; 191 const char kMerchantDomainKey[] = "merchant_domain";
193 const char kReasonKey[] = "reason"; 192 const char kReasonKey[] = "reason";
194 const char kRiskCapabilitiesKey[] = "supported_risk_challenge"; 193 const char kRiskCapabilitiesKey[] = "supported_risk_challenge";
195 const char kRiskParamsKey[] = "risk_params"; 194 const char kRiskParamsKey[] = "risk_params";
196 const char kSelectedAddressIdKey[] = "selected_address_id"; 195 const char kSelectedAddressIdKey[] = "selected_address_id";
197 const char kSelectedInstrumentIdKey[] = "selected_instrument_id"; 196 const char kSelectedInstrumentIdKey[] = "selected_instrument_id";
198 const char kSessionMaterialKey[] = "session_material"; 197 const char kSessionMaterialKey[] = "session_material";
199 const char kShippingAddressIdKey[] = "shipping_address_id"; 198 const char kShippingAddressIdKey[] = "shipping_address_id";
200 const char kShippingAddressKey[] = "shipping_address"; 199 const char kShippingAddressKey[] = "shipping_address";
201 const char kSuccessKey[] = "success"; 200 const char kSuccessKey[] = "success";
202 const char kUpgradedBillingAddressKey[] = "upgraded_billing_address"; 201 const char kUpgradedBillingAddressKey[] = "upgraded_billing_address";
203 const char kUpgradedInstrumentIdKey[] = "upgraded_instrument_id"; 202 const char kUpgradedInstrumentIdKey[] = "upgraded_instrument_id";
204 203
205 } // namespace 204 } // namespace
206 205
207 WalletClient::FullWalletRequest::FullWalletRequest( 206 WalletClient::FullWalletRequest::FullWalletRequest(
208 const std::string& instrument_id, 207 const std::string& instrument_id,
209 const std::string& address_id, 208 const std::string& address_id,
210 const GURL& source_url, 209 const GURL& source_url,
211 const Cart& cart,
212 const std::string& google_transaction_id, 210 const std::string& google_transaction_id,
213 const std::vector<RiskCapability> risk_capabilities) 211 const std::vector<RiskCapability> risk_capabilities)
214 : instrument_id(instrument_id), 212 : instrument_id(instrument_id),
215 address_id(address_id), 213 address_id(address_id),
216 source_url(source_url), 214 source_url(source_url),
217 cart(cart),
218 google_transaction_id(google_transaction_id), 215 google_transaction_id(google_transaction_id),
219 risk_capabilities(risk_capabilities) {} 216 risk_capabilities(risk_capabilities) {}
220 217
221 WalletClient::FullWalletRequest::~FullWalletRequest() {} 218 WalletClient::FullWalletRequest::~FullWalletRequest() {}
222 219
223 WalletClient::UpdateInstrumentRequest::UpdateInstrumentRequest( 220 WalletClient::UpdateInstrumentRequest::UpdateInstrumentRequest(
224 const std::string& instrument_id, 221 const std::string& instrument_id,
225 const GURL& source_url) 222 const GURL& source_url)
226 : instrument_id(instrument_id), 223 : instrument_id(instrument_id),
227 expiration_month(0), 224 expiration_month(0),
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 pending_request_body_.SetString(kRiskParamsKey, delegate_->GetRiskData()); 295 pending_request_body_.SetString(kRiskParamsKey, delegate_->GetRiskData());
299 pending_request_body_.SetString(kSelectedInstrumentIdKey, 296 pending_request_body_.SetString(kSelectedInstrumentIdKey,
300 full_wallet_request.instrument_id); 297 full_wallet_request.instrument_id);
301 pending_request_body_.SetString(kSelectedAddressIdKey, 298 pending_request_body_.SetString(kSelectedAddressIdKey,
302 full_wallet_request.address_id); 299 full_wallet_request.address_id);
303 pending_request_body_.SetString( 300 pending_request_body_.SetString(
304 kMerchantDomainKey, 301 kMerchantDomainKey,
305 full_wallet_request.source_url.GetWithEmptyPath().spec()); 302 full_wallet_request.source_url.GetWithEmptyPath().spec());
306 pending_request_body_.SetString(kGoogleTransactionIdKey, 303 pending_request_body_.SetString(kGoogleTransactionIdKey,
307 full_wallet_request.google_transaction_id); 304 full_wallet_request.google_transaction_id);
308 pending_request_body_.Set(kCartKey,
309 full_wallet_request.cart.ToDictionary().release());
310 pending_request_body_.SetString( 305 pending_request_body_.SetString(
311 kFeatureKey, 306 kFeatureKey,
312 DialogTypeToFeatureString(delegate_->GetDialogType())); 307 DialogTypeToFeatureString(delegate_->GetDialogType()));
313 308
314 scoped_ptr<base::ListValue> risk_capabilities_list(new base::ListValue()); 309 scoped_ptr<base::ListValue> risk_capabilities_list(new base::ListValue());
315 for (std::vector<RiskCapability>::const_iterator it = 310 for (std::vector<RiskCapability>::const_iterator it =
316 full_wallet_request.risk_capabilities.begin(); 311 full_wallet_request.risk_capabilities.begin();
317 it != full_wallet_request.risk_capabilities.end(); 312 it != full_wallet_request.risk_capabilities.end();
318 ++it) { 313 ++it) {
319 risk_capabilities_list->AppendString(RiskCapabilityToString(*it)); 314 risk_capabilities_list->AppendString(RiskCapabilityToString(*it));
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
964 NOTREACHED(); 959 NOTREACHED();
965 return AutofillMetrics::UNKNOWN_API_CALL; 960 return AutofillMetrics::UNKNOWN_API_CALL;
966 } 961 }
967 962
968 NOTREACHED(); 963 NOTREACHED();
969 return AutofillMetrics::UNKNOWN_API_CALL; 964 return AutofillMetrics::UNKNOWN_API_CALL;
970 } 965 }
971 966
972 } // namespace wallet 967 } // namespace wallet
973 } // namespace autofill 968 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/browser/wallet/wallet_client.h ('k') | components/autofill/browser/wallet/wallet_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698