Commit cd59fcad authored by estade's avatar estade Committed by Commit bot

Look in getrealpan response for error code

INTERNAL => try again
anything else => permanent failure

BUG=463291

Review URL: https://codereview.chromium.org/1028313006

Cr-Commit-Position: refs/heads/master@{#322251}
parent 351bf980
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "base/json/json_writer.h" #include "base/json/json_writer.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/values.h" #include "base/values.h"
...@@ -135,16 +136,20 @@ void RealPanWalletClient::OnURLFetchComplete(const net::URLFetcher* source) { ...@@ -135,16 +136,20 @@ void RealPanWalletClient::OnURLFetchComplete(const net::URLFetcher* source) {
switch (response_code) { switch (response_code) {
// Valid response. // Valid response.
case net::HTTP_OK: { case net::HTTP_OK: {
std::string error_code;
scoped_ptr<base::Value> message_value(base::JSONReader::Read(data)); scoped_ptr<base::Value> message_value(base::JSONReader::Read(data));
if (message_value.get() && if (message_value.get() &&
message_value->IsType(base::Value::TYPE_DICTIONARY)) { message_value->IsType(base::Value::TYPE_DICTIONARY)) {
response_dict.reset( response_dict.reset(
static_cast<base::DictionaryValue*>(message_value.release())); static_cast<base::DictionaryValue*>(message_value.release()));
response_dict->GetString("pan", &real_pan); response_dict->GetString("pan", &real_pan);
// TODO(estade): check response for allow_retry. response_dict->GetString("error.code", &error_code);
} }
if (real_pan.empty())
if (LowerCaseEqualsASCII(error_code, "internal"))
result = AutofillClient::TRY_AGAIN_FAILURE; result = AutofillClient::TRY_AGAIN_FAILURE;
else if (real_pan.empty() || !error_code.empty())
result = AutofillClient::PERMANENT_FAILURE;
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment