Search in sources :

Example 1 with GetConsentStatusResponse

use of net.petafuel.styx.api.v1.consent.entity.GetConsentStatusResponse in project styx by petafuel.

the class GetConsentResource method getConsentStatus.

/**
 * Returns the consent status
 *
 * @param consentId of the target consent
 * @return a GetConsentStatusResponse object
 * @throws BankRequestFailedException if something went wrong between the core service and the aspsp
 */
@AcceptsPreStepAuth
@GET
@Path("/consents/{consentId}/status")
public Response getConsentStatus(@NotEmpty @NotBlank @PathParam("consentId") String consentId) throws BankRequestFailedException {
    XS2AFactoryInput xs2AFactoryInput = new XS2AFactoryInput();
    xs2AFactoryInput.setConsentId(consentId);
    IOProcessor ioProcessor = new IOProcessor(getXS2AStandard());
    ioProcessor.modifyInput(xs2AFactoryInput);
    AISRequest request = new AISRequestFactory().create(getXS2AStandard().getRequestClassProvider().consentStatus(), xs2AFactoryInput);
    request.getHeaders().putAll(getAdditionalHeaders());
    ioProcessor.modifyRequest(request, xs2AFactoryInput);
    ConsentStatus state = getXS2AStandard().getCs().getStatus(request);
    GetConsentStatusResponse response = new GetConsentStatusResponse(state);
    LOG.info("Successfully fetched consent status entity for bic={}, consentId={}", getXS2AStandard().getAspsp().getBic(), consentId);
    return Response.status(ResponseConstant.OK).entity(response).build();
}
Also used : AISRequest(net.petafuel.styx.core.xs2a.contracts.AISRequest) ConsentStatus(net.petafuel.styx.core.xs2a.entities.ConsentStatus) GetConsentStatusResponse(net.petafuel.styx.api.v1.consent.entity.GetConsentStatusResponse) XS2AFactoryInput(net.petafuel.styx.core.xs2a.factory.XS2AFactoryInput) AISRequestFactory(net.petafuel.styx.core.xs2a.factory.AISRequestFactory) IOProcessor(net.petafuel.styx.core.ioprocessing.IOProcessor) AcceptsPreStepAuth(net.petafuel.styx.api.filter.authentication.boundary.AcceptsPreStepAuth) Path(javax.ws.rs.Path) ApplicationPath(javax.ws.rs.ApplicationPath) GET(javax.ws.rs.GET)

Example 2 with GetConsentStatusResponse

use of net.petafuel.styx.api.v1.consent.entity.GetConsentStatusResponse in project styx by petafuel.

the class ConsentResourcesFiduciaTest method C_getConsentStatusTest.

@Override
@Test
@Category(IntegrationTest.class)
public void C_getConsentStatusTest() throws IOException {
    Response response = getConsentStatusEndpoint();
    Assertions.assertEquals(200, response.getStatus());
    GetConsentStatusResponse consentStatusResponse = jsonb.fromJson(IOUtils.toString((InputStream) response.getEntity(), StandardCharsets.UTF_8), GetConsentStatusResponse.class);
    Assertions.assertEquals(ConsentStatus.RECEIVED, consentStatusResponse.getState());
}
Also used : Response(javax.ws.rs.core.Response) GetConsentResponse(net.petafuel.styx.api.v1.consent.entity.GetConsentResponse) POSTConsentResponse(net.petafuel.styx.api.v1.consent.entity.POSTConsentResponse) GetConsentStatusResponse(net.petafuel.styx.api.v1.consent.entity.GetConsentStatusResponse) AuthorisationStatusResponse(net.petafuel.styx.api.v1.payment.entity.AuthorisationStatusResponse) GetConsentStatusResponse(net.petafuel.styx.api.v1.consent.entity.GetConsentStatusResponse) InputStream(java.io.InputStream) Category(org.junit.experimental.categories.Category) IntegrationTest(net.petafuel.styx.api.IntegrationTest) Test(org.junit.Test)

Example 3 with GetConsentStatusResponse

use of net.petafuel.styx.api.v1.consent.entity.GetConsentStatusResponse in project styx by petafuel.

the class ConsentResourcesTargoTest method C_getConsentStatusTest.

@Override
@Test
@Category(IntegrationTest.class)
public void C_getConsentStatusTest() throws IOException {
    Response response = getConsentStatusEndpoint();
    Assertions.assertEquals(200, response.getStatus());
    GetConsentStatusResponse consentStatusResponse = jsonb.fromJson(IOUtils.toString((InputStream) response.getEntity(), StandardCharsets.UTF_8), GetConsentStatusResponse.class);
    Assertions.assertEquals(ConsentStatus.RECEIVED, consentStatusResponse.getState());
}
Also used : Response(javax.ws.rs.core.Response) GetConsentResponse(net.petafuel.styx.api.v1.consent.entity.GetConsentResponse) POSTConsentResponse(net.petafuel.styx.api.v1.consent.entity.POSTConsentResponse) GetConsentStatusResponse(net.petafuel.styx.api.v1.consent.entity.GetConsentStatusResponse) AuthorisationStatusResponse(net.petafuel.styx.api.v1.payment.entity.AuthorisationStatusResponse) GetConsentStatusResponse(net.petafuel.styx.api.v1.consent.entity.GetConsentStatusResponse) InputStream(java.io.InputStream) Category(org.junit.experimental.categories.Category) IntegrationTest(net.petafuel.styx.api.IntegrationTest) Test(org.junit.Test)

Example 4 with GetConsentStatusResponse

use of net.petafuel.styx.api.v1.consent.entity.GetConsentStatusResponse in project styx by petafuel.

the class ConsentResourcesConsorsTest method C_getConsentStatusTest.

@Override
@Test
@Category(IntegrationTest.class)
public void C_getConsentStatusTest() throws IOException {
    Response response = getConsentStatusEndpoint();
    Assertions.assertEquals(200, response.getStatus());
    GetConsentStatusResponse consentStatusResponse = jsonb.fromJson(IOUtils.toString((InputStream) response.getEntity(), StandardCharsets.UTF_8), GetConsentStatusResponse.class);
    Assertions.assertEquals(ConsentStatus.VALID, consentStatusResponse.getState());
}
Also used : Response(javax.ws.rs.core.Response) GetConsentResponse(net.petafuel.styx.api.v1.consent.entity.GetConsentResponse) POSTConsentResponse(net.petafuel.styx.api.v1.consent.entity.POSTConsentResponse) GetConsentStatusResponse(net.petafuel.styx.api.v1.consent.entity.GetConsentStatusResponse) GetConsentStatusResponse(net.petafuel.styx.api.v1.consent.entity.GetConsentStatusResponse) InputStream(java.io.InputStream) Category(org.junit.experimental.categories.Category) IntegrationTest(net.petafuel.styx.api.IntegrationTest) Test(org.junit.Test)

Example 5 with GetConsentStatusResponse

use of net.petafuel.styx.api.v1.consent.entity.GetConsentStatusResponse in project styx by petafuel.

the class ConsentResourcesSparkasseTest method C_getConsentStatusTest.

@Override
@Test
@Category(IntegrationTest.class)
public void C_getConsentStatusTest() throws IOException {
    Response response = getConsentStatusEndpoint();
    Assertions.assertEquals(200, response.getStatus());
    GetConsentStatusResponse consentStatusResponse = jsonb.fromJson(IOUtils.toString((InputStream) response.getEntity(), StandardCharsets.UTF_8), GetConsentStatusResponse.class);
    Assertions.assertEquals(ConsentStatus.RECEIVED, consentStatusResponse.getState());
}
Also used : Response(javax.ws.rs.core.Response) GetConsentResponse(net.petafuel.styx.api.v1.consent.entity.GetConsentResponse) POSTConsentResponse(net.petafuel.styx.api.v1.consent.entity.POSTConsentResponse) GetConsentStatusResponse(net.petafuel.styx.api.v1.consent.entity.GetConsentStatusResponse) GetConsentStatusResponse(net.petafuel.styx.api.v1.consent.entity.GetConsentStatusResponse) InputStream(java.io.InputStream) Category(org.junit.experimental.categories.Category) IntegrationTest(net.petafuel.styx.api.IntegrationTest) Test(org.junit.Test)

Aggregations

GetConsentStatusResponse (net.petafuel.styx.api.v1.consent.entity.GetConsentStatusResponse)5 InputStream (java.io.InputStream)4 Response (javax.ws.rs.core.Response)4 IntegrationTest (net.petafuel.styx.api.IntegrationTest)4 GetConsentResponse (net.petafuel.styx.api.v1.consent.entity.GetConsentResponse)4 POSTConsentResponse (net.petafuel.styx.api.v1.consent.entity.POSTConsentResponse)4 Test (org.junit.Test)4 Category (org.junit.experimental.categories.Category)4 AuthorisationStatusResponse (net.petafuel.styx.api.v1.payment.entity.AuthorisationStatusResponse)2 ApplicationPath (javax.ws.rs.ApplicationPath)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 AcceptsPreStepAuth (net.petafuel.styx.api.filter.authentication.boundary.AcceptsPreStepAuth)1 IOProcessor (net.petafuel.styx.core.ioprocessing.IOProcessor)1 AISRequest (net.petafuel.styx.core.xs2a.contracts.AISRequest)1 ConsentStatus (net.petafuel.styx.core.xs2a.entities.ConsentStatus)1 AISRequestFactory (net.petafuel.styx.core.xs2a.factory.AISRequestFactory)1 XS2AFactoryInput (net.petafuel.styx.core.xs2a.factory.XS2AFactoryInput)1