From c23278b736147e4663fb95e3d987199fd67d98ab Mon Sep 17 00:00:00 2001 From: Santosh Bhandary Date: Mon, 17 May 2021 18:15:05 +0545 Subject: [PATCH] request OTP on OTP Expiry added --- .../remit/jmecustomer/base/PrefKeys.java | 1 + .../common/GenericEditTextPromptDialog.java | 3 - .../features/home/gateway/HomeV2Gateway.java | 27 ++++ .../features/home/model/UserInfoModelV2.java | 12 ++ .../presenter/HomeNotificationHandler.java | 46 ++++-- .../presenter/HomeV2InteractorInterface.java | 10 ++ .../presenter/HomeV2PresenterInterface.java | 13 ++ .../home/presenter/HomeViewModel.java | 135 +++++++++++++++- .../features/home/view/HomeActivityV2.java | 45 ++++-- .../features/home/view/HomeFragmentV2.java | 34 +++- .../notifications/EmailNotVerifiedView.java | 73 +++++++++ .../HomeNotificiationViewFactory.java | 10 +- .../gateway/ExistingExistingKYCV3Gateway.java | 26 ++++ .../ExistingKYCV3GatewayInterface.java | 10 ++ .../ExistingKYCV3PresenterInterface.java | 19 ++- .../presenter/ExistingKYCV3ViewModel.java | 115 +++++++++++++- .../view/ExistingKYCV3Activity.java | 38 ++++- .../ExistingKycTermsAndConditionFragment.java | 7 +- .../kyc/newCustomer/gateway/KYCV3Gateway.java | 26 ++++ .../presenter/KYCV3GatewayInterface.java | 10 ++ .../presenter/KYCV3PresenterInterface.java | 12 +- .../newCustomer/presenter/KYCV3ViewModel.java | 114 +++++++++++++- .../kyc/newCustomer/view/KYCV3Activity.java | 37 ++++- .../NewKycTermsAndConditionFragment.java | 6 +- .../recipientlisting/ReceiverInfoModel.java | 13 ++ .../RecipientAddEditV3Gateway.java | 30 ++++ .../RecipientAddEditV3GatewayInterface.java | 6 + .../RecipientListingV3Gateway.java | 35 ++++- .../ReceiverInfoV3Model.java | 12 ++ .../RecipientAddEditBaseV3ViewModel.java | 146 +++++++++++++++++- .../RecipientAddV3ContractInterface.java | 4 + .../RecipientDetailValidatorV3.java | 4 + .../RecipientPresenterInterface.java | 5 + .../add/RecipientAddV3ViewModel.java | 9 +- .../edit/RecipientEditV3ViewModel.java | 10 +- ...RecipientListingV3InteractorInterface.java | 14 +- .../RecipientListingV3Presenter.java | 117 +++++++++++++- .../RecipientListingV3PresenterInterface.java | 6 + .../BeneficiaryAddEditV3TermsFragment.java | 12 +- .../RecipientListingV3Activity.java | 36 ++++- ...stingCustomerRegisterViewModelFactory.java | 4 +- ...gCustomerRegisterV2PresenterInterface.java | 1 - ...=> ExistingCustomerRegisterViewModel.java} | 8 +- .../ExistingCustomerRegisterV2Activity.java | 25 +-- ...ngCustomerRegistrationRequestFragment.java | 4 +- ...ingCustomerRegistrationSubmitFragment.java | 4 +- .../presenter/NewRegisterV2Presenter.java | 3 +- .../NewRegisterV2PresenterInterface.java | 1 - .../view/NewRegisterV2Activity.java | 21 +-- .../renewId/presenter/RenewIdV2ViewModel.java | 9 +- .../consent/UserConsentSendMoneyFragment.java | 16 +- .../webbrowser/WebBrowserFragmentV2.java | 18 +-- .../remit/jmecustomer/utils/Constants.java | 11 ++ .../jmecustomer/utils/https/API_URL.java | 4 +- .../jmecustomer/utils/https/ApiEndpoints.java | 19 +++ .../utils/https/MessageResponseDataModel.java | 12 ++ .../layout/dialog_generci_edittext_prompt.xml | 12 +- app/src/main/res/values/strings.xml | 3 + .../HomeNotificationHandlerTest.java | 26 ++-- 59 files changed, 1286 insertions(+), 203 deletions(-) create mode 100644 app/src/main/java/com/swifttech/remit/jmecustomer/features/home/view/notifications/EmailNotVerifiedView.java rename app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/existingcustomer/presenter/{ExistingCustomerRegisterV2Presenter.java => ExistingCustomerRegisterViewModel.java} (98%) diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/base/PrefKeys.java b/app/src/main/java/com/swifttech/remit/jmecustomer/base/PrefKeys.java index d56c992c..3ec2c737 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/base/PrefKeys.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/base/PrefKeys.java @@ -24,6 +24,7 @@ public class PrefKeys { public static final String USER_DP_URL = "USER_DP_UR_V2L"; public static final String USER_KYC_SUBMITTED = "USER_KYC_SUBMITTED_V2"; public static final String USER_KYC_VERIFIED = "USER_VERIFIED_V2"; + public static final String USER_EMAIL_VERIFIED = "USER_EMAIL_VERIFIED_V2"; public static final String USER_ACTIVE = "USER_ACTIVE_V2"; public static final String USER_CM_REGISTRATION_ID = "USER_CM_REGISTRATION_ID_V2"; public static final String USER_IS_REFERRED = "USER_IS_REFERRED_V2"; diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/common/customwidgets/common/GenericEditTextPromptDialog.java b/app/src/main/java/com/swifttech/remit/jmecustomer/common/customwidgets/common/GenericEditTextPromptDialog.java index d546e289..83cc230d 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/common/customwidgets/common/GenericEditTextPromptDialog.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/common/customwidgets/common/GenericEditTextPromptDialog.java @@ -31,9 +31,6 @@ public class GenericEditTextPromptDialog extends DialogFragment implements View. private GenericEditTextPromptListener listener; private boolean shouldBeCancellable = true; - - - @Override public Dialog onCreateDialog(Bundle savedInstanceState) { MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(getActivity()); diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/home/gateway/HomeV2Gateway.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/home/gateway/HomeV2Gateway.java index ff948443..4acce759 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/home/gateway/HomeV2Gateway.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/home/gateway/HomeV2Gateway.java @@ -9,10 +9,12 @@ import com.swifttech.remit.jmecustomer.features.home.model.UserInfoModelV2; import com.swifttech.remit.jmecustomer.features.home.model.UserInfoV2DataApiResponse; import com.swifttech.remit.jmecustomer.features.home.model.UserCachedState; import com.swifttech.remit.jmecustomer.features.home.presenter.HomeV2InteractorInterface; +import com.swifttech.remit.jmecustomer.utils.Constants; import com.swifttech.remit.jmecustomer.utils.https.HttpClientV2; import com.google.gson.JsonObject; import io.reactivex.Observable; +import okhttp3.ResponseBody; public class HomeV2Gateway extends PrivilegedGateway implements HomeV2InteractorInterface.HomeV2GatewayInterface { @@ -72,6 +74,7 @@ public class HomeV2Gateway extends PrivilegedGateway implements HomeV2Interactor sharedPreferenceEditor.putString(PrefKeys.USER_REWAD_POINT, loginApiResponseModelV2.getRewardPoint()); sharedPreferenceEditor.putString(PrefKeys.USER_SOURCE_ID, loginApiResponseModelV2.getSourceId()); sharedPreferenceEditor.putBoolean(PrefKeys.USER_KYC_VERIFIED, loginApiResponseModelV2.isVerified()); + sharedPreferenceEditor.putBoolean(PrefKeys.USER_EMAIL_VERIFIED, loginApiResponseModelV2.getEmailVerified()); sharedPreferenceEditor.putString(PrefKeys.USER_WALLET_NUMBER, loginApiResponseModelV2.getWalletNumber()); sharedPreferenceEditor.putString(PrefKeys.USER_YEARLY_REMAINING_LIMIT, loginApiResponseModelV2.getYearlyLimit()); sharedPreferenceEditor.putString(PrefKeys.USER_DOB, loginApiResponseModelV2.getUserDob()); @@ -130,6 +133,17 @@ public class HomeV2Gateway extends PrivilegedGateway implements HomeV2Interactor RemitApplication.getStorage().edit().putString(PrefKeys.KJ_BANK_NOTICE_SKIP_DAY, date).apply(); } + @Override + public Observable verifyEmailCode(String auth, + String userId, + String OTP, + String requestFor) { + JsonObject jsonObject = new JsonObject(); + jsonObject.addProperty(Constants.USER_ID_KEY, userId); + jsonObject.addProperty(Constants.OTP_KEY, OTP); + jsonObject.addProperty(Constants.REQUEST_FOR_KEY, requestFor); + return HttpClientV2.getInstance().verifyEmailCode(auth,jsonObject); + } @Override @@ -205,4 +219,17 @@ public class HomeV2Gateway extends PrivilegedGateway implements HomeV2Interactor return Observable.just(userInfoModelV2); } + + @Override + public Observable requestForOtp(String auth, + String userId, + String OTP, + String requestFor + ) { + JsonObject jsonObject = new JsonObject(); + jsonObject.addProperty(Constants.USER_ID_KEY, userId); + jsonObject.addProperty(Constants.OTP_KEY, OTP); + jsonObject.addProperty(Constants.REQUEST_FOR_KEY, requestFor); + return HttpClientV2.getInstance().requestForOtp(auth, jsonObject); + } } diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/home/model/UserInfoModelV2.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/home/model/UserInfoModelV2.java index dc6f03b1..846bbb37 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/home/model/UserInfoModelV2.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/home/model/UserInfoModelV2.java @@ -144,6 +144,10 @@ public class UserInfoModelV2 { @Expose protected String hasUpdatedDefaultCredentials; + @SerializedName("hasVerifiedOTP") + @Expose + protected Boolean isEmailVerified; + public String getReferralCode() { return referralCode; @@ -493,4 +497,12 @@ public class UserInfoModelV2 { public void setHasUpdatedDefaultCredentials(String hasUpdatedDefaultCredentials) { this.hasUpdatedDefaultCredentials = hasUpdatedDefaultCredentials; } + + public Boolean getEmailVerified() { + return isEmailVerified; + } + + public void setEmailVerified(Boolean emailVerified) { + isEmailVerified = emailVerified; + } } diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/home/presenter/HomeNotificationHandler.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/home/presenter/HomeNotificationHandler.java index d6c562eb..95ad4570 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/home/presenter/HomeNotificationHandler.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/home/presenter/HomeNotificationHandler.java @@ -24,6 +24,7 @@ public class HomeNotificationHandler { private String redirectTo; private boolean isExistingCustomer; private String hasUpdatedDefaultCredentials; + private boolean isEmailVerified; public HomeNotificationHandler( RemitApplication.StringExtractor stringExtractor, @@ -33,7 +34,8 @@ public class HomeNotificationHandler { String redirectTo, boolean shouldShowTermsAndCondition, boolean isExistingCustomer, - String hasUpdatedDefaultCredentials + String hasUpdatedDefaultCredentials, + boolean isEmailVerified ) { this.kycSubmit = kycSubmit; this.isVerified = isVerified; @@ -43,6 +45,7 @@ public class HomeNotificationHandler { this.shouldShowTermsAndCondition = shouldShowTermsAndCondition; this.isExistingCustomer = isExistingCustomer; this.hasUpdatedDefaultCredentials = hasUpdatedDefaultCredentials; + this.isEmailVerified = isEmailVerified; } private HomeNotificationHandler(RemitApplication.StringExtractor stringExtractor) { @@ -57,19 +60,28 @@ public class HomeNotificationHandler { private HomeNotificationViewDTO generateHomeNotificaationViewExplicitlyFromType(HomeNoticeViewTypeEnum type) { switch (type) { case KYC_NOT_SUBMITTED: - HomeNotificationViewDTO kycNotSubmittedNotificationViewDTO = new HomeNotificationViewDTO(stringExtractor.getStringFromStringId(R.string.kyc_fill_text), stringExtractor.getStringFromStringId(R.string.complete_your_registration_text), isExistingCustomer, HomeNoticeViewTypeEnum.KYC_NOT_SUBMITTED,hasUpdatedDefaultCredentials); + HomeNotificationViewDTO kycNotSubmittedNotificationViewDTO = new HomeNotificationViewDTO(stringExtractor.getStringFromStringId(R.string.kyc_fill_text), stringExtractor.getStringFromStringId(R.string.complete_your_registration_text), isExistingCustomer, HomeNoticeViewTypeEnum.KYC_NOT_SUBMITTED, hasUpdatedDefaultCredentials); kycNotSubmittedNotificationViewDTO.setFocused(true); return kycNotSubmittedNotificationViewDTO; + case KYC_NOT_VERIFIED: - return new HomeNotificationViewDTO(stringExtractor.getStringFromStringId(R.string.kyc_verify_pending_text), stringExtractor.getStringFromStringId(R.string.verification_in_aproval_process_text), isExistingCustomer, HomeNoticeViewTypeEnum.KYC_NOT_VERIFIED,hasUpdatedDefaultCredentials); + return new HomeNotificationViewDTO(stringExtractor.getStringFromStringId(R.string.kyc_verify_pending_text), stringExtractor.getStringFromStringId(R.string.verification_in_aproval_process_text), isExistingCustomer, HomeNoticeViewTypeEnum.KYC_NOT_VERIFIED, hasUpdatedDefaultCredentials); + case CHANGE_TXN_PIN: - HomeNotificationViewDTO changeTxnPinNotificationViewDTO = new HomeNotificationViewDTO(stringExtractor.getStringFromStringId(R.string.change_txn_pin), stringExtractor.getStringFromStringId(R.string.change_txn_pin_detail), isExistingCustomer, HomeNoticeViewTypeEnum.CHANGE_TXN_PIN,hasUpdatedDefaultCredentials); + HomeNotificationViewDTO changeTxnPinNotificationViewDTO = new HomeNotificationViewDTO(stringExtractor.getStringFromStringId(R.string.change_txn_pin), stringExtractor.getStringFromStringId(R.string.change_txn_pin_detail), isExistingCustomer, HomeNoticeViewTypeEnum.CHANGE_TXN_PIN, hasUpdatedDefaultCredentials); changeTxnPinNotificationViewDTO.setFocused(true); return changeTxnPinNotificationViewDTO; + case CHANGE_TXN_PIN_N_PASS: - HomeNotificationViewDTO changeTxnPinNPassNotificationViewDTO = new HomeNotificationViewDTO(stringExtractor.getStringFromStringId(R.string.change_txn_pin_n_pass), stringExtractor.getStringFromStringId(R.string.change_txn_pin_n_pass_detail), isExistingCustomer, HomeNoticeViewTypeEnum.CHANGE_TXN_PIN_N_PASS,hasUpdatedDefaultCredentials); + HomeNotificationViewDTO changeTxnPinNPassNotificationViewDTO = new HomeNotificationViewDTO(stringExtractor.getStringFromStringId(R.string.change_txn_pin_n_pass), stringExtractor.getStringFromStringId(R.string.change_txn_pin_n_pass_detail), isExistingCustomer, HomeNoticeViewTypeEnum.CHANGE_TXN_PIN_N_PASS, hasUpdatedDefaultCredentials); changeTxnPinNPassNotificationViewDTO.setFocused(true); return changeTxnPinNPassNotificationViewDTO; + + case EMAIL_NOT_VERIFIED: + HomeNotificationViewDTO emailNotVerifiedDto = new HomeNotificationViewDTO(stringExtractor.getStringFromStringId(R.string.verify_email_text), stringExtractor.getStringFromStringId(R.string.verify_email_detail_text), isExistingCustomer, HomeNoticeViewTypeEnum.EMAIL_NOT_VERIFIED, hasUpdatedDefaultCredentials); + emailNotVerifiedDto.setFocused(true); + return emailNotVerifiedDto; + default: return null; @@ -85,19 +97,21 @@ public class HomeNotificationHandler { } private HomeNotificationViewDTO generateApproriateRegistrationRelatedNotification() { - if (!kycSubmit) - return generateHomeNotificaationViewExplicitlyFromType(HomeNoticeViewTypeEnum.KYC_NOT_SUBMITTED); - else if (!isVerified) - return generateHomeNotificaationViewExplicitlyFromType(HomeNoticeViewTypeEnum.KYC_NOT_VERIFIED); - else if (hasUpdatedDefaultCredentials.equals("1")) - return generateHomeNotificaationViewExplicitlyFromType(HomeNoticeViewTypeEnum.CHANGE_TXN_PIN); - else if (hasUpdatedDefaultCredentials.equals("2")) - return generateHomeNotificaationViewExplicitlyFromType(HomeNoticeViewTypeEnum.CHANGE_TXN_PIN_N_PASS); - else - return null; + if (!isEmailVerified) + return generateHomeNotificaationViewExplicitlyFromType(HomeNoticeViewTypeEnum.EMAIL_NOT_VERIFIED); + else if (!kycSubmit) + return generateHomeNotificaationViewExplicitlyFromType(HomeNoticeViewTypeEnum.KYC_NOT_SUBMITTED); + else if (!isVerified) + return generateHomeNotificaationViewExplicitlyFromType(HomeNoticeViewTypeEnum.KYC_NOT_VERIFIED); + else if (hasUpdatedDefaultCredentials.equals("1")) + return generateHomeNotificaationViewExplicitlyFromType(HomeNoticeViewTypeEnum.CHANGE_TXN_PIN); + else if (hasUpdatedDefaultCredentials.equals("2")) + return generateHomeNotificaationViewExplicitlyFromType(HomeNoticeViewTypeEnum.CHANGE_TXN_PIN_N_PASS); + else + return null; } public enum HomeNoticeViewTypeEnum { - KYC_NOT_SUBMITTED, KYC_NOT_VERIFIED, AUTO_DEBIT_FILLUP_REQUIRED, PENNY_TEST_REQUIRED, CHANGE_TXN_PIN, CHANGE_TXN_PIN_N_PASS + KYC_NOT_SUBMITTED, KYC_NOT_VERIFIED, AUTO_DEBIT_FILLUP_REQUIRED, PENNY_TEST_REQUIRED, CHANGE_TXN_PIN, CHANGE_TXN_PIN_N_PASS, EMAIL_NOT_VERIFIED } } diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/home/presenter/HomeV2InteractorInterface.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/home/presenter/HomeV2InteractorInterface.java index 9cf6e7c8..325e4bf4 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/home/presenter/HomeV2InteractorInterface.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/home/presenter/HomeV2InteractorInterface.java @@ -6,6 +6,7 @@ import com.swifttech.remit.jmecustomer.features.home.model.UserInfoModelV2; import com.swifttech.remit.jmecustomer.features.home.model.UserInfoV2DataApiResponse; import io.reactivex.Observable; +import okhttp3.ResponseBody; public interface HomeV2InteractorInterface extends BaseInteractorInterface { @@ -19,6 +20,9 @@ public interface HomeV2InteractorInterface extends BaseInteractorInterface { Observable getCachedUserInfoFromDB(); + Observable requestForOtp(String auth, String userId, String OTP, String requestFor); + + void updateSubmittedKycInCache(boolean action); @@ -30,6 +34,12 @@ public interface HomeV2InteractorInterface extends BaseInteractorInterface { void updateKJBankNoticeSkipDay(String date); + Observable verifyEmailCode(String auth, + String userId, + String OTP, + String requestFor + ); + } } diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/home/presenter/HomeV2PresenterInterface.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/home/presenter/HomeV2PresenterInterface.java index 13ad087b..5640513d 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/home/presenter/HomeV2PresenterInterface.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/home/presenter/HomeV2PresenterInterface.java @@ -8,6 +8,7 @@ import com.swifttech.remit.jmecustomer.base.BaseContractInterface; import com.swifttech.remit.jmecustomer.base.BasePresenterInterface; import com.swifttech.remit.jmecustomer.features.home.model.HomeNotificationViewDTO; import com.swifttech.remit.jmecustomer.features.home.model.HomeViewRelatedDTOV2; +import com.swifttech.remit.jmecustomer.features.recipientmanagement.model.recipientlistingV3.ReceiverInfoV3Model; public interface HomeV2PresenterInterface extends BasePresenterInterface { @@ -21,6 +22,10 @@ public interface HomeV2PresenterInterface extends BasePresenterInterface { void showChangePinScreen(); void showChangePinNPassScreen(); + void postEmailCodeToVerify(String emailCode); + + void showVerifyEmailDialog(); + String checkIfUserVerified(); void storeAppUpdateDecision(boolean booleanExtra); @@ -29,6 +34,8 @@ public interface HomeV2PresenterInterface extends BasePresenterInterface { void checkIfFingerprintPromptShouldBeShown(); + void requestForOtp(); + LiveData subscribeToHomeRelatedDataEvent(); @@ -52,6 +59,9 @@ public interface HomeV2PresenterInterface extends BasePresenterInterface { void showChangePinNPassScreen(); + void showVerifyEmailDialog(); + void onEmailVerifySuccess(); + void showUpdateScreen(String build, String info,boolean isForcedUpdate); Context getContext(); @@ -61,5 +71,8 @@ public interface HomeV2PresenterInterface extends BasePresenterInterface { + + + } } diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/home/presenter/HomeViewModel.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/home/presenter/HomeViewModel.java index 670b311d..bd9e99e5 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/home/presenter/HomeViewModel.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/home/presenter/HomeViewModel.java @@ -1,5 +1,6 @@ package com.swifttech.remit.jmecustomer.features.home.presenter; +import android.annotation.SuppressLint; import android.util.Log; import androidx.lifecycle.LiveData; @@ -15,8 +16,14 @@ import com.swifttech.remit.jmecustomer.features.home.model.AppUpdateModel; import com.swifttech.remit.jmecustomer.features.home.model.HomeNotificationViewDTO; import com.swifttech.remit.jmecustomer.features.home.model.HomeViewRelatedDTOV2; import com.swifttech.remit.jmecustomer.features.home.model.UserInfoModelV2; +import com.swifttech.remit.jmecustomer.features.notice.presenter.NoticeViewModel; +import com.swifttech.remit.jmecustomer.features.recipientmanagement.model.recipientlistingV3.ReceiverInfoV3Model; +import com.swifttech.remit.jmecustomer.features.recipientmanagement.presenter.recipientlistingV3.RecipientListingV3Presenter; import com.swifttech.remit.jmecustomer.utils.Constants; +import com.swifttech.remit.jmecustomer.utils.https.GenericApiObserverResponseV2; +import com.swifttech.remit.jmecustomer.utils.https.GenericResponseDataModel; import com.swifttech.remit.jmecustomer.utils.https.HTTPConstants; +import com.swifttech.remit.jmecustomer.utils.https.MessageResponseDataModel; import com.swifttech.remit.jmecustomer.utils.https.SessionExpiredException; import com.swifttech.remit.jmecustomer.utils.https.UserSessionObserverResponse; @@ -30,6 +37,8 @@ import io.reactivex.functions.Function; import io.reactivex.schedulers.Schedulers; import retrofit2.HttpException; +import static com.swifttech.remit.jmecustomer.utils.Constants.REQUEST_FOR_REC_VALUE; + public class HomeViewModel extends BaseViewModel implements HomeV2PresenterInterface { private final HomeV2ContractInterface view; private final HomeV2InteractorInterface.HomeV2GatewayInterface gateway; @@ -110,6 +119,29 @@ public class HomeViewModel extends BaseViewModel implements HomeV2PresenterInter } + @Override + public void postEmailCodeToVerify(String OTP) { + compositeDisposable.add( gateway.verifyEmailCode( + gateway.getAuth(), + gateway.getUserID(), + OTP, + Constants.REQUEST_FOR_REG_VALUE) + .doOnSubscribe(subs -> view.showProgressBar(true, "")) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .doFinally(() -> view.showProgressBar(false, "")) + .subscribeWith(new UploadEmailCodeObserver(view::onEmailVerifySuccess))); + } + + @Override + public void showVerifyEmailDialog() { + if (notificationViewDTO != null) { +// requestForOtp(); + view.showVerifyEmailDialog(); + } + } + + @Override public String checkIfUserVerified() { String resultMessage = null; @@ -145,6 +177,23 @@ public class HomeViewModel extends BaseViewModel implements HomeV2PresenterInter // } } + @Override + public void requestForOtp() { + compositeDisposable.add( + this.gateway.requestForOtp( + gateway.getAuth(), + gateway.getUserID(), + "", + Constants.REQUEST_FOR_REG_VALUE + ) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .doOnSubscribe(disposable -> view.showProgressBar(true, getStringfromStringId(R.string.processing_request_for_otp_text))) + .doFinally(() -> view.showProgressBar(false, "")) + .subscribeWith(new RequestEmailCodeObserver(view::showVerifyEmailDialog)) + ); + } + @Override public LiveData subscribeToHomeRelatedDataEvent() { return homeRelatedMutableLiveData; @@ -241,7 +290,8 @@ public class HomeViewModel extends BaseViewModel implements HomeV2PresenterInter userInfoModelV2.getRedirectTo(), shouldShowTermsAndCondition, userInfoModelV2.getExistingCustomer(), - userInfoModelV2.getHasUpdatedDefaultCredentials()) + userInfoModelV2.getHasUpdatedDefaultCredentials(), + userInfoModelV2.getEmailVerified()) .generateAppropriateHomeNotificationViewDTO(); @@ -287,4 +337,87 @@ public class HomeViewModel extends BaseViewModel implements HomeV2PresenterInter }); } } + + public class UploadEmailCodeObserver extends GenericApiObserverResponseV2 { + + Runnable task; + + public UploadEmailCodeObserver(Runnable task) { + this.task = task; + } + + @Override + protected void onSuccess(GenericResponseDataModel t) { + + if (t.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) { + if (task != null) + task.run(); + + + } else { + if(t.getErrorCode().equalsIgnoreCase(Constants.OPT_EXPIRED_CODE_V2)){ + view.showPopUpMessage(t.getMsg(), CustomAlertDialog.AlertType.FAILED, alertType -> requestForOtp()); + }else{ + view.showPopUpMessage(t.getMsg(), CustomAlertDialog.AlertType.FAILED, null); + + } + } + } + + @Override + public void onFailed(String message) { + view.showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, null); + } + + @Override + protected void onConnectionNotEstablished(String message) { + view.showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, null); + } + + @Override + protected void unauthorizedAccess(String message) { + gateway.clearAllUserData(); + view.showPopUpMessage(message, CustomAlertDialog.AlertType.ALERT, alertType -> view.logout()); + + } + } + + public class RequestEmailCodeObserver extends GenericApiObserverResponseV2 { + + Runnable task; + + public RequestEmailCodeObserver(Runnable task) { + this.task=task; + } + + @Override + protected void onSuccess(GenericResponseDataModel t) { + + if (t.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) { + if (task != null) + task.run(); + + + } else { + view.showPopUpMessage(t.getMsg(), CustomAlertDialog.AlertType.FAILED, null); + } + } + + @Override + public void onFailed(String message) { + view.showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, null); + } + + @Override + protected void onConnectionNotEstablished(String message) { + view.showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, null); + } + + @Override + protected void unauthorizedAccess(String message) { + gateway.clearAllUserData(); + view.showPopUpMessage(message, CustomAlertDialog.AlertType.ALERT, alertType -> view.logout()); + + } + } } diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/home/view/HomeActivityV2.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/home/view/HomeActivityV2.java index f5e539f8..eb1422b1 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/home/view/HomeActivityV2.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/home/view/HomeActivityV2.java @@ -30,6 +30,7 @@ import com.google.android.material.navigation.NavigationView; import com.swifttech.remit.jmecustomer.R; import com.swifttech.remit.jmecustomer.base.BaseActivity; import com.swifttech.remit.jmecustomer.common.customwidgets.CustomAlertDialog; +import com.swifttech.remit.jmecustomer.common.customwidgets.common.GenericEditTextPromptDialog; import com.swifttech.remit.jmecustomer.features.aboutscreen.view.AboutFastRemit; import com.swifttech.remit.jmecustomer.features.agentslisting.view.AgentListV2Activity; import com.swifttech.remit.jmecustomer.features.appupdate.AppUpdateActivity; @@ -97,7 +98,7 @@ public class HomeActivityV2 extends BaseActivity implements HomeParentViewContra private Fragment currentFragment; private FragmentManager manager; -// private HomeV2PresenterInterface presenter; + // private HomeV2PresenterInterface presenter; private HomeViewModel viewModel; private static int WITHDRAW_AMOUNT_REQUEST_CODE = 24943; private static int SEND_MONEY_REQUEST_CODE = 24944; @@ -105,6 +106,8 @@ public class HomeActivityV2 extends BaseActivity implements HomeParentViewContra private Rect notificationViewBoundry; private boolean isNotificaitonViewActive; + + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -116,7 +119,7 @@ public class HomeActivityV2 extends BaseActivity implements HomeParentViewContra private void initialize() { manager = getSupportFragmentManager(); - HomeViewModelFactory homeViewModelFactory = new HomeViewModelFactory(this, new HomeV2Gateway(), getIntent().getBooleanExtra(PROMPT_FINGERPRINT_BUNDLE_FLAG, false)); + HomeViewModelFactory homeViewModelFactory = new HomeViewModelFactory(this, new HomeV2Gateway(), getIntent().getBooleanExtra(PROMPT_FINGERPRINT_BUNDLE_FLAG, false)); viewModel = new ViewModelProvider(this, homeViewModelFactory).get(HomeViewModel.class); } @@ -231,10 +234,6 @@ public class HomeActivityV2 extends BaseActivity implements HomeParentViewContra } - - - - private void showLogoutConfirmationDialog() { MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this); @@ -299,7 +298,6 @@ public class HomeActivityV2 extends BaseActivity implements HomeParentViewContra } - @Override public void showTodaysRateView() { if (isNotificaitonViewActive()) @@ -470,7 +468,6 @@ public class HomeActivityV2 extends BaseActivity implements HomeParentViewContra } - @Override public void showUpdateScreen(String build, String info, boolean isForceUpdate) { if (!this.viewModel.shouldNotPromptAppUpdate()) { @@ -500,6 +497,7 @@ public class HomeActivityV2 extends BaseActivity implements HomeParentViewContra } + @Override public void performLogout() { viewModel.clearAllData(); @@ -511,6 +509,7 @@ public class HomeActivityV2 extends BaseActivity implements HomeParentViewContra public void showPrivilegedOperationView(Boolean action) { } + @Override public void showKYCScreen(boolean isForExistingCustomer) { if (isForExistingCustomer) { @@ -519,6 +518,7 @@ public class HomeActivityV2 extends BaseActivity implements HomeParentViewContra KYCV3Activity.startActivity(this, false, "", ""); } } + @Override public void showChangePinScreen() { startActivity(new Intent(this, ChangeTxnPinActivity.class)); @@ -529,6 +529,18 @@ public class HomeActivityV2 extends BaseActivity implements HomeParentViewContra startActivity(new Intent(this, ChangePassNPinActivity.class)); } + @Override + public void showVerifyEmailDialog() { + if (currentFragment instanceof HomeFragmentV2) + ((HomeFragmentV2) currentFragment).showVerifyEmailDialog(); + } + + @Override + public void onEmailVerifySuccess() { + if (currentFragment instanceof HomeFragmentV2) + ((HomeFragmentV2) currentFragment).startPulltoRefresh(true); + } + public void setWalletNo(TextView controlNo, String walletNumber, String bankName) { if (walletNumber == null || walletNumber.length() <= 0) { walletNumber = getString(R.string.na_text); @@ -559,7 +571,7 @@ public class HomeActivityV2 extends BaseActivity implements HomeParentViewContra private void showFetaureComingSoon() { - CustomAlertDialog customAlertDialog = new CustomAlertDialog(); + CustomAlertDialog customAlertDialog = new CustomAlertDialog(); customAlertDialog.setAlertType(CustomAlertDialog.AlertType.ALERT); customAlertDialog.setMessage(getString(R.string.featureCommingSoon_text)); FragmentManager fragmentManager = getSupportFragmentManager(); @@ -568,11 +580,16 @@ public class HomeActivityV2 extends BaseActivity implements HomeParentViewContra } @Override - public void onBackPressed() { - showExitConfirmationDialog(); + public void onBackPressed() { + GenericEditTextPromptDialog genericEditTextPromptDialog=null; + if (currentFragment instanceof HomeFragmentV2){ + genericEditTextPromptDialog=((HomeFragmentV2) currentFragment).getGenericPromptDialog(); + } + if(genericEditTextPromptDialog!=null){ + genericEditTextPromptDialog.dismiss(); + }else{ + showExitConfirmationDialog(); + } } - - - } diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/home/view/HomeFragmentV2.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/home/view/HomeFragmentV2.java index d6c06544..d329a1ae 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/home/view/HomeFragmentV2.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/home/view/HomeFragmentV2.java @@ -25,6 +25,7 @@ import androidx.transition.TransitionManager; import com.swifttech.remit.jmecustomer.R; import com.swifttech.remit.jmecustomer.base.BaseFragment; import com.swifttech.remit.jmecustomer.common.customwidgets.LockableScrollView; +import com.swifttech.remit.jmecustomer.common.customwidgets.common.GenericEditTextPromptDialog; import com.swifttech.remit.jmecustomer.features.home.HomeParentViewContractV2; import com.swifttech.remit.jmecustomer.features.home.adapters.HomeMenuRvAdapterV2; import com.swifttech.remit.jmecustomer.features.home.model.HomeNotificationViewDTO; @@ -32,6 +33,7 @@ import com.swifttech.remit.jmecustomer.features.home.model.MenuItem; import com.swifttech.remit.jmecustomer.features.home.presenter.HomeViewModel; import com.swifttech.remit.jmecustomer.features.home.view.notifications.ChangePinNPassNotificationView; import com.swifttech.remit.jmecustomer.features.home.view.notifications.ChangePinNotificationView; +import com.swifttech.remit.jmecustomer.features.home.view.notifications.EmailNotVerifiedView; import com.swifttech.remit.jmecustomer.features.home.view.notifications.HomeNotificiationViewFactory; import com.swifttech.remit.jmecustomer.features.home.view.notifications.KYCNotSubmittedNotificationView; import com.swifttech.remit.jmecustomer.features.home.view.notifications.KYCNotVerifiedNotificationView; @@ -47,7 +49,8 @@ import io.reactivex.disposables.CompositeDisposable; public class HomeFragmentV2 extends BaseFragment implements HomeMenuRvAdapterV2.HomeMenuClickListenerV2, - View.OnClickListener { + View.OnClickListener, + GenericEditTextPromptDialog.GenericEditTextPromptListener { private static final int KYC_FORM_REQUEST_FROM_HOME = 45432; private static final int PENNY_REQUEST_FROM_HOME = 45433; @@ -88,14 +91,13 @@ public class HomeFragmentV2 extends BaseFragment implements View lb_rewardpoint; - - @BindView(R.id.swiperefresh) SwipeRefreshLayout swiperefresh; HomeMenuRvAdapterV2 homeMenuRvAdapterV2; private CompositeDisposable compositeDisposable; private HomeViewModel homeViewModel; + private GenericEditTextPromptDialog genericPromptDialog; @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { @@ -138,7 +140,7 @@ public class HomeFragmentV2 extends BaseFragment implements swiperefresh.setOnRefreshListener(() -> { - if(homeViewModel!=null){ + if (homeViewModel != null) { homeViewModel.getRequiredData(); } }); @@ -258,6 +260,8 @@ public class HomeFragmentV2 extends BaseFragment implements homeViewModel.showChangePinScreen(); } else if (notificationView instanceof ChangePinNPassNotificationView) { homeViewModel.showChangePinNPassScreen(); + } else if (notificationView instanceof EmailNotVerifiedView) { + homeViewModel.showVerifyEmailDialog(); } } @@ -348,4 +352,26 @@ public class HomeFragmentV2 extends BaseFragment implements }, 500); } + public void showVerifyEmailDialog() { + genericPromptDialog = new GenericEditTextPromptDialog(); + genericPromptDialog.setTitleMessage(getString(R.string.enterCodeFromEmail_text)); + genericPromptDialog.setCancellable(false); + genericPromptDialog.setListener(this); + if (!genericPromptDialog.isAdded()) + genericPromptDialog.show(getActivity().getSupportFragmentManager(), "PROMPTEDITTEXT"); + } + + public GenericEditTextPromptDialog getGenericPromptDialog() { + return genericPromptDialog; + } + + @Override + public void onEmailCodeNegativeButtonPressed() { + + } + + @Override + public void onEmailCodePositiveBtnPressed(String emailCode) { + homeViewModel.postEmailCodeToVerify(emailCode); + } } diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/home/view/notifications/EmailNotVerifiedView.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/home/view/notifications/EmailNotVerifiedView.java new file mode 100644 index 00000000..45a4ed81 --- /dev/null +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/home/view/notifications/EmailNotVerifiedView.java @@ -0,0 +1,73 @@ +package com.swifttech.remit.jmecustomer.features.home.view.notifications; + +import android.animation.ObjectAnimator; +import android.animation.ValueAnimator; +import android.content.Context; +import android.graphics.drawable.Drawable; +import android.util.AttributeSet; +import android.view.LayoutInflater; +import android.view.View; +import android.widget.ImageView; +import android.widget.TextView; + +import com.swifttech.remit.jmecustomer.R; + +import butterknife.BindView; +import butterknife.ButterKnife; + +public class EmailNotVerifiedView extends NotificaitonBaseView { + + @BindView(R.id.kftc_renew_title) + TextView kftc_renew_title; + + @BindView(R.id.kftc_renew_text) + TextView kftc_renew_text; + + @BindView(R.id.kftc_renew_image) + ImageView kftc_renew_image; + private ObjectAnimator anim; + + public EmailNotVerifiedView(Context context) { + super(context); + init(context); + } + + public EmailNotVerifiedView(Context context, AttributeSet attrs) { + super(context, attrs); + init(context); + } + + public EmailNotVerifiedView(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + init(context); + } + + @Override + public void animateNotification() { + if(anim==null||!anim.isRunning()) { + anim = ObjectAnimator.ofFloat(kftc_renew_image, View.ROTATION, 0,15,-15,9,-9,0); + anim.setStartDelay(300); + anim.setDuration(2000).setRepeatMode(ValueAnimator.RESTART); + anim.setRepeatCount(ValueAnimator.INFINITE); + anim.start(); + } + } + + private void init(Context context) + { + View view= LayoutInflater.from(context).inflate(R.layout.notification_auto_debit_required, this, true); + ButterKnife.bind(view,this); + } + + public void setTitle(String title) { + kftc_renew_title.setText(title); + } + + public void setMessage(String messageBody) { + kftc_renew_text.setText(messageBody); + + } + public void setImage(Drawable drawableResource){ + kftc_renew_image.setImageDrawable(drawableResource); + } +} diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/home/view/notifications/HomeNotificiationViewFactory.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/home/view/notifications/HomeNotificiationViewFactory.java index 06a1fa25..90904c9d 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/home/view/notifications/HomeNotificiationViewFactory.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/home/view/notifications/HomeNotificiationViewFactory.java @@ -20,13 +20,21 @@ public class HomeNotificiationViewFactory { return getChangePinView(homeNoticeViewDTO, context); case CHANGE_TXN_PIN_N_PASS: return getChangePinNPassView(homeNoticeViewDTO, context); + + case EMAIL_NOT_VERIFIED: + return getEmailNotVerifiedView(homeNoticeViewDTO,context); default: return null; } } - + private static EmailNotVerifiedView getEmailNotVerifiedView(HomeNotificationViewDTO homeNoticeViewDTO, Context context) { + EmailNotVerifiedView view = new EmailNotVerifiedView(context); + view.setTitle(homeNoticeViewDTO.getTitle()); + view.setMessage(homeNoticeViewDTO.getMessageBody()); + return view; + } private static ChangePinNPassNotificationView getChangePinNPassView(HomeNotificationViewDTO homeNoticeViewDTO, Context context) { ChangePinNPassNotificationView view = new ChangePinNPassNotificationView(context); view.setTitle(homeNoticeViewDTO.getTitle()); diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/existingCustomer/gateway/ExistingExistingKYCV3Gateway.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/existingCustomer/gateway/ExistingExistingKYCV3Gateway.java index 3601407e..035b9c40 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/existingCustomer/gateway/ExistingExistingKYCV3Gateway.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/existingCustomer/gateway/ExistingExistingKYCV3Gateway.java @@ -15,6 +15,7 @@ import com.swifttech.remit.jmecustomer.features.kyc.existingCustomer.model.Exist import com.swifttech.remit.jmecustomer.features.kyc.existingCustomer.model.ExistingPersonalInfoDTO; import com.swifttech.remit.jmecustomer.features.kyc.existingCustomer.model.ExistingPicturesDTO; import com.swifttech.remit.jmecustomer.features.kyc.existingCustomer.presenter.ExistingKYCV3GatewayInterface; +import com.swifttech.remit.jmecustomer.utils.Constants; import com.swifttech.remit.jmecustomer.utils.https.HttpClientV2; import java.io.File; @@ -164,4 +165,29 @@ public class ExistingExistingKYCV3Gateway extends PrivilegedGateway implements E existingKycRelatedDataDTO.setPictures(mockedPictures); return existingKycRelatedDataDTO; } + + @Override + public Observable verifyEmailCode(String auth, + String userId, + String OTP, + String requestFor) { + JsonObject jsonObject = new JsonObject(); + jsonObject.addProperty(Constants.USER_ID_KEY, userId); + jsonObject.addProperty(Constants.OTP_KEY, OTP); + jsonObject.addProperty(Constants.REQUEST_FOR_KEY, requestFor); + return HttpClientV2.getInstance().verifyEmailCode(auth,jsonObject); + } + + @Override + public Observable requestForOtp( + String auth, + String userId, + String OTP, + String requestFor) { + JsonObject jsonObject = new JsonObject(); + jsonObject.addProperty(Constants.USER_ID_KEY, userId); + jsonObject.addProperty(Constants.OTP_KEY, OTP); + jsonObject.addProperty(Constants.REQUEST_FOR_KEY, requestFor); + return HttpClientV2.getInstance().requestForOtp(auth, jsonObject); + } } diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/existingCustomer/presenter/ExistingKYCV3GatewayInterface.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/existingCustomer/presenter/ExistingKYCV3GatewayInterface.java index 6c59e51b..9d7f52d2 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/existingCustomer/presenter/ExistingKYCV3GatewayInterface.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/existingCustomer/presenter/ExistingKYCV3GatewayInterface.java @@ -26,4 +26,14 @@ public interface ExistingKYCV3GatewayInterface extends PrivilegedGatewayInterfac void saveSenderId(String senderId); ExistingKYCRelatedDataDTO getMockedData(); + + Observable verifyEmailCode(String auth, + String userId, + String OTP, + String requestFor); + + Observable requestForOtp(String auth, + String userId, + String OTP, + String requestFor); } diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/existingCustomer/presenter/ExistingKYCV3PresenterInterface.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/existingCustomer/presenter/ExistingKYCV3PresenterInterface.java index 42d32451..b2152c70 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/existingCustomer/presenter/ExistingKYCV3PresenterInterface.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/existingCustomer/presenter/ExistingKYCV3PresenterInterface.java @@ -23,6 +23,14 @@ public interface ExistingKYCV3PresenterInterface extends BasePresenterInterface void getKycRelatedData(); void setNewToken(String newToken); + void verifyEmailCode(String emailCode); + + void showEmailPopUp(); + + void requestForOtp(); + + + List getOccupationList(); List getSourceOfFundList(); @@ -38,11 +46,6 @@ public interface ExistingKYCV3PresenterInterface extends BasePresenterInterface void kycSubmitSucessForPopUp(); - - - - - interface KYCV3ViewContractInterface extends BaseContractInterface { @@ -50,6 +53,12 @@ public interface ExistingKYCV3PresenterInterface extends BasePresenterInterface void onKYCFormSubmittedSuccessfully(); + void showEmailCodePromptDialog(); + + void onEmailVerifySuccess(); + + + /** diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/existingCustomer/presenter/ExistingKYCV3ViewModel.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/existingCustomer/presenter/ExistingKYCV3ViewModel.java index 8d1a6c99..5184a265 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/existingCustomer/presenter/ExistingKYCV3ViewModel.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/existingCustomer/presenter/ExistingKYCV3ViewModel.java @@ -445,6 +445,41 @@ public class ExistingKYCV3ViewModel extends BaseViewModel implements ExistingKYC this.newToken = newToken; } + @Override + public void verifyEmailCode(String OTP) { + compositeDisposable.add( + gateway.verifyEmailCode( + gateway.getAuth(), + gateway.getUserID(), + OTP, + Constants.REQUEST_FOR_REG_VALUE) + .doOnSubscribe(subs -> view.showProgressBar(true, "")) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .doFinally(() -> view.showProgressBar(false, "")) + .subscribeWith(new UploadEmailCodeObserver(view::onEmailVerifySuccess))); + } + + @Override + public void showEmailPopUp() { + view.showEmailCodePromptDialog(); + } + + @Override + public void requestForOtp() { + compositeDisposable.add( + gateway.requestForOtp( + gateway.getAuth(), + gateway.getUserID(), + "", + Constants.REQUEST_FOR_REG_VALUE) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .doOnSubscribe(disposable -> view.showProgressBar(true, getStringfromStringId(R.string.processing_request_for_otp_text))) + .doFinally(() -> view.showProgressBar(false, "")) + .subscribeWith(new RequestEmailCodeObserver())); + } + @Override public List getOccupationList() { return validator.getExistingKycRelatedDataDTO().getOccupationList(); @@ -513,7 +548,7 @@ public class ExistingKYCV3ViewModel extends BaseViewModel implements ExistingKYC private void getNewAccessToken(Runnable task) { compositeDisposable.add( - loginGateway.loginUser(loginGateway.getBasicAuth(view.getContext()), this.userId, this.userPwd,newToken) + loginGateway.loginUser(loginGateway.getBasicAuth(view.getContext()), this.userId, this.userPwd, newToken) .doOnSubscribe(sub -> view.showProgressBar(true, "")) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) @@ -672,7 +707,6 @@ public class ExistingKYCV3ViewModel extends BaseViewModel implements ExistingKYC } - boolean validateSelectedIDType(ExistingIDTextDTO data) { if (existingKycRelatedDataDTO.getPersonalInformation() == null) existingKycRelatedDataDTO.setPersonalInformation(new ExistingPersonalInfoDTO()); @@ -887,4 +921,81 @@ public class ExistingKYCV3ViewModel extends BaseViewModel implements ExistingKYC } } + public class UploadEmailCodeObserver extends GenericApiObserverResponseV2 { + + Runnable task; + + public UploadEmailCodeObserver(Runnable task) { + this.task = task; + } + + @Override + protected void onSuccess(GenericResponseDataModel t) { + + if (t.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) { + if (task != null) + task.run(); + + + } else { + if(t.getErrorCode().equalsIgnoreCase(Constants.OPT_EXPIRED_CODE_V2)){ + view.showPopUpMessage(t.getMsg(), CustomAlertDialog.AlertType.FAILED, alertType -> requestForOtp()); + }else{ + view.showPopUpMessage(t.getMsg(), CustomAlertDialog.AlertType.FAILED, null); + + } + + } + } + + @Override + public void onFailed(String message) { + view.showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, null); + } + + @Override + protected void onConnectionNotEstablished(String message) { + view.showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, null); + } + + @Override + protected void unauthorizedAccess(String message) { + gateway.clearAllUserData(); + view.showPopUpMessage(message, CustomAlertDialog.AlertType.ALERT, alertType -> view.logout()); + + } + } + + private class RequestEmailCodeObserver extends GenericApiObserverResponseV2 { + + + + @Override + protected void onSuccess(GenericResponseDataModel t) { + + if (t.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) { + showEmailPopUp(); + } else { + view.showPopUpMessage(t.getMsg(), CustomAlertDialog.AlertType.FAILED, null); + } + } + + @Override + public void onFailed(String message) { + view.showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, null); + } + + @Override + protected void onConnectionNotEstablished(String message) { + view.showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, null); + } + + @Override + protected void unauthorizedAccess(String message) { + gateway.clearAllUserData(); + view.showPopUpMessage(message, CustomAlertDialog.AlertType.ALERT, alertType -> view.logout()); + + } + } + } diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/existingCustomer/view/ExistingKYCV3Activity.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/existingCustomer/view/ExistingKYCV3Activity.java index 2c91938f..39b76232 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/existingCustomer/view/ExistingKYCV3Activity.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/existingCustomer/view/ExistingKYCV3Activity.java @@ -16,8 +16,10 @@ import androidx.viewpager.widget.ViewPager; import com.swifttech.remit.jmecustomer.R; import com.swifttech.remit.jmecustomer.base.BaseActivity; +import com.swifttech.remit.jmecustomer.common.customwidgets.CustomAlertDialog; import com.swifttech.remit.jmecustomer.common.customwidgets.GenericViewPagerAdapter; import com.swifttech.remit.jmecustomer.common.customwidgets.GmeTextView; +import com.swifttech.remit.jmecustomer.common.customwidgets.common.GenericEditTextPromptDialog; import com.swifttech.remit.jmecustomer.common.view.AnswerInputDialog; import com.swifttech.remit.jmecustomer.features.customersupport.view.CustomerSupportFragment; import com.swifttech.remit.jmecustomer.features.kyc.existingCustomer.ExistingKYCV3ViewModelFactory; @@ -35,7 +37,7 @@ import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; -public class ExistingKYCV3Activity extends BaseActivity implements ExistingKYCV3PresenterInterface.KYCV3ViewContractInterface, WebBrowserFragmentV2.WebBrowserFragmentActionListener, ViewPager.OnPageChangeListener { +public class ExistingKYCV3Activity extends BaseActivity implements ExistingKYCV3PresenterInterface.KYCV3ViewContractInterface, WebBrowserFragmentV2.WebBrowserFragmentActionListener, ViewPager.OnPageChangeListener, GenericEditTextPromptDialog.GenericEditTextPromptListener { private static final String SHOULD_REDIRECT_TO_PENNY_TEST_BUNDLE_KEY = "SHOULD_REDIRECT_TO_PENNY_TEST_BUNDLE_KEY"; private static final String USER_ID_BUNDLE_KEY = "USER_ID_BUNDLE_KEY"; @@ -67,6 +69,7 @@ public class ExistingKYCV3Activity extends BaseActivity implements ExistingKYCV3 private ExistingKycTermsAndConditionFragment existingKycTermsAndConditionFragment; private GenericViewPagerAdapter kycViewPagerAdapter; private ExistingKYCV3ViewModel viewModel; + private GenericEditTextPromptDialog genericPromptDialog; public static void startActivityForResult(Activity context, boolean shouldRedirectToPennyTestScreen, String userId, String userPwd) { Intent intent = new Intent(context, ExistingKYCV3Activity.class); @@ -199,7 +202,9 @@ public class ExistingKYCV3Activity extends BaseActivity implements ExistingKYCV3 @Override public void onBackPressed() { - if (kycFormViewPager.getCurrentItem() == 0) { + if(genericPromptDialog!=null && genericPromptDialog.isVisible()){ + genericPromptDialog.dismiss(); + }else if (kycFormViewPager.getCurrentItem() == 0) { Intent returnIntent = new Intent(); setResult(Activity.RESULT_CANCELED, returnIntent); finish(); @@ -237,6 +242,7 @@ public class ExistingKYCV3Activity extends BaseActivity implements ExistingKYCV3 viewModel.kycSubmitSucessForPopUp(); } + @Override public void exitView() { Intent returnIntent = new Intent(); @@ -297,7 +303,6 @@ public class ExistingKYCV3Activity extends BaseActivity implements ExistingKYCV3 } - @Override public void onPageScrollStateChanged(int state) { @@ -312,4 +317,31 @@ public class ExistingKYCV3Activity extends BaseActivity implements ExistingKYCV3 public void webViewActionCompleted() { } + + @Override + public void showEmailCodePromptDialog() { + genericPromptDialog = new GenericEditTextPromptDialog(); + genericPromptDialog.setTitleMessage(getString(R.string.enterCodeFromEmail_text)); + genericPromptDialog.setCancellable(false); + genericPromptDialog.setListener(this); + if (!genericPromptDialog.isAdded()) + genericPromptDialog.show(getSupportFragmentManager(), "PROMPTEDITTEXT"); + } + + @Override + public void onEmailVerifySuccess() { + viewModel.kycSubmitSucessForPopUp(); + } + + + + @Override + public void onEmailCodeNegativeButtonPressed() { + + } + + @Override + public void onEmailCodePositiveBtnPressed(String emailCode) { + viewModel.verifyEmailCode(emailCode); + } } diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/existingCustomer/view/termsAndConditions/ExistingKycTermsAndConditionFragment.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/existingCustomer/view/termsAndConditions/ExistingKycTermsAndConditionFragment.java index 8867a1b0..ea4b34b0 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/existingCustomer/view/termsAndConditions/ExistingKycTermsAndConditionFragment.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/existingCustomer/view/termsAndConditions/ExistingKycTermsAndConditionFragment.java @@ -8,12 +8,11 @@ import android.webkit.WebView; import androidx.annotation.Nullable; import androidx.lifecycle.ViewModelProvider; -import com.swifttech.remit.jmecustomer.R; import com.swifttech.remit.jmecustomer.features.kyc.existingCustomer.presenter.ExistingKYCV3ViewModel; import com.swifttech.remit.jmecustomer.features.webbrowser.WebBrowserFragmentV2; import com.swifttech.remit.jmecustomer.features.webbrowser.model.WebRequestModel; -import static com.swifttech.remit.jmecustomer.utils.Constants.JME_TERMS_N_CONDITIONS; +import static com.swifttech.remit.jmecustomer.utils.Constants.JME_REGISTER_TERMS; public class ExistingKycTermsAndConditionFragment extends WebBrowserFragmentV2 { private ExistingKYCV3ViewModel kycv3ViewModel; @@ -31,14 +30,14 @@ public class ExistingKycTermsAndConditionFragment extends WebBrowserFragmentV2 { @Override protected void proceedButtonClicked() { - kycv3ViewModel.kycSubmitSucessForPopUp(); + kycv3ViewModel.requestForOtp(); } @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); showAcceptOption(true); - WebRequestModel webRequestModel = new WebRequestModel("", JME_TERMS_N_CONDITIONS,null); + WebRequestModel webRequestModel = new WebRequestModel("", JME_REGISTER_TERMS,null); setWebRequestData(webRequestModel); loadWebView(); kycv3ViewModel = new ViewModelProvider(requireActivity()).get(ExistingKYCV3ViewModel.class); diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/newCustomer/gateway/KYCV3Gateway.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/newCustomer/gateway/KYCV3Gateway.java index cab0bf3e..72bc402c 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/newCustomer/gateway/KYCV3Gateway.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/newCustomer/gateway/KYCV3Gateway.java @@ -15,6 +15,7 @@ import com.swifttech.remit.jmecustomer.features.kyc.newCustomer.model.NativeCoun import com.swifttech.remit.jmecustomer.features.kyc.newCustomer.model.PersonalInfoDTO; import com.swifttech.remit.jmecustomer.features.kyc.newCustomer.model.PicturesDTO; import com.swifttech.remit.jmecustomer.features.kyc.newCustomer.presenter.KYCV3GatewayInterface; +import com.swifttech.remit.jmecustomer.utils.Constants; import com.swifttech.remit.jmecustomer.utils.https.HttpClientV2; import java.io.File; @@ -177,5 +178,30 @@ public class KYCV3Gateway extends PrivilegedGateway implements KYCV3GatewayInter return kycRelatedDataDTO; } + @Override + public Observable verifyEmailCode(String auth, + String userId, + String OTP, + String requestFor) { + JsonObject jsonObject = new JsonObject(); + jsonObject.addProperty(Constants.USER_ID_KEY, userId); + jsonObject.addProperty(Constants.OTP_KEY, OTP); + jsonObject.addProperty(Constants.REQUEST_FOR_KEY, requestFor); + return HttpClientV2.getInstance().verifyEmailCode(auth,jsonObject); + } + + @Override + public Observable requestForOtp( + String auth, + String userId, + String OTP, + String requestFor) { + JsonObject jsonObject = new JsonObject(); + jsonObject.addProperty(Constants.USER_ID_KEY, userId); + jsonObject.addProperty(Constants.OTP_KEY, OTP); + jsonObject.addProperty(Constants.REQUEST_FOR_KEY, requestFor); + return HttpClientV2.getInstance().requestForOtp(auth, jsonObject); + } + } diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/newCustomer/presenter/KYCV3GatewayInterface.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/newCustomer/presenter/KYCV3GatewayInterface.java index 593ea34f..abdbbe72 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/newCustomer/presenter/KYCV3GatewayInterface.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/newCustomer/presenter/KYCV3GatewayInterface.java @@ -26,4 +26,14 @@ public interface KYCV3GatewayInterface extends PrivilegedGatewayInterface { void saveSenderId(String senderId); KYCRelatedDataDTO getMockedData(); + + Observable verifyEmailCode(String auth, + String userId, + String OTP, + String requestFor); + + Observable requestForOtp(String auth, + String userId, + String OTP, + String requestFor); } diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/newCustomer/presenter/KYCV3PresenterInterface.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/newCustomer/presenter/KYCV3PresenterInterface.java index d2c5d4f4..5fbddd65 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/newCustomer/presenter/KYCV3PresenterInterface.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/newCustomer/presenter/KYCV3PresenterInterface.java @@ -23,6 +23,8 @@ public interface KYCV3PresenterInterface extends BasePresenterInterface { void setNewToken(String newToken); + void showEmailPopUp(); + List getOccupationList(); List getSourceOfFundList(); @@ -41,7 +43,11 @@ public interface KYCV3PresenterInterface extends BasePresenterInterface { void sendForm1KYCUpdate(); - void kycSubmitSucessForPopUp(); + void kycSubmitSuccessForPopUp(); + + void verifyEmailCode(String emailCode); + + void requestForOtp(); interface KYCV3ViewContractInterface extends BaseContractInterface { @@ -59,6 +65,10 @@ public interface KYCV3PresenterInterface extends BasePresenterInterface { void showTermsAndCondition(); + void onEmailVerifySuccess(); + + void showEmailCodePromptDialog(); + void promptToInputAnswer(String question, AnswerInputDialog.AnswerInputDialogListener listener); diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/newCustomer/presenter/KYCV3ViewModel.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/newCustomer/presenter/KYCV3ViewModel.java index c2b13777..72952216 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/newCustomer/presenter/KYCV3ViewModel.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/newCustomer/presenter/KYCV3ViewModel.java @@ -9,6 +9,7 @@ import com.swifttech.remit.jmecustomer.base.BaseViewModel; import com.swifttech.remit.jmecustomer.common.customwidgets.CustomAlertDialog; import com.swifttech.remit.jmecustomer.common.model.FormInputStateDTO; import com.swifttech.remit.jmecustomer.common.view.AnswerInputDialog; +import com.swifttech.remit.jmecustomer.features.kyc.existingCustomer.presenter.ExistingKYCV3ViewModel; import com.swifttech.remit.jmecustomer.features.kyc.newCustomer.gateway.FileDownloadGateway; import com.swifttech.remit.jmecustomer.features.kyc.newCustomer.model.IDTextDTO; import com.swifttech.remit.jmecustomer.features.kyc.newCustomer.model.KYCRelatedDataDTO; @@ -621,6 +622,11 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter this.newToken = newToken; } + @Override + public void showEmailPopUp() { + view.showEmailCodePromptDialog(); + } + @Override public List getOccupationList() { return validator.getKycRelatedDataDTO().getOccupationList(); @@ -685,10 +691,40 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter } @Override - public void kycSubmitSucessForPopUp() { + public void kycSubmitSuccessForPopUp() { view.showPopUpMessage(view.getContext().getResources().getString(R.string.kycSubmitSucessMessage_text), CustomAlertDialog.AlertType.SUCCESS, alertType -> view.exitView()); } + @Override + public void verifyEmailCode(String OTP) { + compositeDisposable.add( + gateway.verifyEmailCode( + gateway.getAuth(), + gateway.getUserID(), + OTP, + Constants.REQUEST_FOR_REG_VALUE) + .doOnSubscribe(subs -> view.showProgressBar(true, "")) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .doFinally(() -> view.showProgressBar(false, "")) + .subscribeWith(new UploadEmailCodeObserver(view::onEmailVerifySuccess))); + } + + @Override + public void requestForOtp() { + compositeDisposable.add( + gateway.requestForOtp( + gateway.getAuth(), + gateway.getUserID(), + "", + Constants.REQUEST_FOR_REG_VALUE) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .doOnSubscribe(disposable -> view.showProgressBar(true, getStringfromStringId(R.string.processing_request_for_otp_text))) + .doFinally(() -> view.showProgressBar(false, "")) + .subscribeWith(new RequestEmailCodeObserver())); + } + private void getNewAccessToken(Runnable task) { compositeDisposable.add( loginGateway.loginUser(loginGateway.getBasicAuth(view.getContext()), this.userId, this.userPwd,newToken) @@ -1103,4 +1139,80 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter task.run(); } } + + public class UploadEmailCodeObserver extends GenericApiObserverResponseV2 { + + Runnable task; + + public UploadEmailCodeObserver(Runnable task) { + this.task = task; + } + + @Override + protected void onSuccess(GenericResponseDataModel t) { + + if (t.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) { + if (task != null) + task.run(); + + + } else { + if(t.getErrorCode().equalsIgnoreCase(Constants.OPT_EXPIRED_CODE_V2)){ + view.showPopUpMessage(t.getMsg(), CustomAlertDialog.AlertType.FAILED, alertType -> requestForOtp()); + }else{ + view.showPopUpMessage(t.getMsg(), CustomAlertDialog.AlertType.FAILED, null); + + } + } + } + + @Override + public void onFailed(String message) { + view.showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, null); + } + + @Override + protected void onConnectionNotEstablished(String message) { + view.showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, null); + } + + @Override + protected void unauthorizedAccess(String message) { + gateway.clearAllUserData(); + view.showPopUpMessage(message, CustomAlertDialog.AlertType.ALERT, alertType -> view.logout()); + + } + } + + private class RequestEmailCodeObserver extends GenericApiObserverResponseV2 { + + + + @Override + protected void onSuccess(GenericResponseDataModel t) { + + if (t.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) { + showEmailPopUp(); + } else { + view.showPopUpMessage(t.getMsg(), CustomAlertDialog.AlertType.FAILED, null); + } + } + + @Override + public void onFailed(String message) { + view.showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, null); + } + + @Override + protected void onConnectionNotEstablished(String message) { + view.showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, null); + } + + @Override + protected void unauthorizedAccess(String message) { + gateway.clearAllUserData(); + view.showPopUpMessage(message, CustomAlertDialog.AlertType.ALERT, alertType -> view.logout()); + + } + } } diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/newCustomer/view/KYCV3Activity.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/newCustomer/view/KYCV3Activity.java index 9fdda22f..98578828 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/newCustomer/view/KYCV3Activity.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/newCustomer/view/KYCV3Activity.java @@ -18,6 +18,7 @@ import com.swifttech.remit.jmecustomer.R; import com.swifttech.remit.jmecustomer.base.BaseActivity; import com.swifttech.remit.jmecustomer.common.customwidgets.GenericViewPagerAdapter; import com.swifttech.remit.jmecustomer.common.customwidgets.GmeTextView; +import com.swifttech.remit.jmecustomer.common.customwidgets.common.GenericEditTextPromptDialog; import com.swifttech.remit.jmecustomer.common.view.AnswerInputDialog; import com.swifttech.remit.jmecustomer.features.customersupport.view.CustomerSupportFragment; import com.swifttech.remit.jmecustomer.features.kyc.newCustomer.KYCV3ViewModelFactory; @@ -35,7 +36,7 @@ import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; -public class KYCV3Activity extends BaseActivity implements KYCV3PresenterInterface.KYCV3ViewContractInterface, WebBrowserFragmentV2.WebBrowserFragmentActionListener, ViewPager.OnPageChangeListener { +public class KYCV3Activity extends BaseActivity implements KYCV3PresenterInterface.KYCV3ViewContractInterface, WebBrowserFragmentV2.WebBrowserFragmentActionListener, ViewPager.OnPageChangeListener, GenericEditTextPromptDialog.GenericEditTextPromptListener { private static final String SHOULD_REDIRECT_TO_PENNY_TEST_BUNDLE_KEY = "SHOULD_REDIRECT_TO_PENNY_TEST_BUNDLE_KEY"; private static final String USER_ID_BUNDLE_KEY = "USER_ID_BUNDLE_KEY"; @@ -64,6 +65,7 @@ public class KYCV3Activity extends BaseActivity implements KYCV3PresenterInterfa private NewKycTermsAndConditionFragment newKycTermsAndConditionFragment; private GenericViewPagerAdapter kycViewPagerAdapter; private KYCV3ViewModel viewModel; + private GenericEditTextPromptDialog genericPromptDialog; public static void startActivityForResult(Activity context, boolean shouldRedirectToPennyTestScreen, String userId, String userPwd) { Intent intent = new Intent(context, KYCV3Activity.class); @@ -187,7 +189,9 @@ public class KYCV3Activity extends BaseActivity implements KYCV3PresenterInterfa @Override public void onBackPressed() { - if (kycFormViewPager.getCurrentItem() == 0) { + if(genericPromptDialog!=null && genericPromptDialog.isVisible()){ + genericPromptDialog.dismiss(); + }else if (kycFormViewPager.getCurrentItem() == 0) { Intent returnIntent = new Intent(); setResult(Activity.RESULT_CANCELED, returnIntent); finish(); @@ -220,8 +224,6 @@ public class KYCV3Activity extends BaseActivity implements KYCV3PresenterInterfa return customerDetailFragment; } - - @Override public void exitView() { Intent returnIntent = new Intent(); @@ -229,7 +231,6 @@ public class KYCV3Activity extends BaseActivity implements KYCV3PresenterInterfa finish(); } - @Override public void lazyLoadForms() { setupViewPager(); @@ -245,6 +246,12 @@ public class KYCV3Activity extends BaseActivity implements KYCV3PresenterInterfa kycFormViewPager.setCurrentItem(2); } + @Override + public void onEmailVerifySuccess() { + viewModel.kycSubmitSuccessForPopUp(); + } + + @Override @@ -312,4 +319,24 @@ public class KYCV3Activity extends BaseActivity implements KYCV3PresenterInterfa public void webViewActionCompleted() { } + + @Override + public void showEmailCodePromptDialog() { + genericPromptDialog = new GenericEditTextPromptDialog(); + genericPromptDialog.setTitleMessage(getString(R.string.enterCodeFromEmail_text)); + genericPromptDialog.setCancellable(false); + genericPromptDialog.setListener(this); + if (!genericPromptDialog.isAdded()) + genericPromptDialog.show(getSupportFragmentManager(), "PROMPTEDITTEXT"); + } + + @Override + public void onEmailCodeNegativeButtonPressed() { + + } + + @Override + public void onEmailCodePositiveBtnPressed(String emailCode) { + viewModel.verifyEmailCode(emailCode); + } } diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/newCustomer/view/termsAndCondition/NewKycTermsAndConditionFragment.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/newCustomer/view/termsAndCondition/NewKycTermsAndConditionFragment.java index ad76f78d..7b10b655 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/newCustomer/view/termsAndCondition/NewKycTermsAndConditionFragment.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/kyc/newCustomer/view/termsAndCondition/NewKycTermsAndConditionFragment.java @@ -12,7 +12,7 @@ import com.swifttech.remit.jmecustomer.features.kyc.newCustomer.presenter.KYCV3V import com.swifttech.remit.jmecustomer.features.webbrowser.WebBrowserFragmentV2; import com.swifttech.remit.jmecustomer.features.webbrowser.model.WebRequestModel; -import static com.swifttech.remit.jmecustomer.utils.Constants.JME_TERMS_N_CONDITIONS; +import static com.swifttech.remit.jmecustomer.utils.Constants.JME_REGISTER_TERMS; public class NewKycTermsAndConditionFragment extends WebBrowserFragmentV2 { private KYCV3ViewModel kycv3ViewModel; @@ -34,14 +34,14 @@ public class NewKycTermsAndConditionFragment extends WebBrowserFragmentV2 { @Override protected void proceedButtonClicked() { - kycv3ViewModel.kycSubmitSucessForPopUp(); + kycv3ViewModel.requestForOtp(); } @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); showAcceptOption(true); - WebRequestModel webRequestModel = new WebRequestModel("", JME_TERMS_N_CONDITIONS,null); + WebRequestModel webRequestModel = new WebRequestModel("", JME_REGISTER_TERMS,null); setWebRequestData(webRequestModel); loadWebView(); kycv3ViewModel = new ViewModelProvider(requireActivity()).get(KYCV3ViewModel.class); diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientlisting/model/recipientlisting/ReceiverInfoModel.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientlisting/model/recipientlisting/ReceiverInfoModel.java index e2d48f61..c2c7f2c4 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientlisting/model/recipientlisting/ReceiverInfoModel.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientlisting/model/recipientlisting/ReceiverInfoModel.java @@ -116,6 +116,19 @@ public class ReceiverInfoModel implements Parcelable { @Expose private String isPartnerChanged; + @SerializedName("hasVerifiedOTP") + @Expose + private Boolean hasVerifiedOTP; + + + public Boolean getHasVerifiedOTP() { + return hasVerifiedOTP; + } + + public void setHasVerifiedOTP(Boolean hasVerifiedOTP) { + this.hasVerifiedOTP = hasVerifiedOTP; + } + public String getFirstName() { return firstName; } diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/gateway/recipientaddeditV3/RecipientAddEditV3Gateway.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/gateway/recipientaddeditV3/RecipientAddEditV3Gateway.java index d0e6f557..a1df62f4 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/gateway/recipientaddeditV3/RecipientAddEditV3Gateway.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/gateway/recipientaddeditV3/RecipientAddEditV3Gateway.java @@ -6,6 +6,7 @@ import com.swifttech.remit.jmecustomer.base.PrivilegedGateway; import com.swifttech.remit.jmecustomer.features.kyc.newCustomer.model.NativeCountry; import com.swifttech.remit.jmecustomer.features.recipientmanagement.model.recipientlistingV3.ReceiverInfoV3Model; import com.swifttech.remit.jmecustomer.features.sendmoney.model.payoutmode.AccountValidationApiResponse; +import com.swifttech.remit.jmecustomer.utils.Constants; import com.swifttech.remit.jmecustomer.utils.https.HttpClientV2; import com.google.gson.JsonObject; import com.google.gson.reflect.TypeToken; @@ -41,6 +42,35 @@ public class RecipientAddEditV3Gateway extends PrivilegedGateway implements Reci return HttpClientV2.getInstance().editRecipientV3(auth, senderId, recipientID, data); } + @Override + public Observable verifyEmailCode(String auth, + String userId, + String OTP, + String requestFor, + String receiverId) { + JsonObject jsonObject = new JsonObject(); + jsonObject.addProperty(Constants.USER_ID_KEY, userId); + jsonObject.addProperty(Constants.OTP_KEY, OTP); + jsonObject.addProperty(Constants.REQUEST_FOR_KEY, requestFor); + jsonObject.addProperty(Constants.RECEIVER_ID_KEY, receiverId); + return HttpClientV2.getInstance().verifyEmailCode(auth,jsonObject); + } + + @Override + public Observable requestForOtp(String auth, + String userId, + String OTP, + String requestFor, + String receiverId + ) { + JsonObject jsonObject = new JsonObject(); + jsonObject.addProperty(Constants.USER_ID_KEY, userId); + jsonObject.addProperty(Constants.OTP_KEY, OTP); + jsonObject.addProperty(Constants.REQUEST_FOR_KEY, requestFor); + jsonObject.addProperty(Constants.RECEIVER_ID_KEY, receiverId); + return HttpClientV2.getInstance().requestForOtp(auth, jsonObject); + } + @Override public Observable validateAccountFromServer(String auth, String idType, String idNumber, String customerFirstName, diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/gateway/recipientaddeditV3/RecipientAddEditV3GatewayInterface.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/gateway/recipientaddeditV3/RecipientAddEditV3GatewayInterface.java index 7f2e1a36..b97edb80 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/gateway/recipientaddeditV3/RecipientAddEditV3GatewayInterface.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/gateway/recipientaddeditV3/RecipientAddEditV3GatewayInterface.java @@ -22,7 +22,13 @@ public interface RecipientAddEditV3GatewayInterface extends PrivilegedGatewayInt Observable editRecipient(String auth, String senderId,String recipientID, ReceiverInfoV3Model data); + Observable verifyEmailCode(String auth, + String userId, + String OTP, + String requestFor, + String receiverId); + Observable requestForOtp(String auth, String userId, String OTP, String requestFor, String receiverId); Observable validateAccountFromServer(String auth, diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/gateway/recipientlistingV3/RecipientListingV3Gateway.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/gateway/recipientlistingV3/RecipientListingV3Gateway.java index d7d269ad..4988249e 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/gateway/recipientlistingV3/RecipientListingV3Gateway.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/gateway/recipientlistingV3/RecipientListingV3Gateway.java @@ -1,8 +1,10 @@ package com.swifttech.remit.jmecustomer.features.recipientmanagement.gateway.recipientlistingV3; +import com.google.gson.JsonObject; import com.swifttech.remit.jmecustomer.base.PrivilegedGateway; import com.swifttech.remit.jmecustomer.features.recipientmanagement.presenter.recipientlistingV3.RecipientListingV3InteractorInterface; +import com.swifttech.remit.jmecustomer.utils.Constants; import com.swifttech.remit.jmecustomer.utils.https.HttpClientV2; import io.reactivex.Observable; @@ -12,12 +14,41 @@ public class RecipientListingV3Gateway extends PrivilegedGateway implements Reci @Override public Observable getAllRecipientFromNetwork(String auth, String senderId) { - return HttpClientV2.getInstance().getAllRecipientV3(auth,senderId); + return HttpClientV2.getInstance().getAllRecipientV3(auth, senderId); } @Override public Observable deleteRecipientFromNetwork(String auth, String senderId, String recipientID) { - return HttpClientV2.getInstance().deleteRecipientV3(auth,senderId,recipientID); + return HttpClientV2.getInstance().deleteRecipientV3(auth, senderId, recipientID); + } + + @Override + public Observable requestForOtp(String auth, + String userId, + String OTP, + String requestFor, + String receiverId + ) { + JsonObject jsonObject = new JsonObject(); + jsonObject.addProperty(Constants.USER_ID_KEY, userId); + jsonObject.addProperty(Constants.OTP_KEY, OTP); + jsonObject.addProperty(Constants.REQUEST_FOR_KEY, requestFor); + jsonObject.addProperty(Constants.RECEIVER_ID_KEY, receiverId); + return HttpClientV2.getInstance().requestForOtp(auth, jsonObject); + } + + @Override + public Observable verifyEmailCode(String auth, + String userId, + String OTP, + String requestFor, + String receiverId) { + JsonObject jsonObject = new JsonObject(); + jsonObject.addProperty(Constants.USER_ID_KEY, userId); + jsonObject.addProperty(Constants.OTP_KEY, OTP); + jsonObject.addProperty(Constants.REQUEST_FOR_KEY, requestFor); + jsonObject.addProperty(Constants.RECEIVER_ID_KEY, receiverId); + return HttpClientV2.getInstance().verifyEmailCode(auth,jsonObject); } } diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/model/recipientlistingV3/ReceiverInfoV3Model.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/model/recipientlistingV3/ReceiverInfoV3Model.java index dd381aa7..f1f1da3f 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/model/recipientlistingV3/ReceiverInfoV3Model.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/model/recipientlistingV3/ReceiverInfoV3Model.java @@ -116,6 +116,18 @@ public class ReceiverInfoV3Model implements Parcelable { @Expose private String isPartnerChanged; + @SerializedName("hasVerifiedOTP") + @Expose + private Boolean hasVerifiedOTP; + + public Boolean getHasVerifiedOTP() { + return hasVerifiedOTP; + } + + public void setHasVerifiedOTP(Boolean hasVerifiedOTP) { + this.hasVerifiedOTP = hasVerifiedOTP; + } + public String getFirstName() { return firstName; } diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/RecipientAddEditBaseV3ViewModel.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/RecipientAddEditBaseV3ViewModel.java index 4924374b..f06f451a 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/RecipientAddEditBaseV3ViewModel.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/RecipientAddEditBaseV3ViewModel.java @@ -3,11 +3,12 @@ package com.swifttech.remit.jmecustomer.features.recipientmanagement.presenter.r import android.text.TextUtils; import com.swifttech.remit.jmecustomer.R; -import com.swifttech.remit.jmecustomer.base.BasePresenter; import com.swifttech.remit.jmecustomer.base.BaseViewModel; +import com.swifttech.remit.jmecustomer.common.customwidgets.CustomAlertDialog; import com.swifttech.remit.jmecustomer.common.customwidgets.common.GenericPromptDialog; import com.swifttech.remit.jmecustomer.common.view.AnswerInputDialog; import com.swifttech.remit.jmecustomer.features.kyc.newCustomer.model.NativeCountry; +import com.swifttech.remit.jmecustomer.features.kyc.newCustomer.presenter.KYCV3ViewModel; import com.swifttech.remit.jmecustomer.features.recipientmanagement.model.recipientaddeditV3.countryservice.CountryServiceModel; import com.swifttech.remit.jmecustomer.features.recipientmanagement.model.recipientaddeditV3.countryservice.ServiceTypeModel; import com.swifttech.remit.jmecustomer.features.recipientmanagement.model.recipientaddeditV3.dynamicvalidation.DropDownDTO; @@ -16,19 +17,31 @@ import com.swifttech.remit.jmecustomer.features.recipientmanagement.model.recipi import com.swifttech.remit.jmecustomer.features.recipientmanagement.model.recipientaddeditV3.dynamicvalidation.ValidationRuleModel; import com.swifttech.remit.jmecustomer.features.recipientmanagement.model.recipientlistingV3.AgentV3Model; import com.swifttech.remit.jmecustomer.features.recipientmanagement.model.recipientlistingV3.ReceiverInfoV3Model; +import com.swifttech.remit.jmecustomer.features.recipientmanagement.presenter.recipientlistingV3.RecipientListingV3Presenter; import com.swifttech.remit.jmecustomer.features.sendmoney.model.SendMoneyRequiredDataV3; import com.swifttech.remit.jmecustomer.features.sendmoney.model.payoutmode.BankBranchDTO; +import com.swifttech.remit.jmecustomer.utils.Constants; +import com.swifttech.remit.jmecustomer.utils.https.GenericApiObserverResponseV2; +import com.swifttech.remit.jmecustomer.utils.https.GenericResponseDataModel; +import com.swifttech.remit.jmecustomer.utils.https.MessageResponseDataModel; import java.util.List; +import io.reactivex.android.schedulers.AndroidSchedulers; +import io.reactivex.disposables.CompositeDisposable; +import io.reactivex.schedulers.Schedulers; + +import static com.swifttech.remit.jmecustomer.utils.Constants.REQUEST_FOR_REC_VALUE; + public abstract class RecipientAddEditBaseV3ViewModel extends BaseViewModel implements RecipientPresenterInterface { protected final RecipientAddV3ContractInterface view; protected RecipientDetailValidatorV3 validator; - protected String sucessMessage=null; + protected String successMessage =null; protected String receiverId=null; protected SendMoneyRequiredDataV3 sendMoneyRequiredDataV3; + protected CompositeDisposable compositeDisposable; public RecipientAddEditBaseV3ViewModel( @@ -36,6 +49,7 @@ public abstract class RecipientAddEditBaseV3ViewModel extends BaseViewModel impl RecipientDetailValidatorV3 validator) { this.view = view; this.validator = validator; + this.compositeDisposable = new CompositeDisposable(); init(); ReceiverInfoV3Model receiverInfoV3Model = validator.getRecipientDetail(); if (receiverInfoV3Model != null && @@ -50,6 +64,14 @@ public abstract class RecipientAddEditBaseV3ViewModel extends BaseViewModel impl } + @Override + public void onViewDestroyed() { + super.onViewDestroyed(); + if (compositeDisposable != null && !compositeDisposable.isDisposed()) + compositeDisposable.dispose(); + } + + private void init() { view.getRecipientAddEditV3ContractInterface().hideAllViewExceptCountry(); @@ -275,7 +297,7 @@ public abstract class RecipientAddEditBaseV3ViewModel extends BaseViewModel impl @Override public void proceedToAddSucess() { - if(sucessMessage!=null ){ + if(successMessage !=null ){ view.getRecipientAddEditV3ContractInterface().promptToSendMoney(new GenericPromptDialog.GenericDialogPromptListener() { @Override public void onNegativeBtnPressed() { @@ -289,7 +311,7 @@ public abstract class RecipientAddEditBaseV3ViewModel extends BaseViewModel impl } } - }, sucessMessage); + }, successMessage); } } @@ -299,7 +321,123 @@ public abstract class RecipientAddEditBaseV3ViewModel extends BaseViewModel impl view.getRecipientTermsAndConditionsContract().showEmailCodePromptDialog(); } + @Override + public void verifyEmailCode(String OTP){ + compositeDisposable.add( + validator.getGateway().verifyEmailCode( + validator.getGateway().getAuth(), + validator.getGateway().getUserID(), + OTP, + Constants.REQUEST_FOR_REC_VALUE, + validator.getRecipientDetail().getReceiverId()) + .doOnSubscribe(subs -> view.showProgressBar(true, "")) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .doFinally(() -> view.showProgressBar(false, "")) + .subscribeWith(new UploadEmailCodeObserver(view.getRecipientTermsAndConditionsContract()::onEmailVerifySuccess))); + } + + @Override + public void requestForOtp() { + compositeDisposable.add( + validator.getGateway().requestForOtp( + validator.getGateway().getAuth(), + validator.getGateway().getUserID(), + "", + REQUEST_FOR_REC_VALUE, + validator.getRecipientDetail().getReceiverId()) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .doOnSubscribe(disposable -> view.showProgressBar(true, getStringfromStringId(R.string.processing_request_for_otp_text))) + .doFinally(() -> view.showProgressBar(false, "")) + .subscribeWith(new RequestEmailCodeObserver(view.getRecipientTermsAndConditionsContract()::showEmailCodePromptDialog)) + ); + } + private boolean shouldPromptToInputAnswer(DropDownDTO optionType) { return (optionType != null && ("Other (please specify)".equalsIgnoreCase(optionType.getText()))); } + + public class UploadEmailCodeObserver extends GenericApiObserverResponseV2 { + + Runnable task; + + public UploadEmailCodeObserver(Runnable task) { + this.task = task; + } + + @Override + protected void onSuccess(GenericResponseDataModel t) { + + if (t.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) { + if (task != null) + task.run(); + + + } else { + if(t.getErrorCode().equalsIgnoreCase(Constants.OPT_EXPIRED_CODE_V2)){ + view.showPopUpMessage(t.getMsg(), CustomAlertDialog.AlertType.FAILED, alertType -> requestForOtp()); + }else{ + view.showPopUpMessage(t.getMsg(), CustomAlertDialog.AlertType.FAILED, null); + + } + } + } + + @Override + public void onFailed(String message) { + view.showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, null); + } + + @Override + protected void onConnectionNotEstablished(String message) { + view.showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, null); + } + + @Override + protected void unauthorizedAccess(String message) { + validator.getGateway().clearAllUserData(); + view.showPopUpMessage(message, CustomAlertDialog.AlertType.ALERT, alertType -> view.logout()); + + } + } + + private class RequestEmailCodeObserver extends GenericApiObserverResponseV2 { + + Runnable task; + + public RequestEmailCodeObserver(Runnable task) { + this.task=task; + } + + @Override + protected void onSuccess(GenericResponseDataModel t) { + + if (t.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) { + if (task != null) + task.run(); + + + } else { + view.showPopUpMessage(t.getMsg(), CustomAlertDialog.AlertType.FAILED, null); + } + } + + @Override + public void onFailed(String message) { + view.showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, null); + } + + @Override + protected void onConnectionNotEstablished(String message) { + view.showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, null); + } + + @Override + protected void unauthorizedAccess(String message) { + validator.getGateway().clearAllUserData(); + view.showPopUpMessage(message, CustomAlertDialog.AlertType.ALERT, alertType -> view.logout()); + + } + } } diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/RecipientAddV3ContractInterface.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/RecipientAddV3ContractInterface.java index 8078bbd3..be7bf96b 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/RecipientAddV3ContractInterface.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/RecipientAddV3ContractInterface.java @@ -18,11 +18,15 @@ public interface RecipientAddV3ContractInterface extends BaseContractInterface + + RecipientAddEditV3ContractInterface getRecipientAddEditV3ContractInterface(); RecipientTermsAndConditionsContract getRecipientTermsAndConditionsContract(); interface RecipientTermsAndConditionsContract extends BaseContractInterface{ void showEmailCodePromptDialog(); + + void onEmailVerifySuccess(); } interface RecipientAddEditV3ContractInterface extends BaseContractInterface { diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/RecipientDetailValidatorV3.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/RecipientDetailValidatorV3.java index 846f909d..d015bcae 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/RecipientDetailValidatorV3.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/RecipientDetailValidatorV3.java @@ -74,6 +74,10 @@ public class RecipientDetailValidatorV3 { //Now need branch code while account validation. private BankBranchDTO selectedBankBranch; + public RecipientAddEditV3GatewayInterface getGateway() { + return gateway; + } + public RecipientDetailValidatorV3( RecipientAddV3ContractInterface view, diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/RecipientPresenterInterface.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/RecipientPresenterInterface.java index 361f7823..994ea026 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/RecipientPresenterInterface.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/RecipientPresenterInterface.java @@ -7,6 +7,7 @@ import com.swifttech.remit.jmecustomer.features.recipientmanagement.model.recipi import com.swifttech.remit.jmecustomer.features.recipientmanagement.model.recipientaddeditV3.dynamicvalidation.DropDownDTO; import com.swifttech.remit.jmecustomer.features.recipientmanagement.model.recipientaddeditV3.dynamicvalidation.PaymentBankModel; import com.swifttech.remit.jmecustomer.features.recipientmanagement.model.recipientaddeditV3.dynamicvalidation.PayoutProvincesModel; +import com.swifttech.remit.jmecustomer.features.recipientmanagement.model.recipientlistingV3.ReceiverInfoV3Model; import com.swifttech.remit.jmecustomer.features.sendmoney.model.payoutmode.BankBranchDTO; import com.swifttech.remit.jmecustomer.features.webbrowser.model.WebRequestModel; @@ -32,6 +33,10 @@ public interface RecipientPresenterInterface extends BasePresenterInterface { void proceedToAddSucess(); void showEmailCodePopUp(); + void verifyEmailCode(String emailCode); + + void requestForOtp(); + WebRequestModel getWebRequestDataForTermsAndCondition(); diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/add/RecipientAddV3ViewModel.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/add/RecipientAddV3ViewModel.java index 6b876a43..e1caee11 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/add/RecipientAddV3ViewModel.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/add/RecipientAddV3ViewModel.java @@ -4,7 +4,6 @@ import com.google.gson.reflect.TypeToken; import com.swifttech.remit.jmecustomer.R; import com.swifttech.remit.jmecustomer.RemitApplication; import com.swifttech.remit.jmecustomer.common.customwidgets.CustomAlertDialog; -import com.swifttech.remit.jmecustomer.common.customwidgets.common.GenericPromptDialog; import com.swifttech.remit.jmecustomer.common.customwidgets.exchangecountrylistingdialog.CountryFlagMapper; import com.swifttech.remit.jmecustomer.features.recipientmanagement.gateway.recipientaddeditV3.RecipientAddEditV3GatewayInterface; import com.swifttech.remit.jmecustomer.features.recipientmanagement.model.recipientaddeditV3.countryservice.CountryServiceModel; @@ -329,7 +328,7 @@ public class RecipientAddV3ViewModel extends RecipientAddEditBaseV3ViewModel { @Override protected void onSuccess(GenericResponseDataModel t) { if (t.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) { - sucessMessage = t.getMsg()+" \n "+getStringfromStringId(R.string.recipient_add_success_message_text).replace("xxx", getReceiverName(t.getData())); + successMessage = t.getMsg()+" \n "+getStringfromStringId(R.string.recipient_add_success_message_text).replace("xxx", getReceiverName(t.getData())); receiverId=t.getData().getReceiverId(); sendMoneyRequiredDataV3=new SendMoneyRequiredDataV3(t.getData()); view.showTermsAndConditionScreen(); @@ -340,7 +339,7 @@ public class RecipientAddV3ViewModel extends RecipientAddEditBaseV3ViewModel { @Override public void onFailed(String message) { - sucessMessage = null; + successMessage = null; receiverId = null; sendMoneyRequiredDataV3 = null; view.showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, null); @@ -349,7 +348,7 @@ public class RecipientAddV3ViewModel extends RecipientAddEditBaseV3ViewModel { @Override protected void onConnectionNotEstablished(String message) { - sucessMessage = null; + successMessage = null; receiverId=null; sendMoneyRequiredDataV3=null; view.showPopUpMessage(message, CustomAlertDialog.AlertType.NO_INTERNET, null); @@ -357,7 +356,7 @@ public class RecipientAddV3ViewModel extends RecipientAddEditBaseV3ViewModel { @Override protected void unauthorizedAccess(String message) { - sucessMessage = null; + successMessage = null; receiverId=null; sendMoneyRequiredDataV3=null; gateway.clearAllUserData(); diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/edit/RecipientEditV3ViewModel.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/edit/RecipientEditV3ViewModel.java index 739975e5..f18f013b 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/edit/RecipientEditV3ViewModel.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientaddeditV3/edit/RecipientEditV3ViewModel.java @@ -433,7 +433,7 @@ public class RecipientEditV3ViewModel extends RecipientAddEditBaseV3ViewModel { @Override protected void onSuccess(GenericResponseDataModel t) { if (t.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) { - sucessMessage = t.getMsg() + " \n " + getStringfromStringId(R.string.recipient_add_success_message_text).replace("xxx", getReceiverName(t.getData())); + successMessage = t.getMsg() + " \n " + getStringfromStringId(R.string.recipient_add_success_message_text).replace("xxx", getReceiverName(t.getData())); receiverId = t.getData().getReceiverId(); sendMoneyRequiredDataV3 = new SendMoneyRequiredDataV3(t.getData()); view.getRecipientAddEditV3ContractInterface().promptToSendMoney(new GenericPromptDialog.GenericDialogPromptListener() { @@ -445,7 +445,7 @@ public class RecipientEditV3ViewModel extends RecipientAddEditBaseV3ViewModel { public void onPositiveBtnPressed() { view.getRecipientAddEditV3ContractInterface().redirectToSendMoney(sendMoneyRequiredDataV3); } - }, sucessMessage); + }, successMessage); } else { view.showPopUpMessage(t.getMsg(), CustomAlertDialog.AlertType.FAILED, null); } @@ -453,7 +453,7 @@ public class RecipientEditV3ViewModel extends RecipientAddEditBaseV3ViewModel { @Override public void onFailed(String message) { - sucessMessage = null; + successMessage = null; receiverId = null; sendMoneyRequiredDataV3 = null; view.showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, null); @@ -462,7 +462,7 @@ public class RecipientEditV3ViewModel extends RecipientAddEditBaseV3ViewModel { @Override protected void onConnectionNotEstablished(String message) { - sucessMessage = null; + successMessage = null; receiverId = null; sendMoneyRequiredDataV3 = null; view.showPopUpMessage(message, CustomAlertDialog.AlertType.NO_INTERNET, null); @@ -470,7 +470,7 @@ public class RecipientEditV3ViewModel extends RecipientAddEditBaseV3ViewModel { @Override protected void unauthorizedAccess(String message) { - sucessMessage = null; + successMessage = null; receiverId = null; sendMoneyRequiredDataV3 = null; gateway.clearAllUserData(); diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientlistingV3/RecipientListingV3InteractorInterface.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientlistingV3/RecipientListingV3InteractorInterface.java index 1dc671dc..b906cbf7 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientlistingV3/RecipientListingV3InteractorInterface.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientlistingV3/RecipientListingV3InteractorInterface.java @@ -9,12 +9,18 @@ import okhttp3.ResponseBody; public interface RecipientListingV3InteractorInterface extends BaseInteractorInterface { - interface RecipientListingV3GatewayInterface extends PrivilegedGatewayInterface - { - Observable getAllRecipientFromNetwork(String auth, String Uid); - Observable deleteRecipientFromNetwork(String auth, String Uid, String recipientID); + interface RecipientListingV3GatewayInterface extends PrivilegedGatewayInterface { + Observable getAllRecipientFromNetwork(String auth, String Uid); + Observable deleteRecipientFromNetwork(String auth, String Uid, String recipientID); + Observable requestForOtp(String auth, String userId, String OTP, String requestFor, String receiverId); + + Observable verifyEmailCode(String auth, + String userId, + String OTP, + String requestFor, + String receiverId); } } diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientlistingV3/RecipientListingV3Presenter.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientlistingV3/RecipientListingV3Presenter.java index e79060cb..8f81af44 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientlistingV3/RecipientListingV3Presenter.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientlistingV3/RecipientListingV3Presenter.java @@ -21,6 +21,8 @@ import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.disposables.CompositeDisposable; import io.reactivex.schedulers.Schedulers; +import static com.swifttech.remit.jmecustomer.utils.Constants.REQUEST_FOR_REC_VALUE; + public class RecipientListingV3Presenter extends BasePresenter implements RecipientListingV3PresenterInterface { private final RecipientListingV3ContractInterface view; @@ -28,7 +30,8 @@ public class RecipientListingV3Presenter extends BasePresenter implements Recipi CompositeDisposable compositeDisposable; private ReceiverInfoV3Model selectedRecipient; private List availableRecipientList; - private ReceiverInfoV3Model selectedRecipientInfoModel; + + public RecipientListingV3Presenter(RecipientListingV3ContractInterface view, RecipientListingV3InteractorInterface.RecipientListingV3GatewayInterface gatewayInterface) { @@ -65,6 +68,20 @@ public class RecipientListingV3Presenter extends BasePresenter implements Recipi ); } + @Override + public void verifyEmailCode(String OTP) { + compositeDisposable.add( gateway.verifyEmailCode( gateway.getAuth(), + gateway.getUserID(), + OTP, + Constants.REQUEST_FOR_REG_VALUE, + selectedRecipient.getReceiverId()) + .doOnSubscribe(subs -> view.showProgressBar(true, "")) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .doFinally(() -> view.showProgressBar(false, "")) + .subscribeWith(new UploadEmailCodeObserver())); + } + @Override public void saveSelectedRecipientInformationForSendMoney(ReceiverInfoV3Model recipientInfoModel) { @@ -97,7 +114,7 @@ public class RecipientListingV3Presenter extends BasePresenter implements Recipi @Override public SendMoneyRequiredDataV3 getSendMoneyRequiredData() { - return new SendMoneyRequiredDataV3(selectedRecipientInfoModel); + return new SendMoneyRequiredDataV3(selectedRecipient); } @Override @@ -121,7 +138,7 @@ public class RecipientListingV3Presenter extends BasePresenter implements Recipi } }, message); } else { - this.selectedRecipientInfoModel = recipientInfoModel; + this.selectedRecipient = recipientInfoModel; this.view.redirectToSendMoney(getSendMoneyRequiredData()); } } @@ -130,7 +147,7 @@ public class RecipientListingV3Presenter extends BasePresenter implements Recipi if (availableRecipientList != null && availableRecipientList.size() > 0 && reciverId != null) for (ReceiverInfoV3Model receiverInfoV3Model : availableRecipientList) { if (reciverId.equalsIgnoreCase(receiverInfoV3Model.getReceiverId())) { - selectedRecipientInfoModel = receiverInfoV3Model; + selectedRecipient = receiverInfoV3Model; String send_money_to_string = getStringfromStringId(R.string.recipient_add_success_message_text).replace("xxx", getReceiverName(receiverInfoV3Model)); view.promptToSendMoney(new GenericPromptDialog.GenericDialogPromptListener() { @Override @@ -168,6 +185,24 @@ public class RecipientListingV3Presenter extends BasePresenter implements Recipi }); } + @Override + public void requestForOtp(ReceiverInfoV3Model recipientInfoModel) { + this.selectedRecipient=recipientInfoModel; + compositeDisposable.add( + this.gateway.requestForOtp( + gateway.getAuth(), + gateway.getUserID(), + "", + REQUEST_FOR_REC_VALUE, + String.valueOf(recipientInfoModel.getReceiverId())) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .doOnSubscribe(disposable -> view.showProgressBar(true, getStringfromStringId(R.string.processing_request_for_otp_text))) + .doFinally(() -> view.showProgressBar(false, "")) + .subscribeWith(new RequestEmailCodeObserver(view::showEmailCodePromptDialog)) + ); + } + public class RecipientListingV3Observer extends GenericApiObserverResponseV2 { private final Runnable task; @@ -241,4 +276,78 @@ public class RecipientListingV3Presenter extends BasePresenter implements Recipi } } + public class RequestEmailCodeObserver extends GenericApiObserverResponseV2 { + + Runnable task; + + public RequestEmailCodeObserver(Runnable task) { + this.task=task; + } + + @Override + protected void onSuccess(GenericResponseDataModel t) { + + if (t.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) { + if (task != null) + task.run(); + + + } else { + view.showPopUpMessage(t.getMsg(), CustomAlertDialog.AlertType.FAILED, null); + } + } + + @Override + public void onFailed(String message) { + view.showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, null); + } + + @Override + protected void onConnectionNotEstablished(String message) { + view.showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, null); + } + + @Override + protected void unauthorizedAccess(String message) { + gateway.clearAllUserData(); + view.showPopUpMessage(message, CustomAlertDialog.AlertType.ALERT, alertType -> view.logout()); + + } + } + + private class UploadEmailCodeObserver extends GenericApiObserverResponseV2 { + + @Override + protected void onSuccess(GenericResponseDataModel t) { + + if (t.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) { + saveSelectedRecipientInfomation(selectedRecipient); + } else { + if(t.getErrorCode().equalsIgnoreCase(Constants.OPT_EXPIRED_CODE_V2)){ + view.showPopUpMessage(t.getMsg(), CustomAlertDialog.AlertType.FAILED, alertType -> requestForOtp(selectedRecipient)); + }else{ + view.showPopUpMessage(t.getMsg(), CustomAlertDialog.AlertType.FAILED, null); + + } + } + } + + @Override + public void onFailed(String message) { + view.showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, null); + } + + @Override + protected void onConnectionNotEstablished(String message) { + view.showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, null); + } + + @Override + protected void unauthorizedAccess(String message) { + gateway.clearAllUserData(); + view.showPopUpMessage(message, CustomAlertDialog.AlertType.ALERT, alertType -> view.logout()); + + } + } + } diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientlistingV3/RecipientListingV3PresenterInterface.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientlistingV3/RecipientListingV3PresenterInterface.java index aa396b7c..5d6f10b0 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientlistingV3/RecipientListingV3PresenterInterface.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/presenter/recipientlistingV3/RecipientListingV3PresenterInterface.java @@ -14,6 +14,8 @@ public interface RecipientListingV3PresenterInterface extends BasePresenterInter void deleteRecipient(String recipientId); + void verifyEmailCode(String emailCode); + void saveSelectedRecipientInformationForSendMoney(ReceiverInfoV3Model recipientInfoModel); @@ -26,6 +28,8 @@ public interface RecipientListingV3PresenterInterface extends BasePresenterInter void onRecipentUpdatedSucesss(String receiverId ); + void requestForOtp(ReceiverInfoV3Model recipientInfoModel); + interface RecipientListingV3ContractInterface extends BaseContractInterface { @@ -33,6 +37,8 @@ public interface RecipientListingV3PresenterInterface extends BasePresenterInter void onRecipientDeletedSuccessfully(String recipientToBeDeleted); + void showEmailCodePromptDialog(); + void showNoRecipientFoundView(boolean action); diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/view/recipientaddeditV3/BeneficiaryAddEditV3TermsFragment.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/view/recipientaddeditV3/BeneficiaryAddEditV3TermsFragment.java index cd8f3b60..4a1d30ff 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/view/recipientaddeditV3/BeneficiaryAddEditV3TermsFragment.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/view/recipientaddeditV3/BeneficiaryAddEditV3TermsFragment.java @@ -21,7 +21,6 @@ import com.swifttech.remit.jmecustomer.features.recipientmanagement.view.Recipie import com.swifttech.remit.jmecustomer.features.webbrowser.WebBrowserFragmentV2; import com.swifttech.remit.jmecustomer.features.webbrowser.model.WebRequestModel; -import static com.swifttech.remit.jmecustomer.features.recipientlisting.view.recipientaddedit.RecipientAddEditActivity.RECIPIENT_INFO_BUNDLE_KEY; import static com.swifttech.remit.jmecustomer.features.recipientmanagement.view.recipientaddeditV3.RecipientAddEditV3Activity.RECIPIENT_INFO_BUNDLE_KEY_v3; import static com.swifttech.remit.jmecustomer.utils.Constants.JME_TERMS_N_CONDITIONS; @@ -50,7 +49,7 @@ public class BeneficiaryAddEditV3TermsFragment extends WebBrowserFragmentV2 impl if (recipientToBeEdited != null) { viewModel.proceedToEditSucess(); } else { - viewModel.showEmailCodePopUp(); + viewModel.requestForOtp(); } } @@ -70,7 +69,6 @@ public class BeneficiaryAddEditV3TermsFragment extends WebBrowserFragmentV2 impl setWebRequestData(webRequestModel); loadWebView(); - } @Override @@ -83,6 +81,11 @@ public class BeneficiaryAddEditV3TermsFragment extends WebBrowserFragmentV2 impl genericPromptDialog.show(getActivity().getSupportFragmentManager(), "PROMPTEDITTEXT"); } + @Override + public void onEmailVerifySuccess() { + viewModel.proceedToAddSucess(); + } + @Override public void onEmailCodeNegativeButtonPressed() { @@ -90,7 +93,6 @@ public class BeneficiaryAddEditV3TermsFragment extends WebBrowserFragmentV2 impl @Override public void onEmailCodePositiveBtnPressed(String emailCode) { - //@Todo email code submit API implementation - viewModel.proceedToAddSucess(); + viewModel.verifyEmailCode(emailCode); } } diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/view/recipientlistingV3/RecipientListingV3Activity.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/view/recipientlistingV3/RecipientListingV3Activity.java index f2d82a99..f0e0ff17 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/view/recipientlistingV3/RecipientListingV3Activity.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/recipientmanagement/view/recipientlistingV3/RecipientListingV3Activity.java @@ -16,6 +16,7 @@ import com.swifttech.remit.jmecustomer.base.BaseActivity; import com.swifttech.remit.jmecustomer.common.customwidgets.GmeTextView; import com.swifttech.remit.jmecustomer.common.customwidgets.LineDividerItemDecoration; import com.swifttech.remit.jmecustomer.common.customwidgets.TextWatcherAdapter; +import com.swifttech.remit.jmecustomer.common.customwidgets.common.GenericEditTextPromptDialog; import com.swifttech.remit.jmecustomer.common.customwidgets.common.GenericPromptDialog; import com.swifttech.remit.jmecustomer.features.recipientmanagement.adapter.RecipientListingV3RvAdapter; import com.swifttech.remit.jmecustomer.features.recipientmanagement.gateway.recipientlistingV3.RecipientListingV3Gateway; @@ -34,7 +35,8 @@ import butterknife.ButterKnife; public class RecipientListingV3Activity extends BaseActivity implements RecipientListingV3PresenterInterface.RecipientListingV3ContractInterface, RecipientListingV3RvAdapter.RecipientSelectionListener, - View.OnClickListener { + View.OnClickListener, + GenericEditTextPromptDialog.GenericEditTextPromptListener { @BindView(R.id.recipientListRv) RecyclerView recipientListRv; @@ -81,6 +83,8 @@ public class RecipientListingV3Activity extends BaseActivity private SearchEditTextTextWatcher searchEditTextTextWatcher; + private GenericEditTextPromptDialog genericEditTextPromptDialog; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -164,6 +168,26 @@ public class RecipientListingV3Activity extends BaseActivity } + @Override + public void showEmailCodePromptDialog() { + genericEditTextPromptDialog = new GenericEditTextPromptDialog(); + genericEditTextPromptDialog.setTitleMessage(getString(R.string.enterCodeFromEmail_text)); + genericEditTextPromptDialog.setCancellable(false); + genericEditTextPromptDialog.setListener(this); + if (!genericEditTextPromptDialog.isAdded()) + genericEditTextPromptDialog.show(getSupportFragmentManager(), "PROMPTEDITTEXT"); + } + + + @Override + public void onEmailCodeNegativeButtonPressed() { + + } + + @Override + public void onEmailCodePositiveBtnPressed(String emailCode) { + this.presenter.verifyEmailCode(emailCode); + } @Override public void showNoRecipientFoundView(boolean action) { @@ -220,9 +244,12 @@ public class RecipientListingV3Activity extends BaseActivity @Override public void onRecipientSelected(ReceiverInfoV3Model recipientInfoModel) { + if (recipientInfoModel.getHasVerifiedOTP()) { + this.presenter.saveSelectedRecipientInfomation(recipientInfoModel); + } else { + this.presenter.requestForOtp(recipientInfoModel); + } - //TODO - this.presenter.saveSelectedRecipientInfomation(recipientInfoModel); } @Override @@ -237,9 +264,6 @@ public class RecipientListingV3Activity extends BaseActivity } - - - @Override public void onClick(View v) { diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/existingcustomer/ExistingCustomerRegisterViewModelFactory.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/existingcustomer/ExistingCustomerRegisterViewModelFactory.java index 568d0431..75d082ed 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/existingcustomer/ExistingCustomerRegisterViewModelFactory.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/existingcustomer/ExistingCustomerRegisterViewModelFactory.java @@ -6,7 +6,7 @@ import androidx.lifecycle.ViewModelProvider; import com.swifttech.remit.jmecustomer.features.login.gateway.LoginV2Gateway; import com.swifttech.remit.jmecustomer.features.registerv2.existingcustomer.gateway.ExistingExistingRegisterV2Gateway; -import com.swifttech.remit.jmecustomer.features.registerv2.existingcustomer.presenter.ExistingCustomerRegisterV2Presenter; +import com.swifttech.remit.jmecustomer.features.registerv2.existingcustomer.presenter.ExistingCustomerRegisterViewModel; import com.swifttech.remit.jmecustomer.features.registerv2.existingcustomer.presenter.ExistingCustomerRegisterV2PresenterInterface; public class ExistingCustomerRegisterViewModelFactory implements ViewModelProvider.Factory { @@ -23,6 +23,6 @@ public class ExistingCustomerRegisterViewModelFactory implements ViewModelProvid @NonNull @Override public T create(@NonNull Class modelClass) { - return (T) new ExistingCustomerRegisterV2Presenter(view,new ExistingExistingRegisterV2Gateway(),new LoginV2Gateway()); + return (T) new ExistingCustomerRegisterViewModel(view,new ExistingExistingRegisterV2Gateway(),new LoginV2Gateway()); } } diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/existingcustomer/presenter/ExistingCustomerRegisterV2PresenterInterface.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/existingcustomer/presenter/ExistingCustomerRegisterV2PresenterInterface.java index 85afddb8..ddf19e78 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/existingcustomer/presenter/ExistingCustomerRegisterV2PresenterInterface.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/existingcustomer/presenter/ExistingCustomerRegisterV2PresenterInterface.java @@ -26,7 +26,6 @@ public interface ExistingCustomerRegisterV2PresenterInterface extends BasePresen interface ExistingRegisterV2ContractInterface extends BaseContractInterface { - void showEmailCodePromptDialog(); void redirectToTermsAndConditionScreen(); diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/existingcustomer/presenter/ExistingCustomerRegisterV2Presenter.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/existingcustomer/presenter/ExistingCustomerRegisterViewModel.java similarity index 98% rename from app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/existingcustomer/presenter/ExistingCustomerRegisterV2Presenter.java rename to app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/existingcustomer/presenter/ExistingCustomerRegisterViewModel.java index 4ed5d7cd..5bacc089 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/existingcustomer/presenter/ExistingCustomerRegisterV2Presenter.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/existingcustomer/presenter/ExistingCustomerRegisterViewModel.java @@ -32,7 +32,7 @@ import io.reactivex.disposables.Disposable; import io.reactivex.observers.DisposableObserver; import io.reactivex.schedulers.Schedulers; -public class ExistingCustomerRegisterV2Presenter extends BaseViewModel implements ExistingCustomerRegisterV2PresenterInterface, ExistingCustomerRegisterV2InteractorInterface { +public class ExistingCustomerRegisterViewModel extends BaseViewModel implements ExistingCustomerRegisterV2PresenterInterface, ExistingCustomerRegisterV2InteractorInterface { private final ExistingRegister2GatewayInterface registerGateway; private final ExistingRegisterV2ContractInterface view; @@ -52,7 +52,7 @@ public class ExistingCustomerRegisterV2Presenter extends BaseViewModel implement private String newToken; - public ExistingCustomerRegisterV2Presenter(ExistingRegisterV2ContractInterface view, ExistingRegister2GatewayInterface registerGateway, LoginV2InteractorInterface.Login2GatewayInterface loginGateway) { + public ExistingCustomerRegisterViewModel(ExistingRegisterV2ContractInterface view, ExistingRegister2GatewayInterface registerGateway, LoginV2InteractorInterface.Login2GatewayInterface loginGateway) { this.view = view; useCaseCompositeDisposable = new CompositeDisposable(); requestViewEventCompositeDisposable = new CompositeDisposable(); @@ -490,8 +490,8 @@ public class ExistingCustomerRegisterV2Presenter extends BaseViewModel implement if (responseBody.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) { registerGateway.saveUserId(registerSubmitValidator.userIdNumber); registrationSuccessMessage = responseBody.getMsg(); - // performLoginInternally(); - view.showEmailCodePromptDialog(); + performLoginInternally(); +// view.showEmailCodePromptDialog(); } else { view.showPopUpMessage(responseBody.getMsg(), CustomAlertDialog.AlertType.FAILED, null); diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/existingcustomer/view/ExistingCustomerRegisterV2Activity.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/existingcustomer/view/ExistingCustomerRegisterV2Activity.java index e45ff4e1..7dda3a90 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/existingcustomer/view/ExistingCustomerRegisterV2Activity.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/existingcustomer/view/ExistingCustomerRegisterV2Activity.java @@ -17,7 +17,7 @@ import com.swifttech.remit.jmecustomer.features.home.view.HomeActivityV2; import com.swifttech.remit.jmecustomer.features.kyc.existingCustomer.view.ExistingKYCV3Activity; import com.swifttech.remit.jmecustomer.features.kyc.newCustomer.view.KYCV3Activity; import com.swifttech.remit.jmecustomer.features.registerv2.existingcustomer.ExistingCustomerRegisterViewModelFactory; -import com.swifttech.remit.jmecustomer.features.registerv2.existingcustomer.presenter.ExistingCustomerRegisterV2Presenter; +import com.swifttech.remit.jmecustomer.features.registerv2.existingcustomer.presenter.ExistingCustomerRegisterViewModel; import com.swifttech.remit.jmecustomer.features.registerv2.existingcustomer.presenter.ExistingCustomerRegisterV2PresenterInterface; import com.swifttech.remit.jmecustomer.features.termsandcondition.view.TermsAndConditionAcitivity; @@ -29,7 +29,7 @@ import butterknife.OnClick; import static com.swifttech.remit.jmecustomer.features.kyc.existingCustomer.view.ExistingKYCV3Activity.KYC_EXISTING_FORM_REQUEST_CODE; -public class ExistingCustomerRegisterV2Activity extends BaseActivity implements ExistingCustomerRegisterV2PresenterInterface.ExistingRegisterV2ContractInterface,GenericEditTextPromptDialog.GenericEditTextPromptListener{ +public class ExistingCustomerRegisterV2Activity extends BaseActivity implements ExistingCustomerRegisterV2PresenterInterface.ExistingRegisterV2ContractInterface{ @BindView(R.id.view_pager) @@ -57,7 +57,7 @@ public class ExistingCustomerRegisterV2Activity extends BaseActivity implements private void initialize() { - presenter=new ViewModelProvider(this,new ExistingCustomerRegisterViewModelFactory(this)).get(ExistingCustomerRegisterV2Presenter.class); + presenter=new ViewModelProvider(this,new ExistingCustomerRegisterViewModelFactory(this)).get(ExistingCustomerRegisterViewModel.class); setupViewPager(); } @@ -150,25 +150,6 @@ public class ExistingCustomerRegisterV2Activity extends BaseActivity implements restartApp(); } - @Override - public void showEmailCodePromptDialog() { - GenericEditTextPromptDialog genericPromptDialog = new GenericEditTextPromptDialog(); - genericPromptDialog.setTitleMessage(getString(R.string.enterCodeFromEmail_text)); - genericPromptDialog.setCancellable(true); - genericPromptDialog.setListener(this); - if (!genericPromptDialog.isAdded()) - genericPromptDialog.show(getSupportFragmentManager(), "PROMPTEDITTEXT"); - } - - @Override - public void onEmailCodeNegativeButtonPressed() { - } - - @Override - public void onEmailCodePositiveBtnPressed(String emailCode) { - //@Todo email code submit API implementation - presenter.performLoginInternally(); - } @Override public void redirectToTermsAndConditionScreen() { diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/existingcustomer/view/ExistingCustomerRegistrationRequestFragment.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/existingcustomer/view/ExistingCustomerRegistrationRequestFragment.java index f0f7747d..86582b73 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/existingcustomer/view/ExistingCustomerRegistrationRequestFragment.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/existingcustomer/view/ExistingCustomerRegistrationRequestFragment.java @@ -16,7 +16,7 @@ import com.jakewharton.rxbinding3.widget.RxTextView; import com.swifttech.remit.jmecustomer.R; import com.swifttech.remit.jmecustomer.base.BaseFragment; import com.swifttech.remit.jmecustomer.common.model.FormInputStateDTO; -import com.swifttech.remit.jmecustomer.features.registerv2.existingcustomer.presenter.ExistingCustomerRegisterV2Presenter; +import com.swifttech.remit.jmecustomer.features.registerv2.existingcustomer.presenter.ExistingCustomerRegisterViewModel; import com.swifttech.remit.jmecustomer.features.registerv2.existingcustomer.presenter.ExistingCustomerRegisterV2PresenterInterface; import com.swifttech.remit.jmecustomer.features.registerv2.existingcustomer.presenter.ExistingCustomerRegistrationRequestLiveData; import com.swifttech.remit.jmecustomer.utils.Utils; @@ -77,7 +77,7 @@ public class ExistingCustomerRegistrationRequestFragment extends BaseFragment { private void init() { dobSelectionSubject=PublishSubject.create(); - viewModel=new ViewModelProvider(requireActivity()).get(ExistingCustomerRegisterV2Presenter.class); + viewModel=new ViewModelProvider(requireActivity()).get(ExistingCustomerRegisterViewModel.class); } diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/existingcustomer/view/ExistingCustomerRegistrationSubmitFragment.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/existingcustomer/view/ExistingCustomerRegistrationSubmitFragment.java index e19d5d71..898cd44b 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/existingcustomer/view/ExistingCustomerRegistrationSubmitFragment.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/existingcustomer/view/ExistingCustomerRegistrationSubmitFragment.java @@ -16,7 +16,7 @@ import com.jakewharton.rxbinding3.widget.RxTextView; import com.swifttech.remit.jmecustomer.R; import com.swifttech.remit.jmecustomer.base.BaseFragment; import com.swifttech.remit.jmecustomer.common.model.FormInputStateDTO; -import com.swifttech.remit.jmecustomer.features.registerv2.existingcustomer.presenter.ExistingCustomerRegisterV2Presenter; +import com.swifttech.remit.jmecustomer.features.registerv2.existingcustomer.presenter.ExistingCustomerRegisterViewModel; import com.swifttech.remit.jmecustomer.features.registerv2.existingcustomer.presenter.ExistingCustomerRegisterV2PresenterInterface; import com.swifttech.remit.jmecustomer.features.registerv2.existingcustomer.presenter.ExistingCustomerRegistrationSubmitLiveData; @@ -125,7 +125,7 @@ public class ExistingCustomerRegistrationSubmitFragment extends BaseFragment { } private void init() { - viewModel = new ViewModelProvider(requireActivity()).get(ExistingCustomerRegisterV2Presenter.class); + viewModel = new ViewModelProvider(requireActivity()).get(ExistingCustomerRegisterViewModel.class); } diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/newcustomer/presenter/NewRegisterV2Presenter.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/newcustomer/presenter/NewRegisterV2Presenter.java index 62e1602b..f419439e 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/newcustomer/presenter/NewRegisterV2Presenter.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/newcustomer/presenter/NewRegisterV2Presenter.java @@ -330,8 +330,7 @@ this.newToken=newToken; if (responseBody.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) { registerGateway.saveUserId(registerValidator.userEmail); registrationSuccessMessage = responseBody.getMsg(); -// performLoginInternally(); - view.showEmailCodePromptDialog(); + performLoginInternally(); } else { view.showPopUpMessage(responseBody.getMsg(), CustomAlertDialog.AlertType.FAILED, null); diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/newcustomer/presenter/NewRegisterV2PresenterInterface.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/newcustomer/presenter/NewRegisterV2PresenterInterface.java index ceed1be2..040dd3ad 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/newcustomer/presenter/NewRegisterV2PresenterInterface.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/newcustomer/presenter/NewRegisterV2PresenterInterface.java @@ -51,7 +51,6 @@ public interface NewRegisterV2PresenterInterface extends BasePresenterInterface void redirectToTermsAndConditionScreen(); - void showEmailCodePromptDialog(); Context getContext(); diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/newcustomer/view/NewRegisterV2Activity.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/newcustomer/view/NewRegisterV2Activity.java index bedf7898..9ee399b3 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/newcustomer/view/NewRegisterV2Activity.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/registerv2/newcustomer/view/NewRegisterV2Activity.java @@ -4,7 +4,6 @@ import android.annotation.SuppressLint; import android.content.Context; import android.content.Intent; import android.os.Bundle; -import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.widget.Button; @@ -40,7 +39,7 @@ import butterknife.OnClick; import static com.swifttech.remit.jmecustomer.features.kyc.newCustomer.view.KYCV3Activity.KYC_FORM_REQUEST_CODE; -public class NewRegisterV2Activity extends BaseActivity implements NewRegisterV2PresenterInterface.NewRegisterV2ContractInterface, GenericEditTextPromptDialog.GenericEditTextPromptListener { +public class NewRegisterV2Activity extends BaseActivity implements NewRegisterV2PresenterInterface.NewRegisterV2ContractInterface { private static final String REFERENCE_ID = "Ref_Id_Bundle_Key"; @@ -340,23 +339,5 @@ public class NewRegisterV2Activity extends BaseActivity implements NewRegisterV2 } - @Override - public void showEmailCodePromptDialog() { - GenericEditTextPromptDialog genericPromptDialog = new GenericEditTextPromptDialog(); - genericPromptDialog.setTitleMessage(getString(R.string.enterCodeFromEmail_text)); - genericPromptDialog.setCancellable(false); - genericPromptDialog.setListener(this); - if (!genericPromptDialog.isAdded()) - genericPromptDialog.show(getSupportFragmentManager(), "PROMPTEDITTEXT"); - } - @Override - public void onEmailCodeNegativeButtonPressed() { - } - - @Override - public void onEmailCodePositiveBtnPressed(String emailCode) { - //@Todo email code submit API implementation - presenter.performLoginInternally(); - } } diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/renewId/presenter/RenewIdV2ViewModel.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/renewId/presenter/RenewIdV2ViewModel.java index 8a80aed5..d51886a3 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/renewId/presenter/RenewIdV2ViewModel.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/renewId/presenter/RenewIdV2ViewModel.java @@ -35,7 +35,6 @@ public class RenewIdV2ViewModel extends BaseViewModel implements RenewIdV2Presen private final RenewUserIdLiveData renewUserIdLiveData; private RenewUserIdLiveData.RenewUserIdBinding viewBindings; private RenewUserIdValidator validator; - private String userId; private static final int THUMBNAIL_HEIGHT = 150; @@ -65,7 +64,6 @@ public class RenewIdV2ViewModel extends BaseViewModel implements RenewIdV2Presen } private void postUserIdToServer(RenewIdRequestDataDTO renewIdRequestDataDTO, Runnable endWithTask) { - userId = renewIdRequestDataDTO.getUserId(); compositeDisposable.add( this.renewIdV2Gateway.renewUserId(renewIdV2Gateway.getAuth(), renewIdRequestDataDTO) .doOnSubscribe(d -> view.showProgressBar(true, getStringfromStringId(R.string.processing_request_text))) @@ -88,11 +86,8 @@ public class RenewIdV2ViewModel extends BaseViewModel implements RenewIdV2Presen protected void onSuccess(GenericResponseDataModel t) { if (t.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) { - if (task != null) { - loginGateway.updateUserId(userId); - if (task != null) - task.run(); - } + if (task != null) + task.run(); } else view.showPopUpMessage(t.getMsg(), CustomAlertDialog.AlertType.FAILED, null); diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/sendmoney/view/consent/UserConsentSendMoneyFragment.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/sendmoney/view/consent/UserConsentSendMoneyFragment.java index 03b3b987..a8c68d68 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/sendmoney/view/consent/UserConsentSendMoneyFragment.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/sendmoney/view/consent/UserConsentSendMoneyFragment.java @@ -1,38 +1,28 @@ package com.swifttech.remit.jmecustomer.features.sendmoney.view.consent; import android.app.Activity; -import android.content.Context; import android.os.Bundle; import android.util.Log; -import android.view.LayoutInflater; import android.view.View; -import android.view.ViewGroup; import android.webkit.WebView; import androidx.annotation.Nullable; -import androidx.appcompat.widget.AppCompatCheckBox; import androidx.lifecycle.ViewModelProvider; import com.swifttech.remit.jmecustomer.R; -import com.swifttech.remit.jmecustomer.base.BaseFragment; -import com.swifttech.remit.jmecustomer.common.customwidgets.GmeButton; -import com.swifttech.remit.jmecustomer.features.kyc.newCustomer.presenter.KYCV3ViewModel; import com.swifttech.remit.jmecustomer.features.kyc.newCustomer.view.termsAndCondition.NewKycTermsAndConditionFragment; import com.swifttech.remit.jmecustomer.features.sendmoney.presenter.SendMoneyV2Presenter; -import com.swifttech.remit.jmecustomer.features.sendmoney.view.SendMoneyActionListener; import com.swifttech.remit.jmecustomer.features.sendmoney.view.SendMoneyV2Activity; import com.swifttech.remit.jmecustomer.features.webbrowser.WebBrowserFragmentV2; import com.swifttech.remit.jmecustomer.features.webbrowser.model.WebRequestModel; -import butterknife.BindView; -import butterknife.ButterKnife; - -import static com.swifttech.remit.jmecustomer.utils.Constants.JME_TERMS_N_CONDITIONS; +import static com.swifttech.remit.jmecustomer.utils.Constants.JME_TRANSACTION_TERMS; public class UserConsentSendMoneyFragment extends WebBrowserFragmentV2 { private static String TAG = NewKycTermsAndConditionFragment.class.getSimpleName(); private String currentLoadedUrl=""; + @Override protected void doTask(WebRequestModel webRequestModel, WebView webView) { if(webRequestModel!=null&&!currentLoadedUrl.equalsIgnoreCase(webRequestModel.getUrl())) { @@ -71,7 +61,7 @@ public class UserConsentSendMoneyFragment extends WebBrowserFragmentV2 { public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); showAcceptOption(true); - WebRequestModel webRequestModel = new WebRequestModel("", JME_TERMS_N_CONDITIONS,null); + WebRequestModel webRequestModel = new WebRequestModel("", JME_TRANSACTION_TERMS,null); setWebRequestData(webRequestModel); loadWebView(); setButtonText(getString(R.string.send_money_text)); diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/features/webbrowser/WebBrowserFragmentV2.java b/app/src/main/java/com/swifttech/remit/jmecustomer/features/webbrowser/WebBrowserFragmentV2.java index f0f8e256..ca68e996 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/features/webbrowser/WebBrowserFragmentV2.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/features/webbrowser/WebBrowserFragmentV2.java @@ -59,7 +59,7 @@ public abstract class WebBrowserFragmentV2 extends BaseFragment implements View. private ValueCallback mFilePathCallback; private ValueCallback mUploadFile; private boolean showAcceptOption = false; - private boolean isPageLoadSucess = false; + private boolean isPageLoadSuccess = false; @BindView(R.id.webView) @@ -117,7 +117,7 @@ public abstract class WebBrowserFragmentV2 extends BaseFragment implements View. public void loadWebView() { if (webRequestModel != null) { - isPageLoadSucess = false; + isPageLoadSuccess = false; doTask(webRequestModel, webView); } } @@ -148,7 +148,7 @@ public abstract class WebBrowserFragmentV2 extends BaseFragment implements View. settings.setTextZoom(100); settings.setSupportMultipleWindows(true); settings.setJavaScriptCanOpenWindowsAutomatically(true); - webView.getSettings().setAllowFileAccess(true); + settings.setAllowFileAccess(true); nestedScrollView.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener() { @Override public void onScrollChange(NestedScrollView scrollView, int scrollX, int scrollY, int oldScrollX, int oldScrollY) { @@ -168,11 +168,11 @@ public abstract class WebBrowserFragmentV2 extends BaseFragment implements View. int diff = (view.getBottom() - (scrollView.getHeight() + scrollView.getScrollY())); // if diff is zero, then the bottom has been reached - if (diff == 0 && showAcceptOption == true && isPageLoadSucess == true) { + if (diff == 0 && showAcceptOption == true && isPageLoadSuccess == true) { Log.i(TAG, diff + " is true "); llBottom.setVisibility(View.VISIBLE); } else { - Log.i(TAG, diff + " " + showAcceptOption + " " + isPageLoadSucess); + Log.i(TAG, diff + " " + showAcceptOption + " " + isPageLoadSuccess); } } @@ -216,7 +216,7 @@ public abstract class WebBrowserFragmentV2 extends BaseFragment implements View. @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { super.onPageStarted(view, url, favicon); - isPageLoadSucess = false; + isPageLoadSuccess = false; if (webView.getProgress() != 100) { showProgressBar(false, ""); } @@ -225,16 +225,16 @@ public abstract class WebBrowserFragmentV2 extends BaseFragment implements View. @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); - isPageLoadSucess = true; + isPageLoadSuccess = true; if (webView.getProgress() == 100) { - isPageLoadSucess = true; + isPageLoadSuccess = true; showProgressBar(false, ""); } } @Override public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) { - isPageLoadSucess = false; + isPageLoadSuccess = false; webView.setVisibility(View.INVISIBLE); showProgressBar(false, ""); String errorMessage = ""; diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/utils/Constants.java b/app/src/main/java/com/swifttech/remit/jmecustomer/utils/Constants.java index dab488d3..3e1cdad2 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/utils/Constants.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/utils/Constants.java @@ -36,6 +36,7 @@ public class Constants { public static final String CALC_BY_RECIPEINT = "p"; public static final String CALC_BY_SENDER = "c"; public static final String SUCCESS_CODE_V2 = "0"; + public static final String OPT_EXPIRED_CODE_V2 = "101"; public static final String TRUE_STRING = "True"; public static final String MNT_STRING = "JPY"; @@ -44,6 +45,16 @@ public class Constants { public static String TERMS_N_CONDITIONS_KEY="keyTermsAndConditions"; public static String JME_TERMS_N_CONDITIONS="https://www.japanremit.com/Website/TermsAndConditions"; + public static String JME_REGISTER_TERMS="http://203.223.132.110:9093/Document/TermsAndConditions/Reg_TermsAndConditions.html"; + public static String JME_TRANSACTION_TERMS="http://203.223.132.110:9093/Document/TermsAndConditions/Trx_TermsAndConditions.html"; + + public static String USER_ID_KEY="userId"; + public static String OTP_KEY="OTP"; + public static String REQUEST_FOR_KEY="requestFor"; + public static String REQUEST_FOR_REG_VALUE="REGISTER"; + public static String REQUEST_FOR_REC_VALUE="RECEIVER"; + public static String RECEIVER_ID_KEY="receiverId"; + } diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/utils/https/API_URL.java b/app/src/main/java/com/swifttech/remit/jmecustomer/utils/https/API_URL.java index 75765f16..22c956c4 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/utils/https/API_URL.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/utils/https/API_URL.java @@ -83,7 +83,9 @@ public class API_URL { public static final String UPLOAD_EXISTING_KYC_V3 = "v1/mobile/RegisterKycExistingCustomer"; public static final String KYC_RELATED_DATA_V3 = "v4/mobile/loadform/{customer}/{type}"; public static final String FETCH_AUTO_DEBIT_DATA_V4 ="v4/GetKftcParameters/{userId}"; - public static final String RENEW_USER_ID ="v1/mobile/RenewID"; + public static final String RENEW_USER_ID =BuildConfig.API_VERSION+"/mobile/RenewID"; + public static final String EMAIL_VERIFY_SUBMIT =BuildConfig.API_VERSION+"/mobile/submitOTP"; + public static final String EMAIL_VERIFY_REQUEST =BuildConfig.API_VERSION+"/mobile/requestOTP"; diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/utils/https/ApiEndpoints.java b/app/src/main/java/com/swifttech/remit/jmecustomer/utils/https/ApiEndpoints.java index 9bebc2c2..dacf83fe 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/utils/https/ApiEndpoints.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/utils/https/ApiEndpoints.java @@ -311,4 +311,23 @@ public interface ApiEndpoints { @Part MultipartBody.Part frontIdImageFile, @Part MultipartBody.Part backIdImageFile ); + + @POST(API_URL.EMAIL_VERIFY_REQUEST) + @Headers("Content-Type: application/json") + Observable requestForOtp( + @Header("Authorization") String token, + @Body() JsonObject requestBody + ); + + @POST(API_URL.EMAIL_VERIFY_SUBMIT) + @Headers("Content-Type: application/json") + Observable verifyEmailCode( + @Header("Authorization") String token, + @Body() JsonObject requestBody + ); + + + + + } diff --git a/app/src/main/java/com/swifttech/remit/jmecustomer/utils/https/MessageResponseDataModel.java b/app/src/main/java/com/swifttech/remit/jmecustomer/utils/https/MessageResponseDataModel.java index 8156b932..544ba5c8 100644 --- a/app/src/main/java/com/swifttech/remit/jmecustomer/utils/https/MessageResponseDataModel.java +++ b/app/src/main/java/com/swifttech/remit/jmecustomer/utils/https/MessageResponseDataModel.java @@ -9,6 +9,10 @@ public class MessageResponseDataModel { @Expose private String msg; + @SerializedName("referenceId") + @Expose + private String referenceId; + public String getMsg() { return msg; } @@ -16,4 +20,12 @@ public class MessageResponseDataModel { public void setMsg(String msg) { this.msg = msg; } + + public String getReferenceId() { + return referenceId; + } + + public void setReferenceId(String referenceId) { + this.referenceId = referenceId; + } } diff --git a/app/src/main/res/layout/dialog_generci_edittext_prompt.xml b/app/src/main/res/layout/dialog_generci_edittext_prompt.xml index c130b9f1..93dc65f5 100644 --- a/app/src/main/res/layout/dialog_generci_edittext_prompt.xml +++ b/app/src/main/res/layout/dialog_generci_edittext_prompt.xml @@ -5,9 +5,7 @@ xmlns:app="http://schemas.android.com/apk/res-auto" android:orientation="vertical" android:background="@drawable/dialog_round" - android:paddingTop="28dp"> - - + > @@ -26,8 +24,10 @@ diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index af19dd2e..6c638f2b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1044,4 +1044,7 @@ All the configurations are done from backend web application system which allows Invalid user Id User Id Thank you, your Id is updated sucessfully + Verify email + Please click here to verify your email address + Processing request for OTP diff --git a/app/src/test/java/com/swifttech/remit/jmecustomer/HomeNotificationHandlerTest.java b/app/src/test/java/com/swifttech/remit/jmecustomer/HomeNotificationHandlerTest.java index c9f8714d..7d6980f0 100644 --- a/app/src/test/java/com/swifttech/remit/jmecustomer/HomeNotificationHandlerTest.java +++ b/app/src/test/java/com/swifttech/remit/jmecustomer/HomeNotificationHandlerTest.java @@ -60,7 +60,7 @@ public class HomeNotificationHandlerTest { @Test public void shouldShowAutoDebitRedirectPopup() { - HomeNotificationHandler notificationHandler = new HomeNotificationHandler(dummyStringExtractor, KYC_SUBMITTED_FLAG, KYC_VERIFIED_FLAG, PENNY_TEST_NOT_STARTED, AUTO_DEBIT_ROUTE_STRING,false,false,""); + HomeNotificationHandler notificationHandler = new HomeNotificationHandler(dummyStringExtractor, KYC_SUBMITTED_FLAG, KYC_VERIFIED_FLAG, PENNY_TEST_NOT_STARTED, AUTO_DEBIT_ROUTE_STRING,false,false,"",true); assertEquals("Should have shown auto debit route popup", AUTO_DEBIT_FILLUP_REQUIRED, notificationHandler.generateAppropriateHomeNotificationViewDTO().getNoticeViewType()); } @@ -68,7 +68,7 @@ public class HomeNotificationHandlerTest { @Test public void shouldNotShowAutoDebitRedirectPopupForEmptryRoute() { - HomeNotificationHandler notificationHandler = new HomeNotificationHandler(dummyStringExtractor, KYC_SUBMITTED_FLAG, KYC_VERIFIED_FLAG, PENNY_TEST_NOT_STARTED, AUTO_DEBIT_EMPTY_ROUTE_STRING,false,false,""); + HomeNotificationHandler notificationHandler = new HomeNotificationHandler(dummyStringExtractor, KYC_SUBMITTED_FLAG, KYC_VERIFIED_FLAG, PENNY_TEST_NOT_STARTED, AUTO_DEBIT_EMPTY_ROUTE_STRING,false,false,"",true); assertNotEquals("Should not have shown auto debit route popup", AUTO_DEBIT_FILLUP_REQUIRED, notificationHandler.generateAppropriateHomeNotificationViewDTO().getNoticeViewType()); @@ -84,7 +84,7 @@ public class HomeNotificationHandlerTest { @Test public void shouldShowKYCNotSubmittedPopUpForNotSubmittedStatus() { - HomeNotificationHandler notificationHandler = new HomeNotificationHandler(dummyStringExtractor, KYC_NOT_SUBMITTED_FLAG, KYC_VERIFIED_FLAG, PENNY_TEST_COMPLETED, AUTO_DEBIT__NULL_ROUTE_STRING,false,false,""); + HomeNotificationHandler notificationHandler = new HomeNotificationHandler(dummyStringExtractor, KYC_NOT_SUBMITTED_FLAG, KYC_VERIFIED_FLAG, PENNY_TEST_COMPLETED, AUTO_DEBIT__NULL_ROUTE_STRING,false,false,"",true); assertEquals("Should have shown kyc not submitted popup", KYC_NOT_SUBMITTED, notificationHandler.generateAppropriateHomeNotificationViewDTO().getNoticeViewType()); @@ -93,14 +93,14 @@ public class HomeNotificationHandlerTest { @Test public void shouldNotShowKYCNotSubmittedPopUpForSubmittedStatus() { - HomeNotificationHandler notificationHandler = new HomeNotificationHandler(dummyStringExtractor, KYC_SUBMITTED_FLAG, KYC_NOT_VERIFIED_FLAG, PENNY_TEST_NOT_STARTED, AUTO_DEBIT__NULL_ROUTE_STRING,false,false,""); + HomeNotificationHandler notificationHandler = new HomeNotificationHandler(dummyStringExtractor, KYC_SUBMITTED_FLAG, KYC_NOT_VERIFIED_FLAG, PENNY_TEST_NOT_STARTED, AUTO_DEBIT__NULL_ROUTE_STRING,false,false,"",true); assertNotEquals("Should not have shown kyc not submitted popup", KYC_NOT_SUBMITTED, notificationHandler.generateAppropriateHomeNotificationViewDTO().getNoticeViewType()); } @Test public void shouldShowKYCNotVerifiedPopUpForUnverifiedStatus() { - HomeNotificationHandler notificationHandler = new HomeNotificationHandler(dummyStringExtractor, KYC_SUBMITTED_FLAG, KYC_NOT_VERIFIED_FLAG, PENNY_TEST_COMPLETED, AUTO_DEBIT__NULL_ROUTE_STRING,false,false,""); + HomeNotificationHandler notificationHandler = new HomeNotificationHandler(dummyStringExtractor, KYC_SUBMITTED_FLAG, KYC_NOT_VERIFIED_FLAG, PENNY_TEST_COMPLETED, AUTO_DEBIT__NULL_ROUTE_STRING,false,false,"",true); assertEquals("Should have shown kyc not verified popup", KYC_NOT_VERIFIED, notificationHandler.generateAppropriateHomeNotificationViewDTO().getNoticeViewType()); @@ -108,7 +108,7 @@ public class HomeNotificationHandlerTest { @Test public void shouldNotShowKYCNotVerifiedPopUpForVerifiedStatus() { - HomeNotificationHandler notificationHandler = new HomeNotificationHandler(dummyStringExtractor, KYC_SUBMITTED_FLAG, KYC_VERIFIED_FLAG, PENNY_TEST_NOT_STARTED, AUTO_DEBIT__NULL_ROUTE_STRING,false,false,""); + HomeNotificationHandler notificationHandler = new HomeNotificationHandler(dummyStringExtractor, KYC_SUBMITTED_FLAG, KYC_VERIFIED_FLAG, PENNY_TEST_NOT_STARTED, AUTO_DEBIT__NULL_ROUTE_STRING,false,false,"",true); assertNotEquals("Should not have shown kyc not verified popup", KYC_NOT_VERIFIED, notificationHandler.generateAppropriateHomeNotificationViewDTO().getNoticeViewType()); } @@ -116,7 +116,7 @@ public class HomeNotificationHandlerTest { @Test public void shouldShowPennyTestNotCompletedPopupForNotStartedStatusAndKYCVerified() { - HomeNotificationHandler notificationHandler = new HomeNotificationHandler(dummyStringExtractor, KYC_SUBMITTED_FLAG, KYC_VERIFIED_FLAG, PENNY_TEST_NOT_STARTED, AUTO_DEBIT_EMPTY_ROUTE_STRING,false,false,""); + HomeNotificationHandler notificationHandler = new HomeNotificationHandler(dummyStringExtractor, KYC_SUBMITTED_FLAG, KYC_VERIFIED_FLAG, PENNY_TEST_NOT_STARTED, AUTO_DEBIT_EMPTY_ROUTE_STRING,false,false,"",true); assertEquals("Should have shown penny test popup", PENNY_TEST_REQUIRED, notificationHandler.generateAppropriateHomeNotificationViewDTO().getNoticeViewType()); @@ -124,7 +124,7 @@ public class HomeNotificationHandlerTest { @Test public void shouldShowPennyTestNotCompletedPopupForUndefinedStatusAndKYCVerified() { - HomeNotificationHandler notificationHandler = new HomeNotificationHandler(dummyStringExtractor, KYC_SUBMITTED_FLAG, KYC_VERIFIED_FLAG, PENNY_TEST_STATUS_UNDEFINED, AUTO_DEBIT_EMPTY_ROUTE_STRING,false,false,""); + HomeNotificationHandler notificationHandler = new HomeNotificationHandler(dummyStringExtractor, KYC_SUBMITTED_FLAG, KYC_VERIFIED_FLAG, PENNY_TEST_STATUS_UNDEFINED, AUTO_DEBIT_EMPTY_ROUTE_STRING,false,false,"",true); assertEquals("Should have shown penny test popup", PENNY_TEST_REQUIRED, notificationHandler.generateAppropriateHomeNotificationViewDTO().getNoticeViewType()); @@ -133,7 +133,7 @@ public class HomeNotificationHandlerTest { @Test public void shouldShowPennyTestNotCompletedPopupForOnlyRequestedStatusAndKYCVerified() { - HomeNotificationHandler notificationHandler = new HomeNotificationHandler(dummyStringExtractor, KYC_SUBMITTED_FLAG, KYC_VERIFIED_FLAG, PENNY_TEST_ONLY_REQUESTED, AUTO_DEBIT_EMPTY_ROUTE_STRING,false,false,""); + HomeNotificationHandler notificationHandler = new HomeNotificationHandler(dummyStringExtractor, KYC_SUBMITTED_FLAG, KYC_VERIFIED_FLAG, PENNY_TEST_ONLY_REQUESTED, AUTO_DEBIT_EMPTY_ROUTE_STRING,false,false,"",true); assertEquals("Should have shown penny test popup", PENNY_TEST_REQUIRED, notificationHandler.generateAppropriateHomeNotificationViewDTO().getNoticeViewType()); @@ -141,7 +141,7 @@ public class HomeNotificationHandlerTest { @Test public void shouldShowPennyTestNotCompletedPopupForNotStartedStatusAndNotKYCVerified() { - HomeNotificationHandler notificationHandler = new HomeNotificationHandler(dummyStringExtractor, KYC_SUBMITTED_FLAG, KYC_NOT_VERIFIED_FLAG, PENNY_TEST_NOT_STARTED, AUTO_DEBIT_EMPTY_ROUTE_STRING,false,false,""); + HomeNotificationHandler notificationHandler = new HomeNotificationHandler(dummyStringExtractor, KYC_SUBMITTED_FLAG, KYC_NOT_VERIFIED_FLAG, PENNY_TEST_NOT_STARTED, AUTO_DEBIT_EMPTY_ROUTE_STRING,false,false,"",true); assertEquals("Should have shown penny test popup", PENNY_TEST_REQUIRED, notificationHandler.generateAppropriateHomeNotificationViewDTO().getNoticeViewType()); @@ -149,7 +149,7 @@ public class HomeNotificationHandlerTest { @Test public void shouldShowPennyTestNotCompletedPopupForUndefinedStatusAndNotKYCVerified() { - HomeNotificationHandler notificationHandler = new HomeNotificationHandler(dummyStringExtractor, KYC_SUBMITTED_FLAG, KYC_NOT_VERIFIED_FLAG, PENNY_TEST_STATUS_UNDEFINED, AUTO_DEBIT_EMPTY_ROUTE_STRING,false,false,""); + HomeNotificationHandler notificationHandler = new HomeNotificationHandler(dummyStringExtractor, KYC_SUBMITTED_FLAG, KYC_NOT_VERIFIED_FLAG, PENNY_TEST_STATUS_UNDEFINED, AUTO_DEBIT_EMPTY_ROUTE_STRING,false,false,"",true); assertEquals("Should have shown penny test popup", PENNY_TEST_REQUIRED, notificationHandler.generateAppropriateHomeNotificationViewDTO().getNoticeViewType()); @@ -158,7 +158,7 @@ public class HomeNotificationHandlerTest { @Test public void shouldShowPennyTestNotCompletedPopupForOnlyRequestedStatusAndNotKYCVerified() { - HomeNotificationHandler notificationHandler = new HomeNotificationHandler(dummyStringExtractor, KYC_SUBMITTED_FLAG, KYC_NOT_VERIFIED_FLAG, PENNY_TEST_ONLY_REQUESTED, AUTO_DEBIT_EMPTY_ROUTE_STRING,false,false,""); + HomeNotificationHandler notificationHandler = new HomeNotificationHandler(dummyStringExtractor, KYC_SUBMITTED_FLAG, KYC_NOT_VERIFIED_FLAG, PENNY_TEST_ONLY_REQUESTED, AUTO_DEBIT_EMPTY_ROUTE_STRING,false,false,"",true); assertEquals("Should have shown penny test popup", PENNY_TEST_REQUIRED, notificationHandler.generateAppropriateHomeNotificationViewDTO().getNoticeViewType()); @@ -167,7 +167,7 @@ public class HomeNotificationHandlerTest { @Test public void shouldNotShowNotVerifiedPopupForKYCVerifiedStatus() { - HomeNotificationHandler notificationHandler = new HomeNotificationHandler(dummyStringExtractor, KYC_SUBMITTED_FLAG, KYC_VERIFIED_FLAG, PENNY_TEST_COMPLETED, AUTO_DEBIT_EMPTY_ROUTE_STRING,false,false,""); + HomeNotificationHandler notificationHandler = new HomeNotificationHandler(dummyStringExtractor, KYC_SUBMITTED_FLAG, KYC_VERIFIED_FLAG, PENNY_TEST_COMPLETED, AUTO_DEBIT_EMPTY_ROUTE_STRING,false,false,"",true); assertNull("Should have return null for penny test completed status", notificationHandler.generateAppropriateHomeNotificationViewDTO());