|
@ -79,7 +79,7 @@ public class LocalTopUpPresenter extends BasePresenter implements LocalTopUpPres |
|
|
this.fixedTopup = new MutableLiveData<>(); |
|
|
this.fixedTopup = new MutableLiveData<>(); |
|
|
this.selectedPaymentSourceLiveData = new MutableLiveData<>(); |
|
|
this.selectedPaymentSourceLiveData = new MutableLiveData<>(); |
|
|
this.selectedPaymentSourceBalanceLiveData = new MutableLiveData<>(); |
|
|
this.selectedPaymentSourceBalanceLiveData = new MutableLiveData<>(); |
|
|
countDownRemainingValue=-1; |
|
|
|
|
|
|
|
|
countDownRemainingValue = -1; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
@ -126,8 +126,8 @@ public class LocalTopUpPresenter extends BasePresenter implements LocalTopUpPres |
|
|
private void fetchLocalTopUpData() { |
|
|
private void fetchLocalTopUpData() { |
|
|
this.compositeDisposable.add( |
|
|
this.compositeDisposable.add( |
|
|
Observable.zip( |
|
|
Observable.zip( |
|
|
getLocalTopUpOnBasisCardType(REGULAR_CARD_TYPE, userMsisdn).onErrorReturnItem(new LocalTopUpResponseDTO()), |
|
|
|
|
|
getLocalTopUpOnBasisCardType(FIXED_CARD_TYPE, userMsisdn).onErrorReturnItem(new LocalTopUpResponseDTO()), |
|
|
|
|
|
|
|
|
getLocalTopUpOnBasisCardType(REGULAR_CARD_TYPE, userMsisdn), |
|
|
|
|
|
getLocalTopUpOnBasisCardType(FIXED_CARD_TYPE, userMsisdn), |
|
|
getPaymentSourcesList(), |
|
|
getPaymentSourcesList(), |
|
|
LocalTopUpRelatedData::new) |
|
|
LocalTopUpRelatedData::new) |
|
|
.subscribeOn(Schedulers.io()) |
|
|
.subscribeOn(Schedulers.io()) |
|
@ -141,14 +141,6 @@ public class LocalTopUpPresenter extends BasePresenter implements LocalTopUpPres |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void loadDummyData() { |
|
|
|
|
|
String type1 = "{\"CardListType\":\"1\",\"ButtonsGrid\":[{\"Price\":\"10000\"},{\"Price\":\"20000\"},{\"Price\":\"30000\"},{\"Price\":\"40000\"},{\"Price\":\"50000\"},{\"Price\":\"10000000\"}],\"CountryPriceCode\":null,\"CardInfo\":null}"; |
|
|
|
|
|
String type2 = "{\"CardListType\":\"6\",\"ButtonsGrid\":null,\"CountryPriceCode\":null,\"CardInfo\":[{\"CardCode\":null,\"CardName\":\"AimPlus \",\"FacePrice\":null,\"SubInfo\":[{\"Mvno_code\":\"1\",\"Sale_price\":\"10000\",\"Card_type\":\"FLAT_005\",\"Product_name\":\"AimPlus (10,000)\",\"Face_price\":\"10000\",\"Product_type\":\"FLAT\",\"Plan_info\":null,\"Card_name\":\"AimPlus (10,000)\",\"Telecom_code\":\"\"},{\"Mvno_code\":\"1\",\"Sale_price\":\"20000\",\"Card_type\":\"FLAT_005\",\"Product_name\":\"AimPlus (20,000)\",\"Face_price\":\"20000\",\"Product_type\":\"FLAT\",\"Plan_info\":null,\"Card_name\":\"AimPlus (20,000)\",\"Telecom_code\":\"\"},{\"Mvno_code\":\"1\",\"Sale_price\":\"25000\",\"Card_type\":\"FLAT_005\",\"Product_name\":\"AimPlus (25,000)\",\"Face_price\":\"2500000\",\"Product_type\":\"FLAT\",\"Plan_info\":null,\"Card_name\":\"AimPlus (2,500,000)\",\"Telecom_code\":\"\"}],\"Promotion_price\":null}]}"; |
|
|
|
|
|
regularTopup.setValue(HttpClientV2.getDeserializer().fromJson(type1, LocalTopUpResponseDTO.class)); |
|
|
|
|
|
fixedTopup.setValue(HttpClientV2.getDeserializer().fromJson(type2, LocalTopUpResponseDTO.class)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void onRegularTopUpDenoSelected(ButtonsGrid selectedAmount) { |
|
|
public void onRegularTopUpDenoSelected(ButtonsGrid selectedAmount) { |
|
|
regularTopUpValidator.isDenoValid(selectedAmount); |
|
|
regularTopUpValidator.isDenoValid(selectedAmount); |
|
@ -221,14 +213,10 @@ public class LocalTopUpPresenter extends BasePresenter implements LocalTopUpPres |
|
|
this.selectedPaymentSource = paymentSource; |
|
|
this.selectedPaymentSource = paymentSource; |
|
|
this.userCurrentBalance = null; |
|
|
this.userCurrentBalance = null; |
|
|
selectedPaymentSourceLiveData.setValue(this.selectedPaymentSource.toString()); |
|
|
selectedPaymentSourceLiveData.setValue(this.selectedPaymentSource.toString()); |
|
|
if("wallet".equalsIgnoreCase(paymentSource.getType())) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
if ("wallet".equalsIgnoreCase(paymentSource.getType())) { |
|
|
String walletBalance = gateway.getUserCurrentBalance(); |
|
|
String walletBalance = gateway.getUserCurrentBalance(); |
|
|
if (walletBalance != null && walletBalance.length() > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
// userCurrentBalance=Utils.formatCurrencyWithoutTruncatingDecimal(walletBalance); |
|
|
|
|
|
//TODO Dummy |
|
|
|
|
|
userCurrentBalance="20000"; |
|
|
|
|
|
|
|
|
if (walletBalance != null && walletBalance.length() > 0) { |
|
|
|
|
|
userCurrentBalance = Utils.formatCurrencyWithoutTruncatingDecimal(walletBalance); |
|
|
updateBalance(userCurrentBalance); |
|
|
updateBalance(userCurrentBalance); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -255,7 +243,7 @@ public class LocalTopUpPresenter extends BasePresenter implements LocalTopUpPres |
|
|
view.promptBiometricAuthDialog(new TransactionBiometricPromptDialog.BiometricPromptResultListener() { |
|
|
view.promptBiometricAuthDialog(new TransactionBiometricPromptDialog.BiometricPromptResultListener() { |
|
|
@Override |
|
|
@Override |
|
|
public void onBiometricAuthSuccess(String password) { |
|
|
public void onBiometricAuthSuccess(String password) { |
|
|
prepareAndPerformRegularTopUpTxn(password,true); |
|
|
|
|
|
|
|
|
prepareAndPerformRegularTopUpTxn(password, true); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
@ -263,7 +251,7 @@ public class LocalTopUpPresenter extends BasePresenter implements LocalTopUpPres |
|
|
view.promptPassword(new PasswordPromptListener() { |
|
|
view.promptPassword(new PasswordPromptListener() { |
|
|
@Override |
|
|
@Override |
|
|
public void onPasswordSubmit(String password) { |
|
|
public void onPasswordSubmit(String password) { |
|
|
prepareAndPerformRegularTopUpTxn(password,false); |
|
|
|
|
|
|
|
|
prepareAndPerformRegularTopUpTxn(password, false); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -300,7 +288,7 @@ public class LocalTopUpPresenter extends BasePresenter implements LocalTopUpPres |
|
|
view.promptBiometricAuthDialog(new TransactionBiometricPromptDialog.BiometricPromptResultListener() { |
|
|
view.promptBiometricAuthDialog(new TransactionBiometricPromptDialog.BiometricPromptResultListener() { |
|
|
@Override |
|
|
@Override |
|
|
public void onBiometricAuthSuccess(String password) { |
|
|
public void onBiometricAuthSuccess(String password) { |
|
|
prepareAndPerformFixedTopUpTxn(password,true); |
|
|
|
|
|
|
|
|
prepareAndPerformFixedTopUpTxn(password, true); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
@ -308,7 +296,7 @@ public class LocalTopUpPresenter extends BasePresenter implements LocalTopUpPres |
|
|
view.promptPassword(new PasswordPromptListener() { |
|
|
view.promptPassword(new PasswordPromptListener() { |
|
|
@Override |
|
|
@Override |
|
|
public void onPasswordSubmit(String password) { |
|
|
public void onPasswordSubmit(String password) { |
|
|
prepareAndPerformFixedTopUpTxn(password,false); |
|
|
|
|
|
|
|
|
prepareAndPerformFixedTopUpTxn(password, false); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
@ -337,7 +325,7 @@ public class LocalTopUpPresenter extends BasePresenter implements LocalTopUpPres |
|
|
view.promptBiometricAuthDialog(new TransactionBiometricPromptDialog.BiometricPromptResultListener() { |
|
|
view.promptBiometricAuthDialog(new TransactionBiometricPromptDialog.BiometricPromptResultListener() { |
|
|
@Override |
|
|
@Override |
|
|
public void onBiometricAuthSuccess(String password) { |
|
|
public void onBiometricAuthSuccess(String password) { |
|
|
prepareAndPerformDataTopUpTxn(password,true); |
|
|
|
|
|
|
|
|
prepareAndPerformDataTopUpTxn(password, true); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
@ -345,7 +333,7 @@ public class LocalTopUpPresenter extends BasePresenter implements LocalTopUpPres |
|
|
view.promptPassword(new PasswordPromptListener() { |
|
|
view.promptPassword(new PasswordPromptListener() { |
|
|
@Override |
|
|
@Override |
|
|
public void onPasswordSubmit(String password) { |
|
|
public void onPasswordSubmit(String password) { |
|
|
prepareAndPerformDataTopUpTxn(password,false); |
|
|
|
|
|
|
|
|
prepareAndPerformDataTopUpTxn(password, false); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
@ -380,7 +368,7 @@ public class LocalTopUpPresenter extends BasePresenter implements LocalTopUpPres |
|
|
performLocalTopupTxn(localTopUpTxnRequestBodyDTO); |
|
|
performLocalTopupTxn(localTopUpTxnRequestBodyDTO); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void prepareAndPerformFixedTopUpTxn(String password,boolean isBiometricUsed) { |
|
|
|
|
|
|
|
|
private void prepareAndPerformFixedTopUpTxn(String password, boolean isBiometricUsed) { |
|
|
LocalTopUpTxnRequestBodyDTO localTopUpTxnRequestBodyDTO = new LocalTopUpTxnRequestBodyDTO(); |
|
|
LocalTopUpTxnRequestBodyDTO localTopUpTxnRequestBodyDTO = new LocalTopUpTxnRequestBodyDTO(); |
|
|
|
|
|
|
|
|
localTopUpTxnRequestBodyDTO.setBuyType(FIXED_CARD_TYPE); |
|
|
localTopUpTxnRequestBodyDTO.setBuyType(FIXED_CARD_TYPE); |
|
@ -636,7 +624,8 @@ public class LocalTopUpPresenter extends BasePresenter implements LocalTopUpPres |
|
|
regularTopup.setValue(o.regularDTO); |
|
|
regularTopup.setValue(o.regularDTO); |
|
|
fixedTopup.setValue(o.fixedDTO); |
|
|
fixedTopup.setValue(o.fixedDTO); |
|
|
updatePaymentSourceData(o.paymentSourceList); |
|
|
updatePaymentSourceData(o.paymentSourceList); |
|
|
loadDummyData(); |
|
|
|
|
|
|
|
|
regularTopUpValidator.validateAll(); |
|
|
|
|
|
fixedTopUpValidator.validateAll(); |
|
|
view.showTopUpScreens(true); |
|
|
view.showTopUpScreens(true); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
@ -670,11 +659,8 @@ public class LocalTopUpPresenter extends BasePresenter implements LocalTopUpPres |
|
|
selectedPaymentSource = paymentSource; |
|
|
selectedPaymentSource = paymentSource; |
|
|
selectedPaymentSourceLiveData.setValue(selectedPaymentSource.getBankName()); |
|
|
selectedPaymentSourceLiveData.setValue(selectedPaymentSource.getBankName()); |
|
|
String walletBalance = gateway.getUserCurrentBalance(); |
|
|
String walletBalance = gateway.getUserCurrentBalance(); |
|
|
if (walletBalance != null && walletBalance.length() > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
// userCurrentBalance=Utils.formatCurrencyWithoutTruncatingDecimal(walletBalance); |
|
|
|
|
|
//TODO Dummy |
|
|
|
|
|
userCurrentBalance="45000"; |
|
|
|
|
|
|
|
|
if (walletBalance != null && walletBalance.length() > 0) { |
|
|
|
|
|
userCurrentBalance = Utils.formatCurrencyWithoutTruncatingDecimal(walletBalance); |
|
|
updateBalance(userCurrentBalance); |
|
|
updateBalance(userCurrentBalance); |
|
|
} |
|
|
} |
|
|
return; |
|
|
return; |
|
@ -689,8 +675,6 @@ public class LocalTopUpPresenter extends BasePresenter implements LocalTopUpPres |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class LocalTopUpTransactionObserver extends GenericApiObserverResponseV2<LocalTopUpTxnDTO> { |
|
|
public class LocalTopUpTransactionObserver extends GenericApiObserverResponseV2<LocalTopUpTxnDTO> { |
|
|
@Override |
|
|
@Override |
|
|
protected Type getDataType() { |
|
|
protected Type getDataType() { |
|
@ -734,19 +718,15 @@ public class LocalTopUpPresenter extends BasePresenter implements LocalTopUpPres |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
protected void onSuccess(GenericResponseDataModel<KFTCBalanceCheckDTO> t) { |
|
|
protected void onSuccess(GenericResponseDataModel<KFTCBalanceCheckDTO> t) { |
|
|
//TODO Dummy |
|
|
|
|
|
updateBalance("40000"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (t.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) { |
|
|
|
|
|
updateBalance(t.getData().getBalanceAmt()); |
|
|
regularTopUpValidator.validateAll(); |
|
|
regularTopUpValidator.validateAll(); |
|
|
fixedTopUpValidator.validateAll(); |
|
|
fixedTopUpValidator.validateAll(); |
|
|
|
|
|
|
|
|
// if (t.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) { |
|
|
|
|
|
// updateBalance(t.getData().getBalanceAmt()); |
|
|
|
|
|
// regularTopUpValidator.validateAll(); |
|
|
|
|
|
// fixedTopUpValidator.validateAll(); |
|
|
|
|
|
//// dataTopUpValidator.validateAll(); |
|
|
|
|
|
// } else { |
|
|
|
|
|
// view.showPopUpMessage(t.getMsg(), CustomAlertDialog.AlertType.FAILED, null); |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
// dataTopUpValidator.validateAll(); |
|
|
|
|
|
} else { |
|
|
|
|
|
view.showPopUpMessage(t.getMsg(), CustomAlertDialog.AlertType.FAILED, null); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|