|
@ -41,7 +41,7 @@ public class RecipientAddV3ViewModel extends RecipientAddEditBaseV3ViewModel { |
|
|
|
|
|
|
|
|
private final RecipientAddEditV3GatewayInterface gateway; |
|
|
private final RecipientAddEditV3GatewayInterface gateway; |
|
|
private final CompositeDisposable compositeDisposable; |
|
|
private final CompositeDisposable compositeDisposable; |
|
|
private String TAG=RecipientAddV3ViewModel.class.getSimpleName(); |
|
|
|
|
|
|
|
|
private String TAG = RecipientAddV3ViewModel.class.getSimpleName(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public RecipientAddV3ViewModel( |
|
|
public RecipientAddV3ViewModel( |
|
@ -122,7 +122,6 @@ public class RecipientAddV3ViewModel extends RecipientAddEditBaseV3ViewModel { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public WebRequestModel getWebRequestDataForTermsAndCondition() { |
|
|
public WebRequestModel getWebRequestDataForTermsAndCondition() { |
|
|
return new WebRequestModel(getStringfromStringId(R.string.terms_and_condition_title_text), JME_TERMS_N_CONDITIONS, null); |
|
|
return new WebRequestModel(getStringfromStringId(R.string.terms_and_condition_title_text), JME_TERMS_N_CONDITIONS, null); |
|
@ -218,7 +217,7 @@ public class RecipientAddV3ViewModel extends RecipientAddEditBaseV3ViewModel { |
|
|
receiverLastName = ""; |
|
|
receiverLastName = ""; |
|
|
|
|
|
|
|
|
compositeDisposable.add(gateway.validateAccountFromServer(gateway.getAuth(), idType, idNumber, customerFirstName, customerLastName, receiverFirstName, receiverLastName, country, |
|
|
compositeDisposable.add(gateway.validateAccountFromServer(gateway.getAuth(), idType, idNumber, customerFirstName, customerLastName, receiverFirstName, receiverLastName, country, |
|
|
accountType, issuerCode, accountNumber, amount, bankCode, payoutPartner, processId, bankId, receiverCountryId, deliveryMethodID) |
|
|
|
|
|
|
|
|
accountType, issuerCode, accountNumber, amount, bankCode, payoutPartner, processId, bankId, receiverCountryId, deliveryMethodID) |
|
|
.doOnSubscribe(disposable -> view.showProgressBar(true, getStringfromStringId(R.string.processing_request_text))) |
|
|
.doOnSubscribe(disposable -> view.showProgressBar(true, getStringfromStringId(R.string.processing_request_text))) |
|
|
.doFinally(() -> view.showProgressBar(false, "")) |
|
|
.doFinally(() -> view.showProgressBar(false, "")) |
|
|
.subscribeOn(Schedulers.io()) |
|
|
.subscribeOn(Schedulers.io()) |
|
@ -334,11 +333,11 @@ public class RecipientAddV3ViewModel extends RecipientAddEditBaseV3ViewModel { |
|
|
@Override |
|
|
@Override |
|
|
protected void onSuccess(GenericResponseDataModel<ReceiverInfoV3Model> t) { |
|
|
protected void onSuccess(GenericResponseDataModel<ReceiverInfoV3Model> t) { |
|
|
if (t.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) { |
|
|
if (t.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) { |
|
|
successMessage = 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(); |
|
|
receiverId=t.getData().getReceiverId(); |
|
|
Log.d(TAG, "receiverId "+receiverId); |
|
|
Log.d(TAG, "receiverId "+receiverId); |
|
|
sendMoneyRequiredDataV3=new SendMoneyRequiredDataV3(t.getData()); |
|
|
|
|
|
view.showTermsAndConditionScreen(); |
|
|
|
|
|
|
|
|
sendMoneyRequiredDataV3 = new SendMoneyRequiredDataV3(t.getData()); |
|
|
|
|
|
view.showTermsAndConditionScreen(); |
|
|
} else { |
|
|
} else { |
|
|
Log.d(TAG, "Failure "); |
|
|
Log.d(TAG, "Failure "); |
|
|
view.showPopUpMessage(t.getMsg(), CustomAlertDialog.AlertType.FAILED, null); |
|
|
view.showPopUpMessage(t.getMsg(), CustomAlertDialog.AlertType.FAILED, null); |
|
@ -357,16 +356,16 @@ public class RecipientAddV3ViewModel extends RecipientAddEditBaseV3ViewModel { |
|
|
@Override |
|
|
@Override |
|
|
protected void onConnectionNotEstablished(String message) { |
|
|
protected void onConnectionNotEstablished(String message) { |
|
|
successMessage = null; |
|
|
successMessage = null; |
|
|
receiverId=null; |
|
|
|
|
|
sendMoneyRequiredDataV3=null; |
|
|
|
|
|
|
|
|
receiverId = null; |
|
|
|
|
|
sendMoneyRequiredDataV3 = null; |
|
|
view.showPopUpMessage(message, CustomAlertDialog.AlertType.NO_INTERNET, null); |
|
|
view.showPopUpMessage(message, CustomAlertDialog.AlertType.NO_INTERNET, null); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
protected void unauthorizedAccess(String message) { |
|
|
protected void unauthorizedAccess(String message) { |
|
|
successMessage = null; |
|
|
successMessage = null; |
|
|
receiverId=null; |
|
|
|
|
|
sendMoneyRequiredDataV3=null; |
|
|
|
|
|
|
|
|
receiverId = null; |
|
|
|
|
|
sendMoneyRequiredDataV3 = null; |
|
|
gateway.clearAllUserData(); |
|
|
gateway.clearAllUserData(); |
|
|
view.showPopUpMessage(message, CustomAlertDialog.AlertType.ALERT, alertType -> view.exitView()); |
|
|
view.showPopUpMessage(message, CustomAlertDialog.AlertType.ALERT, alertType -> view.exitView()); |
|
|
} |
|
|
} |
|
@ -405,16 +404,19 @@ public class RecipientAddV3ViewModel extends RecipientAddEditBaseV3ViewModel { |
|
|
view.showPopUpMessage(message, CustomAlertDialog.AlertType.ALERT, alertType -> view.exitView()); |
|
|
view.showPopUpMessage(message, CustomAlertDialog.AlertType.ALERT, alertType -> view.exitView()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private String getReceiverName(ReceiverInfoV3Model receiverInfoV3Model) { |
|
|
private String getReceiverName(ReceiverInfoV3Model receiverInfoV3Model) { |
|
|
String name = ""; |
|
|
String name = ""; |
|
|
if (receiverInfoV3Model.getFullName() != null && receiverInfoV3Model.getFullName().length() > 0) |
|
|
|
|
|
name = receiverInfoV3Model.getFullName(); |
|
|
|
|
|
else if (receiverInfoV3Model.getFirstName() != null && receiverInfoV3Model.getFirstName().length() > 0) |
|
|
|
|
|
name = receiverInfoV3Model.getFirstName(); |
|
|
|
|
|
else if (receiverInfoV3Model.getLocalFullName() != null && receiverInfoV3Model.getLocalFullName().length() > 0) |
|
|
|
|
|
name = receiverInfoV3Model.getLocalFullName(); |
|
|
|
|
|
else if (receiverInfoV3Model.getLocalFirstName() != null && receiverInfoV3Model.getLocalFirstName().length() > 0) |
|
|
|
|
|
name = receiverInfoV3Model.getLocalFirstName(); |
|
|
|
|
|
|
|
|
if (receiverInfoV3Model != null) { |
|
|
|
|
|
if (receiverInfoV3Model.getFullName() != null && receiverInfoV3Model.getFullName().length() > 0) |
|
|
|
|
|
name = receiverInfoV3Model.getFullName(); |
|
|
|
|
|
else if (receiverInfoV3Model.getFirstName() != null && receiverInfoV3Model.getFirstName().length() > 0) |
|
|
|
|
|
name = receiverInfoV3Model.getFirstName(); |
|
|
|
|
|
else if (receiverInfoV3Model.getLocalFullName() != null && receiverInfoV3Model.getLocalFullName().length() > 0) |
|
|
|
|
|
name = receiverInfoV3Model.getLocalFullName(); |
|
|
|
|
|
else if (receiverInfoV3Model.getLocalFirstName() != null && receiverInfoV3Model.getLocalFirstName().length() > 0) |
|
|
|
|
|
name = receiverInfoV3Model.getLocalFirstName(); |
|
|
|
|
|
} |
|
|
return name; |
|
|
return name; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|