Browse Source

Validation triggered when local topup data is fetched successfully

master
Preyea Regmi 5 years ago
parent
commit
f4c32fd17a
  1. BIN
      .idea/caches/build_file_checksums.ser
  2. 6
      app/src/main/java/com/gmeremit/online/gmeremittance_native/kycV3/presenter/KYCV3ViewModel.java
  3. 1
      app/src/main/java/com/gmeremit/online/gmeremittance_native/topup/local/gateway/topup/LocalTopUpGateway.java
  4. 52
      app/src/main/java/com/gmeremit/online/gmeremittance_native/topup/local/presenter/topup/LocalTopUpPresenter.java
  5. 1
      app/src/main/java/com/gmeremit/online/gmeremittance_native/topup/local/view/topup/ConfirmRechargePaymentBottomSheetDialog.java

BIN
.idea/caches/build_file_checksums.ser

6
app/src/main/java/com/gmeremit/online/gmeremittance_native/kycV3/presenter/KYCV3ViewModel.java

@ -188,9 +188,9 @@ public class KYCV3ViewModel extends BaseViewModel implements KYCV3PresenterInter
@Override @Override
public void onCustomerDetailFormReady(CustomerDetailFragment.Form1ViewBindings form1ViewBindings, CustomerDetailFragment.Form2ViewBindings form2ViewBindings, CustomerDetailFragment.Form3ViewBindings form3ViewBindings) { public void onCustomerDetailFormReady(CustomerDetailFragment.Form1ViewBindings form1ViewBindings, CustomerDetailFragment.Form2ViewBindings form2ViewBindings, CustomerDetailFragment.Form3ViewBindings form3ViewBindings) {
if (customerDetailViewSubscriptions != null && !customerDetailViewSubscriptions.isDisposed())
customerDetailViewSubscriptions.dispose();
// if (customerDetailViewSubscriptions != null && !customerDetailViewSubscriptions.isDisposed())
// customerDetailViewSubscriptions.dispose();
//
alternateIDImageRequiredLiveData.setValue(false); alternateIDImageRequiredLiveData.setValue(false);
this.customerDetailViewSubscriptions.add( this.customerDetailViewSubscriptions.add(

1
app/src/main/java/com/gmeremit/online/gmeremittance_native/topup/local/gateway/topup/LocalTopUpGateway.java

@ -16,7 +16,6 @@ public class LocalTopUpGateway extends PrivilegedGateway implements LocalTopUpIn
JsonObject jsonObject=new JsonObject(); JsonObject jsonObject=new JsonObject();
jsonObject.addProperty("GetcardType",cardType); jsonObject.addProperty("GetcardType",cardType);
jsonObject.addProperty("PhoneNo",topUpMobileNumber); jsonObject.addProperty("PhoneNo",topUpMobileNumber);
return HttpClientV2.getInstance().getLocalTopUpRelatedData(auth,jsonObject); return HttpClientV2.getInstance().getLocalTopUpRelatedData(auth,jsonObject);
} }

52
app/src/main/java/com/gmeremit/online/gmeremittance_native/topup/local/presenter/topup/LocalTopUpPresenter.java

@ -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);
} }
} }
@ -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

1
app/src/main/java/com/gmeremit/online/gmeremittance_native/topup/local/view/topup/ConfirmRechargePaymentBottomSheetDialog.java

@ -88,7 +88,6 @@ public class ConfirmRechargePaymentBottomSheetDialog extends BottomSheetDialogFr
View v = inflater.inflate(R.layout.confirm_recharge_payment_bottom_sheet, container, false); View v = inflater.inflate(R.layout.confirm_recharge_payment_bottom_sheet, container, false);
ButterKnife.bind(this, v); ButterKnife.bind(this, v);
//TODO Waihat requirement solti haru ko.
if (!"wallet".equalsIgnoreCase(paymentSource.getType())) { if (!"wallet".equalsIgnoreCase(paymentSource.getType())) {
dedcutedWalletAmount = null; dedcutedWalletAmount = null;
accountBalance = null; accountBalance = null;

Loading…
Cancel
Save