| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 package org.chromium.chrome.browser.payments; | 5 package org.chromium.chrome.browser.payments; |
| 6 | 6 |
| 7 import android.content.Context; | 7 import android.content.Context; |
| 8 import android.text.TextUtils; | 8 import android.text.TextUtils; |
| 9 import android.util.JsonWriter; | 9 import android.util.JsonWriter; |
| 10 | 10 |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 | 297 |
| 298 mHasValidNumberAndName = true; | 298 mHasValidNumberAndName = true; |
| 299 if (mCard.getIsLocal()) { | 299 if (mCard.getIsLocal()) { |
| 300 if (TextUtils.isEmpty(mCard.getName())) { | 300 if (TextUtils.isEmpty(mCard.getName())) { |
| 301 mHasValidNumberAndName = false; | 301 mHasValidNumberAndName = false; |
| 302 editMessageResId = R.string.payments_name_on_card_required; | 302 editMessageResId = R.string.payments_name_on_card_required; |
| 303 editTitleResId = R.string.payments_add_name_on_card; | 303 editTitleResId = R.string.payments_add_name_on_card; |
| 304 invalidFieldsCount++; | 304 invalidFieldsCount++; |
| 305 } | 305 } |
| 306 | 306 |
| 307 if (PersonalDataManager.getInstance().getBasicCardPaymentType( | 307 if (PersonalDataManager.getInstance().getBasicCardIssuerNetwork( |
| 308 mCard.getNumber().toString(), true) | 308 mCard.getNumber().toString(), true) |
| 309 == null) { | 309 == null) { |
| 310 mHasValidNumberAndName = false; | 310 mHasValidNumberAndName = false; |
| 311 editMessageResId = R.string.payments_card_number_invalid_validat
ion_message; | 311 editMessageResId = R.string.payments_card_number_invalid_validat
ion_message; |
| 312 editTitleResId = R.string.payments_add_valid_card_number; | 312 editTitleResId = R.string.payments_add_valid_card_number; |
| 313 invalidFieldsCount++; | 313 invalidFieldsCount++; |
| 314 } | 314 } |
| 315 } | 315 } |
| 316 | 316 |
| 317 if (invalidFieldsCount > 1) { | 317 if (invalidFieldsCount > 1) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 341 | 341 |
| 342 int networkNameEndIndex = previewString.indexOf(" "); | 342 int networkNameEndIndex = previewString.indexOf(" "); |
| 343 if (networkNameEndIndex > 0) { | 343 if (networkNameEndIndex > 0) { |
| 344 // Only display card network name. | 344 // Only display card network name. |
| 345 previewString.delete(networkNameEndIndex, previewString.length()); | 345 previewString.delete(networkNameEndIndex, previewString.length()); |
| 346 } | 346 } |
| 347 if (previewString.length() < maxLength) return previewString.toString(); | 347 if (previewString.length() < maxLength) return previewString.toString(); |
| 348 return previewString.substring(0, maxLength / 2); | 348 return previewString.substring(0, maxLength / 2); |
| 349 } | 349 } |
| 350 } | 350 } |
| OLD | NEW |