Compare commits

..

No commits in common. "139863ea839feeed43b6130c3999938055e4e289" and "2eb1359fddd635f72e1fb47ee7146d75ed40ff55" have entirely different histories.

11 changed files with 13 additions and 52 deletions

6
Jenkinsfile vendored
View File

@ -45,11 +45,7 @@ pipeline {
sourcePattern: 'src/main/java' sourcePattern: 'src/main/java'
) )
// archive scenario-test reports in HTML format // archive scenario-test reports
sh '''
cd doc/scenarios
./to-html
'''
archiveArtifacts artifacts: 'doc/scenarios/*.html', allowEmptyArchive: true archiveArtifacts artifacts: 'doc/scenarios/*.html', allowEmptyArchive: true
// cleanup workspace // cleanup workspace

View File

@ -7,7 +7,7 @@ get:
parameters: parameters:
- $ref: 'auth.yaml#/components/parameters/currentSubject' - $ref: 'auth.yaml#/components/parameters/currentSubject'
- $ref: 'auth.yaml#/components/parameters/assumedRoles' - $ref: 'auth.yaml#/components/parameters/assumedRoles'
- name: iban - name: name
in: query in: query
required: false required: false
schema: schema:

View File

@ -194,6 +194,7 @@ 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("debitorNumberNumber", "31010")
.given("bankAccountIBAN", "DE02701500000000594937") .given("bankAccountIBAN", "DE02701500000000594937")
.given("mandateValidUntil", "2025-09-30") .given("mandateValidUntil", "2025-09-30")
.doRun(); .doRun();

View File

@ -24,7 +24,7 @@ public class DeleteDebitor extends UseCase<DeleteDebitor> {
@Override @Override
protected HttpResponse run() { protected HttpResponse run() {
httpDelete("/api/hs/office/debitors/&{Debitor: Test AG - delete debitor}") httpDelete("/api/hs/office/debitors/" + uuid("Debitor: Test AG - delete debitor"))
.expecting(HttpStatus.NO_CONTENT); .expecting(HttpStatus.NO_CONTENT);
return null; return null;
} }

View File

@ -13,7 +13,7 @@ public class DeleteSepaMandateForDebitor extends UseCase<DeleteSepaMandateForDeb
@Override @Override
protected HttpResponse run() { protected HttpResponse run() {
httpDelete("/api/hs/office/sepamandates/&{SEPA-Mandate: Test AG}") httpDelete("/api/hs/office/sepamandates/" + uuid("SEPA-Mandate: Test AG"))
.expecting(HttpStatus.NO_CONTENT); .expecting(HttpStatus.NO_CONTENT);
return null; return null;
} }

View File

@ -12,7 +12,7 @@ public class DontDeleteDefaultDebitor extends UseCase<DontDeleteDefaultDebitor>
@Override @Override
protected HttpResponse run() { protected HttpResponse run() {
httpDelete("/api/hs/office/debitors/&{Debitor: Test AG - main debitor}") httpDelete("/api/hs/office/debitors/" + uuid("Debitor: Test AG - main debitor"))
// TODO.spec: should be CONFLICT or CLIENT_ERROR for Debitor "00" - but how to delete Partners? // TODO.spec: should be CONFLICT or CLIENT_ERROR for Debitor "00" - but how to delete Partners?
.expecting(HttpStatus.NO_CONTENT); .expecting(HttpStatus.NO_CONTENT);
return null; return null;

View File

@ -15,16 +15,9 @@ public class InvalidateSepaMandateForDebitor extends UseCase<InvalidateSepaManda
@Override @Override
protected HttpResponse run() { protected HttpResponse run() {
obtain("SEPA-Mandate: %{bankAccountIBAN}", () -> return httpPatch("/api/hs/office/sepamandates/" + uuid("SEPA-Mandate: Test AG"), usingJsonBody("""
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": ${mandateValidUntil} "validUntil": ${validUntil}
} }
""")) """))
.expecting(OK).expecting(JSON); .expecting(OK).expecting(JSON);

View File

@ -18,7 +18,7 @@ public class DeletePartner extends UseCase<DeletePartner> {
@Override @Override
protected HttpResponse run() { protected HttpResponse run() {
httpDelete("/api/hs/office/partners/&{Partner: Delete AG}") httpDelete("/api/hs/office/partners/" + uuid("Partner: Delete AG"))
.expecting(HttpStatus.NO_CONTENT); .expecting(HttpStatus.NO_CONTENT);
return null; return null;
} }

View File

@ -23,7 +23,7 @@ public class RemoveOperationsContactFromPartner extends UseCase<RemoveOperations
"In production data this query could result in multiple outputs. In that case, you have to find out which is the right one." "In production data this query could result in multiple outputs. In that case, you have to find out which is the right one."
); );
return httpDelete("/api/hs/office/relations/&{Operations-Contact: %{operationsContactPerson}}") return httpDelete("/api/hs/office/relations/" + uuid("Operations-Contact: %{operationsContactPerson}"))
.expecting(NO_CONTENT); .expecting(NO_CONTENT);
} }
} }

View File

@ -25,7 +25,7 @@ public class UnsubscribeFromMailinglist extends UseCase<UnsubscribeFromMailingli
"In production data this query could result in multiple outputs. In that case, you have to find out which is the right one." "In production data this query could result in multiple outputs. In that case, you have to find out which is the right one."
); );
return httpDelete("/api/hs/office/relations/&{Subscription: %{subscriberEMailAddress}}") return httpDelete("/api/hs/office/relations/" + uuid("Subscription: %{subscriberEMailAddress}"))
.expecting(NO_CONTENT); .expecting(NO_CONTENT);
} }
} }

View File

@ -8,6 +8,7 @@ import net.hostsharing.hsadminng.hs.office.bankaccount.HsOfficeBankAccountReposi
import net.hostsharing.hsadminng.hs.office.debitor.HsOfficeDebitorRepository; import net.hostsharing.hsadminng.hs.office.debitor.HsOfficeDebitorRepository;
import net.hostsharing.hsadminng.rbac.test.ContextBasedTestWithCleanup; import net.hostsharing.hsadminng.rbac.test.ContextBasedTestWithCleanup;
import net.hostsharing.hsadminng.rbac.test.JpaAttempt; import net.hostsharing.hsadminng.rbac.test.JpaAttempt;
import org.json.JSONException;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Nested;
@ -57,7 +58,7 @@ class HsOfficeSepaMandateControllerAcceptanceTest extends ContextBasedTestWithCl
class ListSepaMandates { class ListSepaMandates {
@Test @Test
void globalAdmin_canViewAllSepaMandates_ifNoCriteriaGiven() { void globalAdmin_canViewAllSepaMandates_ifNoCriteriaGiven() throws JSONException {
RestAssured // @formatter:off RestAssured // @formatter:off
.given() .given()
@ -96,36 +97,6 @@ class HsOfficeSepaMandateControllerAcceptanceTest extends ContextBasedTestWithCl
""")); """));
// @formatter:on // @formatter:on
} }
@Test
void globalAdmin_canFindSepaMandateByName() {
RestAssured // @formatter:off
.given()
.header("current-subject", "superuser-alex@hostsharing.net")
.port(port)
.when()
.get("http://localhost/api/hs/office/sepamandates?iban=DE02120300000000202051")
.then().log().all().assertThat()
.statusCode(200)
.contentType("application/json")
.log().all()
.body("", lenientlyEquals("""
[
{
"debitor": { "debitorNumber": 1000111 },
"bankAccount": {
"iban": "DE02120300000000202051",
"holder": "First GmbH"
},
"reference": "ref-10001-11",
"validFrom": "2022-10-01",
"validTo": "2026-12-31"
}
]
"""));
// @formatter:on
}
} }
@Nested @Nested