|
|
@ -36,6 +36,7 @@ public class WithdrawPresenter extends BaseViewModel implements WithdrawPresente |
|
|
|
private final CompositeDisposable viewSubs; |
|
|
|
private WithdrawStatusResponseDTO withdrawStatusDTO; |
|
|
|
private String selectedWithdrawAmount; |
|
|
|
private String currentTxnId; |
|
|
|
|
|
|
|
public WithdrawPresenter(WithdrawPresenterInterface.WithdrawContract view, WithdrawGatewayInterface withdrawGateway) { |
|
|
|
this.view = view; |
|
|
@ -95,15 +96,13 @@ public class WithdrawPresenter extends BaseViewModel implements WithdrawPresente |
|
|
|
@Override |
|
|
|
public void onRemitAuthSuccess(RemitAuthSuccessResult result) { |
|
|
|
useCaseSubs.add( |
|
|
|
gateway.performWithdraw(gateway.getAuth(), gateway.getUserID(), selectedWithdrawAmount, result.getResult()) |
|
|
|
gateway.performWithdraw(gateway.getAuth(), gateway.getUserID(), selectedWithdrawAmount, currentTxnId,result.getResult()) |
|
|
|
.doOnSubscribe(subs -> view.showProgressBar(true, "")) |
|
|
|
.subscribeOn(Schedulers.io()) |
|
|
|
.observeOn(AndroidSchedulers.mainThread()) |
|
|
|
.doFinally(() -> view.showProgressBar(false, "")) |
|
|
|
.subscribeWith(new WithdrawTxnbserver()) |
|
|
|
); |
|
|
|
//TODO Mock Success Response |
|
|
|
view.showPopUpMessage("Withdraw Success", CustomAlertDialog.AlertType.SUCCESS, alertType -> view.exitView()); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
@ -129,12 +128,6 @@ public class WithdrawPresenter extends BaseViewModel implements WithdrawPresente |
|
|
|
.doFinally(() -> view.showProgressBar(false, "")) |
|
|
|
.subscribeWith(new WithdrawStatusObserver()) |
|
|
|
); |
|
|
|
|
|
|
|
//TODO Mock Success Response |
|
|
|
// WithdrawStatusResponseDTO dummyData = new WithdrawStatusResponseDTO(); |
|
|
|
// dummyData.seedDummyValues(); |
|
|
|
// onReceivingWithdrawStatus(dummyData); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private Boolean validateAmount(CharSequence amount) { |
|
|
@ -178,6 +171,7 @@ public class WithdrawPresenter extends BaseViewModel implements WithdrawPresente |
|
|
|
@Override |
|
|
|
protected void onSuccess(GenericResponseDataModel<WithdrawStatusResponseDTO> t) { |
|
|
|
if (Constants.SUCCESS_CODE_V2.equalsIgnoreCase(t.getErrorCode()) && t.getData() != null) { |
|
|
|
currentTxnId=t.getData().getTxnId(); |
|
|
|
onReceivingWithdrawStatus(t.getData()); |
|
|
|
} else { |
|
|
|
view.showPopUpMessage(t.getMsg(), CustomAlertDialog.AlertType.FAILED, null); |
|
|
|