Search in sources :

Example 6 with BasicPaymentItem

use of com.globalcollect.gateway.sdk.client.android.sdk.model.paymentproduct.BasicPaymentItem in project connect-sdk-client-android by Ingenico-ePayments.

the class ProductSelectionViewImpl method renderDynamicContent.

@Override
public void renderDynamicContent(BasicPaymentItems paymentItems) {
    // Render all basic paymentitems and accounts on file
    for (BasicPaymentItem basicPaymentItem : paymentItems.getBasicPaymentItems()) {
        paymentItemRenderer.renderPaymentItem(basicPaymentItem, renderProductsLayout);
    }
    // Check if there are accountsOnFile, then set their container and header to visible
    if (!paymentItems.getAccountsOnFile().isEmpty()) {
        rootView.findViewById(R.id.listAccountsOnFileHeader).setVisibility(View.VISIBLE);
        rootView.findViewById(R.id.listAccountsOnFile).setVisibility(View.VISIBLE);
        rootView.findViewById(R.id.listAccountsOnFileDivider).setVisibility(View.VISIBLE);
        // Render all accountsOnFile
        for (AccountOnFile accountOnFile : paymentItems.getAccountsOnFile()) {
            accountOnFileRenderer.renderAccountOnFile(accountOnFile, accountOnFile.getPaymentProductId(), renderAccountOnFilesLayout);
        }
    }
}
Also used : RenderAccountOnFile(com.globalcollect.gateway.sdk.client.android.exampleapp.render.accountonfile.RenderAccountOnFile) AccountOnFile(com.globalcollect.gateway.sdk.client.android.sdk.model.paymentproduct.AccountOnFile) BasicPaymentItem(com.globalcollect.gateway.sdk.client.android.sdk.model.paymentproduct.BasicPaymentItem)

Example 7 with BasicPaymentItem

use of com.globalcollect.gateway.sdk.client.android.sdk.model.paymentproduct.BasicPaymentItem 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);
                            }
                        }
                    });
                }
            }
        }
    }
}
Also used : PaymentProduct(com.globalcollect.gateway.sdk.client.android.sdk.model.paymentproduct.PaymentProduct) IinDetail(com.globalcollect.gateway.sdk.client.android.sdk.model.iin.IinDetail) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) ArrayList(java.util.ArrayList) PaymentProductAsyncTask(com.globalcollect.gateway.sdk.client.android.sdk.asynctask.PaymentProductAsyncTask) BasicPaymentItem(com.globalcollect.gateway.sdk.client.android.sdk.model.paymentproduct.BasicPaymentItem)

Aggregations

BasicPaymentItem (com.globalcollect.gateway.sdk.client.android.sdk.model.paymentproduct.BasicPaymentItem)7 BasicPaymentProduct (com.globalcollect.gateway.sdk.client.android.sdk.model.paymentproduct.BasicPaymentProduct)3 BasicPaymentProductGroup (com.globalcollect.gateway.sdk.client.android.sdk.model.paymentproduct.BasicPaymentProductGroup)3 AccountOnFile (com.globalcollect.gateway.sdk.client.android.sdk.model.paymentproduct.AccountOnFile)2 ArrayList (java.util.ArrayList)2 BitmapDrawable (android.graphics.drawable.BitmapDrawable)1 LayoutInflater (android.view.LayoutInflater)1 View (android.view.View)1 ViewGroup (android.view.ViewGroup)1 ImageView (android.widget.ImageView)1 LinearLayout (android.widget.LinearLayout)1 TextView (android.widget.TextView)1 RenderAccountOnFile (com.globalcollect.gateway.sdk.client.android.exampleapp.render.accountonfile.RenderAccountOnFile)1 Translator (com.globalcollect.gateway.sdk.client.android.exampleapp.translation.Translator)1 PaymentProductAsyncTask (com.globalcollect.gateway.sdk.client.android.sdk.asynctask.PaymentProductAsyncTask)1 EnvironmentType (com.globalcollect.gateway.sdk.client.android.sdk.model.Environment.EnvironmentType)1 IinDetail (com.globalcollect.gateway.sdk.client.android.sdk.model.iin.IinDetail)1 BasicPaymentItems (com.globalcollect.gateway.sdk.client.android.sdk.model.paymentproduct.BasicPaymentItems)1 PaymentProduct (com.globalcollect.gateway.sdk.client.android.sdk.model.paymentproduct.PaymentProduct)1 Type (java.lang.reflect.Type)1