use of net.petafuel.styx.api.v1.consent.entity.GetConsentResponse in project styx by petafuel.
the class GetConsentResource method fetchConsent.
/**
* Returns the consent object with the corresponding accounts
*
* @param consentId of the target consent
* @return a GetConsentResponse object
* @throws BankRequestFailedException if something went wrong between the core service and the aspsp
*/
@AcceptsPreStepAuth
@GET
@Path("/consents/{consentId}")
public Response fetchConsent(@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().consentRetrieval(), xs2AFactoryInput);
request.getHeaders().putAll(getAdditionalHeaders());
ioProcessor.modifyRequest(request, xs2AFactoryInput);
Consent consent = getXS2AStandard().getCs().getConsent(request);
GetConsentResponse response = new GetConsentResponse(consent);
LOG.info("Successfully fetched consent entity for bic={}, consentId={}", getXS2AStandard().getAspsp().getBic(), consentId);
return Response.status(ResponseConstant.OK).entity(response).build();
}
use of net.petafuel.styx.api.v1.consent.entity.GetConsentResponse in project styx by petafuel.
the class ConsentResourcesFiduciaTest method B_fetchConsentTest.
@Override
@Test
@Category(IntegrationTest.class)
public void B_fetchConsentTest() throws IOException {
Response response = fetchConsentEndpoint();
Assertions.assertEquals(200, response.getStatus());
GetConsentResponse consentResponse = jsonb.fromJson(IOUtils.toString((InputStream) response.getEntity(), StandardCharsets.UTF_8), GetConsentResponse.class);
Assertions.assertNotNull(consentResponse.getConsent().getId());
Assertions.assertTrue(consentResponse.getConsent().getAccess().getAccounts().contains(getAccountReference()));
}
use of net.petafuel.styx.api.v1.consent.entity.GetConsentResponse in project styx by petafuel.
the class ConsentResourcesTargoTest method B_fetchConsentTest.
@Override
@Test
@Category(IntegrationTest.class)
public void B_fetchConsentTest() throws IOException {
Response response = fetchConsentEndpoint();
Assertions.assertEquals(200, response.getStatus());
GetConsentResponse consentResponse = jsonb.fromJson(IOUtils.toString((InputStream) response.getEntity(), StandardCharsets.UTF_8), GetConsentResponse.class);
Assertions.assertNotNull(consentResponse.getConsent().getId());
Assertions.assertTrue(consentResponse.getConsent().getAccess().getAccounts().contains(getAccountReference()));
}
use of net.petafuel.styx.api.v1.consent.entity.GetConsentResponse in project styx by petafuel.
the class ConsentResourcesConsorsTest method B_fetchConsentTest.
@Override
@Test
@Category(IntegrationTest.class)
public void B_fetchConsentTest() throws IOException {
Response response = fetchConsentEndpoint();
Assertions.assertEquals(200, response.getStatus());
GetConsentResponse consentResponse = jsonb.fromJson(IOUtils.toString((InputStream) response.getEntity(), StandardCharsets.UTF_8), GetConsentResponse.class);
Assertions.assertNotNull(consentResponse.getConsent().getId());
Assertions.assertTrue(consentResponse.getConsent().getAccess().getAccounts().contains(getAccountReference()));
}
use of net.petafuel.styx.api.v1.consent.entity.GetConsentResponse in project styx by petafuel.
the class ConsentResourcesSparkasseTest method B_fetchConsentTest.
@Override
@Test
@Category(IntegrationTest.class)
public void B_fetchConsentTest() throws IOException {
Response response = fetchConsentEndpoint();
Assertions.assertEquals(200, response.getStatus());
GetConsentResponse consentResponse = jsonb.fromJson(IOUtils.toString((InputStream) response.getEntity(), StandardCharsets.UTF_8), GetConsentResponse.class);
Assertions.assertNotNull(consentResponse.getConsent().getId());
Assertions.assertTrue(consentResponse.getConsent().getAccess().getAccounts().contains(getAccountReference()));
}
Aggregations