use of com.fitpay.android.api.callbacks.ApiCallback in project fitpay-android-sdk by fitpay.
the class User method getAllCreditCards.
/**
* Retrieves 'all' credit cards
*
* @return observable
*/
public Observable<Collections.CreditCardCollection> getAllCreditCards() {
return Observable.create(new Observable.OnSubscribe<Collections.CreditCardCollection>() {
@Override
public void call(Subscriber<? super Collections.CreditCardCollection> subscriber) {
getAllCreditCards(new ApiCallback<Collections.CreditCardCollection>() {
@Override
public void onSuccess(Collections.CreditCardCollection result) {
if (result == null) {
subscriber.onError(new Exception("cards result is null"));
return;
}
subscriber.onNext(result);
subscriber.onCompleted();
}
@Override
public void onFailure(@ResultCode.Code int errorCode, String errorMessage) {
subscriber.onError(new DeviceOperationException(errorMessage, errorCode));
}
});
}
});
}
Aggregations