Search in sources :

Example 1 with OnIinLookupCompleteListener

use of com.globalcollect.gateway.sdk.client.android.sdk.asynctask.IinLookupAsyncTask.OnIinLookupCompleteListener in project connect-sdk-client-android by Ingenico-ePayments.

the class GcSession method getIinDetails.

/**
 * Gets the IinDetails for a given partialCreditCardNumber
 *
 * @param context, used for reading device metada which is send to the GC gateway
 * @param partialCreditCardNumber, entered partial creditcardnumber for which the IinDetails will be retrieved
 * @param listener, listener which will be called by the AsyncTask when the IIN result is retrieved
 * @param paymentContext, payment information for which the IinDetails will be retrieved
 */
public void getIinDetails(Context context, String partialCreditCardNumber, OnIinLookupCompleteListener listener, PaymentContext paymentContext) {
    if (context == null) {
        throw new InvalidParameterException("Error getting iinDetails, context may not be null");
    }
    if (partialCreditCardNumber == null) {
        throw new InvalidParameterException("Error getting iinDetails, productId may not be null");
    }
    if (listener == null) {
        throw new InvalidParameterException("Error getting iinDetails, listener may not be null");
    }
    // Add OnPaymentProductsCallComplete listener and this class to list of listeners so we can reset the iinLookupPending flag
    List<OnIinLookupCompleteListener> listeners = new ArrayList<OnIinLookupCompleteListener>();
    listeners.add(this);
    listeners.add(listener);
    if (!iinLookupPending) {
        IinLookupAsyncTask task = new IinLookupAsyncTask(context, partialCreditCardNumber, communicator, listeners, paymentContext);
        task.execute();
        iinLookupPending = true;
    }
}
Also used : InvalidParameterException(java.security.InvalidParameterException) OnIinLookupCompleteListener(com.globalcollect.gateway.sdk.client.android.sdk.asynctask.IinLookupAsyncTask.OnIinLookupCompleteListener) ArrayList(java.util.ArrayList) IinLookupAsyncTask(com.globalcollect.gateway.sdk.client.android.sdk.asynctask.IinLookupAsyncTask)

Aggregations

IinLookupAsyncTask (com.globalcollect.gateway.sdk.client.android.sdk.asynctask.IinLookupAsyncTask)1 OnIinLookupCompleteListener (com.globalcollect.gateway.sdk.client.android.sdk.asynctask.IinLookupAsyncTask.OnIinLookupCompleteListener)1 InvalidParameterException (java.security.InvalidParameterException)1 ArrayList (java.util.ArrayList)1