use of com.globalcollect.gateway.sdk.client.android.sdk.asynctask.BasicPaymentItemsAsyncTask in project connect-sdk-client-android by Ingenico-ePayments.
the class GcSession method getBasicPaymentItems.
/**
* Gets all basitPaymentItems for a given payment context
*
* @param context Used for reading device metadata which is send to the GC gateway
* @param paymentContext PaymentContext which contains all neccessary payment info to retrieve the allowed payment items
* @param listener Listener that will be called when the lookup is done
* @param groupPaymentProducts boolean that controls whether the basicPaymentItem call will group the retrieved payment items; true for grouping, false otherwise
*/
public void getBasicPaymentItems(Context context, PaymentContext paymentContext, OnBasicPaymentItemsCallCompleteListener listener, boolean groupPaymentProducts) {
if (context == null) {
throw new InvalidParameterException("Error getting paymentproduct, context may not be null");
}
if (paymentContext == null) {
throw new InvalidParameterException("Error getting paymentproducts, paymentContext may not be null");
}
if (listener == null) {
throw new InvalidParameterException("Error getting paymentproducts, listener may not be null");
}
this.paymentContext = paymentContext;
// Add OnBasicPaymentItemsCallCompleteListener and this class to list of listeners so we can store the paymentproducts here
List<OnBasicPaymentItemsCallCompleteListener> listeners = new ArrayList<>();
listeners.add(this);
listeners.add(listener);
// Start the task which gets paymentproducts
BasicPaymentItemsAsyncTask task = new BasicPaymentItemsAsyncTask(context, paymentContext, communicator, listeners, groupPaymentProducts);
task.execute();
}
Aggregations