|
@ -1,5 +1,6 @@ |
|
|
package com.remit.jmecustomer.features.home.presenter; |
|
|
package com.remit.jmecustomer.features.home.presenter; |
|
|
|
|
|
|
|
|
|
|
|
import com.remit.jmecustomer.base.PrefKeys; |
|
|
import com.remit.jmecustomer.features.home.view.HomeFragmentV2; |
|
|
import com.remit.jmecustomer.features.home.view.HomeFragmentV2; |
|
|
import com.remit.jmecustomer.R; |
|
|
import com.remit.jmecustomer.R; |
|
|
import com.remit.jmecustomer.RemitApplication; |
|
|
import com.remit.jmecustomer.RemitApplication; |
|
@ -53,49 +54,51 @@ public class HomeNotificationHandler { |
|
|
this.stringExtractor = stringExtractor; |
|
|
this.stringExtractor = stringExtractor; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public static HomeNotificationViewDTO generateNotificationFromType(RemitApplication.StringExtractor stringExtractor, HomeNoticeViewTypeEnum type, String redirectTo,String residenceType) { |
|
|
|
|
|
return new HomeNotificationHandler(stringExtractor).generateHomeNotificationViewExplicitlyFromType(type, redirectTo,residenceType); |
|
|
|
|
|
|
|
|
public static HomeNotificationViewDTO generateNotificationFromType(RemitApplication.StringExtractor stringExtractor, HomeNoticeViewTypeEnum type, String redirectTo, String residenceType) { |
|
|
|
|
|
return new HomeNotificationHandler(stringExtractor).generateHomeNotificationViewExplicitlyFromType(type, redirectTo, residenceType); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private HomeNotificationViewDTO generateHomeNotificationViewExplicitlyFromType(HomeNoticeViewTypeEnum type, String redirectTo,String residenceType) { |
|
|
|
|
|
|
|
|
private HomeNotificationViewDTO generateHomeNotificationViewExplicitlyFromType(HomeNoticeViewTypeEnum type, String redirectTo, String residenceType) { |
|
|
switch (type) { |
|
|
switch (type) { |
|
|
case KYC_NOT_SUBMITTED: |
|
|
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, redirectTo,residenceType); |
|
|
|
|
|
|
|
|
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, redirectTo, residenceType); |
|
|
kycNotSubmittedNotificationViewDTO.setFocused(true); |
|
|
kycNotSubmittedNotificationViewDTO.setFocused(true); |
|
|
return kycNotSubmittedNotificationViewDTO; |
|
|
return kycNotSubmittedNotificationViewDTO; |
|
|
|
|
|
|
|
|
case TERMSNOTACCEPTED: |
|
|
case TERMSNOTACCEPTED: |
|
|
HomeNotificationViewDTO termsNotAcceptedNotificationViewDTO = new HomeNotificationViewDTO(stringExtractor.getStringFromStringId(R.string.terms_and_condition_title_text), stringExtractor.getStringFromStringId(R.string.terms_not_accepted_text), isExistingCustomer, HomeNoticeViewTypeEnum.TERMSNOTACCEPTED, hasUpdatedDefaultCredentials, redirectTo,residenceType); |
|
|
|
|
|
|
|
|
HomeNotificationViewDTO termsNotAcceptedNotificationViewDTO = new HomeNotificationViewDTO(stringExtractor.getStringFromStringId(R.string.terms_and_condition_title_text), stringExtractor.getStringFromStringId(R.string.terms_not_accepted_text), isExistingCustomer, HomeNoticeViewTypeEnum.TERMSNOTACCEPTED, hasUpdatedDefaultCredentials, redirectTo, residenceType); |
|
|
termsNotAcceptedNotificationViewDTO.setFocused(true); |
|
|
termsNotAcceptedNotificationViewDTO.setFocused(true); |
|
|
return termsNotAcceptedNotificationViewDTO; |
|
|
return termsNotAcceptedNotificationViewDTO; |
|
|
|
|
|
|
|
|
case KYC_NOT_VERIFIED: |
|
|
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, redirectTo,residenceType); |
|
|
|
|
|
|
|
|
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, redirectTo, residenceType); |
|
|
|
|
|
|
|
|
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, redirectTo,residenceType); |
|
|
|
|
|
|
|
|
case CHANGE_TXN_PIN: { |
|
|
|
|
|
String hasUpdatedCredentials = RemitApplication.getStorage().getString(PrefKeys.HAS_UPDATED_CREDENTIALS, "0"); |
|
|
|
|
|
HomeNotificationViewDTO changeTxnPinNotificationViewDTO = new HomeNotificationViewDTO(stringExtractor.getStringFromStringId(hasUpdatedCredentials.equalsIgnoreCase("5") ? R.string.setup_new_pin_title : R.string.change_txn_pin), stringExtractor.getStringFromStringId(R.string.change_txn_pin_detail), isExistingCustomer, HomeNoticeViewTypeEnum.CHANGE_TXN_PIN, hasUpdatedDefaultCredentials, redirectTo, residenceType); |
|
|
changeTxnPinNotificationViewDTO.setFocused(true); |
|
|
changeTxnPinNotificationViewDTO.setFocused(true); |
|
|
return changeTxnPinNotificationViewDTO; |
|
|
return changeTxnPinNotificationViewDTO; |
|
|
|
|
|
|
|
|
case CHANGE_PIN: |
|
|
|
|
|
HomeNotificationViewDTO changePinNotificationViewDTO = new HomeNotificationViewDTO(stringExtractor.getStringFromStringId(R.string.change_txn_pin), stringExtractor.getStringFromStringId(R.string.change_txn_pin_detail1), isExistingCustomer, HomeNoticeViewTypeEnum.CHANGE_PIN, hasUpdatedDefaultCredentials, redirectTo,residenceType); |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
case CHANGE_PIN: { |
|
|
|
|
|
String hasUpdatedCredentials = RemitApplication.getStorage().getString(PrefKeys.HAS_UPDATED_CREDENTIALS, "0"); |
|
|
|
|
|
HomeNotificationViewDTO changePinNotificationViewDTO = new HomeNotificationViewDTO(stringExtractor.getStringFromStringId(hasUpdatedCredentials.equalsIgnoreCase("5") ? R.string.setup_new_pin_title : R.string.change_txn_pin), stringExtractor.getStringFromStringId(hasUpdatedCredentials.equalsIgnoreCase("5") ? R.string.setup_new_pin_body : R.string.change_txn_pin_detail1), isExistingCustomer, HomeNoticeViewTypeEnum.CHANGE_PIN, hasUpdatedDefaultCredentials, redirectTo, residenceType); |
|
|
changePinNotificationViewDTO.setFocused(true); |
|
|
changePinNotificationViewDTO.setFocused(true); |
|
|
return changePinNotificationViewDTO; |
|
|
return changePinNotificationViewDTO; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
case CHANGE_TXN_PIN_N_PASS: |
|
|
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, redirectTo,residenceType); |
|
|
|
|
|
|
|
|
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, redirectTo, residenceType); |
|
|
changeTxnPinNPassNotificationViewDTO.setFocused(true); |
|
|
changeTxnPinNPassNotificationViewDTO.setFocused(true); |
|
|
return changeTxnPinNPassNotificationViewDTO; |
|
|
return changeTxnPinNPassNotificationViewDTO; |
|
|
|
|
|
|
|
|
case CHANGE_TXN_PASS: |
|
|
case CHANGE_TXN_PASS: |
|
|
HomeNotificationViewDTO changeTxnPassNotificationViewDTO = new HomeNotificationViewDTO(stringExtractor.getStringFromStringId(R.string.change_password_text), stringExtractor.getStringFromStringId(R.string.change_txn_pass_detail), isExistingCustomer, HomeNoticeViewTypeEnum.CHANGE_TXN_PASS, hasUpdatedDefaultCredentials, redirectTo,residenceType); |
|
|
|
|
|
|
|
|
HomeNotificationViewDTO changeTxnPassNotificationViewDTO = new HomeNotificationViewDTO(stringExtractor.getStringFromStringId(R.string.change_password_text), stringExtractor.getStringFromStringId(R.string.change_txn_pass_detail), isExistingCustomer, HomeNoticeViewTypeEnum.CHANGE_TXN_PASS, hasUpdatedDefaultCredentials, redirectTo, residenceType); |
|
|
changeTxnPassNotificationViewDTO.setFocused(true); |
|
|
changeTxnPassNotificationViewDTO.setFocused(true); |
|
|
return changeTxnPassNotificationViewDTO; |
|
|
return changeTxnPassNotificationViewDTO; |
|
|
|
|
|
|
|
|
case EMAIL_NOT_VERIFIED: |
|
|
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, redirectTo,residenceType); |
|
|
|
|
|
|
|
|
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, redirectTo, residenceType); |
|
|
emailNotVerifiedDto.setFocused(true); |
|
|
emailNotVerifiedDto.setFocused(true); |
|
|
return emailNotVerifiedDto; |
|
|
return emailNotVerifiedDto; |
|
|
|
|
|
|
|
@ -106,27 +109,29 @@ public class HomeNotificationHandler { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public HomeNotificationViewDTO generateAppropriateHomeNotificationViewDTO(String redirectTo,String residenceType) { |
|
|
|
|
|
return generateAppropriateRegistrationRelatedNotification(redirectTo,residenceType); |
|
|
|
|
|
|
|
|
public HomeNotificationViewDTO generateAppropriateHomeNotificationViewDTO(String redirectTo, String residenceType) { |
|
|
|
|
|
return generateAppropriateRegistrationRelatedNotification(redirectTo, residenceType); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private HomeNotificationViewDTO generateAppropriateRegistrationRelatedNotification(String redirectTo,String residenceType) { |
|
|
|
|
|
|
|
|
private HomeNotificationViewDTO generateAppropriateRegistrationRelatedNotification(String redirectTo, String residenceType) { |
|
|
if (!isEmailVerified) |
|
|
if (!isEmailVerified) |
|
|
return generateHomeNotificationViewExplicitlyFromType(HomeNoticeViewTypeEnum.EMAIL_NOT_VERIFIED,redirectTo,residenceType); |
|
|
|
|
|
|
|
|
return generateHomeNotificationViewExplicitlyFromType(HomeNoticeViewTypeEnum.EMAIL_NOT_VERIFIED, redirectTo, residenceType); |
|
|
else if (!kycSubmit) |
|
|
else if (!kycSubmit) |
|
|
return generateHomeNotificationViewExplicitlyFromType(HomeNoticeViewTypeEnum.KYC_NOT_SUBMITTED,redirectTo,residenceType); |
|
|
|
|
|
|
|
|
return generateHomeNotificationViewExplicitlyFromType(HomeNoticeViewTypeEnum.KYC_NOT_SUBMITTED, redirectTo, residenceType); |
|
|
else if (!isTermsAccepted) |
|
|
else if (!isTermsAccepted) |
|
|
return generateHomeNotificationViewExplicitlyFromType(HomeNoticeViewTypeEnum.TERMSNOTACCEPTED,redirectTo,residenceType); |
|
|
|
|
|
|
|
|
return generateHomeNotificationViewExplicitlyFromType(HomeNoticeViewTypeEnum.TERMSNOTACCEPTED, redirectTo, residenceType); |
|
|
else if (!isVerified) |
|
|
else if (!isVerified) |
|
|
return generateHomeNotificationViewExplicitlyFromType(HomeNoticeViewTypeEnum.KYC_NOT_VERIFIED,redirectTo,residenceType); |
|
|
|
|
|
|
|
|
return generateHomeNotificationViewExplicitlyFromType(HomeNoticeViewTypeEnum.KYC_NOT_VERIFIED, redirectTo, residenceType); |
|
|
else if (hasUpdatedDefaultCredentials.equals("1")) |
|
|
else if (hasUpdatedDefaultCredentials.equals("1")) |
|
|
return generateHomeNotificationViewExplicitlyFromType(HomeNoticeViewTypeEnum.CHANGE_TXN_PIN,redirectTo,residenceType); |
|
|
|
|
|
|
|
|
return generateHomeNotificationViewExplicitlyFromType(HomeNoticeViewTypeEnum.CHANGE_TXN_PIN, redirectTo, residenceType); |
|
|
else if (hasUpdatedDefaultCredentials.equals("2")) |
|
|
else if (hasUpdatedDefaultCredentials.equals("2")) |
|
|
return generateHomeNotificationViewExplicitlyFromType(HomeNoticeViewTypeEnum.CHANGE_TXN_PIN_N_PASS,redirectTo,residenceType); |
|
|
|
|
|
|
|
|
return generateHomeNotificationViewExplicitlyFromType(HomeNoticeViewTypeEnum.CHANGE_TXN_PIN_N_PASS, redirectTo, residenceType); |
|
|
else if (hasUpdatedDefaultCredentials.equals("3")) |
|
|
else if (hasUpdatedDefaultCredentials.equals("3")) |
|
|
return generateHomeNotificationViewExplicitlyFromType(HomeNoticeViewTypeEnum.CHANGE_TXN_PASS,redirectTo,residenceType); |
|
|
|
|
|
|
|
|
return generateHomeNotificationViewExplicitlyFromType(HomeNoticeViewTypeEnum.CHANGE_TXN_PASS, redirectTo, residenceType); |
|
|
else if (hasUpdatedDefaultCredentials.equals("4")) |
|
|
else if (hasUpdatedDefaultCredentials.equals("4")) |
|
|
return generateHomeNotificationViewExplicitlyFromType(HomeNoticeViewTypeEnum.CHANGE_PIN,redirectTo,residenceType); |
|
|
|
|
|
|
|
|
return generateHomeNotificationViewExplicitlyFromType(HomeNoticeViewTypeEnum.CHANGE_PIN, redirectTo, residenceType); |
|
|
|
|
|
else if (hasUpdatedDefaultCredentials.equals("5")) |
|
|
|
|
|
return generateHomeNotificationViewExplicitlyFromType(HomeNoticeViewTypeEnum.CHANGE_PIN, redirectTo, residenceType); |
|
|
else |
|
|
else |
|
|
return null; |
|
|
return null; |
|
|
} |
|
|
} |
|
|