use of com.globalcollect.gateway.sdk.client.android.sdk.model.paymentproduct.PaymentProduct 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