Search in sources :

Example 36 with InvalidParameterException

use of java.security.InvalidParameterException in project connect-sdk-client-android by Ingenico-ePayments.

the class GcSession method getDirectoryForPaymentProductId.

/**
 * Gets PaymentProductDirectory from the GC gateway
 *
 * @param productId, for which product must the lookup be done
 * @param currencyCode, for which currencyCode must the lookup be done
 * @param countryCode, for which countryCode must the lookup be done
 * @param context, used for reading device metada which is send to the GC gateway
 * @param listener, listener which will be called by the AsyncTask when the PaymentProductDirectory with fields is retrieved
 */
public void getDirectoryForPaymentProductId(String productId, CurrencyCode currencyCode, CountryCode countryCode, Context context, OnPaymentProductDirectoryCallCompleteListener listener) {
    if (productId == null) {
        throw new InvalidParameterException("Error getting PaymentProductDirectory, productId may not be null");
    }
    if (currencyCode == null) {
        throw new InvalidParameterException("Error getting PaymentProductDirectory, currencyCode may not be null");
    }
    if (countryCode == null) {
        throw new InvalidParameterException("Error getting PaymentProductDirectory, countryCode may not be null");
    }
    if (listener == null) {
        throw new InvalidParameterException("Error getting PaymentProductDirectory, listener may not be null");
    }
    if (context == null) {
        throw new InvalidParameterException("Error getting PaymentProductDirectory, context may not be null");
    }
    PaymentProductDirectoryAsyncTask task = new PaymentProductDirectoryAsyncTask(productId, currencyCode, countryCode, context, communicator, listener);
    task.execute();
}
Also used : InvalidParameterException(java.security.InvalidParameterException) PaymentProductDirectoryAsyncTask(com.globalcollect.gateway.sdk.client.android.sdk.asynctask.PaymentProductDirectoryAsyncTask)

Example 37 with InvalidParameterException

use of java.security.InvalidParameterException in project connect-sdk-client-android by Ingenico-ePayments.

the class GcSession method getBasicPaymentProductGroups.

/**
 * Gets BasicPaymentProducts for the given PaymentRequest
 *
 * @param context, used for reading device metada which is send to the GC gateway
 * @param paymentContext, C2sPaymentProductContext which contains all neccesary data for doing call to the GC gateway to retrieve paymentproducts
 * @param listener, OnPaymentProductsCallComplete which will be called by the BasicPaymentProductsAsyncTask when the BasicPaymentProducts are loaded
 */
public void getBasicPaymentProductGroups(Context context, PaymentContext paymentContext, OnBasicPaymentProductGroupsCallCompleteListener listener) {
    if (context == null) {
        throw new InvalidParameterException("Error getting paymentProductGroups, context may not be null");
    }
    if (paymentContext == null) {
        throw new InvalidParameterException("Error getting paymentProductGroups, paymentContext may not be null");
    }
    if (listener == null) {
        throw new InvalidParameterException("Error getting paymentProductGroups, listener may not be null");
    }
    this.paymentContext = paymentContext;
    // Add OnBasicPaymentProductGroupsCallCompleteListener and this class to list of listeners so we can store the paymentProductGroups here
    List<OnBasicPaymentProductGroupsCallCompleteListener> listeners = new ArrayList<>();
    listeners.add(this);
    listeners.add(listener);
    // Start the task which gets paymentproducts
    BasicPaymentProductGroupsAsyncTask task = new BasicPaymentProductGroupsAsyncTask(context, paymentContext, communicator, listeners);
    task.execute();
}
Also used : InvalidParameterException(java.security.InvalidParameterException) OnBasicPaymentProductGroupsCallCompleteListener(com.globalcollect.gateway.sdk.client.android.sdk.asynctask.BasicPaymentProductGroupsAsyncTask.OnBasicPaymentProductGroupsCallCompleteListener) ArrayList(java.util.ArrayList) BasicPaymentProductGroupsAsyncTask(com.globalcollect.gateway.sdk.client.android.sdk.asynctask.BasicPaymentProductGroupsAsyncTask)

Example 38 with InvalidParameterException

use of java.security.InvalidParameterException in project connect-sdk-client-android by Ingenico-ePayments.

the class GcSession method getPaymentProductGroup.

/**
 * Gets PaymentProductGroup with fields from the GC gateway
 *
 * @param context, used for reading device metada which is send to the GC gateway
 * @param groupId, the productId of the group which needs to be retrieved from the GC gateway
 * @param paymentContext, PaymentContext which contains all necessary data for doing call to the GC gateway to retrieve PaymentProductGroup
 * @param listener, listener which will be called by the AsyncTask when the PaymentProductGroup with fields is retrieved
 */
public void getPaymentProductGroup(Context context, String groupId, PaymentContext paymentContext, OnPaymentProductGroupCallCompleteListener listener) {
    if (context == null) {
        throw new InvalidParameterException("Error getting paymentproduct, context may not be null");
    }
    if (groupId == null) {
        throw new InvalidParameterException("Error getting paymentproduct, groupId may not be null");
    }
    if (paymentContext == null) {
        throw new InvalidParameterException(("Error getting paymentproduct, paymentContext may not be null"));
    }
    if (listener == null) {
        throw new InvalidParameterException("Error getting paymentproduct, listener may not be null");
    }
    this.paymentContext = paymentContext;
    // Create the cache key for this paymentProductGroup
    PaymentItemCacheKey key = createPaymentItemCacheKey(paymentContext, groupId);
    // If the paymentProductGroup is already in the cache, call the listener with that paymentProductGroup
    if (paymentItemMapping.containsKey(key)) {
        PaymentProductGroup cachedPPG = (PaymentProductGroup) paymentItemMapping.get(key);
        listener.onPaymentProductGroupCallComplete(cachedPPG);
    } else {
        // Add OnPaymentProductsCallComplete listener and this class to list of listeners so we can store the paymentproduct here
        List<OnPaymentProductGroupCallCompleteListener> listeners = new ArrayList<>();
        listeners.add(this);
        listeners.add(listener);
        // Do the call to the GC gateway
        PaymentProductGroupAsyncTask task = new PaymentProductGroupAsyncTask(context, groupId, paymentContext, communicator, listeners);
        task.execute();
    }
}
Also used : InvalidParameterException(java.security.InvalidParameterException) PaymentItemCacheKey(com.globalcollect.gateway.sdk.client.android.sdk.model.PaymentItemCacheKey) PaymentProductGroupAsyncTask(com.globalcollect.gateway.sdk.client.android.sdk.asynctask.PaymentProductGroupAsyncTask) ArrayList(java.util.ArrayList) OnPaymentProductGroupCallCompleteListener(com.globalcollect.gateway.sdk.client.android.sdk.asynctask.PaymentProductGroupAsyncTask.OnPaymentProductGroupCallCompleteListener) BasicPaymentProductGroup(com.globalcollect.gateway.sdk.client.android.sdk.model.paymentproduct.BasicPaymentProductGroup) PaymentProductGroup(com.globalcollect.gateway.sdk.client.android.sdk.model.paymentproduct.PaymentProductGroup)

Example 39 with InvalidParameterException

use of java.security.InvalidParameterException in project connect-sdk-client-android by Ingenico-ePayments.

the class GcSession method getPaymentProductNetworks.

public void getPaymentProductNetworks(Context context, String productId, PaymentContext paymentContext, OnPaymentProductNetworksCallCompleteListener listener) {
    if (context == null) {
        throw new InvalidParameterException("Error getting PaymentProductNetworks, context may not be null");
    }
    if (productId == null) {
        throw new InvalidParameterException("Error getting PaymentProductNetworks, productId may not be null");
    }
    if (paymentContext == null) {
        throw new InvalidParameterException("Error getting PaymentProductNetworks, paymentContext may not be null");
    }
    if (listener == null) {
        throw new InvalidParameterException("Error getting PaymentProductNetworks, listener may not be null");
    }
    PaymentProductNetworksAsyncTask task = new PaymentProductNetworksAsyncTask(context, productId, paymentContext, communicator, listener);
    task.execute();
}
Also used : InvalidParameterException(java.security.InvalidParameterException) PaymentProductNetworksAsyncTask(com.globalcollect.gateway.sdk.client.android.sdk.asynctask.PaymentProductNetworksAsyncTask)

Example 40 with InvalidParameterException

use of java.security.InvalidParameterException in project connect-sdk-client-android by Ingenico-ePayments.

the class GcSession method getPaymentProductPublicKey.

/**
 * Retrieves the publickey for a specific payment product from the GC gateway
 *
 * @param context, used for reading device metadata, which is send to the GC gateway
 * @param listener, OnPaymentProductPublicKeyLoaded listener which is called when the Android pay public key is retrieved
 */
public void getPaymentProductPublicKey(Context context, String productId, OnPaymentProductPublicKeyLoadedListener listener) {
    if (context == null) {
        throw new InvalidParameterException("Error getting payment product public key, context may not be null");
    }
    if (productId == null) {
        throw new InvalidParameterException("Error getting payment product public key, productId may not be null");
    }
    if (listener == null) {
        throw new InvalidParameterException("Error getting payment product public key, listener may not be null");
    }
    PaymentProductPublicKeyAsyncTask task = new PaymentProductPublicKeyAsyncTask(context, productId, communicator, listener);
    task.execute();
}
Also used : PaymentProductPublicKeyAsyncTask(com.globalcollect.gateway.sdk.client.android.sdk.asynctask.PaymentProductPublicKeyAsyncTask) InvalidParameterException(java.security.InvalidParameterException)

Aggregations

InvalidParameterException (java.security.InvalidParameterException)280 IOException (java.io.IOException)34 ArrayList (java.util.ArrayList)24 ActionEvent (com.cloud.event.ActionEvent)22 SecureRandom (java.security.SecureRandom)19 LoadBalancerVO (com.cloud.network.dao.LoadBalancerVO)18 ResourceUnavailableException (com.cloud.exception.ResourceUnavailableException)16 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)16 File (java.io.File)16 InvalidAlgorithmParameterException (java.security.InvalidAlgorithmParameterException)15 FirewallRule (com.cloud.network.rules.FirewallRule)14 DB (com.cloud.utils.db.DB)14 Map (java.util.Map)14 HashMap (java.util.HashMap)12 MalformedURLException (java.net.MalformedURLException)11 Paint (android.graphics.Paint)9 InvalidParameterValueException (com.cloud.exception.InvalidParameterValueException)8 CommunicationException (com.globalcollect.gateway.sdk.client.android.sdk.exception.CommunicationException)8 HttpURLConnection (java.net.HttpURLConnection)8 Scanner (java.util.Scanner)8