@ -6,7 +6,13 @@ import com.gmeremit.online.gmeremittance_native.homeV2.model.HomeNotificationVie
/ * *
* @author Preyea R . Regmi
* Inorder to understand the implementation of this class , consider reading the corresponding Unit Test : HomeNotificationHandlerTest
* This class is responsbile for generating appropriate notification related data that is shown in { @link com . gmeremit . online . gmeremittance_native . homeV2 . view . HomeFragmentV2 }
* Currently two set of Notifications are handled .
* 1 ) Redirect Notification
* 2 ) Registration Notification
* < bold > Precedence Order < / bold >
* < p > Redirect Notification ( AUTO_DEBIT_REDIRECT ) > > Registration Notification ( KYC_SUBMIT - > PENNY_TEST_STATUS - > KYC_VERIFIED ) .
* Inorder to understand the implementation of this class , consider reading the corresponding Unit Test : HomeNotificationHandlerTest < / p >
* /
public class HomeNotificationHandler {
@ -32,31 +38,31 @@ public class HomeNotificationHandler {
}
private HomeNotificationHandler ( GmeApplication . StringExtractor stringExtractor )
{
this . stringExtractor = stringExtractor ;
private HomeNotificationHandler ( GmeApplication . StringExtractor stringExtractor ) {
this . stringExtractor = stringExtractor ;
}
public static HomeNotificationViewDTO generateNotificationFromType ( GmeApplication . StringExtractor stringExtractor , HomeNoticeViewTypeEnum type )
{
public static HomeNotificationViewDTO generateNotificationFromType ( GmeApplication . StringExtractor stringExtractor , HomeNoticeViewTypeEnum type ) {
return new HomeNotificationHandler ( stringExtractor ) . generateHomeNotificaationViewExplicitlyFromType ( type ) ;
}
private HomeNotificationViewDTO generateHomeNotificaationViewExplicitlyFromType ( HomeNoticeViewTypeEnum type )
{
switch ( type )
{
private HomeNotificationViewDTO generateHomeNotificaationViewExplicitlyFromType ( HomeNoticeViewTypeEnum type ) {
switch ( type ) {
case KYC_NOT_SUBMITTED :
return new HomeNotificationViewDTO ( stringExtractor . getStringFromStringId ( R . string . kyc_fill_text ) , stringExtractor . getStringFromStringId ( R . string . complete_your_registration_text ) , HomeNoticeViewTypeEnum . KYC_NOT_SUBMITTED ) ;
HomeNotificationViewDTO kycNotSubmittedNotificationViewDTO = new HomeNotificationViewDTO ( stringExtractor . getStringFromStringId ( R . string . kyc_fill_text ) , stringExtractor . getStringFromStringId ( R . string . complete_your_registration_text ) , HomeNoticeViewTypeEnum . KYC_NOT_SUBMITTED ) ;
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 ) , HomeNoticeViewTypeEnum . KYC_NOT_VERIFIED ) ;
case PENNY_TEST_REQUIRED :
return new HomeNotificationViewDTO ( stringExtractor . getStringFromStringId ( R . string . penny_test_pending_text ) , stringExtractor . getStringFromStringId ( R . string . complete_penny_test ) , HomeNoticeViewTypeEnum . PENNY_TEST_REQUIRED ) ;
HomeNotificationViewDTO pennyTestRequiredNotificationViewDTO = new HomeNotificationViewDTO ( stringExtractor . getStringFromStringId ( R . string . penny_test_pending_text ) , stringExtractor . getStringFromStringId ( R . string . complete_penny_test ) , HomeNoticeViewTypeEnum . PENNY_TEST_REQUIRED ) ;
pennyTestRequiredNotificationViewDTO . setFocused ( true ) ;
return pennyTestRequiredNotificationViewDTO ;
case AUTO_DEBIT_FILLUP_REQUIRED :
HomeNotificationViewDTO notificationViewDTO = new HomeNotificationViewDTO ( stringExtractor . getStringFromStringId ( R . string . add_auto_debit_account_text ) , stringExtractor . getStringFromStringId ( R . string . autodebit_account_required_message ) , HomeNoticeViewTypeEnum . AUTO_DEBIT_FILLUP_REQUIRED ) ;
n otificationViewDTO. setFocused ( true ) ;
return n otificationViewDTO;
HomeNotificationViewDTO autoDebitFillUPRequiredN otificationViewDTO = new HomeNotificationViewDTO ( stringExtractor . getStringFromStringId ( R . string . add_auto_debit_account_text ) , stringExtractor . getStringFromStringId ( R . string . autodebit_account_required_message ) , HomeNoticeViewTypeEnum . AUTO_DEBIT_FILLUP_REQUIRED ) ;
autoDebitFillUPRequiredN otificationViewDTO. setFocused ( true ) ;
return autoDebitFillUPRequiredN otificationViewDTO;
default :
return null ;
@ -67,23 +73,25 @@ public class HomeNotificationHandler {
public HomeNotificationViewDTO generateAppropriateHomeNotificationViewDTO ( ) {
if ( "autoDebit" . equalsIgnoreCase ( redirectTo ) ) {
return generateHomeNotificaationViewExplicitlyFromType ( HomeNoticeViewTypeEnum . AUTO_DEBIT_FILLUP_REQUIRED ) ;
} else {
{
} else
return generateApproriateRegistrationRelatedNotification ( ) ;
}
private HomeNotificationViewDTO generateApproriateRegistrationRelatedNotification ( ) {
if ( ! kycSubmit )
return generateHomeNotificaationViewExplicitlyFromType ( HomeNoticeViewTypeEnum . KYC_NOT_SUBMITTED ) ;
else {
if ( ! isVerified )
return generateHomeNotificaationViewExplicitlyFromType ( HomeNoticeViewTypeEnum . KYC_NOT_VERIFIED ) ;
else {
if ( ! "2" . equalsIgnoreCase ( pennyTestStatus ) )
return generateHomeNotificaationViewExplicitlyFromType ( HomeNoticeViewTypeEnum . PENNY_TEST_REQUIRED ) ;
else {
if ( ! isVerified )
return generateHomeNotificaationViewExplicitlyFromType ( HomeNoticeViewTypeEnum . KYC_NOT_VERIFIED ) ;
else
return null ;
}
}
}
}
}
public enum HomeNoticeViewTypeEnum {