use of net.petafuel.styx.core.xs2a.exceptions.BankRequestFailedException in project styx by petafuel.
the class BasicAuthorisationService method startAuthorisation.
protected SCA startAuthorisation(StartAuthorisationRequest request) throws BankRequestFailedException {
this.setUrl(this.url + request.getServicePath());
this.createBody(RequestType.POST, JSON, request);
this.createHeaders(request);
try (Response response = this.execute();
Jsonb jsonb = JsonbBuilder.create()) {
String responseBody = extractResponseBody(response, 201);
SCA sca = jsonb.fromJson(responseBody, SCA.class);
SCAUtils.parseSCAApproach(sca, response);
return sca;
} catch (Exception e) {
throw new BankRequestFailedException(e.getMessage(), e);
}
}
use of net.petafuel.styx.core.xs2a.exceptions.BankRequestFailedException in project styx by petafuel.
the class BasicAuthorisationService method getSCAStatus.
protected SCA.Status getSCAStatus(GetSCAStatusRequest 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);
GetSCAStatusResponse getSCAStatusResponse = jsonb.fromJson(responseBody, GetSCAStatusResponse.class);
return getSCAStatusResponse.getScaStatus();
} catch (Exception e) {
throw new BankRequestFailedException(e.getMessage(), e);
}
}
use of net.petafuel.styx.core.xs2a.exceptions.BankRequestFailedException in project styx by petafuel.
the class BasicAuthorisationService method selectAuthenticationMethod.
protected SCA selectAuthenticationMethod(SelectAuthenticationMethodRequest selectAuthenticationMethodRequest) throws BankRequestFailedException {
this.setUrl(this.url + selectAuthenticationMethodRequest.getServicePath());
this.createBody(RequestType.PUT, JSON, selectAuthenticationMethodRequest);
this.createHeaders(selectAuthenticationMethodRequest);
try (Response response = this.execute();
Jsonb jsonb = JsonbBuilder.create()) {
String responseBody = extractResponseBody(response, 200);
SCA sca = jsonb.fromJson(responseBody, SCA.class);
SCAUtils.parseSCAApproach(sca, response);
return sca;
} catch (Exception e) {
throw new BankRequestFailedException(e.getMessage(), e);
}
}
use of net.petafuel.styx.core.xs2a.exceptions.BankRequestFailedException in project styx by petafuel.
the class BasicAuthorisationService method updatePSUIdentification.
protected SCA updatePSUIdentification(UpdatePSUIdentificationRequest updatePSUIdentificationRequest) throws BankRequestFailedException {
this.setUrl(this.url + updatePSUIdentificationRequest.getServicePath());
this.createBody(RequestType.PUT, JSON, updatePSUIdentificationRequest);
this.createHeaders(updatePSUIdentificationRequest);
try (Response response = this.execute();
Jsonb jsonb = JsonbBuilder.create()) {
String responseBody = extractResponseBody(response, 200);
SCA sca = jsonb.fromJson(responseBody, SCA.class);
SCAUtils.parseSCAApproach(sca, response);
return sca;
} catch (Exception e) {
throw new BankRequestFailedException(e.getMessage(), e);
}
}
use of net.petafuel.styx.core.xs2a.exceptions.BankRequestFailedException in project styx by petafuel.
the class BerlinGroupCS method deleteConsent.
@Override
public Consent deleteConsent(AISRequest consentDeleteRequest) throws BankRequestFailedException {
this.setUrl(this.url + consentDeleteRequest.getServicePath());
this.createBody(RequestType.DELETE);
this.createHeaders(consentDeleteRequest);
try (Response response = this.execute()) {
extractResponseBody(response, 204, false);
Consent consent = new Consent();
consent.setId(consentDeleteRequest.getConsentId());
return new PersistentConsent().updateState(consent, ConsentStatus.TERMINATED_BY_TPP);
} catch (IOException e) {
throw new BankRequestFailedException(e.getMessage(), e);
}
}
Aggregations