use of com.fitpay.android.paymentdevice.DeviceOperationException in project fitpay-android-sdk by fitpay.
the class Device method getAllCommits.
/**
* Retrieves 'all' events that should be committed to this device.
*
* @param lastCommitId last commit id
* @return observable
*/
public Observable<Collections.CommitsCollection> getAllCommits(final String lastCommitId) {
return Observable.create(new Observable.OnSubscribe<Collections.CommitsCollection>() {
@Override
public void call(Subscriber<? super Collections.CommitsCollection> subscriber) {
getAllCommits(lastCommitId, new ApiCallback<Collections.CommitsCollection>() {
@Override
public void onSuccess(Collections.CommitsCollection result) {
if (result == null) {
subscriber.onError(new Exception("commits 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));
}
});
}
});
}
use of com.fitpay.android.paymentdevice.DeviceOperationException in project fitpay-android-sdk by fitpay.
the class Device method getLastAckCommit.
/**
* Retrieves last event that was committed to this device.
*
* @return observable
*/
public Observable<Commit> getLastAckCommit() {
return Observable.create(subscriber -> getLastAckCommit(new ApiCallback<Commit>() {
@Override
public void onSuccess(Commit result) {
subscriber.onNext(result);
subscriber.onCompleted();
}
@Override
public void onFailure(@ResultCode.Code int errorCode, String errorMessage) {
subscriber.onError(new DeviceOperationException(errorMessage, errorCode));
}
}));
}
use of com.fitpay.android.paymentdevice.DeviceOperationException 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