找到了com.jalil.naby.Card,需要'卡'

时间:2018-01-19 02:24:01

标签: android validation payment credit-card

现在我正在实施像“Stripe”这样的信用卡服务,这是我的功能addCard。最后,“openpay.createCard( ,这个);”,卡上有一个错误,上面写着:“错误的第一个参数类型.Found com .jalil.naby.Card,需要'卡'“但我不明白这是什么意思。这是OpenPay(Stripe like service)给出的代码示例。它只对我的项目不起作用,但它确实适用于他们的项目。

private void addCard() {
    Openpay openpay = ((OpenPayAppExample) this.getApplication()).getOpenpay();
    Card card = new Card();
    boolean isValid = true;

    final EditText holderNameEt = ((EditText) this.findViewById(R.id.nombre));
    final String holderName = holderNameEt.getText().toString();
    card.holderName(holderName);
    if (!CardValidator.validateHolderName(holderName)) {
        holderNameEt.setError(this.getString(R.string.invalid_holder_name));
        isValid = false;
    }

    final EditText cardNumberEt = ((EditText) this.findViewById(R.id.noTarjeta));
    final String cardNumber = cardNumberEt.getText().toString();
    card.cardNumber(cardNumber);
    if (!CardValidator.validateNumber(cardNumber)) {
        cardNumberEt.setError(this.getString(R.string.invalid_card_number));
        isValid = false;
    }

    EditText cvv2Et = ((EditText) this.findViewById(R.id.cvv));
    String cvv = cvv2Et.getText().toString();
    card.cvv2(cvv);
    if (!CardValidator.validateCVV(cvv, cardNumber)) {
        cvv2Et.setError(this.getString(R.string.invalid_cvv));
        isValid = false;
    }

    EditText yearE = ((EditText) this.findViewById(R.id.anio));

    EditText monthE = ((EditText) this.findViewById(R.id.mes));

    String yearS = yearE.getText().toString();
    int year = Integer.parseInt(yearS);

    String monthS = monthE.getText().toString();
    int month = Integer.parseInt(monthS);

    if (!CardValidator.validateExpiryDate(month, year)) {
        DialogFragment fragment = MessageDialogFragment.newInstance(R.string.error,
                this.getString(R.string.invalid_expire_date));
        fragment.show(this.getFragmentManager(), "Error");
        isValid = false;
    }

    card.expirationMonth(month);
    card.expirationYear(year);

    if (isValid) {
        this.progressFragment.show(this.getSupportFragmentManager(), "progress");
        openpay.createCard(card, this);
    }

}

0 个答案:

没有答案