Search in sources :

Example 1 with GetAuthorisationResponse

use of net.petafuel.styx.core.xs2a.standards.berlingroup.v1_3.http.GetAuthorisationResponse in project styx by petafuel.

the class BasicAuthorisationService method getAuthorisations.

protected List<String> getAuthorisations(GetAuthorisationsRequest xs2ARequest) throws BankRequestFailedException {
    this.setUrl(this.url + xs2ARequest.getServicePath());
    this.createBody(RequestType.GET);
    this.createHeaders(xs2ARequest);
    try (Response response = this.execute();
        Jsonb jsonb = JsonbBuilder.create()) {
        String responseBody = extractResponseBody(response, 200);
        GetAuthorisationResponse getAuthorisationResponse = jsonb.fromJson(responseBody, GetAuthorisationResponse.class);
        return getAuthorisationResponse.getAuthorisationIds();
    } catch (Exception e) {
        throw new BankRequestFailedException(e.getMessage(), e);
    }
}
Also used : GetAuthorisationResponse(net.petafuel.styx.core.xs2a.standards.berlingroup.v1_3.http.GetAuthorisationResponse) GetSCAStatusResponse(net.petafuel.styx.core.xs2a.standards.berlingroup.v1_3.http.GetSCAStatusResponse) Response(okhttp3.Response) Jsonb(javax.json.bind.Jsonb) GetAuthorisationResponse(net.petafuel.styx.core.xs2a.standards.berlingroup.v1_3.http.GetAuthorisationResponse) BankRequestFailedException(net.petafuel.styx.core.xs2a.exceptions.BankRequestFailedException) BankRequestFailedException(net.petafuel.styx.core.xs2a.exceptions.BankRequestFailedException)

Aggregations

Jsonb (javax.json.bind.Jsonb)1 BankRequestFailedException (net.petafuel.styx.core.xs2a.exceptions.BankRequestFailedException)1 GetAuthorisationResponse (net.petafuel.styx.core.xs2a.standards.berlingroup.v1_3.http.GetAuthorisationResponse)1 GetSCAStatusResponse (net.petafuel.styx.core.xs2a.standards.berlingroup.v1_3.http.GetSCAStatusResponse)1 Response (okhttp3.Response)1