|
|
|
|
@ -135,9 +135,33 @@ class CommercialBankIssuanceApplicationServiceTest {
|
|
|
|
|
.isEqualTo(ErrorCode.UNAUTHORIZED);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void acceptsAmountBelowSuggestedSupplementWhenDenominationsMatch() {
|
|
|
|
|
IssuanceRequestView created = service.create(createCommand(new BigDecimal("40000.00"), 300), "tzs001");
|
|
|
|
|
|
|
|
|
|
assertThat(created.getTotalAmount()).isEqualByComparingTo("40000.00");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void rejectsAmountAboveSuggestedSupplement() {
|
|
|
|
|
assertThatThrownBy(() -> service.create(
|
|
|
|
|
createCommand(new BigDecimal("50100.00"), 401), "tzs001"))
|
|
|
|
|
.isInstanceOf(BusinessException.class)
|
|
|
|
|
.satisfies(exception -> {
|
|
|
|
|
BusinessException businessException = (BusinessException) exception;
|
|
|
|
|
assertThat(businessException.getErrorCode()).isEqualTo(ErrorCode.VALIDATION_ERROR);
|
|
|
|
|
assertThat(businessException.getMessage())
|
|
|
|
|
.isEqualTo("申请发行金额不得超过建议补充金额 50000.00 元");
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private CreateIssuanceRequestCommand createCommand() {
|
|
|
|
|
return new CreateIssuanceRequestCommand("BKCHCNBJ00001", "ORG_3A4B5C6D7E8F", new BigDecimal("50000.00"),
|
|
|
|
|
"DC", Arrays.asList(new DenominationItem(100, 400), new DenominationItem(50, 100),
|
|
|
|
|
return createCommand(new BigDecimal("50000.00"), 400);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private CreateIssuanceRequestCommand createCommand(BigDecimal totalAmount, int hundredQuantity) {
|
|
|
|
|
return new CreateIssuanceRequestCommand("BKCHCNBJ00001", "ORG_3A4B5C6D7E8F", totalAmount,
|
|
|
|
|
"DC", Arrays.asList(new DenominationItem(100, hundredQuantity), new DenominationItem(50, 100),
|
|
|
|
|
new DenominationItem(20, 200), new DenominationItem(10, 50), new DenominationItem(5, 80),
|
|
|
|
|
new DenominationItem(1, 100), new DenominationItem(new BigDecimal("0.5"), 0),
|
|
|
|
|
new DenominationItem(new BigDecimal("0.2"), 0), new DenominationItem(new BigDecimal("0.1"), 0),
|
|
|
|
|
@ -159,7 +183,8 @@ class CommercialBankIssuanceApplicationServiceTest {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Optional<IssuanceBankInventory> findBuiltInInventory() {
|
|
|
|
|
return Optional.empty();
|
|
|
|
|
return Optional.of(new IssuanceBankInventory("BKCHCNBJ00001", new BigDecimal("49960000.00"),
|
|
|
|
|
new BigDecimal("50000000.00"), new BigDecimal("50000.00")));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|