return wallet.Pass();
}
-base::string16 FullWallet::GetInfo(const AutofillType& type) {
+base::string16 FullWallet::GetInfo(const std::string& app_locale,
+ const AutofillType& type) {
switch (type.GetStorableType()) {
case CREDIT_CARD_NUMBER:
- return base::UTF8ToUTF16(GetPan());
+ return base::ASCIIToUTF16(GetPan());
case CREDIT_CARD_NAME:
return billing_address()->recipient_name();
case CREDIT_CARD_VERIFICATION_CODE:
- return base::UTF8ToUTF16(GetCvn());
+ return base::ASCIIToUTF16(GetCvn());
case CREDIT_CARD_EXP_MONTH:
if (expiration_month() == 0)
case CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR:
if (expiration_month() == 0 || expiration_year() == 0)
- return base::string16();
+ return base::string16();
return base::IntToString16(expiration_month()) + base::ASCIIToUTF16("/") +
base::IntToString16(expiration_year() % 100);
case CREDIT_CARD_TYPE: {
std::string internal_type =
- CreditCard::GetCreditCardType(base::UTF8ToUTF16(GetPan()));
+ CreditCard::GetCreditCardType(base::ASCIIToUTF16(GetPan()));
if (internal_type == kGenericCard)
return base::string16();
return CreditCard::TypeForDisplay(internal_type);
}
- default:
- NOTREACHED();
- }
+ default: {
+ switch (type.group()) {
+ case NAME_BILLING:
+ case PHONE_BILLING:
+ case ADDRESS_BILLING:
+ return billing_address_->GetInfo(type, app_locale);
- return base::string16();
+ case CREDIT_CARD:
+ NOTREACHED();
+
+ default:
+ return shipping_address_->GetInfo(type, app_locale);
+ }
+ }
+ }
}
bool FullWallet::HasRequiredAction(RequiredAction action) const {
base::string16 FullWallet::TypeAndLastFourDigits() {
CreditCard card;
- card.SetRawInfo(CREDIT_CARD_NUMBER,
- GetInfo(AutofillType(CREDIT_CARD_NUMBER)));
+ card.SetRawInfo(CREDIT_CARD_NUMBER, base::ASCIIToUTF16(GetPan()));
return card.TypeAndLastFourDigits();
}
+const std::string& FullWallet::GetPan() {
+ if (pan_.empty())
+ DecryptCardInfo();
+ return pan_;
+}
+
bool FullWallet::operator==(const FullWallet& other) const {
if (expiration_month_ != other.expiration_month_)
return false;
pan_ = iin_ + card_info.substr(0, split);
}
-const std::string& FullWallet::GetPan() {
- if (pan_.empty())
- DecryptCardInfo();
- return pan_;
-}
-
const std::string& FullWallet::GetCvn() {
if (cvn_.empty())
DecryptCardInfo();