check that the corrent paymentaccount is used for this offer

This commit is contained in:
Mike Rosseel 2017-09-04 19:59:40 +02:00
parent d826efc984
commit 68a7e7c9c5
2 changed files with 13 additions and 4 deletions

View file

@ -166,6 +166,12 @@ public class BisqProxy {
public Optional<BisqProxyError> offerMake(String accountId, OfferPayload.Direction direction, BigDecimal amount, BigDecimal minAmount,
boolean useMarketBasedPrice, Double marketPriceMargin, String baseCurrencyCode, String counterCurrencyCode, String fiatPrice) {
// exception from gui code is not clear enough, so this check is added. Missing money is another possible check but that's clear in the gui exception.
if(user.getAcceptedArbitratorAddresses().size() == 0) {
return BisqProxyError.getOptional("No arbitrator has been chosen");
}
// Checked that if fixed we have a fixed price, if percentage we have a percentage
if (marketPriceMargin == null && useMarketBasedPrice) {
return BisqProxyError.getOptional("When choosing PERCENTAGE price, fill in percentage_from_market_price");
@ -267,6 +273,9 @@ public class BisqProxy {
Offer offer = new Offer(offerPayload);
offer.setPriceFeedService(priceFeedService);
if(!PaymentAccountUtil.isPaymentAccountValidForOffer(offer, paymentAccount)) {
return BisqProxyError.getOptional("PaymentAccount is not valid for offer");
}
// use countdownlatch to block this method until there's a success/error callback call
CountDownLatch loginLatch = new CountDownLatch(1);

View file

@ -176,6 +176,10 @@ public class BisqApp extends Application {
injector = Guice.createInjector(bisqAppModule);
injector.getInstance(InjectorViewFactory.class).setInjector(injector);
if(Boolean.valueOf(bisqEnvironment.getRequiredProperty(AppOptionKeys.ENABLE_API))) {
injector.getInstance(DropwizardApplication.class).run("server", "bisq-api.yml");
}
// All classes which are persisting objects need to be added here
// Maintain order!
ArrayList<PersistedDataHost> persistedDataHosts = new ArrayList<>();
@ -215,10 +219,6 @@ public class BisqApp extends Application {
mainView.setPersistedFilesCorrupted(corruptedDatabaseFiles);
});
if(Boolean.valueOf(bisqEnvironment.getRequiredProperty(AppOptionKeys.ENABLE_API))) {
injector.getInstance(DropwizardApplication.class).run("server", "bisq-api.yml");
}
// load the main view and create the main scene
CachingViewLoader viewLoader = injector.getInstance(CachingViewLoader.class);
mainView = (MainView) viewLoader.load(MainView.class);