use of io.bisq.api.model.OfferToCreate in project bisq-api by mrosseel.
the class OfferResourceIT method createOffer_notUseMarketBasePriceButNoFixedPrice_returns422status.
@InSequence(3)
@Test
public void createOffer_notUseMarketBasePriceButNoFixedPrice_returns422status() {
final OfferToCreate offer = getOfferToCreateFixedBuy(tradeCurrency, alicePaymentAccount.id);
offer.priceType = PriceType.FIXED;
final JSONObject jsonOffer = toJsonObject(offer);
jsonOffer.remove("fixedPrice");
given().port(getAlicePort()).body(jsonOffer.toString()).contentType(ContentType.JSON).when().post("/api/v1/offers").then().statusCode(422);
}
use of io.bisq.api.model.OfferToCreate in project bisq-api by mrosseel.
the class OfferResourceIT method createOffer_validPayloadButNoFunds_returns427status.
@InSequence(3)
@Test
public void createOffer_validPayloadButNoFunds_returns427status() {
final OfferToCreate offer = getOfferToCreateFixedBuy(tradeCurrency, alicePaymentAccount.id);
createOffer_template(offer, 427);
}
use of io.bisq.api.model.OfferToCreate in project bisq-api by mrosseel.
the class OfferResourceIT method createOffer_validPayloadAndHasFunds_returnsOffer.
@InSequence(5)
@Test
public void createOffer_validPayloadAndHasFunds_returnsOffer() throws Exception {
final int alicePort = getAlicePort();
final OfferToCreate offer = getOfferToCreateFixedBuy(tradeCurrency, alicePaymentAccount.id);
createdOffer = given().port(alicePort).body(offer).contentType(ContentType.JSON).when().post("/api/v1/offers").then().statusCode(200).and().body("acceptedCountryCodes", equalTo(alicePaymentAccount.acceptedCountries)).and().body("amount", equalTo(1)).and().body("arbitratorNodeAddresses", equalTo(ApiTestHelper.getAcceptedArbitrators(alicePort))).and().body("baseCurrencyCode", equalTo("BTC")).and().body("bankId", equalTo(alicePaymentAccount.bic)).and().body("blockHeightAtOfferCreation", isA(Integer.class)).and().body("buyerSecurityDeposit", equalTo(offer.buyerSecurityDeposit.intValue())).and().body("counterCurrencyCode", equalTo(alicePaymentAccount.selectedTradeCurrency)).and().body("countryCode", equalTo(alicePaymentAccount.countryCode)).and().body("currencyCode", equalTo(alicePaymentAccount.selectedTradeCurrency)).and().body("date", isA(Long.class)).and().body("direction", equalTo(OfferPayload.Direction.BUY.name())).and().body("id", isA(String.class)).and().body("isCurrencyForMakerFeeBtc", equalTo(true)).and().body("isPrivateOffer", equalTo(false)).and().body("lowerClosePrice", equalTo(0)).and().body("makerFee", equalTo(5000)).and().body("makerPaymentAccountId", equalTo(alicePaymentAccount.id)).and().body("marketPriceMargin", equalTo(10f)).and().body("maxTradeLimit", equalTo(25000000)).and().body("maxTradePeriod", equalTo(518400000)).and().body("minAmount", equalTo(1)).and().body("offerFeePaymentTxId", isA(String.class)).and().body("ownerNodeAddress", equalTo(ApiTestHelper.getP2PNetworkStatus(alicePort).address)).and().body("paymentMethodId", equalTo(alicePaymentAccount.paymentMethod)).and().body("price", equalTo(10)).and().body("protocolVersion", equalTo(1)).and().body("sellerSecurityDeposit", equalTo(300000)).and().body("state", equalTo(Offer.State.OFFER_FEE_PAID.name())).and().body("txFee", equalTo(6000)).and().body("upperClosePrice", equalTo(0)).and().body("useAutoClose", equalTo(false)).and().body("useMarketBasedPrice", equalTo(false)).and().body("useReOpenAfterAutoClose", equalTo(false)).and().body("versionNr", isA(String.class)).extract().as(OfferDetail.class);
}
use of io.bisq.api.model.OfferToCreate in project bisq-api by mrosseel.
the class OfferResourceIT method getOfferToCreateFixedBuy.
@NotNull
private OfferToCreate getOfferToCreateFixedBuy(String tradeCurrency, String paymentAccountId) {
final OfferToCreate offer = new OfferToCreate();
offer.fundUsingBisqWallet = true;
offer.amount = new BigDecimal(1);
offer.minAmount = offer.amount;
offer.direction = OfferPayload.Direction.BUY;
offer.fixedPrice = 10L;
offer.marketPair = "BTC_" + tradeCurrency;
offer.priceType = PriceType.FIXED;
offer.accountId = paymentAccountId;
offer.percentageFromMarketPrice = 10.0;
offer.buyerSecurityDeposit = 123456L;
return offer;
}
use of io.bisq.api.model.OfferToCreate in project bisq-api by mrosseel.
the class OfferResourceIT method createOffer_useMarketBasePriceButNoMarginProvided_returns422status.
@InSequence(3)
@Test
public void createOffer_useMarketBasePriceButNoMarginProvided_returns422status() {
final OfferToCreate offer = getOfferToCreateFixedBuy(tradeCurrency, alicePaymentAccount.id);
offer.priceType = PriceType.PERCENTAGE;
offer.percentageFromMarketPrice = null;
createOffer_template(offer, 422);
}
Aggregations