Browse Source

Payment Mode validation added

master
preyearegmi 6 years ago
parent
commit
9f3d5e3485
  1. 10
      app/src/main/java/com/gmeremit/online/gmeremittance_native/base/PrivilegedGateway.java
  2. 4
      app/src/main/java/com/gmeremit/online/gmeremittance_native/base/PrivilegedGatewayInterface.java
  3. 294
      app/src/main/java/com/gmeremit/online/gmeremittance_native/exchange_rate/gateway/ExchangeRateV2Gateway.java
  4. 28
      app/src/main/java/com/gmeremit/online/gmeremittance_native/exchange_rate/model/datav2/ExchangeCalculationModel.java
  5. 1
      app/src/main/java/com/gmeremit/online/gmeremittance_native/exchange_rate/presenter/ExchangeRateV2InteractorInterface.java
  6. 6
      app/src/main/java/com/gmeremit/online/gmeremittance_native/exchange_rate/presenter/ExchangeRateV2Presenter.java
  7. 2
      app/src/main/java/com/gmeremit/online/gmeremittance_native/exchange_rate/presenter/ExchangeRateV2PresenterInterface.java
  8. 29
      app/src/main/java/com/gmeremit/online/gmeremittance_native/sendmoneyV2/gateway/SendMoneyV2Gateway.java
  9. 6
      app/src/main/java/com/gmeremit/online/gmeremittance_native/sendmoneyV2/presenter/SendMoneyV2InteractorInterface.java
  10. 30
      app/src/main/java/com/gmeremit/online/gmeremittance_native/sendmoneyV2/presenter/SendMoneyV2Presenter.java
  11. 5
      app/src/main/java/com/gmeremit/online/gmeremittance_native/sendmoneyV2/presenter/SendMoneyV2PresenterInterface.java
  12. 37
      app/src/main/java/com/gmeremit/online/gmeremittance_native/sendmoneyV2/view/amountdetail/AmountDetailSendMoneyFragment.java
  13. 1
      app/src/main/java/com/gmeremit/online/gmeremittance_native/utils/Constants.java
  14. 2
      app/src/main/java/com/gmeremit/online/gmeremittance_native/utils/https/API_URL.java
  15. 3
      app/src/main/java/com/gmeremit/online/gmeremittance_native/utils/https/ApiEndpoints.java

10
app/src/main/java/com/gmeremit/online/gmeremittance_native/base/PrivilegedGateway.java

@ -12,4 +12,14 @@ public abstract class PrivilegedGateway implements PrivilegedGatewayInterface {
public String getAuth(){
return "Basic "+GmeApplication.getStorage().getString("ACCESS_CODE","");
}
@Override
public String getUserNativeCountryCode() {
return "NP";
}
@Override
public String getUserPreferredCurrency() {
return "KRW";
}
}

4
app/src/main/java/com/gmeremit/online/gmeremittance_native/base/PrivilegedGatewayInterface.java

@ -7,4 +7,8 @@ public interface PrivilegedGatewayInterface extends BaseGatewayInterface {
String getAuth();
String getUserID();
String getUserNativeCountryCode();
String getUserPreferredCurrency();
}

294
app/src/main/java/com/gmeremit/online/gmeremittance_native/exchange_rate/gateway/ExchangeRateV2Gateway.java

@ -20,296 +20,6 @@ import io.reactivex.Observable;
public class ExchangeRateV2Gateway extends PrivilegedGateway implements ExchangeRateV2InteractorInterface.ExchangeRateV2GatewayInterface {
String mockedResponseString ="{\n" +
"\"ErrorCode\": \"0\",\n" +
"\"Msg\": \"Success\",\n" +
"\"Id\": \"null\",\n" +
"\"Data\": [\n" +
"{\n" +
"\"country\": \"Bangladesh\",\n" +
"\"countryCode\": \"BD\",\n" +
"\"countryId\": \"16\",\n" +
"\"currency\": \"BDT\",\n" +
"\"serviceAvailable\": [\n" +
"{\n" +
"\"id\": \"2\",\n" +
"\"text\": \"Bank Deposit\",\n" +
"\"description\": \"1 Business Day\"\n" +
"},\n" +
"{\n" +
"\"id\": \"1\",\n" +
"\"text\": \"Cash Payment\",\n" +
"\"description\": \"1 Business Day\"\n" +
"},\n" +
"{\n" +
"\"id\": \"13\",\n" +
"\"text\": \"Mobile Wallet\",\n" +
"\"description\": \"1 Business Day\"\n" +
"}\n" +
"]\n" +
"},\n" +
"{\n" +
"\"country\": \"Myanmar\",\n" +
"\"countryCode\": \"MM\",\n" +
"\"countryId\": \"33\",\n" +
"\"currency\": \"MMK\",\n" +
"\"serviceAvailable\": [\n" +
"{\n" +
"\"id\": \"1\",\n" +
"\"text\": \"Cash Payment\",\n" +
"\"description\": \"1 Business Day\"\n" +
"}\n" +
"]\n" +
"},\n" +
"{\n" +
"\"country\": \"Cambodia\",\n" +
"\"countryCode\": \"KH\",\n" +
"\"countryId\": \"36\",\n" +
"\"currency\": \"USD\",\n" +
"\"serviceAvailable\": [\n" +
"{\n" +
"\"id\": \"1\",\n" +
"\"text\": \"Cash Payment\",\n" +
"\"description\": \"1 Business Day\"\n" +
"},\n" +
"{\n" +
"\"id\": \"13\",\n" +
"\"text\": \"Mobile Wallet\",\n" +
"\"description\": \"1 Business Day\"\n" +
"},\n" +
"{\n" +
"\"id\": \"2\",\n" +
"\"text\": \"Bank Deposit\",\n" +
"\"description\": \"1 Business Day\"\n" +
"}\n" +
"]\n" +
"},\n" +
"{\n" +
"\"country\": \"Sri Lanka\",\n" +
"\"countryCode\": \"LK\",\n" +
"\"countryId\": \"42\",\n" +
"\"currency\": \"LKR\",\n" +
"\"serviceAvailable\": [\n" +
"{\n" +
"\"id\": \"1\",\n" +
"\"text\": \"Cash Payment\",\n" +
"\"description\": \"1 Business Day\"\n" +
"},\n" +
"{\n" +
"\"id\": \"2\",\n" +
"\"text\": \"Bank Deposit\",\n" +
"\"description\": \"1 Business Day\"\n" +
"}\n" +
"]\n" +
"},\n" +
"{\n" +
"\"country\": \"Sri Lanka\",\n" +
"\"countryCode\": \"LK\",\n" +
"\"countryId\": \"42\",\n" +
"\"currency\": \"USD\",\n" +
"\"serviceAvailable\": [\n" +
"{\n" +
"\"id\": \"1\",\n" +
"\"text\": \"Cash Payment\",\n" +
"\"description\": \"1 Business Day\"\n" +
"},\n" +
"{\n" +
"\"id\": \"2\",\n" +
"\"text\": \"Bank Deposit\",\n" +
"\"description\": \"1 Business Day\"\n" +
"}\n" +
"]\n" +
"},\n" +
"{\n" +
"\"country\": \"India\",\n" +
"\"countryCode\": \"IN\",\n" +
"\"countryId\": \"104\",\n" +
"\"currency\": \"INR\",\n" +
"\"serviceAvailable\": [\n" +
"{\n" +
"\"id\": \"2\",\n" +
"\"text\": \"Bank Deposit\",\n" +
"\"description\": \"1 Business Day\"\n" +
"}\n" +
"]\n" +
"},\n" +
"{\n" +
"\"country\": \"Indonesia\",\n" +
"\"countryCode\": \"ID\",\n" +
"\"countryId\": \"105\",\n" +
"\"currency\": \"IDR\",\n" +
"\"serviceAvailable\": [\n" +
"{\n" +
"\"id\": \"2\",\n" +
"\"text\": \"Bank Deposit\",\n" +
"\"description\": \"1 Business Day\"\n" +
"}\n" +
"]\n" +
"},\n" +
"{\n" +
"\"country\": \"Malaysia\",\n" +
"\"countryCode\": \"MY\",\n" +
"\"countryId\": \"133\",\n" +
"\"currency\": \"MYR\",\n" +
"\"serviceAvailable\": [\n" +
"{\n" +
"\"id\": \"2\",\n" +
"\"text\": \"Bank Deposit\",\n" +
"\"description\": \"1 Business Day\"\n" +
"}\n" +
"]\n" +
"},\n" +
"{\n" +
"\"country\": \"Nepal\",\n" +
"\"countryCode\": \"NP\",\n" +
"\"countryId\": \"151\",\n" +
"\"currency\": \"NPR\",\n" +
"\"serviceAvailable\": [\n" +
"{\n" +
"\"id\": \"1\",\n" +
"\"text\": \"Cash Payment\",\n" +
"\"description\": \"1 Business Day\"\n" +
"},\n" +
"{\n" +
"\"id\": \"2\",\n" +
"\"text\": \"Bank Deposit\",\n" +
"\"description\": \"1 Business Day\"\n" +
"}\n" +
"]\n" +
"},\n" +
"{\n" +
"\"country\": \"Pakistan\",\n" +
"\"countryCode\": \"PK\",\n" +
"\"countryId\": \"169\",\n" +
"\"currency\": \"PKR\",\n" +
"\"serviceAvailable\": [\n" +
"{\n" +
"\"id\": \"2\",\n" +
"\"text\": \"Bank Deposit\",\n" +
"\"description\": \"1 Business Day\"\n" +
"},\n" +
"{\n" +
"\"id\": \"13\",\n" +
"\"text\": \"Mobile Wallet\",\n" +
"\"description\": \"1 Business Day\"\n" +
"},\n" +
"{\n" +
"\"id\": \"1\",\n" +
"\"text\": \"Cash Payment\",\n" +
"\"description\": \"1 Business Day\"\n" +
"}\n" +
"]\n" +
"},\n" +
"{\n" +
"\"country\": \"Philippines\",\n" +
"\"countryCode\": \"PH\",\n" +
"\"countryId\": \"174\",\n" +
"\"currency\": \"PHP\",\n" +
"\"serviceAvailable\": [\n" +
"{\n" +
"\"id\": \"2\",\n" +
"\"text\": \"Bank Deposit\",\n" +
"\"description\": \"1 Business Day\"\n" +
"},\n" +
"{\n" +
"\"id\": \"1\",\n" +
"\"text\": \"Cash Payment\",\n" +
"\"description\": \"1 Business Day\"\n" +
"}\n" +
"]\n" +
"},\n" +
"{\n" +
"\"country\": \"Russian Federation\",\n" +
"\"countryCode\": \"RU\",\n" +
"\"countryId\": \"184\",\n" +
"\"currency\": \"RUB\",\n" +
"\"serviceAvailable\": [\n" +
"{\n" +
"\"id\": \"1\",\n" +
"\"text\": \"Cash Payment\",\n" +
"\"description\": \"1 Business Day\"\n" +
"},\n" +
"{\n" +
"\"id\": \"2\",\n" +
"\"text\": \"Bank Deposit\",\n" +
"\"description\": \"1 Business Day\"\n" +
"}\n" +
"]\n" +
"},\n" +
"{\n" +
"\"country\": \"Singapore\",\n" +
"\"countryCode\": \"SG\",\n" +
"\"countryId\": \"201\",\n" +
"\"currency\": \"SGD\",\n" +
"\"serviceAvailable\": [\n" +
"{\n" +
"\"id\": \"2\",\n" +
"\"text\": \"Bank Deposit\",\n" +
"\"description\": \"1 Business Day\"\n" +
"}\n" +
"]\n" +
"},\n" +
"{\n" +
"\"country\": \"Vietnam\",\n" +
"\"countryCode\": \"VN\",\n" +
"\"countryId\": \"203\",\n" +
"\"currency\": \"VND\",\n" +
"\"serviceAvailable\": [\n" +
"{\n" +
"\"id\": \"1\",\n" +
"\"text\": \"Cash Payment\",\n" +
"\"description\": \"1 Business Day\"\n" +
"},\n" +
"{\n" +
"\"id\": \"2\",\n" +
"\"text\": \"Bank Deposit\",\n" +
"\"description\": \"1 Business Day\"\n" +
"},\n" +
"{\n" +
"\"id\": \"12\",\n" +
"\"text\": \"Home Delivery\",\n" +
"\"description\": \"1 Business Day\"\n" +
"}\n" +
"]\n" +
"},\n" +
"{\n" +
"\"country\": \"Vietnam\",\n" +
"\"countryCode\": \"VN\",\n" +
"\"countryId\": \"203\",\n" +
"\"currency\": \"USD\",\n" +
"\"serviceAvailable\": [\n" +
"{\n" +
"\"id\": \"1\",\n" +
"\"text\": \"Cash Payment\",\n" +
"\"description\": \"1 Business Day\"\n" +
"},\n" +
"{\n" +
"\"id\": \"2\",\n" +
"\"text\": \"Bank Deposit\",\n" +
"\"description\": \"1 Business Day\"\n" +
"},\n" +
"{\n" +
"\"id\": \"12\",\n" +
"\"text\": \"Home Delivery\",\n" +
"\"description\": \"1 Business Day\"\n" +
"}\n" +
"]\n" +
"},\n" +
"{\n" +
"\"country\": \"Thailand\",\n" +
"\"countryCode\": \"TH\",\n" +
"\"countryId\": \"218\",\n" +
"\"currency\": \"THB\",\n" +
"\"serviceAvailable\": [\n" +
"{\n" +
"\"id\": \"2\",\n" +
"\"text\": \"Bank Deposit\",\n" +
"\"description\": \"1 Business Day\"\n" +
"}\n" +
"]\n" +
"}\n" +
"]\n" +
"}";
String mockedSeedValueListString="{\n" +
" \"data\":\n" +
@ -359,10 +69,6 @@ public class ExchangeRateV2Gateway extends PrivilegedGateway implements Exchange
// return Observable.just(mockedResponse);
}
@Override
public String getNativeCountry() {
return "NP";
}
@Override
public Observable<List<CountryPaymentServiceSeedValueModel>> getAllSeedVAlues() {

28
app/src/main/java/com/gmeremit/online/gmeremittance_native/exchange_rate/model/datav2/ExchangeCalculationModel.java

@ -7,7 +7,7 @@ public class ExchangeCalculationModel {
@SerializedName("Id")
@Expose
private Object id;
private String id;
@SerializedName("scCharge")
@Expose
private String scCharge;
@ -47,12 +47,15 @@ public class ExchangeCalculationModel {
@SerializedName("schemeId")
@Expose
private String schemeId;
@SerializedName("EXRATEID")
@Expose
private String exrateId;
public Object getId() {
public String getId() {
return id;
}
public void setId(Object id) {
public void setId(String id) {
this.id = id;
}
@ -80,27 +83,27 @@ public class ExchangeCalculationModel {
this.exRate = exRate;
}
public String getPCurr() {
public String getpCurr() {
return pCurr;
}
public void setPCurr(String pCurr) {
public void setpCurr(String pCurr) {
this.pCurr = pCurr;
}
public String getPAmt() {
public String getpAmt() {
return pAmt;
}
public void setPAmt(String pAmt) {
public void setpAmt(String pAmt) {
this.pAmt = pAmt;
}
public String getSAmt() {
public String getsAmt() {
return sAmt;
}
public void setSAmt(String sAmt) {
public void setsAmt(String sAmt) {
this.sAmt = sAmt;
}
@ -160,4 +163,11 @@ public class ExchangeCalculationModel {
this.schemeId = schemeId;
}
public String getExrateId() {
return exrateId;
}
public void setExrateId(String exrateId) {
this.exrateId = exrateId;
}
}

1
app/src/main/java/com/gmeremit/online/gmeremittance_native/exchange_rate/presenter/ExchangeRateV2InteractorInterface.java

@ -19,7 +19,6 @@ public interface ExchangeRateV2InteractorInterface extends BaseInteractorInterfa
{
//Change to observable rxjava
Observable<PaymentServiceApiResponse> getPaymentServiceInfoFromServer(String auth);
String getNativeCountry();
Observable<List<CountryPaymentServiceSeedValueModel>> getAllSeedVAlues();
Observable<ExchangeCalculationApiResponse> sendDataForForexCalculation(String auth,String senderCountryId, String senderCurrency, String recieverCurrency,

6
app/src/main/java/com/gmeremit/online/gmeremittance_native/exchange_rate/presenter/ExchangeRateV2Presenter.java

@ -54,7 +54,7 @@ public class ExchangeRateV2Presenter extends BasePresenter implements ExchangeRa
compositeDisposables.add(
this.gateway.sendDataForForexCalculation(gateway.getAuth(),
sendCountryDefault,
Constants.EXCHANGE_RATE_SENDER_DEFAULT_CURRENCY,selectedCountryPaymentService.getCurrency(),
gateway.getUserPreferredCurrency(),selectedCountryPaymentService.getCurrency(),
sendAmount,recipientAmount,selectedPaymentMode.getId(),calculateFlag,selectedCountryPaymentService.getCountry(),
selectedCountryPaymentService.getCountryId())
.doOnSubscribe(disposable -> this.view.showProgressBar(true, "Calculating..."))
@ -82,7 +82,7 @@ public class ExchangeRateV2Presenter extends BasePresenter implements ExchangeRa
private Observable<CountryPaymentServiceSeedValueModel> getDefaultValue() {
return this.gateway.getAllSeedVAlues().flatMap(seedValueList -> {
String nativeCountryCode = this.gateway.getNativeCountry();
String nativeCountryCode = this.gateway.getUserNativeCountryCode();
for (CountryPaymentServiceSeedValueModel seedValueModel : seedValueList) {
if (seedValueModel.getCountryCode().equalsIgnoreCase(nativeCountryCode))
return Observable.just(seedValueModel);
@ -170,7 +170,7 @@ public class ExchangeRateV2Presenter extends BasePresenter implements ExchangeRa
ExchangeCalculationModel data = exchangeCalculationApiResponse.getData();
String transferAmount = data.getScCharge();
String exRate = data.getExRateDisplay();
String recipientAmount = data.getPAmt();
String recipientAmount = data.getpAmt();
String sendAmount = data.getCollAmt();
String sendingCurrency = data.getCollCurr();

2
app/src/main/java/com/gmeremit/online/gmeremittance_native/exchange_rate/presenter/ExchangeRateV2PresenterInterface.java

@ -13,7 +13,7 @@ public interface ExchangeRateV2PresenterInterface extends BasePresenterInterface
void getAllData();
void getForex(CountryPaymentService selectedCountryPaymentService, PaymentMode selectedPaymentMode, String text, String sendMoneyEditTextText, boolean shouldCaulatedByRecipient);
void getForex(CountryPaymentService selectedCountryPaymentService, PaymentMode selectedPaymentMode, String recieveAmount, String sendMoneyEditTextText, boolean shouldCaulatedByRecipient);
interface ExchangeRateV2ContractInterface extends BaseContractInterface

29
app/src/main/java/com/gmeremit/online/gmeremittance_native/sendmoneyV2/gateway/SendMoneyV2Gateway.java

@ -3,11 +3,13 @@ package com.gmeremit.online.gmeremittance_native.sendmoneyV2.gateway;
import com.gmeremit.online.gmeremittance_native.agentsV2.model.AgentsListApiResponse;
import com.gmeremit.online.gmeremittance_native.agentsV2.presenter.AgentListV2InteractorInterface;
import com.gmeremit.online.gmeremittance_native.base.PrivilegedGateway;
import com.gmeremit.online.gmeremittance_native.exchange_rate.model.datav2.ExchangeCalculationApiResponse;
import com.gmeremit.online.gmeremittance_native.sendmoneyV2.model.payoutmode.PayoutModeApiResponse;
import com.gmeremit.online.gmeremittance_native.sendmoneyV2.presenter.SendMoneyV2InteractorInterface;
import com.gmeremit.online.gmeremittance_native.utils.https.HttpClientV2;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
import io.reactivex.Observable;
@ -70,6 +72,33 @@ public class SendMoneyV2Gateway extends PrivilegedGateway implements SendMoneyV2
this.interactor=sendMoneyV2InteractorInterface;
}
@Override
public Observable<ExchangeCalculationApiResponse> 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) {
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","WALLET");
jsonObject.addProperty("payOutPartner",payoutPartnerId);
jsonObject.addProperty("userId",userID);
return HttpClientV2.getInstance().calculateForSendMoneyExchangeRateV2(auth,jsonObject);
}
@Override
public Observable<PayoutModeApiResponse> getAgentInfoListFromNetwork(String auth, String recipientCountryId, String recipientId) {

6
app/src/main/java/com/gmeremit/online/gmeremittance_native/sendmoneyV2/presenter/SendMoneyV2InteractorInterface.java

@ -3,6 +3,7 @@ package com.gmeremit.online.gmeremittance_native.sendmoneyV2.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.payoutmode.PayoutModeApiResponse;
import io.reactivex.Observable;
@ -15,5 +16,10 @@ public interface SendMoneyV2InteractorInterface extends BaseInteractorInterface
Observable<PayoutModeApiResponse> getAgentInfoListFromNetwork(String auth,String recipientCountryId, String recipientId);
Observable<ExchangeCalculationApiResponse> 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);
}
}

30
app/src/main/java/com/gmeremit/online/gmeremittance_native/sendmoneyV2/presenter/SendMoneyV2Presenter.java

@ -3,6 +3,9 @@ package com.gmeremit.online.gmeremittance_native.sendmoneyV2.presenter;
import android.text.Editable;
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.exchange_rate.model.datav2.ExchangeCalculationModel;
import com.gmeremit.online.gmeremittance_native.recipientV2.model.recipientlisting.RecipientInfoModel;
import com.gmeremit.online.gmeremittance_native.sendmoneyV2.gateway.SendMoneyV2Gateway;
import com.gmeremit.online.gmeremittance_native.sendmoneyV2.model.payoutmode.BankList;
@ -10,6 +13,7 @@ import com.gmeremit.online.gmeremittance_native.sendmoneyV2.model.payoutmode.Bra
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.utils.Constants;
import com.gmeremit.online.gmeremittance_native.utils.https.GenericApiObserverResponse;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
@ -90,4 +94,30 @@ public class SendMoneyV2Presenter extends BasePresenter implements SendMoneyV2Pr
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread());
}
@Override
public Observable<ExchangeCalculationApiResponse> getForex(String recieveAmount, String sendMoneyEditTextText, boolean shouldCaulatedByRecipient,String recieverCurrency) {
/*
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 senderCountryId=gateway.getUserNativeCountryCode();
String senderCurrency=gateway.getUserPreferredCurrency();
String paymentMethodId=selectedPaymentModeData.getId();
String calculationPreference="";
String recipientCountryName=selectedRecipient.getCountry();
String recipientCountryID=selectedRecipient.getCountryCode();
String bankId=(selectedBankData==null)?"":selectedBankData.getId();
String paymentPartnerId=selectedPaymentModeData.getPayoutPartner();
// return gateway.sendDataForForexCalculation(gateway.getAuth(),)
return Observable.just(new ExchangeCalculationApiResponse());
}
}

5
app/src/main/java/com/gmeremit/online/gmeremittance_native/sendmoneyV2/presenter/SendMoneyV2PresenterInterface.java

@ -4,17 +4,22 @@ import android.text.Editable;
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.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 io.reactivex.Observable;
public interface SendMoneyV2PresenterInterface extends BasePresenterInterface {
io.reactivex.Observable<PayoutModeApiResponse> getAllPayoutMode();
Observable<ExchangeCalculationApiResponse> getForex(String recieveAmount, String sendMoneyEditTextText, boolean shouldCaulatedByRecipient,String recieverCurrency);
void setPaymentData(PayoutMode selectedPaymentData);
void clearPaymentData();

37
app/src/main/java/com/gmeremit/online/gmeremittance_native/sendmoneyV2/view/amountdetail/AmountDetailSendMoneyFragment.java

@ -11,8 +11,13 @@ import android.widget.Button;
import com.gmeremit.online.gmeremittance_native.R;
import com.gmeremit.online.gmeremittance_native.base.BaseFragment;
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.exchange_rate.model.datav2.ExchangeCalculationModel;
import com.gmeremit.online.gmeremittance_native.sendmoneyV2.view.SendMoneyActionListener;
import com.gmeremit.online.gmeremittance_native.sendmoneyV2.view.SendMoneyV2Activity;
import com.gmeremit.online.gmeremittance_native.utils.Constants;
import com.gmeremit.online.gmeremittance_native.utils.https.GenericApiObserverResponse;
import butterknife.BindView;
import butterknife.ButterKnife;
@ -89,4 +94,36 @@ public class AmountDetailSendMoneyFragment extends BaseFragment implements View.
break;
}
}
public class ExchangeRateCalcObserver extends GenericApiObserverResponse<ExchangeCalculationApiResponse>
{
@Override
protected void onSuccess(ExchangeCalculationApiResponse exchangeCalculationApiResponse) {
if(exchangeCalculationApiResponse.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) {
ExchangeCalculationModel data = exchangeCalculationApiResponse.getData();
String transferAmount = data.getScCharge();
String exRate = data.getExRateDisplay();
String recipientAmount = data.getpAmt();
String sendAmount = data.getCollAmt();
String sendingCurrency = data.getCollCurr();
String transferDisplay = " - " + transferAmount +" "+ sendingCurrency + " (Transfer Fee Included)";
String exRateDisplay = " " + exRate + " (Current Exchange Rate)";
}
else
showPopUpMessage(exchangeCalculationApiResponse.getMsg(), CustomAlertDialog.AlertType.FAILED,null);
}
@Override
public void onFailed(String message) {
showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED,null);
}
@Override
protected void onConnectionNotEstablished(String message) {
showPopUpMessage(message, CustomAlertDialog.AlertType.NO_INTERNET, null);
}
}
}

1
app/src/main/java/com/gmeremit/online/gmeremittance_native/utils/Constants.java

@ -130,7 +130,6 @@ public class Constants {
public static final String DEFAULT_EXCHANGE_SEND_AMOUNT = "1000000";
public static final String CALC_BY_RECIPEINT = "p";
public static final String CALC_BY_SENDER = "c";
public static final String EXCHANGE_RATE_SENDER_DEFAULT_CURRENCY = "KRW";
public static final String SUCCESS_CODE_V2 = "0";
public static final String TRUE_STRING = "True";
// public static final String DEVICEID = "gme1234apps12sanam";

2
app/src/main/java/com/gmeremit/online/gmeremittance_native/utils/https/API_URL.java

@ -126,5 +126,7 @@ public class API_URL {
public static final String GET_ALL_RECIPIENT_V2 = "mobile/{uId}/receivers?search=";
public static final String DELETE_RECIPIENT_V2 = "mobile/receiver/remove/{uId}/";
public static final String SEND_MONEY_GET_PAYMENTMODE_V2 = "mobile/sendmoney/load/{countryId}/";
public static final String SEND_MONEY_CALCULATE_EXCHANGE_RATE = "mobile/sendmoney/calculate";
}

3
app/src/main/java/com/gmeremit/online/gmeremittance_native/utils/https/ApiEndpoints.java

@ -553,4 +553,7 @@ public interface ApiEndpoints {
@Headers("Content-Type: application/json")
Observable<PayoutModeApiResponse> getPayoutModeForSendMoneyV2(@Header("Authorization") String token, @Path("countryId") String countryID, @Query("receiver") String recieverId);
@POST(API_URL.SEND_MONEY_CALCULATE_EXCHANGE_RATE)
@Headers("Content-Type: application/json")
Observable<ExchangeCalculationApiResponse> calculateForSendMoneyExchangeRateV2(@Header("Authorization") String token, @Body() JsonObject jsonObject);
}
Loading…
Cancel
Save