|
@ -34,7 +34,7 @@ public class CashPickupToWalletPresenter extends BaseViewModel implements CashPi |
|
|
private final CompositeDisposable viewSubs; |
|
|
private final CompositeDisposable viewSubs; |
|
|
private final CompositeDisposable useCaseSubs; |
|
|
private final CompositeDisposable useCaseSubs; |
|
|
private String selectedControlNo; |
|
|
private String selectedControlNo; |
|
|
private CashPickupTxnDetailDTO currentCashPickupTxnDetail; |
|
|
|
|
|
|
|
|
private String currentCashPickupTxnId; |
|
|
|
|
|
|
|
|
public CashPickupToWalletPresenter(CashPickupToWalletPresenterInterface.CashPickupToWalletContract view, CashPickupToWalletGatewayInterface cashPickupToWalletGateway) { |
|
|
public CashPickupToWalletPresenter(CashPickupToWalletPresenterInterface.CashPickupToWalletContract view, CashPickupToWalletGatewayInterface cashPickupToWalletGateway) { |
|
|
this.view = view; |
|
|
this.view = view; |
|
@ -65,17 +65,9 @@ public class CashPickupToWalletPresenter extends BaseViewModel implements CashPi |
|
|
.doFinally(() -> view.showProgressBar(false, "")) |
|
|
.doFinally(() -> view.showProgressBar(false, "")) |
|
|
.subscribeWith(new CashPickupTxnSearchObserver()) |
|
|
.subscribeWith(new CashPickupTxnSearchObserver()) |
|
|
); |
|
|
); |
|
|
//TODO mocked |
|
|
|
|
|
// showDummyResponse(); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void showDummyResponse() { |
|
|
|
|
|
CashPickupTxnDetailDTO dummy=new CashPickupTxnDetailDTO(); |
|
|
|
|
|
dummy.seedDummyValues(); |
|
|
|
|
|
currentCashPickupTxnDetail=dummy; |
|
|
|
|
|
cashPickupTxnDetailDTOMutableLiveData.setValue(dummy); |
|
|
|
|
|
view.showTxnDetailScreen(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void redeemCashPickup() { |
|
|
public void redeemCashPickup() { |
|
@ -86,15 +78,13 @@ public class CashPickupToWalletPresenter extends BaseViewModel implements CashPi |
|
|
@Override |
|
|
@Override |
|
|
public void onRemitAuthSuccess(RemitAuthSuccessResult result) { |
|
|
public void onRemitAuthSuccess(RemitAuthSuccessResult result) { |
|
|
useCaseSubs.add( |
|
|
useCaseSubs.add( |
|
|
gateway.redeemCashPickupTxn(gateway.getAuth(), gateway.getUserID(), selectedControlNo, "", "") |
|
|
|
|
|
|
|
|
gateway.redeemCashPickupTxn(gateway.getAuth(), gateway.getUserID(), selectedControlNo, currentCashPickupTxnId, result.getResult()) |
|
|
.doOnSubscribe(subs -> view.showProgressBar(true, "")) |
|
|
.doOnSubscribe(subs -> view.showProgressBar(true, "")) |
|
|
.subscribeOn(Schedulers.io()) |
|
|
.subscribeOn(Schedulers.io()) |
|
|
.observeOn(AndroidSchedulers.mainThread()) |
|
|
.observeOn(AndroidSchedulers.mainThread()) |
|
|
.doFinally(() -> view.showProgressBar(false, "")) |
|
|
.doFinally(() -> view.showProgressBar(false, "")) |
|
|
.subscribeWith(new CashPickupTxnRedeemObserver()) |
|
|
.subscribeWith(new CashPickupTxnRedeemObserver()) |
|
|
); |
|
|
); |
|
|
//TODO mocked |
|
|
|
|
|
// view.showPopUpMessage("Redeem Success", CustomAlertDialog.AlertType.SUCCESS, alertType -> view.exitView()); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
@ -158,7 +148,7 @@ public class CashPickupToWalletPresenter extends BaseViewModel implements CashPi |
|
|
@Override |
|
|
@Override |
|
|
protected void onSuccess(GenericResponseDataModel<CashPickupTxnDetailDTO> t) { |
|
|
protected void onSuccess(GenericResponseDataModel<CashPickupTxnDetailDTO> t) { |
|
|
if (Constants.SUCCESS_CODE_V2.equalsIgnoreCase(t.getErrorCode())) { |
|
|
if (Constants.SUCCESS_CODE_V2.equalsIgnoreCase(t.getErrorCode())) { |
|
|
currentCashPickupTxnDetail=t.getData(); |
|
|
|
|
|
|
|
|
currentCashPickupTxnId = t.getData().getTxnId(); |
|
|
cashPickupTxnDetailDTOMutableLiveData.setValue(t.getData()); |
|
|
cashPickupTxnDetailDTOMutableLiveData.setValue(t.getData()); |
|
|
view.showTxnDetailScreen(); |
|
|
view.showTxnDetailScreen(); |
|
|
} else { |
|
|
} else { |
|
|