diff options
author | dbeam@chromium.org <dbeam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-14 04:59:07 +0000 |
---|---|---|
committer | dbeam@chromium.org <dbeam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-14 04:59:07 +0000 |
commit | 096ade45562cb292003a0c28ad8504d6ff954753 (patch) | |
tree | f67c852f8f6cbf3d69f352c224e276932bc325ba /components | |
parent | cc70f5017d56dee38acfaebd5f7a24c8af830e07 (diff) | |
download | chromium_src-096ade45562cb292003a0c28ad8504d6ff954753.zip chromium_src-096ade45562cb292003a0c28ad8504d6ff954753.tar.gz chromium_src-096ade45562cb292003a0c28ad8504d6ff954753.tar.bz2 |
Fix /Same as billing/, fix entering new Wallet data (maybe?), show an error
message or disable wallet on required actions, hook up updating of instruments &
addresses, save billing addresses as shipping addresses, and fix countless other
bugs along the way.
Based on patches by Alex Hutter <ahutter@chromium.org> and Raman Kumar Kakilate
<ramankk@chromium.org> and help from everybody else as well...
BUG=163508,225439,225442,236091,237684,237687
R=estade@chromium.org,isherman@chromium.org
NOTRY=true
Review URL: https://chromiumcodereview.appspot.com/14756008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@199906 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components')
5 files changed, 20 insertions, 7 deletions
diff --git a/components/autofill/browser/wallet/encryption_escrow_client.cc b/components/autofill/browser/wallet/encryption_escrow_client.cc index 4b74c1a..53754a2 100644 --- a/components/autofill/browser/wallet/encryption_escrow_client.cc +++ b/components/autofill/browser/wallet/encryption_escrow_client.cc @@ -109,6 +109,10 @@ void EncryptionEscrowClient::CancelRequest() { request_type_ = NO_PENDING_REQUEST; } +bool EncryptionEscrowClient::HasRequestInProgress() const { + return request_; +} + void EncryptionEscrowClient::MakeRequest(const GURL& url, const std::string& post_body) { DCHECK(!request_.get()); diff --git a/components/autofill/browser/wallet/encryption_escrow_client.h b/components/autofill/browser/wallet/encryption_escrow_client.h index ddd93d4..9af04f6a 100644 --- a/components/autofill/browser/wallet/encryption_escrow_client.h +++ b/components/autofill/browser/wallet/encryption_escrow_client.h @@ -52,6 +52,8 @@ class EncryptionEscrowClient : public net::URLFetcherDelegate { // Cancels |request_| (if it exists). void CancelRequest(); + bool HasRequestInProgress() const; + protected: // Exposed for testing. const net::URLFetcher* request() const { return request_.get(); } diff --git a/components/autofill/browser/wallet/wallet_client.cc b/components/autofill/browser/wallet/wallet_client.cc index 4dbf552..ace0f5d 100644 --- a/components/autofill/browser/wallet/wallet_client.cc +++ b/components/autofill/browser/wallet/wallet_client.cc @@ -188,6 +188,7 @@ const char kInstrumentKey[] = "instrument"; const char kInstrumentEscrowHandleKey[] = "instrument_escrow_handle"; const char kInstrumentExpMonthKey[] = "instrument.credit_card.exp_month"; const char kInstrumentExpYearKey[] = "instrument.credit_card.exp_year"; +const char kInstrumentType[] = "instrument.type"; const char kInstrumentPhoneNumberKey[] = "instrument_phone_number"; const char kMerchantDomainKey[] = "merchant_domain"; const char kReasonKey[] = "reason"; @@ -559,6 +560,9 @@ void WalletClient::UpdateInstrument( update_instrument_request.expiration_year); } + if (active_request_body->HasKey(kInstrumentKey)) + active_request_body->SetString(kInstrumentType, "CREDIT_CARD"); + if (update_instrument_request.card_verification_number.empty()) { std::string post_body; base::JSONWriter::Write(active_request_body, &post_body); @@ -571,7 +575,10 @@ void WalletClient::UpdateInstrument( } bool WalletClient::HasRequestInProgress() const { - return request_.get() != NULL; + // |SaveInstrument*()| and |UpdateInstrument()| methods don't set |request_| + // until sensitive info has been escrowed, so this class is considered to have + // a request in progress if |encryption_escrow_client_| is working as well. + return request_ || encryption_escrow_client_.HasRequestInProgress(); } void WalletClient::CancelRequests() { diff --git a/components/autofill/browser/wallet/wallet_client.h b/components/autofill/browser/wallet/wallet_client.h index 31ec90a..51f74ba 100644 --- a/components/autofill/browser/wallet/wallet_client.h +++ b/components/autofill/browser/wallet/wallet_client.h @@ -214,16 +214,14 @@ class WalletClient const std::string& google_transaction_id); // UpdateAddress updates Online Wallet with the data in |address|. - void UpdateAddress(const Address& address, - const GURL& source_url); + virtual void UpdateAddress(const Address& address, const GURL& source_url); // Updates Online Wallet with the data in |update_instrument_request| and, if // it's provided, |billing_address|. - void UpdateInstrument( + virtual void UpdateInstrument( const UpdateInstrumentRequest& update_instrument_request, scoped_ptr<Address> billing_address); - // Whether there is a currently running request (i.e. |request_| != NULL). bool HasRequestInProgress() const; // Cancels and clears the current |request_| and |pending_requests_| (if any). diff --git a/components/autofill/browser/wallet/wallet_client_unittest.cc b/components/autofill/browser/wallet/wallet_client_unittest.cc index 8ceb029..dd5244c 100644 --- a/components/autofill/browser/wallet/wallet_client_unittest.cc +++ b/components/autofill/browser/wallet/wallet_client_unittest.cc @@ -532,7 +532,8 @@ const char kUpdateInstrumentAddressAndExpirationDateValidRequest[] = "{" "\"exp_month\":12," "\"exp_year\":2015" - "}" + "}," + "\"type\":\"CREDIT_CARD\"" "}," "\"instrument_escrow_handle\":\"escrow_handle\"," "\"instrument_phone_number\":\"phone_number\"," @@ -562,7 +563,8 @@ const char kUpdateInstrumentExpirationDateValidRequest[] = "{" "\"exp_month\":12," "\"exp_year\":2015" - "}" + "}," + "\"type\":\"CREDIT_CARD\"" "}," "\"instrument_escrow_handle\":\"escrow_handle\"," "\"merchant_domain\":\"https://example.com/\"," |