本文整理汇总了Java中io.card.payment.CreditCard.isExpiryValid方法的典型用法代码示例。如果您正苦于以下问题:Java CreditCard.isExpiryValid方法的具体用法?Java CreditCard.isExpiryValid怎么用?Java CreditCard.isExpiryValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.card.payment.CreditCard
的用法示例。
在下文中一共展示了CreditCard.isExpiryValid方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onActivityResult
import io.card.payment.CreditCard; //导入方法依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == CARDIO_REQUEST_ID) {
if (data != null && data.hasExtra(CardIOActivity.EXTRA_SCAN_RESULT)) {
CreditCard scanResult = data.getParcelableExtra(CardIOActivity.EXTRA_SCAN_RESULT);
cardNumber.getEditText().setText(scanResult.getFormattedCardNumber());
if (scanResult.isExpiryValid()) {
String month = String.valueOf(scanResult.expiryMonth).length() == 1 ? "0" + scanResult.expiryMonth : String.valueOf(scanResult.expiryMonth);
String year = String.valueOf(scanResult.expiryYear).substring(2);
expiryInputLayout.getEditText().setText(month + "/" + year);
}
if (scanResult.cvv != null) {
// Never log or display a CVV
cvvInputLayout.getEditText().setText(scanResult.cvv);
}
}
}
}
示例2: handleCardIOResponse
import io.card.payment.CreditCard; //导入方法依赖的package包/类
@SuppressLint("DefaultLocale")
public void handleCardIOResponse(Intent data) {
if (data != null && data.hasExtra(CardIOActivity.EXTRA_SCAN_RESULT)) {
CreditCard scanResult = data.getParcelableExtra(CardIOActivity.EXTRA_SCAN_RESULT);
if (mCardNumberRequired) {
mCardNumber.setText(scanResult.cardNumber);
mCardNumber.focusNextView();
}
if (scanResult.isExpiryValid() && mExpirationRequired) {
mExpiration.setText(String.format("%02d%d", scanResult.expiryMonth, scanResult.expiryYear));
mExpiration.focusNextView();
}
}
}
示例3: onActivityResult
import io.card.payment.CreditCard; //导入方法依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case REQUEST_CODE_SCAN_CARD: {
if (data != null && data.hasExtra(CardIOActivity.EXTRA_SCAN_RESULT)) {
CreditCard scanResult = data.getParcelableExtra(CardIOActivity.EXTRA_SCAN_RESULT);
String expiryDate = "";
if (scanResult.isExpiryValid()) {
expiryDate = String.format("%d/%d", scanResult.expiryMonth, scanResult.expiryYear);
}
updateCardNumber(scanResult.cardNumber, expiryDate);
}
break;
}
}
}
示例4: onActivityResult
import io.card.payment.CreditCard; //导入方法依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == PaymentFormActivity.SCAN_REQUEST_CODE) {
if (data != null && data.hasExtra(CardIOActivity.EXTRA_SCAN_RESULT)) {
CreditCard scanResult = data.getParcelableExtra(CardIOActivity.EXTRA_SCAN_RESULT);
mCardNumber.setFilters( new InputFilter[] { new InputFilter.LengthFilter(Integer.MAX_VALUE)});
mCardNumber.setText(scanResult.getFormattedCardNumber());
if (scanResult.isExpiryValid()) {
String expiryYear = String.valueOf(scanResult.expiryYear);
if (expiryYear.length() == 4 && TextUtils.isDigitsOnly(expiryYear)) {
mCardExpiration.setText(scanResult.expiryMonth + "/" + expiryYear.substring(2,4));
}
}
}
else {
//no-op, scan was canceled.
}
}
}
示例5: applyCardIOResult
import io.card.payment.CreditCard; //导入方法依赖的package包/类
private void applyCardIOResult(CreditCard data) {
EditText numberField = views.editText(R.id.edit_card_number);
EditText nameField = views.editText(R.id.edit_card_name);
EditText securityCodeField = views.editText(R.id.edit_security_code);
if (data.cardNumber != null && !data.cardNumber.isEmpty()) {
numberField.setText(CardNumber.format(data.cardNumber));
}
if (data.cardholderName != null && !data.cardholderName.isEmpty()) {
nameField.setText(data.cardholderName);
}
if (data.isExpiryValid()) {
Spinner spinner = views.spinner(R.id.spinner_expiry_month);
ExpiryMonthSpinnerAdapter monthAdapter = (ExpiryMonthSpinnerAdapter) spinner.getAdapter();
spinner.setSelection(monthAdapter.getPosition(data.expiryMonth));
spinner = views.spinner(R.id.spinner_expiry_year);
ExpiryYearSpinnerAdapter yearAdapter = (ExpiryYearSpinnerAdapter) spinner.getAdapter() ;
spinner.setSelection(yearAdapter.getPosition(data.expiryYear));
}
if (data.cvv != null && !data.cvv.isEmpty()) {
securityCodeField.setText(data.cvv);
}
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
if (numberField.getText() == null || numberField.getText().toString().isEmpty()) {
numberField.requestFocus();
imm.showSoftInput(numberField, InputMethodManager.SHOW_IMPLICIT);
} else if (nameField.getText() == null || nameField.getText().toString().isEmpty()) {
nameField.requestFocus();
imm.showSoftInput(nameField, InputMethodManager.SHOW_IMPLICIT);
} else if (securityCodeField.getText() == null || securityCodeField.getText().toString().isEmpty()) {
securityCodeField.requestFocus();
imm.showSoftInput(securityCodeField, InputMethodManager.SHOW_IMPLICIT);
}
}
示例6: onActivityResult
import io.card.payment.CreditCard; //导入方法依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == MY_SCAN_REQUEST_CODE) {
if (data != null && data.hasExtra(CardIOActivity.EXTRA_SCAN_RESULT)) {
CreditCard scanResult = data.getParcelableExtra(CardIOActivity.EXTRA_SCAN_RESULT);
// Never log a raw card number. Avoid displaying it, but if necessary use getFormattedCardNumber()
resultDisplayStr = "Card Number: " + scanResult.getLastFourDigitsOfCardNumber() + "\n";
db.addNumberToDatabase(resultDisplayStr);
//getRedactedCardNumber() ******####
//getFormattedCardNumber( ############
// Do something with the raw number, e.g.:
// myService.setCardNumber( scanResult.cardNumber );
populateListView(resultDisplayStr);
registerClickerCallback();
if (scanResult.isExpiryValid()) {
resultDisplayStr += "Expiration Date: " + scanResult.expiryMonth + "/" + scanResult.expiryYear + "\n";
}
if (scanResult.cvv != null) {
// Never log or display a CVV
resultDisplayStr += "CVV has " + scanResult.cvv.length() + " digits.\n";
}
if (scanResult.postalCode != null) {
resultDisplayStr += "Postal Code: " + scanResult.postalCode + "\n";
}
}
else {
resultDisplayStr = "Scan was canceled.";
}
// do something with resultDisplayStr, maybe display it in a textView
// resultTextView.setText(resultStr);
populateListView(resultDisplayStr);
}
// else handle other activity results
}