hs_office_sepamandate_rv: fix missing update column reference
This commit is contained in:
parent
6df93bfbb6
commit
ddfabef9b7
@ -102,6 +102,7 @@ call generateRbacIdentityView('hs_office_sepamandate', idNameExpression => 'targ
|
|||||||
call generateRbacRestrictedView('hs_office_sepamandate',
|
call generateRbacRestrictedView('hs_office_sepamandate',
|
||||||
orderby => 'target.reference',
|
orderby => 'target.reference',
|
||||||
columnUpdates => $updates$
|
columnUpdates => $updates$
|
||||||
|
reference = new.reference,
|
||||||
agreement = new.agreement,
|
agreement = new.agreement,
|
||||||
validity = new.validity
|
validity = new.validity
|
||||||
$updates$);
|
$updates$);
|
||||||
|
@ -341,7 +341,52 @@ class HsOfficeSepaMandateControllerAcceptanceTest {
|
|||||||
class PatchSepaMandate {
|
class PatchSepaMandate {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void globalAdmin_canPatchValidToOfArbitrarySepaMandate() {
|
void globalAdmin_canPatchAllUpdatablePropertiesOfSepaMandate() {
|
||||||
|
|
||||||
|
final var givenSepaMandate = givenSomeTemporarySepaMandate();
|
||||||
|
|
||||||
|
final var location = RestAssured // @formatter:off
|
||||||
|
.given()
|
||||||
|
.header("current-user", "superuser-alex@hostsharing.net")
|
||||||
|
.contentType(ContentType.JSON)
|
||||||
|
.body("""
|
||||||
|
{
|
||||||
|
"reference": "temp ref CAT Z - patched",
|
||||||
|
"agreement": "2020-06-01",
|
||||||
|
"validFrom": "2020-06-05",
|
||||||
|
"validTo": "2022-12-31"
|
||||||
|
}
|
||||||
|
""")
|
||||||
|
.port(port)
|
||||||
|
.when()
|
||||||
|
.patch("http://localhost/api/hs/office/sepamandates/" + givenSepaMandate.getUuid())
|
||||||
|
.then().log().all().assertThat()
|
||||||
|
.statusCode(200)
|
||||||
|
.contentType(ContentType.JSON)
|
||||||
|
.body("uuid", isUuidValid())
|
||||||
|
.body("debitor.partner.person.tradeName", is("First GmbH"))
|
||||||
|
.body("bankAccount.iban", is("DE02120300000000202051"))
|
||||||
|
.body("reference", is("temp ref CAT Z - patched"))
|
||||||
|
.body("agreement", is("2020-06-01"))
|
||||||
|
.body("validFrom", is("2020-06-05"))
|
||||||
|
.body("validTo", is("2022-12-31"));
|
||||||
|
// @formatter:on
|
||||||
|
|
||||||
|
// finally, the sepaMandate is actually updated
|
||||||
|
context.define("superuser-alex@hostsharing.net");
|
||||||
|
assertThat(sepaMandateRepo.findByUuid(givenSepaMandate.getUuid())).isPresent().get()
|
||||||
|
.matches(mandate -> {
|
||||||
|
assertThat(mandate.getDebitor().toString()).isEqualTo("debitor(10001: First GmbH)");
|
||||||
|
assertThat(mandate.getBankAccount().toShortString()).isEqualTo("First GmbH");
|
||||||
|
assertThat(mandate.getReference()).isEqualTo("temp ref CAT Z - patched");
|
||||||
|
assertThat(mandate.getValidFrom()).isEqualTo("2020-06-05");
|
||||||
|
assertThat(mandate.getValidTo()).isEqualTo("2022-12-31");
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void globalAdmin_canPatchJustValidToOfArbitrarySepaMandate() {
|
||||||
|
|
||||||
context.define("superuser-alex@hostsharing.net");
|
context.define("superuser-alex@hostsharing.net");
|
||||||
final var givenSepaMandate = givenSomeTemporarySepaMandate();
|
final var givenSepaMandate = givenSomeTemporarySepaMandate();
|
||||||
|
@ -78,7 +78,7 @@ class HsOfficeSepaMandateRepositoryIntegrationTest extends ContextBasedTest {
|
|||||||
.debitor(givenDebitor)
|
.debitor(givenDebitor)
|
||||||
.bankAccount(givenBankAccount)
|
.bankAccount(givenBankAccount)
|
||||||
.reference("temp ref A")
|
.reference("temp ref A")
|
||||||
.agreement(LocalDate.parse( "2020-01-02"))
|
.agreement(LocalDate.parse("2020-01-02"))
|
||||||
.validity(Range.closedOpen(
|
.validity(Range.closedOpen(
|
||||||
LocalDate.parse("2020-01-01"), LocalDate.parse("2023-01-01")))
|
LocalDate.parse("2020-01-01"), LocalDate.parse("2023-01-01")))
|
||||||
.build();
|
.build();
|
||||||
@ -238,29 +238,30 @@ class HsOfficeSepaMandateRepositoryIntegrationTest extends ContextBasedTest {
|
|||||||
class UpdateSepaMandate {
|
class UpdateSepaMandate {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void hostsharingAdmin_canUpdateValidityOfArbitrarySepaMandate() {
|
public void hostsharingAdmin_canUpdateArbitrarySepaMandate() {
|
||||||
// given
|
// given
|
||||||
context("superuser-alex@hostsharing.net");
|
|
||||||
final var givenSepaMandate = givenSomeTemporarySepaMandateBessler("Peter Smith");
|
final var givenSepaMandate = givenSomeTemporarySepaMandateBessler("Peter Smith");
|
||||||
assertThatSepaMandateIsVisibleForUserWithRole(
|
assertThatSepaMandateIsVisibleForUserWithRole(
|
||||||
givenSepaMandate,
|
givenSepaMandate,
|
||||||
"hs_office_bankaccount#PeterSmith.admin");
|
"hs_office_bankaccount#PeterSmith.admin");
|
||||||
assertThatSepaMandateActuallyInDatabase(givenSepaMandate);
|
|
||||||
final var newValidityEnd = LocalDate.now();
|
|
||||||
|
|
||||||
// when
|
// when
|
||||||
context("superuser-alex@hostsharing.net");
|
|
||||||
final var result = jpaAttempt.transacted(() -> {
|
final var result = jpaAttempt.transacted(() -> {
|
||||||
context("superuser-alex@hostsharing.net");
|
context("superuser-alex@hostsharing.net");
|
||||||
|
givenSepaMandate.setReference("temp ref X - updated");
|
||||||
|
givenSepaMandate.setAgreement(LocalDate.parse("2019-05-13"));
|
||||||
givenSepaMandate.setValidity(Range.closedOpen(
|
givenSepaMandate.setValidity(Range.closedOpen(
|
||||||
givenSepaMandate.getValidity().lower(), newValidityEnd));
|
LocalDate.parse("2019-05-17"), LocalDate.parse("2023-01-01")));
|
||||||
return sepaMandateRepo.save(givenSepaMandate);
|
return sepaMandateRepo.save(givenSepaMandate);
|
||||||
});
|
});
|
||||||
|
|
||||||
// then
|
// then
|
||||||
result.assertSuccessful();
|
result.assertSuccessful();
|
||||||
|
jpaAttempt.transacted(() -> {
|
||||||
sepaMandateRepo.deleteByUuid(givenSepaMandate.getUuid());
|
context("superuser-alex@hostsharing.net");
|
||||||
|
assertThat(sepaMandateRepo.findByUuid(givenSepaMandate.getUuid())).isNotEmpty().get()
|
||||||
|
.usingRecursiveComparison().isEqualTo(givenSepaMandate);
|
||||||
|
}).assertSuccessful();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -422,7 +423,7 @@ class HsOfficeSepaMandateRepositoryIntegrationTest extends ContextBasedTest {
|
|||||||
.debitor(givenDebitor)
|
.debitor(givenDebitor)
|
||||||
.bankAccount(givenBankAccount)
|
.bankAccount(givenBankAccount)
|
||||||
.reference("temp ref X")
|
.reference("temp ref X")
|
||||||
.agreement(LocalDate.parse( "2020-01-02"))
|
.agreement(LocalDate.parse("2020-01-02"))
|
||||||
.validity(Range.closedOpen(
|
.validity(Range.closedOpen(
|
||||||
LocalDate.parse("2020-01-01"), LocalDate.parse("2023-01-01")))
|
LocalDate.parse("2020-01-01"), LocalDate.parse("2023-01-01")))
|
||||||
.build();
|
.build();
|
||||||
|
Loading…
Reference in New Issue
Block a user