|
@ -18,6 +18,7 @@ import com.gmeremit.online.gmeremittance_native.utils.https.GenericApiObserverRe |
|
|
import io.reactivex.Observable; |
|
|
import io.reactivex.Observable; |
|
|
import io.reactivex.android.schedulers.AndroidSchedulers; |
|
|
import io.reactivex.android.schedulers.AndroidSchedulers; |
|
|
import io.reactivex.disposables.CompositeDisposable; |
|
|
import io.reactivex.disposables.CompositeDisposable; |
|
|
|
|
|
import io.reactivex.observers.DisposableObserver; |
|
|
import io.reactivex.schedulers.Schedulers; |
|
|
import io.reactivex.schedulers.Schedulers; |
|
|
|
|
|
|
|
|
public class ExchangeRateV2Presenter extends BasePresenter implements ExchangeRateV2PresenterInterface, ExchangeRateV2InteractorInterface { |
|
|
public class ExchangeRateV2Presenter extends BasePresenter implements ExchangeRateV2PresenterInterface, ExchangeRateV2InteractorInterface { |
|
@ -73,6 +74,20 @@ public class ExchangeRateV2Presenter extends BasePresenter implements ExchangeRa |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void getDefaultReceivingAmountForSelectedCurrency(CountryPaymentService countryPaymentService) { |
|
|
|
|
|
String nativeCountryCode = countryPaymentService.getCountryCode(); |
|
|
|
|
|
String preferredCurrency= countryPaymentService.getCurrency(); |
|
|
|
|
|
compositeDisposables.add( |
|
|
|
|
|
this.gateway.getAllSeedVAlues().flatMap(seedValueList -> { |
|
|
|
|
|
for (CountryPaymentServiceSeedValueModel seedValueModel : seedValueList) { |
|
|
|
|
|
if (seedValueModel.getCountryCode().equalsIgnoreCase(nativeCountryCode)&&seedValueModel.getCurrency().equalsIgnoreCase(preferredCurrency)) |
|
|
|
|
|
return Observable.just(seedValueModel); |
|
|
|
|
|
} |
|
|
|
|
|
return Observable.just(new CountryPaymentServiceSeedValueModel(null, null, null)); |
|
|
|
|
|
}).subscribeWith(new DefaultRecievingAmountObserver())); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void onViewDestroyed() { |
|
|
public void onViewDestroyed() { |
|
|
super.onViewDestroyed(); |
|
|
super.onViewDestroyed(); |
|
@ -216,4 +231,28 @@ public class ExchangeRateV2Presenter extends BasePresenter implements ExchangeRa |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public class DefaultRecievingAmountObserver extends DisposableObserver<CountryPaymentServiceSeedValueModel> |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void onNext(CountryPaymentServiceSeedValueModel countryPaymentServiceSeedValueModel) { |
|
|
|
|
|
String receivingAmount=countryPaymentServiceSeedValueModel.getRecipientSeedValue(); |
|
|
|
|
|
if(receivingAmount!=null) |
|
|
|
|
|
view.updateReceivingAmountAndFetchExchangeRate(Utils.formatCurrency(receivingAmount)); |
|
|
|
|
|
else |
|
|
|
|
|
view.fallbackToSendingAmountAndFetchExchangeRate(); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void onError(Throwable e) { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void onComplete() { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |