explicitly fetch Debutor in CreateSepaMandateForDebitor
This commit is contained in:
parent
1cb0ea1018
commit
e3027579e7
@ -173,10 +173,18 @@ class HsOfficeScenarioTests extends ScenarioTest {
|
|||||||
@Produces("SEPA-Mandate: Test AG")
|
@Produces("SEPA-Mandate: Test AG")
|
||||||
void shouldCreateSepaMandateForDebitor() {
|
void shouldCreateSepaMandateForDebitor() {
|
||||||
new CreateSepaMandateForDebitor(this)
|
new CreateSepaMandateForDebitor(this)
|
||||||
.given("debitor", "Test AG")
|
// existing debitor
|
||||||
.given("memberNumberSuffix", "00")
|
.given("debitorNumber", "3101000")
|
||||||
.given("validFrom", "2024-10-15")
|
|
||||||
.given("membershipFeeBillable", "true")
|
// new sepa-mandate
|
||||||
|
.given("mandateReference", "Test AG - main debitor")
|
||||||
|
.given("mandateAgreement", "2022-10-12")
|
||||||
|
.given("mandateValidFrom", "2024-10-15")
|
||||||
|
|
||||||
|
// new bank-account
|
||||||
|
.given("bankAccountHolder", "Test AG - debit bank account")
|
||||||
|
.given("bankAccountIBAN", "DE02701500000000594937")
|
||||||
|
.given("bankAccountBIC", "SSKMDEMM")
|
||||||
.doRun()
|
.doRun()
|
||||||
.keep();
|
.keep();
|
||||||
}
|
}
|
||||||
@ -186,8 +194,9 @@ class HsOfficeScenarioTests extends ScenarioTest {
|
|||||||
@Requires("SEPA-Mandate: Test AG")
|
@Requires("SEPA-Mandate: Test AG")
|
||||||
void shouldInvalidateSepaMandateForDebitor() {
|
void shouldInvalidateSepaMandateForDebitor() {
|
||||||
new InvalidateSepaMandateForDebitor(this)
|
new InvalidateSepaMandateForDebitor(this)
|
||||||
.given("sepaMandateUuid", "%{SEPA-Mandate: Test AG}")
|
.given("debitorNumberNumber", "31010")
|
||||||
.given("validUntil", "2025-09-30")
|
.given("bankAccountIBAN", "DE02701500000000594937")
|
||||||
|
.given("mandateValidUntil", "2025-09-30")
|
||||||
.doRun();
|
.doRun();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest;
|
|||||||
|
|
||||||
import static io.restassured.http.ContentType.JSON;
|
import static io.restassured.http.ContentType.JSON;
|
||||||
import static org.springframework.http.HttpStatus.CREATED;
|
import static org.springframework.http.HttpStatus.CREATED;
|
||||||
|
import static org.springframework.http.HttpStatus.OK;
|
||||||
|
|
||||||
public class CreateSepaMandateForDebitor extends UseCase<CreateSepaMandateForDebitor> {
|
public class CreateSepaMandateForDebitor extends UseCase<CreateSepaMandateForDebitor> {
|
||||||
|
|
||||||
@ -14,12 +15,19 @@ public class CreateSepaMandateForDebitor extends UseCase<CreateSepaMandateForDeb
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected HttpResponse run() {
|
protected HttpResponse run() {
|
||||||
|
|
||||||
|
obtain("Debitor: Test AG - main debitor", () ->
|
||||||
|
httpGet("/api/hs/office/debitors?debitorNumber=&{debitorNumber}")
|
||||||
|
.expecting(OK).expecting(JSON),
|
||||||
|
response -> response.expectArrayElements(1).getFromBody("[0].uuid")
|
||||||
|
);
|
||||||
|
|
||||||
obtain("BankAccount: Test AG - debit bank account", () ->
|
obtain("BankAccount: Test AG - debit bank account", () ->
|
||||||
httpPost("/api/hs/office/bankaccounts", usingJsonBody("""
|
httpPost("/api/hs/office/bankaccounts", usingJsonBody("""
|
||||||
{
|
{
|
||||||
"holder": "Test AG - debit bank account",
|
"holder": ${bankAccountHolder},
|
||||||
"iban": "DE02701500000000594937",
|
"iban": ${bankAccountIBAN},
|
||||||
"bic": "SSKMDEMM"
|
"bic": ${bankAccountBIC}
|
||||||
}
|
}
|
||||||
"""))
|
"""))
|
||||||
.expecting(CREATED).expecting(JSON)
|
.expecting(CREATED).expecting(JSON)
|
||||||
@ -29,9 +37,9 @@ public class CreateSepaMandateForDebitor extends UseCase<CreateSepaMandateForDeb
|
|||||||
{
|
{
|
||||||
"debitorUuid": ${Debitor: Test AG - main debitor},
|
"debitorUuid": ${Debitor: Test AG - main debitor},
|
||||||
"bankAccountUuid": ${BankAccount: Test AG - debit bank account},
|
"bankAccountUuid": ${BankAccount: Test AG - debit bank account},
|
||||||
"reference": "Test AG - main debitor",
|
"reference": ${mandateReference},
|
||||||
"agreement": "2022-10-12",
|
"agreement": ${mandateAgreement},
|
||||||
"validFrom": "2022-10-13"
|
"validFrom": ${mandateValidFrom}
|
||||||
}
|
}
|
||||||
"""))
|
"""))
|
||||||
.expecting(CREATED).expecting(JSON);
|
.expecting(CREATED).expecting(JSON);
|
||||||
|
Loading…
Reference in New Issue
Block a user