Browse Source

Minor fixes in withdraw

master
Preyea Regmi 4 years ago
parent
commit
380b04b4a3
  1. BIN
      .idea/caches/build_file_checksums.ser
  2. 13
      app/src/main/java/com/swifttech/remit/android/features/withdraw/gateway/WithdrawGateway.java
  3. 57
      app/src/main/java/com/swifttech/remit/android/features/withdraw/presenter/WithdrawPresenter.java
  4. 2
      app/src/main/java/com/swifttech/remit/android/features/withdraw/view/WithdrawActivity.java
  5. 2
      app/src/main/java/com/swifttech/remit/android/utils/https/API_URL.java
  6. 8
      app/src/main/java/com/swifttech/remit/android/utils/https/ApiEndpoints.java
  7. 8
      app/src/main/res/layout/fragment_cash_pickup_txn_detail.xml
  8. 2
      app/src/main/res/layout/fragment_otp_request.xml

BIN
.idea/caches/build_file_checksums.ser

13
app/src/main/java/com/swifttech/remit/android/features/withdraw/gateway/WithdrawGateway.java

@ -1,7 +1,9 @@
package com.swifttech.remit.android.features.withdraw.gateway;
import com.google.gson.JsonObject;
import com.swifttech.remit.android.base.PrivilegedGateway;
import com.swifttech.remit.android.features.withdraw.presenter.WithdrawGatewayInterface;
import com.swifttech.remit.android.utils.https.HttpClientV2;
import io.reactivex.Observable;
import okhttp3.ResponseBody;
@ -9,11 +11,18 @@ import okhttp3.ResponseBody;
public class WithdrawGateway extends PrivilegedGateway implements WithdrawGatewayInterface {
@Override
public Observable<ResponseBody> checkWithdrawStatus(String auth, String userID, String selectedWithdrawAmount) {
return null;
JsonObject jsonObject=new JsonObject();
jsonObject.addProperty("userID",userID);
jsonObject.addProperty("amount",selectedWithdrawAmount);
return HttpClientV2.getInstance().requestForBankDeposit(auth,jsonObject);
}
@Override
public Observable<ResponseBody> performWithdraw(String auth, String userID, String amount, String password) {
return null;
JsonObject jsonObject=new JsonObject();
jsonObject.addProperty("userID",userID);
jsonObject.addProperty("amount",amount);
jsonObject.addProperty("password",password);
return HttpClientV2.getInstance().proceedForBankDeposit(auth,jsonObject);
}
}

57
app/src/main/java/com/swifttech/remit/android/features/withdraw/presenter/WithdrawPresenter.java

@ -4,9 +4,9 @@ import androidx.appcompat.app.AppCompatActivity;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import com.google.gson.reflect.TypeToken;
import com.swifttech.remit.android.base.BaseViewModel;
import com.swifttech.remit.android.common.customwidgets.CustomAlertDialog;
import com.swifttech.remit.android.common.model.FormInputStateDTO;
import com.swifttech.remit.android.features.security.RemitAuthManager;
import com.swifttech.remit.android.features.security.model.RemitAuthFailedResult;
import com.swifttech.remit.android.features.security.model.RemitAuthSuccessResult;
@ -18,6 +18,8 @@ import com.swifttech.remit.android.utils.https.GenericApiObserverResponseV2;
import com.swifttech.remit.android.utils.https.GenericResponseDataModel;
import com.swifttech.remit.android.utils.https.MessageResponseDataModel;
import java.lang.reflect.Type;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
@ -92,14 +94,15 @@ public class WithdrawPresenter extends BaseViewModel implements WithdrawPresente
).setListener(new RemitAuthManager.RemitAuthListener() {
@Override
public void onRemitAuthSuccess(RemitAuthSuccessResult result) {
// useCaseSubs.add(
// gateway.performWithdraw(gateway.getAuth(), gateway.getUserID(), selectedWithdrawAmount, result.getResult())
// .doOnSubscribe(subs -> view.showProgressBar(true, ""))
// .subscribeOn(Schedulers.io())
// .observeOn(AndroidSchedulers.mainThread())
// .doFinally(() -> view.showProgressBar(false, ""))
// .subscribeWith(new WithdrawTxnbserver())
// );
useCaseSubs.add(
gateway.performWithdraw(gateway.getAuth(), gateway.getUserID(), selectedWithdrawAmount, 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());
}
@ -118,18 +121,19 @@ public class WithdrawPresenter extends BaseViewModel implements WithdrawPresente
@Override
public void getWithdrawDetail() {
view.hideKeyBoard();
// useCaseSubs.add(
// gateway.checkWithdrawStatus(gateway.getAuth(), gateway.getUserID(),selectedWithdrawAmount )
// .doOnSubscribe(subs -> view.showProgressBar(true, ""))
// .subscribeOn(Schedulers.io())
// .observeOn(AndroidSchedulers.mainThread())
// .doFinally(() -> view.showProgressBar(false, ""))
// .subscribeWith(new WithdrawStatusObserver())
// );
WithdrawStatusResponseDTO dummyData = new WithdrawStatusResponseDTO();
dummyData.seedDummyValues();
onReceivingWithdrawStatus(dummyData);
useCaseSubs.add(
gateway.checkWithdrawStatus(gateway.getAuth(), gateway.getUserID(),selectedWithdrawAmount )
.doOnSubscribe(subs -> view.showProgressBar(true, ""))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.doFinally(() -> view.showProgressBar(false, ""))
.subscribeWith(new WithdrawStatusObserver())
);
//TODO Mock Success Response
// WithdrawStatusResponseDTO dummyData = new WithdrawStatusResponseDTO();
// dummyData.seedDummyValues();
// onReceivingWithdrawStatus(dummyData);
}
@ -166,24 +170,29 @@ public class WithdrawPresenter extends BaseViewModel implements WithdrawPresente
public class WithdrawStatusObserver extends GenericApiObserverResponseV2<WithdrawStatusResponseDTO> {
@Override
protected Type getDataType() {
return TypeToken.getParameterized(WithdrawStatusResponseDTO.class).getType();
}
@Override
protected void onSuccess(GenericResponseDataModel<WithdrawStatusResponseDTO> t) {
if (Constants.SUCCESS_CODE_V2.equalsIgnoreCase(t.getErrorCode()) && t.getData() != null) {
onReceivingWithdrawStatus(t.getData());
} else {
view.showPopUpMessage(t.getMsg(), CustomAlertDialog.AlertType.FAILED, alertType -> view.exitView());
view.showPopUpMessage(t.getMsg(), CustomAlertDialog.AlertType.FAILED, null);
}
}
@Override
public void onFailed(String message) {
view.showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, alertType -> view.exitView());
view.showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, null);
}
@Override
protected void onConnectionNotEstablished(String message) {
view.showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, alertType -> view.exitView());
view.showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, null);
}

2
app/src/main/java/com/swifttech/remit/android/features/withdraw/view/WithdrawActivity.java

@ -51,7 +51,7 @@ public class WithdrawActivity extends BaseActivity implements WithdrawPresenterI
}
private void init() {
toolbarTitle.setText("Withdraw");
toolbarTitle.setText("Bank Deposit");
viewModel = new ViewModelProvider(this, new WithdrawViewModelFactory(this)).get(WithdrawPresenter.class);
setupViewPager();
}

2
app/src/main/java/com/swifttech/remit/android/utils/https/API_URL.java

@ -96,5 +96,7 @@ public class API_URL {
public static final String REGISTER_OTP_SUBMIT = BuildConfig.API_VERSION + "/mobile/submitOTP ";
public static final String SEARCH_CASH_PICKUP_BY_CONTROL_NO = BuildConfig.API_VERSION + "/mobile/searchTxnByControlNumber ";
public static final String REDEEM_CASH_PICKUP = BuildConfig.API_VERSION + "/mobile/redeemCashPayment ";
public static final String REQUEST_FOR_BANK_DEPOSIT =BuildConfig.API_VERSION + "/mobile/withdrawWalletRequest" ;
public static final String PROCEED_FOR_BANK_DEPOSIT = BuildConfig.API_VERSION + "/mobile/withdrawFromWallet";
}

8
app/src/main/java/com/swifttech/remit/android/utils/https/ApiEndpoints.java

@ -246,6 +246,14 @@ public interface ApiEndpoints {
@Headers("Content-Type: application/json")
Observable<ResponseBody> redeemCashPickup(@Header("Authorization") String token, @Body()JsonObject requestBody);
@POST(API_URL.REQUEST_FOR_BANK_DEPOSIT)
@Headers("Content-Type: application/json")
Observable<ResponseBody> requestForBankDeposit(@Header("Authorization") String token, @Body()JsonObject requestBody);
@POST(API_URL.PROCEED_FOR_BANK_DEPOSIT)
@Headers("Content-Type: application/json")
Observable<ResponseBody> proceedForBankDeposit(@Header("Authorization") String token, @Body()JsonObject requestBody);

8
app/src/main/res/layout/fragment_cash_pickup_txn_detail.xml

@ -264,6 +264,7 @@
</LinearLayout>
<View
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@id/mobile_label"
@ -271,6 +272,7 @@
<LinearLayout
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content">
@ -400,13 +402,7 @@
app:txtfontName="@string/semibold" />
</LinearLayout>
<!---->
<View
android:id="@+id/coupon_fee_divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/gray" />
<!---->
<View
android:id="@+id/exrate_divider"
android:layout_width="match_parent"

2
app/src/main/res/layout/fragment_otp_request.xml

@ -35,6 +35,8 @@
style="@style/MTextInputEditText"
android:inputType="phone"
android:imeOptions="actionDone"
android:maxLength="15"
android:digits="0123456789"
/>

Loading…
Cancel
Save