use of movile.com.creditcardguide.model.PurchaseOption in project CreditCardView by Movile.
the class FlagCardAdapter method getView.
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = LayoutInflater.from(context).inflate(R.layout.adapter_flag_card, null);
}
FontUtils.loadFonts(convertView);
PurchaseOption option = purchaseOptions.get(position);
IssuerCode issuerCode = option.getIssuerCode();
((ImageView) convertView.findViewById(R.id.adapter_flag_card_img_card)).setImageResource(issuerCode.getIconId());
((TextView) convertView.findViewById(R.id.adapter_flag_card_txt_name)).setText(issuerCode.getNameId());
return convertView;
}
use of movile.com.creditcardguide.model.PurchaseOption in project CreditCardView by Movile.
the class CreditCardFragment method restoreSavedCard.
public void restoreSavedCard(CreditCardPaymentMethod creditCardPaymentMethod) {
this.savedCard = creditCardPaymentMethod;
boolean canPayWithSaveCard = false;
int installments = 0;
if (creditCardPaymentMethod != null) {
for (PurchaseOption purchaseOption : purchaseOptions) {
if (creditCardPaymentMethod.getIssuerCode() == purchaseOption.getIssuerCode()) {
canPayWithSaveCard = true;
installments = purchaseOption.getInstallments();
break;
}
}
}
if (creditCardPaymentMethod != null && canPayWithSaveCard) {
cardRestored = true;
backFinish.set(true);
editNumberCard.setText(creditCardPaymentMethod.getCreditCardNumber());
creditCardView.setTextNumber(editNumberCard.getText());
creditCardView.setTextOwner(creditCardPaymentMethod.getCreditCardName());
editNameCard.setText(creditCardPaymentMethod.getCreditCardName());
String expireDateS = String.format("%s/%s", String.format("%02d", creditCardPaymentMethod.getExpireMonth() != null ? creditCardPaymentMethod.getExpireMonth() : 0), creditCardPaymentMethod.getExpireYear());
creditCardView.setTextExpDate(expireDateS);
editExpireCard.setText(expireDateS);
btEdit.setVisibility(View.VISIBLE);
switchSaveCard.setChecked(true);
switchSaveCard.setVisibility(View.GONE);
List<Integer> installmentsList = new ArrayList<>();
for (int i = 1; i <= installments; i++) {
installmentsList.add(i);
}
if (installmentsList.isEmpty()) {
spInstallments.setClickable(false);
} else {
spInstallments.setClickable(true);
}
installmentsCardAdapter = new InstallmentsCardAdapter(getActivity(), installmentsList);
spInstallments.setAdapter(installmentsCardAdapter);
selectedPurchaseOption = new PurchaseOption(creditCardPaymentMethod.getType(), creditCardPaymentMethod.getIssuerCode(), creditCardPaymentMethod.getInstallments());
if (creditCardPaymentMethod.getIssuerCode() == IssuerCode.AMEX) {
int maxLength = 4;
InputFilter[] fArray = new InputFilter[1];
fArray[0] = new InputFilter.LengthFilter(maxLength);
editCVVCard.setFilters(fArray);
} else {
int maxLength = 3;
InputFilter[] fArray = new InputFilter[1];
fArray[0] = new InputFilter.LengthFilter(maxLength);
editCVVCard.setFilters(fArray);
}
layoutPayment.setVisibility(View.VISIBLE);
layoutData.setVisibility(View.GONE);
pageChanged();
setIssuerCode(selectedPurchaseOption.getIssuerCode());
}
}
use of movile.com.creditcardguide.model.PurchaseOption in project CreditCardView by Movile.
the class CreditCardFragmentActivity method getList.
private List<PurchaseOption> getList() {
List<PurchaseOption> list = new ArrayList<>();
list.add(new PurchaseOption(PaymentMethod.Type.CREDIT_CARD, IssuerCode.MASTERCARD, 6));
list.add(new PurchaseOption(PaymentMethod.Type.CREDIT_CARD, IssuerCode.VISACREDITO, 6));
list.add(new PurchaseOption(PaymentMethod.Type.CREDIT_CARD, IssuerCode.AMEX, 6));
list.add(new PurchaseOption(PaymentMethod.Type.CREDIT_CARD, IssuerCode.PAYPAL, 6));
list.add(new PurchaseOption(PaymentMethod.Type.CREDIT_CARD, IssuerCode.DINERS, 6));
list.add(new PurchaseOption(PaymentMethod.Type.CREDIT_CARD, IssuerCode.NUBANK, 6));
list.add(new PurchaseOption(PaymentMethod.Type.CREDIT_CARD, IssuerCode.AURA, 6));
list.add(new PurchaseOption(PaymentMethod.Type.CREDIT_CARD, IssuerCode.ELO, 6));
list.add(new PurchaseOption(PaymentMethod.Type.CREDIT_CARD, IssuerCode.HIPERCARD, 6));
list.add(new PurchaseOption(PaymentMethod.Type.CREDIT_CARD, IssuerCode.OTHER, 6));
return list;
}
Aggregations