use of com.globalcollect.gateway.sdk.client.android.sdk.model.iin.IinDetail in project connect-sdk-client-android by Ingenico-ePayments.
the class DetailInputActivityCreditCards method handleIinStatusSupported.
// This function alters the view so that it is compliable with the IinStatus "EXISTING_BUT_NOT_ALLOWED"
private void handleIinStatusSupported(IinDetailsResponse response) {
fieldView.removeCreditCardValidationMessage(inputValidationPersister);
fieldView.activatePayButton();
// Find whether the brand, chosen by the user on the payment product selection screen, is in the IinResponse
// and whether the chosen product can be payed with in the current paymentcontext
List<IinDetail> coBrands = response.getCoBrands();
if (coBrands != null) {
for (IinDetail coBrand : coBrands) {
if (coBrand.isAllowedInContext() && inputDataPersister.getPaymentItem().getId().equals(coBrand.getPaymentProductId())) {
// Show the corresponding logo for the Payement Product
fieldView.renderPaymentProductLogoInCreditCardField(coBrand.getPaymentProductId());
// Show the user that he can possibly switch to an other brand with the same card number
getCoBrandProductsAndRenderNotification(response);
return;
}
}
}
// We now know that the user entered a completely different payment product, retrieve this
// product and then rerender the view from the getPaymentProduct callback
retrieveNewPaymentProduct(response.getPaymentProductId());
}
use of com.globalcollect.gateway.sdk.client.android.sdk.model.iin.IinDetail in project connect-sdk-client-android by Ingenico-ePayments.
the class DetailInputActivityCreditCards method getCoBrandProductsAndRenderNotification.
private void getCoBrandProductsAndRenderNotification(IinDetailsResponse response) {
// If the currently known iinDetailsResponse within this activity is not null, check whether cobrand notifications need to be shown.
if (response != null) {
// Retrieve the cobrands from the iinDetailsResponse
final List<IinDetail> coBrands = response.getCoBrands();
// Remove all cobrands that cannot be payed with
if (coBrands != null && !coBrands.isEmpty()) {
// Create a list to store all allowed paymentProducts
final List<BasicPaymentItem> paymentProductsAllowedInContext = new ArrayList<>(4);
// Counter
final AtomicInteger count = new AtomicInteger(coBrands.size());
// Add the allowed paymentProducts to the list
for (IinDetail iinDetail : coBrands) {
if (iinDetail.isAllowedInContext()) {
// Load the paymentProducts that are allowed in context, so they can be rendered in the possible coBrand list
session.getPaymentProduct(this.getApplicationContext(), iinDetail.getPaymentProductId(), paymentContext, new PaymentProductAsyncTask.OnPaymentProductCallCompleteListener() {
@Override
public void onPaymentProductCallComplete(PaymentProduct paymentProduct) {
if (paymentProduct != null) {
paymentProductsAllowedInContext.add(paymentProduct);
}
if (count.decrementAndGet() < 1) {
// All of the payment products have been retrieved
fieldView.renderCoBrandNotification(paymentProductsAllowedInContext, DetailInputActivityCreditCards.this);
}
}
});
}
}
}
}
}
Aggregations