// Copyright (c) 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/autofill/wallet/instrument.h" #include "base/logging.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "base/values.h" #include "chrome/browser/autofill/validation.h" #include "chrome/browser/autofill/wallet/wallet_address.h" namespace { std::string FormOfPaymentToString( wallet::Instrument::FormOfPayment form_of_payment) { switch (form_of_payment) { case wallet::Instrument::UNKNOWN: return "UNKNOWN"; case wallet::Instrument::VISA: return "VISA"; case wallet::Instrument::MASTER_CARD: return "MASTER_CARD"; case wallet::Instrument::AMEX: return "AMEX"; case wallet::Instrument::DISCOVER: return "DISCOVER"; case wallet::Instrument::JCB: return "JCB"; } NOTREACHED(); return "NOT_POSSIBLE"; } } // namespace namespace wallet { Instrument::Instrument(const std::string& primary_account_number, const std::string& card_verification_number, int expiration_month, int expiration_year, FormOfPayment form_of_payment, scoped_ptr
address) : primary_account_number_(primary_account_number), card_verification_number_(card_verification_number), expiration_month_(expiration_month), expiration_year_(expiration_year), form_of_payment_(form_of_payment), address_(address.Pass()) { DCHECK(address_); if (primary_account_number_.size() >=4) { last_four_digits_ = primary_account_number_.substr(primary_account_number_.size() - 4); } } Instrument::~Instrument() {} scoped_ptr