mirror of
https://github.com/aljazceru/lnd-manageJ.git
synced 2026-01-20 14:34:24 +01:00
remove some properties from exposed payment options
This commit is contained in:
@@ -24,7 +24,6 @@ import static de.cotto.lndmanagej.model.ChannelIdFixtures.CHANNEL_ID_3;
|
||||
import static de.cotto.lndmanagej.model.ChannelIdFixtures.CHANNEL_ID_5;
|
||||
import static de.cotto.lndmanagej.model.PubkeyFixtures.PUBKEY;
|
||||
import static de.cotto.lndmanagej.model.PubkeyFixtures.PUBKEY_2;
|
||||
import static de.cotto.lndmanagej.model.PubkeyFixtures.PUBKEY_4;
|
||||
import static de.cotto.lndmanagej.model.RouteFixtures.ROUTE;
|
||||
import static de.cotto.lndmanagej.pickhardtpayments.model.MultiPathPaymentFixtures.MULTI_PATH_PAYMENT;
|
||||
import static de.cotto.lndmanagej.pickhardtpayments.model.PaymentOptions.DEFAULT_PAYMENT_OPTIONS;
|
||||
@@ -49,16 +48,14 @@ class PickhardtPaymentsControllerIT {
|
||||
private static final PaymentOptions PAYMENT_OPTIONS = new PaymentOptions(
|
||||
Optional.of(123),
|
||||
Optional.of(999L),
|
||||
Optional.of(777L),
|
||||
Optional.empty(),
|
||||
false,
|
||||
Optional.of(PUBKEY_4)
|
||||
Optional.empty()
|
||||
);
|
||||
private static final String DTO_AS_STRING = "{" +
|
||||
" \"feeRateWeight\": 123," +
|
||||
" \"feeRateLimit\": 999," +
|
||||
" \"feeRateLimitExceptIncomingHops\": 777," +
|
||||
" \"ignoreFeesForOwnChannels\": false," +
|
||||
" \"peer\": \"000000000000000000000000000000000000000000000000000000000000000004\"" +
|
||||
" \"ignoreFeesForOwnChannels\": false" +
|
||||
"}";
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package de.cotto.lndmanagej.controller.dto;
|
||||
|
||||
import de.cotto.lndmanagej.model.Pubkey;
|
||||
import de.cotto.lndmanagej.pickhardtpayments.model.PaymentOptions;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@@ -20,10 +19,6 @@ public class PaymentOptionsDto {
|
||||
@Nullable
|
||||
private Long feeRateLimit;
|
||||
private boolean ignoreFeesForOwnChannels;
|
||||
@Nullable
|
||||
private Pubkey peer;
|
||||
@Nullable
|
||||
private Long feeRateLimitExceptIncomingHops;
|
||||
|
||||
public PaymentOptionsDto() {
|
||||
ignoreFeesForOwnChannels = DEFAULT_PAYMENT_OPTIONS.ignoreFeesForOwnChannels();
|
||||
@@ -34,9 +29,9 @@ public class PaymentOptionsDto {
|
||||
return new PaymentOptions(
|
||||
Optional.ofNullable(feeRateWeight),
|
||||
Optional.ofNullable(feeRateLimit),
|
||||
Optional.ofNullable(feeRateLimitExceptIncomingHops),
|
||||
Optional.empty(),
|
||||
ignoreFeesForOwnChannels,
|
||||
Optional.ofNullable(peer)
|
||||
Optional.empty()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -51,12 +46,4 @@ public class PaymentOptionsDto {
|
||||
public void setIgnoreFeesForOwnChannels(boolean ignoreFeesForOwnChannels) {
|
||||
this.ignoreFeesForOwnChannels = ignoreFeesForOwnChannels;
|
||||
}
|
||||
|
||||
public void setPeer(@Nullable Pubkey peer) {
|
||||
this.peer = peer;
|
||||
}
|
||||
|
||||
public void setFeeRateLimitExceptIncomingHops(@Nullable Long feeRateLimitExceptIncomingHops) {
|
||||
this.feeRateLimitExceptIncomingHops = feeRateLimitExceptIncomingHops;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ import java.util.Optional;
|
||||
|
||||
import static de.cotto.lndmanagej.model.PubkeyFixtures.PUBKEY;
|
||||
import static de.cotto.lndmanagej.model.PubkeyFixtures.PUBKEY_2;
|
||||
import static de.cotto.lndmanagej.model.PubkeyFixtures.PUBKEY_4;
|
||||
import static de.cotto.lndmanagej.pickhardtpayments.model.MultiPathPaymentFixtures.MULTI_PATH_PAYMENT;
|
||||
import static de.cotto.lndmanagej.pickhardtpayments.model.PaymentOptions.DEFAULT_PAYMENT_OPTIONS;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -45,18 +44,14 @@ class PickhardtPaymentsControllerTest {
|
||||
PAYMENT_OPTIONS = new PaymentOptions(
|
||||
Optional.of(123),
|
||||
Optional.of(999L),
|
||||
Optional.of(777L),
|
||||
Optional.empty(),
|
||||
false,
|
||||
Optional.of(PUBKEY_4)
|
||||
Optional.empty()
|
||||
);
|
||||
PAYMENT_OPTIONS_DTO = new PaymentOptionsDto();
|
||||
PAYMENT_OPTIONS_DTO.setFeeRateWeight(PAYMENT_OPTIONS.feeRateWeight().orElse(null));
|
||||
PAYMENT_OPTIONS_DTO.setFeeRateLimit(PAYMENT_OPTIONS.feeRateLimit().orElse(null));
|
||||
PAYMENT_OPTIONS_DTO.setFeeRateLimitExceptIncomingHops(
|
||||
PAYMENT_OPTIONS.feeRateLimitExceptIncomingHops().orElse(null)
|
||||
);
|
||||
PAYMENT_OPTIONS_DTO.setIgnoreFeesForOwnChannels(PAYMENT_OPTIONS.ignoreFeesForOwnChannels());
|
||||
PAYMENT_OPTIONS_DTO.setPeer(PAYMENT_OPTIONS.peer().orElse(null));
|
||||
}
|
||||
|
||||
@InjectMocks
|
||||
|
||||
@@ -5,7 +5,6 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import static de.cotto.lndmanagej.model.PubkeyFixtures.PUBKEY;
|
||||
import static de.cotto.lndmanagej.pickhardtpayments.model.PaymentOptions.DEFAULT_PAYMENT_OPTIONS;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@@ -37,23 +36,6 @@ class PaymentOptionsDtoTest {
|
||||
assertThat(dto.toModel()).isEqualTo(expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
void feeRateLimit_and_feeRateLimitExceptIncomingHops() {
|
||||
PaymentOptionsDto dto = new PaymentOptionsDto();
|
||||
long feeRateLimit = 555;
|
||||
long feeRateLimitExceptIncomingHops = 777;
|
||||
dto.setFeeRateLimit(feeRateLimit);
|
||||
dto.setFeeRateLimitExceptIncomingHops(feeRateLimitExceptIncomingHops);
|
||||
PaymentOptions expected = new PaymentOptions(
|
||||
Optional.empty(),
|
||||
Optional.of(feeRateLimit),
|
||||
Optional.of(feeRateLimitExceptIncomingHops),
|
||||
DEFAULT_PAYMENT_OPTIONS.ignoreFeesForOwnChannels(),
|
||||
Optional.empty()
|
||||
);
|
||||
assertThat(dto.toModel()).isEqualTo(expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
void ignoreFeesForOwnChannels() {
|
||||
PaymentOptionsDto dto = new PaymentOptionsDto();
|
||||
@@ -67,18 +49,4 @@ class PaymentOptionsDtoTest {
|
||||
);
|
||||
assertThat(dto.toModel()).isEqualTo(expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
void peer() {
|
||||
PaymentOptionsDto dto = new PaymentOptionsDto();
|
||||
dto.setPeer(PUBKEY);
|
||||
PaymentOptions expected = new PaymentOptions(
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
DEFAULT_PAYMENT_OPTIONS.ignoreFeesForOwnChannels(),
|
||||
Optional.of(PUBKEY)
|
||||
);
|
||||
assertThat(dto.toModel()).isEqualTo(expected);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user