diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index 108a92fb..0708edee 100644 Binary files a/.idea/caches/build_file_checksums.ser and b/.idea/caches/build_file_checksums.ser differ diff --git a/.idea/caches/gradle_models.ser b/.idea/caches/gradle_models.ser index e880a6f4..9981c9bd 100644 Binary files a/.idea/caches/gradle_models.ser and b/.idea/caches/gradle_models.ser differ diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 00000000..30aa626c --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 00000000..97626ba4 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 00000000..2996d531 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,15 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 00000000..08bf643e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,39 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 00000000..cda2e337 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..94a25f7f --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index ed6e282c..c52c4cbe 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -30,7 +30,7 @@ android { setProperty("archivesBaseName", "GME_" + dateTime + "_v" + versionCode + "(" + versionName + ")") ndk { - abiFilters "armeabi-v7a", "x86" + abiFilters "armeabi-v7a", "x86" } } @@ -94,7 +94,7 @@ android { applicationIdSuffix ".uat" signingConfig signingConfigs.debug // buildConfigField 'String', 'BASE_URL', '"http://gmeuat.gmeremit.com:5012/api/"' - buildConfigField 'String', 'BASE_URL', '"http://gmeuat.gmeremit.com:5029/api/"' + buildConfigField 'String', 'BASE_URL', '"http://gmeuat.gmeremit.com:5029/api/"' buildConfigField 'String', 'BASE_URL_SOCIAL', '"http://10.1.1.171:8080/v1/"' debuggable true minifyEnabled false diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index c2ee3ed0..ded1e3eb 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -23,6 +23,11 @@ android:supportsRtl="true" android:theme="@style/AppTheme" tools:replace="android:allowBackup"> + + - - - + - - - - - - - + @@ -186,8 +183,7 @@ android:name=".settings.view.SettingsView" android:screenOrientation="portrait" android:theme="@style/AppTheme.NoActionBar" - android:windowSoftInputMode="stateHidden" /> - + android:windowSoftInputMode="stateHidden" /> @@ -284,10 +280,10 @@ android:windowSoftInputMode="stateAlwaysHidden" /> + android:windowSoftInputMode="stateAlwaysHidden" /> sendDataForForexCalculation(String auth, String senderCountryId, String senderCurrency, String recieverCurrency, + String senderAmount, String recieverAmount, String paymentMethodId, + String calculationPreference, String recipientCountryName, String recieverCountryId, + String bankId,String payoutPartnerId,String userID,String paymentType) { + JsonObject jsonObject=new JsonObject(); + jsonObject.addProperty("sCountry",senderCountryId); + jsonObject.addProperty("sCurrency",senderCurrency); + jsonObject.addProperty("pCurrency",recieverCurrency); + jsonObject.addProperty("calcBy",calculationPreference); + jsonObject.addProperty("cAmount",senderAmount); + jsonObject.addProperty("pAmount",recieverAmount); + jsonObject.addProperty("serviceType",paymentMethodId); + jsonObject.addProperty("pCountry",recieverCountryId); + jsonObject.addProperty("pCountryName",recipientCountryName); + + jsonObject.addProperty("pAgent",bankId); + jsonObject.addProperty("paymentType",paymentType); + jsonObject.addProperty("payOutPartner",payoutPartnerId); + jsonObject.addProperty("userId",userID); + + return HttpClientV2.getInstance().calculateForSendMoneyExchangeRateV2(auth,jsonObject); + } + + @Override + public Observable getBranchListFromNetwork(String auth, String countryCode, String bankId, String searchKeyword) { + return HttpClientV2.getInstance().getBranchListV2(auth,countryCode,bankId,searchKeyword); + } + + @Override + public Observable validateAccountFromServer(String auth, String idType, String idNumber, String customerFirstName, + String customerLastName, String receiverFirstName, String receiverLastName, + String country, String accountType, String issuerCode, String accountNo, + String amount, String bankCode, String payoutPartner, String processId) { + + JsonObject jsonObject=new JsonObject(); + jsonObject.addProperty("idType",idType); + jsonObject.addProperty("idNumber",idNumber); + jsonObject.addProperty("customerFirstName",customerFirstName); + jsonObject.addProperty("customerLastName",customerLastName); + jsonObject.addProperty("receiverFirstName",receiverFirstName); + jsonObject.addProperty("receiverLastName",receiverLastName); + jsonObject.addProperty("country",country); + jsonObject.addProperty("accountType",accountType); + jsonObject.addProperty("issuerCode",issuerCode); + + jsonObject.addProperty("accountNo",accountNo); + jsonObject.addProperty("amount",amount); + jsonObject.addProperty("bankCode",bankCode); + jsonObject.addProperty("payoutPartner",payoutPartner); + jsonObject.addProperty("processId",processId); + + return HttpClientV2.getInstance().accountValidationV2(auth,jsonObject); + } + + @Override + public Observable performSendMoneyTransaction(String auth, SendMoneyAPIRequestBody requestBody) { + return HttpClientV2.getInstance().performSendMoneyTransactionV2(auth,requestBody); + } + + + + @Override + public Observable getAgentInfoListFromNetwork(String auth, String recipientCountryId, String recipientId) { + return HttpClientV2.getInstance().getPayoutModeForSendMoneyV2(auth,recipientCountryId,recipientId); + } + + +} diff --git a/app/src/main/java/com/gmeremit/online/gmeremittance_native/resendV2/presenter/ReSendMoneyV2InteractorInterface.java b/app/src/main/java/com/gmeremit/online/gmeremittance_native/resendV2/presenter/ReSendMoneyV2InteractorInterface.java new file mode 100644 index 00000000..b7f91275 --- /dev/null +++ b/app/src/main/java/com/gmeremit/online/gmeremittance_native/resendV2/presenter/ReSendMoneyV2InteractorInterface.java @@ -0,0 +1,52 @@ +package com.gmeremit.online.gmeremittance_native.resendV2.presenter; + +import com.gmeremit.online.gmeremittance_native.agentsV2.model.AgentsListApiResponse; +import com.gmeremit.online.gmeremittance_native.base.BaseInteractorInterface; +import com.gmeremit.online.gmeremittance_native.base.PrivilegedGatewayInterface; +import com.gmeremit.online.gmeremittance_native.exchange_rate.model.datav2.ExchangeCalculationApiResponse; +import com.gmeremit.online.gmeremittance_native.sendmoneyV2.model.SendMoneyAPIRequestBody; +import com.gmeremit.online.gmeremittance_native.sendmoneyV2.model.SendMoneyTransactionResponseBody; +import com.gmeremit.online.gmeremittance_native.sendmoneyV2.model.amountdetail.BranchListApiResponse; +import com.gmeremit.online.gmeremittance_native.sendmoneyV2.model.payoutmode.AccountValidationApiResponse; +import com.gmeremit.online.gmeremittance_native.sendmoneyV2.model.payoutmode.PayoutModeApiResponse; + +import io.reactivex.Observable; + +public interface ReSendMoneyV2InteractorInterface extends BaseInteractorInterface { + + + interface ReSendMoneyV2GatewayInterface extends PrivilegedGatewayInterface + { + + Observable getAgentInfoListFromNetwork(String auth,String recipientCountryId, String recipientId); + + Observable sendDataForForexCalculation(String auth, String senderCountryId, String senderCurrency, String recieverCurrency, + String senderAmount, String recieverAmount, String paymentMethodId, + String calculationPreference, String recipientCountryName, String recieverCountryId, + String bankId,String payoutPartnerId,String userID,String paymentType); + + Observable getBranchListFromNetwork(String auth, String countryCode, String bankId,String searchKeyword); + + + Observable validateAccountFromServer(String auth, + String idType, + String idNumber, + String customerFirstName, + String customerLastName, + String receiverFirstName, + String receiverLastName, + String country, + String accountType, + String issuerCode, + String accountNo, + String amount, + String bankCode, + String payoutPartner, + String processId); + + Observable performSendMoneyTransaction(String auth, SendMoneyAPIRequestBody requestBody); + + + + } +} diff --git a/app/src/main/java/com/gmeremit/online/gmeremittance_native/resendV2/presenter/ReSendMoneyV2Presenter.java b/app/src/main/java/com/gmeremit/online/gmeremittance_native/resendV2/presenter/ReSendMoneyV2Presenter.java new file mode 100644 index 00000000..82427a90 --- /dev/null +++ b/app/src/main/java/com/gmeremit/online/gmeremittance_native/resendV2/presenter/ReSendMoneyV2Presenter.java @@ -0,0 +1,272 @@ +package com.gmeremit.online.gmeremittance_native.resendV2.presenter; + +import com.gmeremit.online.gmeremittance_native.R; +import com.gmeremit.online.gmeremittance_native.autodebitV2.model.autodebitaccountlisting.AutoDebitAccount; +import com.gmeremit.online.gmeremittance_native.autodebitV2.model.autodebitaccountlisting.WebRequestModel; +import com.gmeremit.online.gmeremittance_native.base.BasePresenter; +import com.gmeremit.online.gmeremittance_native.customwidgets.CustomAlertDialog; +import com.gmeremit.online.gmeremittance_native.exchange_rate.model.datav2.ExchangeCalculationApiResponse; +import com.gmeremit.online.gmeremittance_native.homeV2.model.UserInfoModelV2; +import com.gmeremit.online.gmeremittance_native.recipientV2.model.recipientlisting.RecipientInfoModel; +import com.gmeremit.online.gmeremittance_native.resendV2.gateway.ReSendMoneyV2Gateway; +import com.gmeremit.online.gmeremittance_native.sendmoneyV2.gateway.SendMoneyV2Gateway; +import com.gmeremit.online.gmeremittance_native.sendmoneyV2.model.SendMoneyAPIRequestBody; +import com.gmeremit.online.gmeremittance_native.sendmoneyV2.model.SendMoneyRequiredData; +import com.gmeremit.online.gmeremittance_native.sendmoneyV2.model.SendMoneyTransactionResponseBody; +import com.gmeremit.online.gmeremittance_native.sendmoneyV2.model.amountdetail.AmountDetailRelatedDataModel; +import com.gmeremit.online.gmeremittance_native.sendmoneyV2.model.amountdetail.BranchListApiResponse; +import com.gmeremit.online.gmeremittance_native.sendmoneyV2.model.amountdetail.RecipientCurrencyModel; +import com.gmeremit.online.gmeremittance_native.sendmoneyV2.model.payoutmode.AccountValidationApiResponse; +import com.gmeremit.online.gmeremittance_native.sendmoneyV2.model.payoutmode.BankList; +import com.gmeremit.online.gmeremittance_native.sendmoneyV2.model.payoutmode.BranchList; +import com.gmeremit.online.gmeremittance_native.sendmoneyV2.model.payoutmode.PayoutMode; +import com.gmeremit.online.gmeremittance_native.sendmoneyV2.model.payoutmode.PayoutModeApiResponse; +import com.gmeremit.online.gmeremittance_native.sendmoneyV2.model.verification.VerificationViewModel; +import com.gmeremit.online.gmeremittance_native.sendmoneyV2.presenter.SendMoneyV2InteractorInterface; +import com.gmeremit.online.gmeremittance_native.sendmoneyV2.presenter.SendMoneyV2PresenterInterface; +import com.gmeremit.online.gmeremittance_native.transactionpasspromt.PasswordPromptListener; +import com.gmeremit.online.gmeremittance_native.utils.Constants; +import com.gmeremit.online.gmeremittance_native.utils.Utils; +import com.gmeremit.online.gmeremittance_native.utils.https.GenericApiObserverResponse; + +import java.util.ArrayList; +import java.util.List; + +import io.reactivex.Observable; +import io.reactivex.android.schedulers.AndroidSchedulers; +import io.reactivex.disposables.CompositeDisposable; +import io.reactivex.schedulers.Schedulers; + +public class ReSendMoneyV2Presenter extends BasePresenter implements ReSendMoneyV2PresenterInterface, ReSendMoneyV2InteractorInterface { + + private final CompositeDisposable compositeObservable; + ReSendMoneyV2ContractInterface view; + ReSendMoneyV2GatewayInterface gateway; + + + + public ReSendMoneyV2Presenter(ReSendMoneyV2ContractInterface view) { + this.view = view; + this.gateway = new ReSendMoneyV2Gateway(this); + this.compositeObservable = new CompositeDisposable(); + } + + + @Override + public void clearPaymentData() { + + } + + + + @Override + public VerificationViewModel getVerificationRelatedData() { +// String fullName = this.selectedRecipient.getFirstName() + " " + this.selectedRecipient.getMiddleName() + " " + this.selectedRecipient.getLastName(); +// String address = this.selectedRecipient.getAddress(); +// String country = this.selectedRecipient.getCountry(); +// String mobile = this.selectedRecipient.getMobileNumber(); +// String pCountry = this.selectedRecipient.getCountry(); +// String pMode = this.selectedPaymentModeData.getMode(); +// String pAmount = this.selectedRecievingAmount + " " + selectedSendingCurrency; +// String exRate = this.selectedExRate; +// String serviceCharge = Utils.formatCurrency(this.selectedTransferFee) + " KRW"; +// +// String pAgent = null; +// if (selectedBranchData != null) +// pAgent = selectedBranchData.getName(); +// else if (selectedBankData != null) +// pAgent = selectedBankData.getName(); + + +// return new VerificationViewModel(fullName, address, country, mobile, pCountry, pMode, pAmount, exRate, serviceCharge, pAgent, this.selectedAccountNo); + return null; + } + + @Override + public void setSendingAmount(String sendingAmount, String recipientCurrencyCode, String selectedExRate, String recievingAmount, String transferFee, + boolean shouldCalcByRecipient, String forexId, String transferAmount) { +// this.selectedSendingAmount = sendingAmount; +// this.selectedSendingCurrency = recipientCurrencyCode; +// this.selectedExRate = selectedExRate; +// this.selectedRecievingAmount = recievingAmount; +// this.selectedTransferFee = transferFee; +// this.selectedCalcBy = shouldCalcByRecipient ? Constants.CALC_BY_RECIPEINT : Constants.CALC_BY_SENDER; +// this.selectedForexId = forexId; +// this.selectedTransferAmount = transferAmount; + } + + @Override + public void clearExRateData() { +// selectedSendingAmount = null; +// selectedExRate = null; +// selectedSendingCurrency = null; +// selectedRecievingAmount = null; +// selectedTransferAmount = null; + } + + @Override + public void promptPinAndPerformTransaction() { + view.promptPassword(new PasswordPromptListener() { + @Override + public void onPasswordSubmit(String password) { + performSendMoneyTransaction(password); + } + + @Override + public void onCancelled() { + + } + }); + } + + + @Override + public WebRequestModel getWebRequestDataForTermsAndCondition() { + return new WebRequestModel(getStringfromStringId(R.string.terms_and_condition_title_text), "https://online.gmeremit.com/Terms", null); + } + + @Override + public String getPaymentType() { + return null; + } + + + public void performSendMoneyTransaction(String password) { + + SendMoneyAPIRequestBody sendMoneyAPIRequestBody = new SendMoneyAPIRequestBody(); + +// sendMoneyAPIRequestBody.setUser(gateway.getUserID()); +// sendMoneyAPIRequestBody.setSenderId(gateway.getUserIDNumber()); +// +// sendMoneyAPIRequestBody.setReceiverId(selectedRecipient.getRecipientId()); +// +// sendMoneyAPIRequestBody.setDeliveryMethodId(selectedPaymentModeData.getId()); +// +// sendMoneyAPIRequestBody.setpAgent((selectedBankData != null) ? selectedBankData.getId() : ""); +// sendMoneyAPIRequestBody.setpBranch((selectedBankData != null && +// selectedBankData.getBranchRequired().equalsIgnoreCase(Constants.TRUE_STRING) +// && selectedBranchData != null) +// ? selectedBranchData.getBranchId() : ""); +// sendMoneyAPIRequestBody.setPayOutPartner(selectedPaymentModeData.getPayoutPartner()); +// sendMoneyAPIRequestBody.setPaymentType(selectedPaymentType.getType()); +// +// +// sendMoneyAPIRequestBody.setReceiverAccountNo(selectedAccountNo != null ? selectedAccountNo : ""); +// +// sendMoneyAPIRequestBody.setpCurr(selectedSendingCurrency); +// sendMoneyAPIRequestBody.setCollAmt(Utils.removeSpecialCharacterAndDecimalFromCurrency(selectedSendingAmount)); +// sendMoneyAPIRequestBody.setCollCurr("KRW"); +// sendMoneyAPIRequestBody.setPayoutAmt(selectedRecievingAmount); +// sendMoneyAPIRequestBody.setTransferAmt(selectedTransferAmount); +// sendMoneyAPIRequestBody.setServiceCharge(selectedTransferFee); +// sendMoneyAPIRequestBody.setDiscount(""); +// sendMoneyAPIRequestBody.setExRate(selectedExRate); +// sendMoneyAPIRequestBody.setCalBy(selectedCalcBy); +// sendMoneyAPIRequestBody.setTpExRate(selectedExRate); +// sendMoneyAPIRequestBody.setTpPCurr(selectedSendingCurrency); +// sendMoneyAPIRequestBody.setForeXSESSIONID(selectedForexId); +// +// sendMoneyAPIRequestBody.setPurposeOfRemittance(selectedRecipient.getReasonId()); +// sendMoneyAPIRequestBody.setSourceOfFund("128"); +// sendMoneyAPIRequestBody.setRelWithSender(selectedRecipient.getRelationId()); +// sendMoneyAPIRequestBody.setOccupation(""); +// sendMoneyAPIRequestBody.setIpAddress(""); +// sendMoneyAPIRequestBody.setrState(selectedRecipient.getState()); +// sendMoneyAPIRequestBody.setrLocation(selectedRecipient.getDistrictId()); +// sendMoneyAPIRequestBody.setIsAgreed(Constants.TRUE_STRING); +// +// //KFTC Related Params +// sendMoneyAPIRequestBody.setKftcAccountId(selectedPaymentType.getKftcAccountId()); +// +// sendMoneyAPIRequestBody.setTxnPassword(password); + + compositeObservable.add( + gateway.performSendMoneyTransaction(gateway.getAuth(), sendMoneyAPIRequestBody) + .subscribeOn(Schedulers.io()) + .doOnSubscribe(d -> view.showProgressBar(true, getStringfromStringId(R.string.processing_request_text))) + .doFinally(() -> view.showProgressBar(false, "")) + .observeOn(AndroidSchedulers.mainThread()) + .subscribeWith(new SendMoneyTransactionObserver()) + ); + + + } + + + @Override + public void onViewDestroyed() { + super.onViewDestroyed(); + if (compositeObservable != null && !compositeObservable.isDisposed()) { + compositeObservable.dispose(); + } + + } + + + + @Override + public Observable getForex(String recieveAmount, String senderAmount, boolean shouldCaulatedByRecipient, String recieverCurrency) { + +// String senderCountryId = gateway.getUserCountryId(); +// String senderCurrency = gateway.getUserPreferredCurrency(); +// String paymentMethodId = selectedPaymentModeData.getId(); +// String calculationPreference = shouldCaulatedByRecipient ? Constants.CALC_BY_RECIPEINT : Constants.CALC_BY_SENDER; +// String recipientCountryName = selectedRecipient.getCountry(); +// String recipientCountryID = selectedRecipient.getCountryId(); +// String bankId = (selectedBankData == null) ? "" : selectedBankData.getId(); +// String paymentPartnerId = selectedPaymentModeData.getPayoutPartner(); +// +// +// return gateway.sendDataForForexCalculation(gateway.getAuth(), senderCountryId, +// senderCurrency, recieverCurrency, senderAmount, +// recieveAmount, paymentMethodId, calculationPreference, recipientCountryName, +// recipientCountryID, bankId, paymentPartnerId, gateway.getUserID(), selectedPaymentType.getType()) +// .subscribeOn(Schedulers.io()) +// .observeOn(AndroidSchedulers.mainThread()); + + return null; + } + + + + public class SendMoneyTransactionObserver extends GenericApiObserverResponse { + + @Override + protected void onSuccess(SendMoneyTransactionResponseBody sendMoneyResponse) { + if (sendMoneyResponse.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) { + UserInfoModelV2 userInfoModelV2 = new UserInfoModelV2(); + userInfoModelV2.setAvailableBalance(sendMoneyResponse.getExtra()); + userInfoModelV2.setYearlyLimit(sendMoneyResponse.getExtra2()); + gateway.updateUserInfoInBatch(userInfoModelV2); + view.showPopUpMessage(sendMoneyResponse.getMsg(), CustomAlertDialog.AlertType.SUCCESS, new CustomAlertDialog.CustomDialogActionListener() { + + @Override + public void onCutomDialogActionPressed(CustomAlertDialog.AlertType alertType) { + + view.showReceiptOnTransactionComplete(sendMoneyResponse.getId()); + } + }); + } else { + view.showPopUpMessage(sendMoneyResponse.getMsg(), CustomAlertDialog.AlertType.FAILED, null); + } + } + + @Override + public void onFailed(String message) { + view.showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, null); + } + + @Override + protected void onConnectionNotEstablished(String message) { + view.showPopUpMessage(message, CustomAlertDialog.AlertType.NO_INTERNET, null); + } + + @Override + protected void unauthorizedAccess(String message) { + gateway.clearAllUserData(); + + view.showPopUpMessage(message, CustomAlertDialog.AlertType.ALERT,alertType -> view.logout()); + + } + } +} diff --git a/app/src/main/java/com/gmeremit/online/gmeremittance_native/resendV2/presenter/ReSendMoneyV2PresenterInterface.java b/app/src/main/java/com/gmeremit/online/gmeremittance_native/resendV2/presenter/ReSendMoneyV2PresenterInterface.java new file mode 100644 index 00000000..2ee61442 --- /dev/null +++ b/app/src/main/java/com/gmeremit/online/gmeremittance_native/resendV2/presenter/ReSendMoneyV2PresenterInterface.java @@ -0,0 +1,48 @@ +package com.gmeremit.online.gmeremittance_native.resendV2.presenter; + +import com.gmeremit.online.gmeremittance_native.autodebitV2.model.autodebitaccountlisting.WebRequestModel; +import com.gmeremit.online.gmeremittance_native.base.BaseContractInterface; +import com.gmeremit.online.gmeremittance_native.base.BasePresenterInterface; +import com.gmeremit.online.gmeremittance_native.exchange_rate.model.datav2.ExchangeCalculationApiResponse; +import com.gmeremit.online.gmeremittance_native.sendmoneyV2.model.amountdetail.AmountDetailRelatedDataModel; +import com.gmeremit.online.gmeremittance_native.sendmoneyV2.model.amountdetail.BranchListApiResponse; +import com.gmeremit.online.gmeremittance_native.sendmoneyV2.model.payoutmode.AccountValidationApiResponse; +import com.gmeremit.online.gmeremittance_native.sendmoneyV2.model.payoutmode.BankList; +import com.gmeremit.online.gmeremittance_native.sendmoneyV2.model.payoutmode.BranchList; +import com.gmeremit.online.gmeremittance_native.sendmoneyV2.model.payoutmode.PayoutMode; +import com.gmeremit.online.gmeremittance_native.sendmoneyV2.model.payoutmode.PayoutModeApiResponse; +import com.gmeremit.online.gmeremittance_native.sendmoneyV2.model.verification.VerificationViewModel; +import com.gmeremit.online.gmeremittance_native.transactionpasspromt.PasswordPromptListener; + +import io.reactivex.Observable; + + +public interface ReSendMoneyV2PresenterInterface extends BasePresenterInterface { + + + Observable getForex(String recieveAmount, String sendMoneyEditTextText, boolean shouldCaulatedByRecipient,String recieverCurrency); + + + void clearPaymentData(); + + + VerificationViewModel getVerificationRelatedData(); + + void setSendingAmount(String sendingAmount, String recipientCurrencyCode, String selectedExRate, String recievingAmount, String transferFee, boolean calcBy, String forexId,String transferAmount); + + void clearExRateData(); + + void promptPinAndPerformTransaction(); + + WebRequestModel getWebRequestDataForTermsAndCondition(); + + String getPaymentType(); + + interface ReSendMoneyV2ContractInterface extends BaseContractInterface + { + void promptPassword(PasswordPromptListener listener); + + void showReceiptOnTransactionComplete(String transactionId); + + } +} diff --git a/app/src/main/java/com/gmeremit/online/gmeremittance_native/resendV2/view/ReSendMoneyV2Activity.java b/app/src/main/java/com/gmeremit/online/gmeremittance_native/resendV2/view/ReSendMoneyV2Activity.java new file mode 100644 index 00000000..d04222b0 --- /dev/null +++ b/app/src/main/java/com/gmeremit/online/gmeremittance_native/resendV2/view/ReSendMoneyV2Activity.java @@ -0,0 +1,175 @@ +package com.gmeremit.online.gmeremittance_native.resendV2.view; + +import android.content.Intent; +import android.support.annotation.LayoutRes; +import android.support.v4.app.FragmentTransaction; +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; +import android.view.View; +import android.widget.TextView; + +import com.gmeremit.online.gmeremittance_native.R; +import com.gmeremit.online.gmeremittance_native.base.BaseActivity; +import com.gmeremit.online.gmeremittance_native.base.BaseFragment; +import com.gmeremit.online.gmeremittance_native.resendV2.ReSendMoneyActionListener; +import com.gmeremit.online.gmeremittance_native.resendV2.ReSendMoneyScreenManager; +import com.gmeremit.online.gmeremittance_native.resendV2.presenter.ReSendMoneyV2Presenter; +import com.gmeremit.online.gmeremittance_native.resendV2.presenter.ReSendMoneyV2PresenterInterface; +import com.gmeremit.online.gmeremittance_native.sendmoneyV2.view.SendMoneyScreenManager; +import com.gmeremit.online.gmeremittance_native.sendmoneyV2.view.SendMoneyV2TransactionCompleteActivity; +import com.gmeremit.online.gmeremittance_native.transactionpasspromt.PasswordPromptListener; +import com.gmeremit.online.gmeremittance_native.transactionpasspromt.TransactionPasswordPromptActivity; + +import butterknife.BindView; +import butterknife.ButterKnife; + +import static com.gmeremit.online.gmeremittance_native.transactionpasspromt.TransactionPasswordPromptActivity.PAYMENT_TYPE_BUNDLE_KEY; + +public class ReSendMoneyV2Activity extends BaseActivity implements ReSendMoneyV2PresenterInterface.ReSendMoneyV2ContractInterface, ReSendMoneyActionListener, View.OnClickListener { + + private static final int PASSWORD_PROMPT_REQUEST = 43278; + public static String RESEND_DATA = "resendData"; + private Object reSendMoneyRequiredData; + private android.support.v4.app.FragmentManager fragmentManager; + private ReSendMoneyV2PresenterInterface presenter; + private PasswordPromptListener passwordPromptListener; + + @BindView(R.id.toolbar_title) + TextView toolbar_title; + + @BindView(R.id.iv_back) + View iv_back; + + @BindView(R.id.iv_cancel) + View iv_cancel; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_re_send_money_v2); + ButterKnife.bind(this); + fragmentManager = getSupportFragmentManager(); + initialize(); + performDefaultAction(savedInstanceState); + } + + private void performDefaultAction(Bundle savedInstanceState) { + if (savedInstanceState == null) { + try { + reSendMoneyRequiredData = getIntent().getExtras().getParcelable("SOME KEY NAME"); + + } catch (Exception e) { + reSendMoneyRequiredData = null; + } + } else { + reSendMoneyRequiredData = savedInstanceState.getParcelable(RESEND_DATA); + } + + addScreenToSendMoneyOnly(R.layout.fragment_amount_detail_resend_money_v2, false); + + } + + + public boolean addScreenToSendMoney(@LayoutRes int layoutID, boolean addTransitionEffect) { + BaseFragment baseFragment = ReSendMoneyScreenManager.getReSendMoneyScreenFromId(layoutID); + if (baseFragment != null) { + FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); + if (addTransitionEffect) + fragmentTransaction.setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_left, R.anim.enter_from_right, R.anim + .exit_to_left); + fragmentTransaction.add(R.id.sendMoneyViewContainer, baseFragment, baseFragment.toString()); + fragmentTransaction.addToBackStack(layoutID + ""); + fragmentTransaction.commit(); + return true; + } else + return false; + } + + public boolean addScreenToSendMoneyOnly(@LayoutRes int layoutID, boolean addTransitionEffect) { + BaseFragment baseFragment = ReSendMoneyScreenManager.getReSendMoneyScreenFromId(layoutID); + if (baseFragment != null) { + FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); + if (addTransitionEffect) + fragmentTransaction.setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_left, R.anim.enter_from_right, R.anim + .exit_to_left); + fragmentTransaction.add(R.id.sendMoneyViewContainer, baseFragment, baseFragment.toString()); + fragmentTransaction.commit(); + return true; + } else + return false; + } + + private void initialize() { + toolbar_title.setText(getString(R.string.resend_money_text)); + } + + + @Override + protected void onStart() { + super.onStart(); + iv_back.setOnClickListener(this); + iv_cancel.setOnClickListener(this); + + } + + @Override + protected void onStop() { + super.onStop(); + iv_back.setOnClickListener(null); + iv_cancel.setOnClickListener(null); + } + + @Override + public void onClick(View v) { + switch (v.getId()) { + case R.id.iv_back: + onBackPressed(); + break; + + case R.id.iv_cancel: + finish(); + break; + + } + } + + @Override + public void onBackPressed() { + hideKeyBoard(); + super.onBackPressed(); + } + + + @Override + public void showTransactionReviewPage() { + addScreenToSendMoney(R.layout.fragment_verification_resend_money_v2, true); + } + + @Override + public ReSendMoneyV2PresenterInterface getPresenter() { + if (this.presenter == null) + this.presenter = new ReSendMoneyV2Presenter(this); + return this.presenter; + } + + @Override + public void promptPassword(PasswordPromptListener listener) { + String paymentType=presenter.getPaymentType(); + this.passwordPromptListener=listener; + Intent passwordRequestIntent=new Intent(this, TransactionPasswordPromptActivity.class); + passwordRequestIntent.putExtra(PAYMENT_TYPE_BUNDLE_KEY,""); + startActivityForResult(passwordRequestIntent,PASSWORD_PROMPT_REQUEST); + } + + @Override + public void showReceiptOnTransactionComplete(String transactionId) { + Intent startReceiptActivity = new Intent(this, SendMoneyV2TransactionCompleteActivity.class); + startReceiptActivity.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + startReceiptActivity.putExtra(SendMoneyV2TransactionCompleteActivity.SEND_MONEY_TID_BUNDLE_KEY, transactionId); + startReceiptActivity.putExtra(SendMoneyV2TransactionCompleteActivity.IS_TRANSACTION_DETAIL_REQUEST_FROM_SEND_MONEY_BUNDLE_KEY, true); + startReceiptActivity.putExtra(SendMoneyV2TransactionCompleteActivity.SHOULD_UPDATE_BALANCE_UPON_RETURN, true); + startActivity(startReceiptActivity); + } + + +} diff --git a/app/src/main/java/com/gmeremit/online/gmeremittance_native/resendV2/view/amountdetail/ResendMoneyAmountDetailFragment.java b/app/src/main/java/com/gmeremit/online/gmeremittance_native/resendV2/view/amountdetail/ResendMoneyAmountDetailFragment.java new file mode 100644 index 00000000..bb6e4a6a --- /dev/null +++ b/app/src/main/java/com/gmeremit/online/gmeremittance_native/resendV2/view/amountdetail/ResendMoneyAmountDetailFragment.java @@ -0,0 +1,519 @@ +package com.gmeremit.online.gmeremittance_native.resendV2.view.amountdetail; + +import android.app.Activity; +import android.content.Context; +import android.os.Bundle; +import android.os.Handler; +import android.support.annotation.Nullable; +import android.support.v4.view.ViewCompat; +import android.text.Editable; +import android.text.TextWatcher; +import android.view.KeyEvent; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.view.animation.AccelerateDecelerateInterpolator; +import android.view.animation.Interpolator; +import android.view.inputmethod.EditorInfo; +import android.widget.Button; +import android.widget.EditText; +import android.widget.ImageView; +import android.widget.TextView; + +import com.gmeremit.online.gmeremittance_native.GmeApplication; +import com.gmeremit.online.gmeremittance_native.R; +import com.gmeremit.online.gmeremittance_native.base.BaseFragment; +import com.gmeremit.online.gmeremittance_native.customwidgets.CurrencyFormatterTextWatcher; +import com.gmeremit.online.gmeremittance_native.customwidgets.CustomAlertDialog; +import com.gmeremit.online.gmeremittance_native.customwidgets.exchangecountrylistingdialog.CountryFlagMapper; +import com.gmeremit.online.gmeremittance_native.exchange_rate.model.datav2.ExchangeCalculationApiResponse; +import com.gmeremit.online.gmeremittance_native.exchange_rate.model.datav2.ExchangeCalculationModel; +import com.gmeremit.online.gmeremittance_native.resendV2.ReSendMoneyActionListener; +import com.gmeremit.online.gmeremittance_native.sendmoneyV2.model.amountdetail.AmountDetailRelatedDataModel; +import com.gmeremit.online.gmeremittance_native.sendmoneyV2.model.amountdetail.RecipientCurrencyModel; +import com.gmeremit.online.gmeremittance_native.sendmoneyV2.view.SendMoneyActionListener; +import com.gmeremit.online.gmeremittance_native.sendmoneyV2.view.amountdetail.AmountDetailExRateCountryListingDialog; +import com.gmeremit.online.gmeremittance_native.utils.Constants; +import com.gmeremit.online.gmeremittance_native.utils.Utils; +import com.gmeremit.online.gmeremittance_native.utils.https.GenericApiObserverResponse; + +import butterknife.BindView; +import butterknife.ButterKnife; +import io.reactivex.disposables.CompositeDisposable; + +public class ResendMoneyAmountDetailFragment extends BaseFragment implements View.OnClickListener, TextView.OnEditorActionListener { + + @BindView(R.id.amountDetailContinueButton) + Button continueBtn; + + @BindView(R.id.sendAmountEdTxt) + EditText sendMoneyEditText; + + @BindView(R.id.receiveAmountEdTxt) + EditText recieveMoneyEditText; + + @BindView(R.id.transferFeeTxtView) + TextView transferFeeTxtView; + + @BindView(R.id.exchangeRateTxtView) + TextView exchangeRateTxtView; + + @BindView(R.id.recepientCurrencyTextView) + TextView recepientCurrencyTextView; + + + @BindView(R.id.countrySelectionSpinner) + ViewGroup countrySelectionSpinner; + + @BindView(R.id.recepientFlagImageView) + ImageView recepientFlagImageView; + + @BindView(R.id.rootView) + ViewGroup rootView; + + private boolean shouldCaulatedByRecipient; + private boolean shouldCalculateExRate = true; + + CompositeDisposable compositeDisposable = null; + + + private Interpolator interpolator; + + private AmountDetailRelatedDataModel amountDetailRelatedData; + + private String selectedTransferFeeAmount; + private String selectedExRate; + private String selectedRecipientAmount; + private String selectedSendAmount; + private String selectedsendingCurrency; + private SendAmountTextWatcher sendAmountTextWatcher; + private RecipientAmountTextWatcher recepientAmountTextWatcher; + private CurrencyFormatterTextWatcher sendCurrencyFormatterTextWatcher; + private CurrencyFormatterTextWatcher recepientCurrencyFormatterTextWatcher; + private String selectedExRateId; + private String selectedExRateWithoutTrunc; + private String selectedTransferAmount; + + + @Override + public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + return inflater.inflate(R.layout.fragment_amount_detail_resend_money_v2, container, false); + } + + @Override + public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + ButterKnife.bind(this, view); + init(); + performDefaultAction(savedInstanceState); + } + + private void init() { + this.sendAmountTextWatcher = new SendAmountTextWatcher(); + this.recepientAmountTextWatcher = new RecipientAmountTextWatcher(); + compositeDisposable = new CompositeDisposable(); + interpolator = new AccelerateDecelerateInterpolator(); + registerTextWatchers(true); + + + } + + @Override + public void onStart() { + super.onStart(); + continueBtn.setOnClickListener(this); + recieveMoneyEditText.setOnEditorActionListener(this); + sendMoneyEditText.setOnEditorActionListener(this); + countrySelectionSpinner.setOnClickListener(this); +// rootView.setOnTouchListener((v, event) -> focusOutAndHideKeyboard()); + } + + @Override + public void onStop() { + super.onStop(); + continueBtn.setOnClickListener(null); + recieveMoneyEditText.setOnEditorActionListener(null); + sendMoneyEditText.setOnEditorActionListener(null); + countrySelectionSpinner.setOnClickListener(null); +// rootView.setOnTouchListener(null); + + } + +// @Override +// public void onAttach(Context context) { +// super.onAttach(context); +// ((ReSendMoneyActionListener) context).updateCurrentIndexFrom(R.layout.fragment_amount_detail_send_money_v2); +// } +// +// @Override +// public void onAttach(Activity activity) { +// super.onAttach(activity); +// ((ReSendMoneyActionListener) activity).updateCurrentIndexFrom(R.layout.fragment_amount_detail_send_money_v2); +// +// } +// +// @Override +// public void onDetach() { +// super.onDetach(); +// ((ReSendMoneyActionListener) getActivity()).updateCurrentScreenByLayoutId(R.layout.fragment_amount_detail_send_money_v2); +// +// } + + @Override + public void onDestroy() { + ((ReSendMoneyActionListener) getActivity()).getPresenter().clearExRateData(); + registerTextWatchers(false); + super.onDestroy(); + if (compositeDisposable != null && !compositeDisposable.isDisposed()) + compositeDisposable.dispose(); + } + + + + private void performDefaultAction(Bundle savedInstance) { + shouldCaulatedByRecipient = false; + + + } + + + private boolean focusOutAndHideKeyboard() { + if(sendMoneyEditText.hasFocus()||recieveMoneyEditText.hasFocus()) + { + + View currentViewWithFocus=rootView.getFocusedChild(); + if(currentViewWithFocus!=null) + currentViewWithFocus.clearFocus(); + + hideKeyBoard(); + return true; + + } + return false; + } + + @Override + public void onClick(View v) { + switch (v.getId()) { + case R.id.amountDetailContinueButton: + + + if (shouldCalculateExRate) { + getForex(); + } else { + if (validateAll()) { + sendMoneyEditText.clearFocus(); + recieveMoneyEditText.clearFocus(); + hideKeyBoard(); + ((ReSendMoneyActionListener) getActivity()).getPresenter().setSendingAmount(sendMoneyEditText.getText().toString(), amountDetailRelatedData.getDefaultSelectedCurrency().getCurrencyCode(), selectedExRateWithoutTrunc, selectedRecipientAmount, selectedTransferFeeAmount, shouldCaulatedByRecipient, selectedExRateId,selectedTransferAmount); + ((ReSendMoneyActionListener) getActivity()).showTransactionReviewPage(); + } + + } + break; + } + } + + + private void getForex() { + if (shouldCaulatedByRecipient && !validateAmountIsNotEmpty(recieveMoneyEditText.getText().toString())) { + showToastMessage(getString(R.string.sending_amount_error)); + return; + } + if (!shouldCaulatedByRecipient && !validateAmountIsNotEmpty(sendMoneyEditText.getText().toString())) { + showToastMessage(getString(R.string.receiving_amount_error)); + return; + } + compositeDisposable.add( + ((ReSendMoneyActionListener) getActivity()).getPresenter().getForex( + recieveMoneyEditText.getText().toString(), sendMoneyEditText.getText().toString(), shouldCaulatedByRecipient, amountDetailRelatedData.getDefaultSelectedCurrency().getCurrencyCode() + ).doOnSubscribe(d -> showProgressBar(true, getString(R.string.processing_request_text))) + .subscribeWith(new ExchangeRateCalcObserver()) + ); + } + + private void showSelectedCurrency(String selectedCountryCode, String selectedCountryCurrency) { + int flagResId = -1; + if (selectedCountryCode != null) + flagResId = CountryFlagMapper.getFlagFromCountryCode(selectedCountryCode); + if (flagResId != -1) + this.recepientFlagImageView.setBackgroundResource(flagResId); + else + this.recepientFlagImageView.setBackgroundResource(0); + + if (selectedCountryCurrency != null) + this.recepientCurrencyTextView.setText(selectedCountryCurrency); + } + + private void showTransferfeeAndExRate(boolean action, String transferDisplay, String exRateDisplay) { + + if (action) { + + if (this.exchangeRateTxtView.getVisibility() == View.VISIBLE) + this.exchangeRateTxtView.setVisibility(View.INVISIBLE); + this.exchangeRateTxtView.setText(exRateDisplay); + this.exchangeRateTxtView.setTranslationY(this.exchangeRateTxtView.getHeight()); + this.exchangeRateTxtView.setVisibility(View.VISIBLE); + ViewCompat.animate(this.exchangeRateTxtView).translationY(0).setDuration(550).setInterpolator(this.interpolator).start(); + + + if (this.transferFeeTxtView.getVisibility() == View.VISIBLE) + this.transferFeeTxtView.setVisibility(View.INVISIBLE); + this.transferFeeTxtView.setText(transferDisplay); + this.transferFeeTxtView.setTranslationY(this.transferFeeTxtView.getHeight()); + this.transferFeeTxtView.setVisibility(View.VISIBLE); + ViewCompat.animate(this.transferFeeTxtView).translationY(0).setDuration(550).setInterpolator(this.interpolator).start(); + + } else { + if (exchangeRateTxtView.getVisibility() == View.VISIBLE) + this.exchangeRateTxtView.setVisibility(View.INVISIBLE); + + if (transferFeeTxtView.getVisibility() == View.VISIBLE) { + this.transferFeeTxtView.setVisibility(View.INVISIBLE); + + } + } + } + + + private void showSendAndRecieveAmount(String sendAmount, String recieveAmount) { + updateSendAmount(sendAmount); + updateRecievingAmount(recieveAmount); + } + + private boolean validateAmountIsNotEmpty(String amount) { + return amount != null && amount.length() > 0; + } + + + @Override + public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { + switch (v.getId()) { + case R.id.sendAmountEdTxt: + if (actionId == EditorInfo.IME_ACTION_DONE) { + hideKeyBoard(); + getForex(); + } + return true; + + case R.id.receiveAmountEdTxt: + if (actionId == EditorInfo.IME_ACTION_DONE) { + hideKeyBoard(); + getForex(); + } + return true; + } + return false; + } + + public class ExchangeRateCalcObserver extends GenericApiObserverResponse { + + @Override + protected void onSuccess(ExchangeCalculationApiResponse exchangeCalculationApiResponse) { + if (isUIReady()) { + showProgressBar(false, ""); + if (exchangeCalculationApiResponse.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) { + ExchangeCalculationModel data = exchangeCalculationApiResponse.getData(); + selectedTransferFeeAmount = data.getScCharge(); + selectedExRate = data.getExRateDisplay(); + selectedExRateWithoutTrunc = data.getExRate(); + selectedRecipientAmount = data.getpAmt(); + selectedSendAmount = data.getCollAmt(); + selectedsendingCurrency = data.getCollCurr(); + selectedExRateId = data.getExrateId(); + selectedTransferAmount=data.getsAmt(); + + String transferDisplay = " - " + Utils.formatCurrency(selectedTransferFeeAmount) + " " + selectedsendingCurrency + " ("+getString(R.string.transfer_fee_included_text)+")"; + String exRateDisplay = " " + selectedExRate + " ("+getString(R.string.current_exchange_rate_text)+")"; + + showTransferfeeAndExRate(true, transferDisplay, exRateDisplay); + showSendAndRecieveAmount(selectedSendAmount, selectedRecipientAmount); + updateButtonToCalculate(false); + + } else + showPopUpMessage(exchangeCalculationApiResponse.getMsg(), CustomAlertDialog.AlertType.FAILED, null); + } + else + { + scheduleTaskLater(()->{ + showProgressBar(false, ""); + if (exchangeCalculationApiResponse.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) { + ExchangeCalculationModel data = exchangeCalculationApiResponse.getData(); + selectedTransferFeeAmount = data.getScCharge(); + selectedExRate = data.getExRateDisplay(); + selectedExRateWithoutTrunc = data.getExRate(); + selectedRecipientAmount = data.getpAmt(); + selectedSendAmount = data.getCollAmt(); + selectedsendingCurrency = data.getCollCurr(); + selectedExRateId = data.getExrateId(); + selectedTransferAmount=data.getsAmt(); + + String transferDisplay = " - " + Utils.formatCurrency(selectedTransferFeeAmount) + " " + selectedsendingCurrency + " ("+getString(R.string.transfer_fee_included_text)+")"; + String exRateDisplay = " " + selectedExRate + " ("+getString(R.string.current_exchange_rate_text)+")"; + + showTransferfeeAndExRate(true, transferDisplay, exRateDisplay); + showSendAndRecieveAmount(selectedSendAmount, selectedRecipientAmount); + updateButtonToCalculate(false); + + } else + showPopUpMessage(exchangeCalculationApiResponse.getMsg(), CustomAlertDialog.AlertType.FAILED, null); + + }); + } + } + + @Override + public void onFailed(String message) { + if(isUIReady()) { + showProgressBar(false, ""); + showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, null); + } + else + { + scheduleTaskLater(()->{ + showProgressBar(false, ""); + showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, null); + }); + } + } + + @Override + protected void onConnectionNotEstablished(String message) { + if(isUIReady()) { + showProgressBar(false, ""); + showPopUpMessage(message, CustomAlertDialog.AlertType.NO_INTERNET, null); + } + else + { + scheduleTaskLater(()->{ + showProgressBar(false, ""); + showPopUpMessage(message, CustomAlertDialog.AlertType.NO_INTERNET, null); + }); + } + } + + @Override + protected void unauthorizedAccess(String message) { + GmeApplication.getStorage().edit().clear().commit(); + showPopUpMessage(message, CustomAlertDialog.AlertType.ALERT,alertType -> logout()); + + } + } + + + private boolean validateAll() { + return validateAmountIsNotEmpty(sendMoneyEditText.getText().toString())&&validateAmountIsNotEmpty(recieveMoneyEditText.getText().toString()); + } + + + + private void updateButtonToCalculate(boolean action) { + shouldCalculateExRate = action; + if (action) + continueBtn.setText(getString(R.string.calculate_text)); + else + continueBtn.setText(getString(R.string.continue_text)); + } + + private void updateSendAmount(String amount) { + registerAvailableTextWatchersForEditText(sendMoneyEditText, false); + sendMoneyEditText.setText(Utils.formatCurrency(amount)); + registerAvailableTextWatchersForEditText(sendMoneyEditText, true); + } + + private void updateRecievingAmount(String amount) { + registerAvailableTextWatchersForEditText(recieveMoneyEditText, false); + recieveMoneyEditText.setText(Utils.formatCurrency(amount)); + registerAvailableTextWatchersForEditText(recieveMoneyEditText, true); + } + + private void registerTextWatchers(boolean action) { + if (action) { + if (sendAmountTextWatcher == null) + sendAmountTextWatcher = new SendAmountTextWatcher(); + if (recepientAmountTextWatcher == null) + recepientAmountTextWatcher = new RecipientAmountTextWatcher(); + + if (recepientCurrencyFormatterTextWatcher == null) + recepientCurrencyFormatterTextWatcher = new CurrencyFormatterTextWatcher(recieveMoneyEditText); + if (sendCurrencyFormatterTextWatcher == null) + sendCurrencyFormatterTextWatcher = new CurrencyFormatterTextWatcher(sendMoneyEditText); + + + sendMoneyEditText.addTextChangedListener(sendAmountTextWatcher); + recieveMoneyEditText.addTextChangedListener(recepientAmountTextWatcher); + + sendMoneyEditText.addTextChangedListener(sendCurrencyFormatterTextWatcher); + recieveMoneyEditText.addTextChangedListener(recepientCurrencyFormatterTextWatcher); + } else { + sendMoneyEditText.removeTextChangedListener(sendAmountTextWatcher); + recieveMoneyEditText.removeTextChangedListener(recepientAmountTextWatcher); + + sendMoneyEditText.removeTextChangedListener(sendCurrencyFormatterTextWatcher); + recieveMoneyEditText.removeTextChangedListener(recepientCurrencyFormatterTextWatcher); + } + } + + private void registerAvailableTextWatchersForEditText(EditText editText, boolean action) { + switch (editText.getId()) { + case R.id.sendAmountEdTxt: + if (action) + sendMoneyEditText.addTextChangedListener(sendAmountTextWatcher); + else + sendMoneyEditText.removeTextChangedListener(sendAmountTextWatcher); + break; + case R.id.receiveAmountEdTxt: + if (action) + recieveMoneyEditText.addTextChangedListener(recepientAmountTextWatcher); + else + recieveMoneyEditText.removeTextChangedListener(recepientAmountTextWatcher); + break; + } + } + + + private class SendAmountTextWatcher implements TextWatcher { + + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + + } + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + + } + + @Override + public void afterTextChanged(Editable s) { + shouldCaulatedByRecipient = false; + updateRecievingAmount(""); + updateButtonToCalculate(true); + showTransferfeeAndExRate(false, "", ""); + } + } + + private class RecipientAmountTextWatcher implements TextWatcher { + + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + + } + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + + } + + @Override + public void afterTextChanged(Editable s) { + shouldCaulatedByRecipient = true; + updateSendAmount(""); + updateButtonToCalculate(true); + showTransferfeeAndExRate(false, "", ""); + + + } + } + +} diff --git a/app/src/main/java/com/gmeremit/online/gmeremittance_native/resendV2/view/verification/ResendVerificationDetailFragment.java b/app/src/main/java/com/gmeremit/online/gmeremittance_native/resendV2/view/verification/ResendVerificationDetailFragment.java new file mode 100644 index 00000000..24e43014 --- /dev/null +++ b/app/src/main/java/com/gmeremit/online/gmeremittance_native/resendV2/view/verification/ResendVerificationDetailFragment.java @@ -0,0 +1,195 @@ +package com.gmeremit.online.gmeremittance_native.resendV2.view.verification; + +import android.app.Activity; +import android.content.Context; +import android.content.Intent; +import android.net.Uri; +import android.os.Bundle; +import android.support.annotation.Nullable; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.TextView; + +import com.gmeremit.online.gmeremittance_native.R; +import com.gmeremit.online.gmeremittance_native.autodebitV2.model.autodebitaccountlisting.WebRequestModel; +import com.gmeremit.online.gmeremittance_native.base.BaseFragment; +import com.gmeremit.online.gmeremittance_native.resendV2.ReSendMoneyActionListener; +import com.gmeremit.online.gmeremittance_native.sendmoneyV2.model.verification.VerificationViewModel; +import com.gmeremit.online.gmeremittance_native.sendmoneyV2.view.SendMoneyV2Activity; +import com.gmeremit.online.gmeremittance_native.sendmoneyV2.view.verification.TermsAndConditionV2BrowserActivity; + +import butterknife.BindView; +import butterknife.ButterKnife; + +import static com.gmeremit.online.gmeremittance_native.webbrowserV2.WebBrowserV2Activity.WEB_BROWSWER_URL_BUNDLE_KEY; + +public class ResendVerificationDetailFragment extends BaseFragment implements View.OnClickListener { + + @BindView(R.id.txt_firstName) + TextView txt_firstName; + @BindView(R.id.txt_address) + TextView txt_address; + @BindView(R.id.txt_country) + TextView txt_country ; + @BindView(R.id.txt_mobile) + TextView txt_mobile ; + @BindView(R.id.txt_pcountry) + TextView txt_pcountry ; + @BindView(R.id.txt_pmode) + TextView txt_pmode; + @BindView(R.id.txt_pamount) + TextView txt_pamount ; + @BindView(R.id.txt_exrate) + TextView txt_exrate ; + @BindView(R.id.txt_servicechargeAmount) + TextView txt_servicechargeAmount ; + @BindView(R.id.txt_pagent) + TextView txt_pagent ; + @BindView(R.id.pAgentContainerView) + ViewGroup pAgentContainerView ; + @BindView(R.id.bankAcNoContainer) + View bankAcNoContainer ; + + @BindView(R.id.txt_bankAcNo) + TextView txt_bankAcNo ; + + @BindView(R.id.txt_user_aggreement) + TextView txt_user_aggreement; + + @BindView(R.id.exRateCalculateButton) + Button sendTransactionButton; + + + @Override + public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + return inflater.inflate(R.layout.fragment_verification_resend_money_v2, container, false); + } + + @Override + public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + ButterKnife.bind(this, view); + init(); + performDefaultAction(savedInstanceState); + } + + private void init() { + + setupRecyclerView(); + + } + + private void setupRecyclerView() { + + } + +// @Override +// public void onAttach(Context context) { +// super.onAttach(context); +// ((SendMoneyActionListener)context).updateCurrentIndexFrom(R.layout.fragment_verification_send_money_v2); +// } +// +// @Override +// public void onAttach(Activity activity) { +// super.onAttach(activity); +// ((SendMoneyActionListener)activity).updateCurrentIndexFrom(R.layout.fragment_verification_send_money_v2); +// +// } +// +// @Override +// public void onDetach() { +// super.onDetach(); +// ((SendMoneyActionListener) getActivity()).updateCurrentScreenByLayoutId(R.layout.fragment_verification_send_money_v2); +// } + + @Override + public void onStart() { + super.onStart(); + sendTransactionButton.setOnClickListener(this); + txt_user_aggreement.setOnClickListener(this); + } + + @Override + public void onStop() { + super.onStop(); + sendTransactionButton.setOnClickListener(null); + txt_user_aggreement.setOnClickListener(null); + + } + + @Override + public void onDestroy() { + super.onDestroy(); + ((SendMoneyV2Activity) getActivity()).updateFinalTranstionToDefault(); + } + + private void performDefaultAction(Bundle savedInstance) { + + VerificationViewModel verificationViewModel= ((ReSendMoneyActionListener)getActivity()).getPresenter().getVerificationRelatedData(); + txt_address.setText(" : "+verificationViewModel.getAddress()); + txt_country.setText(" : "+verificationViewModel.getCountry()); + txt_exrate.setText(" : "+verificationViewModel.getExRate()); + txt_firstName.setText(" : "+verificationViewModel.getFirstName()); + txt_mobile.setText(" : "+verificationViewModel.getMobile()); + txt_pamount.setText(" : "+verificationViewModel.getpAmount()); + txt_pcountry.setText(" : "+verificationViewModel.getpCountry()); + txt_pmode.setText(" : "+verificationViewModel.getpMode()); + txt_servicechargeAmount.setText(" : "+verificationViewModel.getServiceCharge()); + if(verificationViewModel.getBankAcNo()!=null&&verificationViewModel.getBankAcNo().length()>1) + { + bankAcNoContainer.setVisibility(View.VISIBLE); + txt_bankAcNo.setText(" : "+verificationViewModel.getBankAcNo()); + } + String pAgent=verificationViewModel.getpAgent(); + + if(pAgent!=null) { + hideAgentLocation(false); + txt_pagent.setText(" : "+verificationViewModel.getpAgent()); + } + else + hideAgentLocation(true); + + + } + + private void hideAgentLocation(boolean action) { + if(action) + { + pAgentContainerView.setVisibility(View.GONE); + } + else + { + pAgentContainerView.setVisibility(View.VISIBLE); + } + } + + + + @Override + public void onClick(View v) { + + switch(v.getId()) + { + case R.id.exRateCalculateButton: + ((ReSendMoneyActionListener)getActivity()).getPresenter().promptPinAndPerformTransaction(); + break; + case R.id.txt_user_aggreement: + openUserAgreement(); + break; + } + } + + private void openUserAgreement() { +// String url = "https://online.gmeremit.com/Terms"; +// Intent i = new Intent(Intent.ACTION_VIEW); +// i.setData(Uri.parse(url)); +// startActivity(i); + WebRequestModel requestModel=((ReSendMoneyActionListener)getActivity()).getPresenter().getWebRequestDataForTermsAndCondition(); + Intent intent= new Intent(getActivity(), TermsAndConditionV2BrowserActivity.class); + intent.putExtra(WEB_BROWSWER_URL_BUNDLE_KEY,requestModel); + startActivity(intent); + + } +} diff --git a/app/src/main/res/drawable-xxhdpi/ic_menu_resendmoney.png b/app/src/main/res/drawable-xxhdpi/ic_menu_resendmoney.png new file mode 100755 index 00000000..609582e5 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_menu_resendmoney.png differ diff --git a/app/src/main/res/layout/activity_re_send_money_v2.xml b/app/src/main/res/layout/activity_re_send_money_v2.xml new file mode 100644 index 00000000..2320cbe0 --- /dev/null +++ b/app/src/main/res/layout/activity_re_send_money_v2.xml @@ -0,0 +1,22 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_amount_detail_resend_money_v2.xml b/app/src/main/res/layout/fragment_amount_detail_resend_money_v2.xml new file mode 100644 index 00000000..07464293 --- /dev/null +++ b/app/src/main/res/layout/fragment_amount_detail_resend_money_v2.xml @@ -0,0 +1,238 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/fragment_verification_resend_money_v2.xml b/app/src/main/res/layout/fragment_verification_resend_money_v2.xml new file mode 100644 index 00000000..5a53d33f --- /dev/null +++ b/app/src/main/res/layout/fragment_verification_resend_money_v2.xml @@ -0,0 +1,393 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/nav_drawer_fragment.xml b/app/src/main/res/layout/nav_drawer_fragment.xml index 8a127005..3dea1bf7 100644 --- a/app/src/main/res/layout/nav_drawer_fragment.xml +++ b/app/src/main/res/layout/nav_drawer_fragment.xml @@ -196,11 +196,40 @@ + + + + + + + + + GME - SanFranciscoText-Regular.otf SanFranciscoText-Semibold.otf @@ -61,7 +60,6 @@ ******** - Login New User @@ -270,184 +268,184 @@ how robust our operations are as a result of the hard work completed earlier. We are now ready with a 100% compliant and secured system that guarantees your money will arrive safely in right hands every single time. -App Version -Follow us on -Check for Update - -Change Password -Current Password -New Password -Enter Your Current Password -Enter Your New Password -Confirm Your Password -Save -Password should be At least one sumbol, At least one capital letter, At leset one number and be at least 9 characters -Confirm password does not match with new password -Success -Confirm password cannot be empty - -Profile - -Personal -Tell us a few things about yourself -Enter Your Full Name -Email Address -Gender -Select Gender -Native Country -Select Native Country -Address In Korea -Province -Select Province -Occupation -Select Occupation -Save And Continue -Enter your Mobile No - -Security -Let\'s get your bank connected -Primary Bank Name -Select Primary Bank -Primary Account Number -Enter your Primary Account Number -Verification Id Type -Select Verification Id Type -Verification Id Number -Enter Your Verification Id No. -Source Of Fund -Select Source Of Fund -Issue Date -Expiry Date - -Upload -Upload your documents -View Sample -Selfie with Verification Id Front -Verification Id front -Verification Id Back -Bank Passbook -Passport -Submit -Note: Verification Id can be your National ID or Alien Reg ID or Passport Front selected on Security Screen -Add a Photo -Camera -Gallery -Please provide all images -Camera access denied. Do you want to change the permission from settings? -Gallery access denied. Do you want to change the permission from settings? -Done - -Please enter a valid fullname -Please enter a valid korean mobile number -Mobile number cannot be empty -Please select gender -Please select native country -Please enter valid address -Please select province -Please select occupation -Please select bank -Please enter valid account number -Please select valid verification Id type -Please select source of fund -Please enter a valid verification id number -Please fill all the required details -Please select an issue date -Please select an expiry date - -Ok -Invalid date range selected -Please restart app manually -Permission Denied -Please check your internet connection -Select Currency -Search Currency -No Currency found -No Country found -Select Gender -Male -Female -Other -No Gender found -Enter your login Password -Search Country -Select Country -Select District -Search District -No district found -Select Province -Search Province -No Province found -Select Relation -Search Relation -No relation found -Select Transfer Reason -Search Transfer Reason -No transfer reason found -Select Occupation -Search Occupation -No Occupation found -Select Id Type -No Id Type found -Search Id Type -Select Primary Bank -No primary bank found -Search Primary Bank -Select Source Of Fund -No Source of Fund found -Search Source of Fund -Select dob -Select issue date -Select expiry date -Search Language -Select Language -No Language found -Search Bank -No Bank found -Search Branch -No Branch found + App Version + Follow us on + Check for Update + + Change Password + Current Password + New Password + Enter Your Current Password + Enter Your New Password + Confirm Your Password + Save + Password should be At least one sumbol, At least one capital letter, At leset one number and be at least 9 characters + Confirm password does not match with new password + Success + Confirm password cannot be empty + + Profile + + Personal + Tell us a few things about yourself + Enter Your Full Name + Email Address + Gender + Select Gender + Native Country + Select Native Country + Address In Korea + Province + Select Province + Occupation + Select Occupation + Save And Continue + Enter your Mobile No + + Security + Let\'s get your bank connected + Primary Bank Name + Select Primary Bank + Primary Account Number + Enter your Primary Account Number + Verification Id Type + Select Verification Id Type + Verification Id Number + Enter Your Verification Id No. + Source Of Fund + Select Source Of Fund + Issue Date + Expiry Date + + Upload + Upload your documents + View Sample + Selfie with Verification Id Front + Verification Id front + Verification Id Back + Bank Passbook + Passport + Submit + Note: Verification Id can be your National ID or Alien Reg ID or Passport Front selected on Security Screen + Add a Photo + Camera + Gallery + Please provide all images + Camera access denied. Do you want to change the permission from settings? + Gallery access denied. Do you want to change the permission from settings? + Done + + Please enter a valid fullname + Please enter a valid korean mobile number + Mobile number cannot be empty + Please select gender + Please select native country + Please enter valid address + Please select province + Please select occupation + Please select bank + Please enter valid account number + Please select valid verification Id type + Please select source of fund + Please enter a valid verification id number + Please fill all the required details + Please select an issue date + Please select an expiry date + + Ok + Invalid date range selected + Please restart app manually + Permission Denied + Please check your internet connection + Select Currency + Search Currency + No Currency found + No Country found + Select Gender + Male + Female + Other + No Gender found + Enter your login Password + Search Country + Select Country + Select District + Search District + No district found + Select Province + Search Province + No Province found + Select Relation + Search Relation + No relation found + Select Transfer Reason + Search Transfer Reason + No transfer reason found + Select Occupation + Search Occupation + No Occupation found + Select Id Type + No Id Type found + Search Id Type + Select Primary Bank + No primary bank found + Search Primary Bank + Select Source Of Fund + No Source of Fund found + Search Source of Fund + Select dob + Select issue date + Select expiry date + Search Language + Select Language + No Language found + Search Bank + No Bank found + Search Branch + No Branch found Type to search branches (Minimum 3 characters) -Search Account -No Account found -Choose Payment Method -No Result Found -Processing request -Important -Error -Operation Failed -Connection Failed - -Auto Refund -How much would you like to refund? -Withdraw -Refund -You Refund -Per Refund Bank Charge - -Your bank account verification is required inorder to complete the registration. Do you want to verify it now? -Not now -Deposit Reference -Resend Request -Proceed -Close -Penny Test -Please enter the valid verification code - -New update is available -Update - - -Manage Auto Debit Account -Are you sure? -You want to delete Auto-Debit Account! -Add Auto Debit Account -Hold to Delete the account -No Languages Available -Swipe left to Edit or Delete account. - - -Language - + Search Account + No Account found + Choose Payment Method + No Result Found + Processing request + Important + Error + Operation Failed + Connection Failed + + Auto Refund + How much would you like to refund? + Withdraw + Refund + You Refund + Per Refund Bank Charge + + Your bank account verification is required inorder to complete the registration. Do you want to verify it now? + Not now + Deposit Reference + Resend Request + Proceed + Close + Penny Test + Please enter the valid verification code + + New update is available + Update + + + Manage Auto Debit Account + Are you sure? + You want to delete Auto-Debit Account! + Add Auto Debit Account + Hold to Delete the account + No Languages Available + Swipe left to Edit or Delete account. + + + Language + Resend