explicitly fetch SEPA-Mandate in CreateSepaMandateForDebitor

This commit is contained in:
Michael Hoennig 2024-10-30 15:45:42 +01:00
parent f2733b804a
commit 82f1ec057f
2 changed files with 9 additions and 3 deletions

View File

@ -194,7 +194,6 @@ class HsOfficeScenarioTests extends ScenarioTest {
@Requires("SEPA-Mandate: Test AG")
void shouldInvalidateSepaMandateForDebitor() {
new InvalidateSepaMandateForDebitor(this)
.given("debitorNumberNumber", "31010")
.given("bankAccountIBAN", "DE02701500000000594937")
.given("mandateValidUntil", "2025-09-30")
.doRun();

View File

@ -15,9 +15,16 @@ public class InvalidateSepaMandateForDebitor extends UseCase<InvalidateSepaManda
@Override
protected HttpResponse run() {
return httpPatch("/api/hs/office/sepamandates/" + uuid("SEPA-Mandate: Test AG"), usingJsonBody("""
obtain("SEPA-Mandate: %{bankAccountIBAN}", () ->
httpGet("/api/hs/office/sepamandates?iban=&{bankAccountIBAN}")
.expecting(OK).expecting(JSON),
response -> response.expectArrayElements(1).getFromBody("[0].uuid"),
"With production data, the bank-account could be used in multiple SEPA-mandates, make sure to use the right one!"
);
return httpPatch("/api/hs/office/sepamandates/&{SEPA-Mandate: %{bankAccountIBAN}}", usingJsonBody("""
{
"validUntil": ${validUntil}
"validUntil": ${mandateValidUntil}
}
"""))
.expecting(OK).expecting(JSON);