Search in sources :

Example 6 with ConsentStatusEntry

use of com.forgerock.openbanking.analytics.model.entries.ConsentStatusEntry in project openbanking-aspsp by OpenBankingToolkit.

the class AccountAccessConsentApiController method createAccountAccessConsent.

@Override
public ResponseEntity<OBReadConsentResponse1> createAccountAccessConsent(@ApiParam(value = "Create an Account Request", required = true) @Valid @RequestBody OBReadRequest1 body, @ApiParam(value = "The unique id of the ASPSP to which the request is issued. The unique id will be issued by OB.", required = true) @RequestHeader(value = "x-fapi-financial-id", required = true) String xFapiFinancialId, @ApiParam(value = "An Authorisation Token as per https://tools.ietf.org/html/rfc6750", required = true) @RequestHeader(value = "Authorization", required = true) String authorization, @ApiParam(value = "Header containing a detached JWS signature of the body of the payload.", required = true) @RequestHeader(value = "x-jws-signature", required = false) String xJwsSignature, @ApiParam(value = "The time when the PSU last logged in with the TPP.  All dates in the HTTP headers are represented as RFC 7231 Full Dates. An example is below:  Sun, 10 Sep 2017 19:43:31 UTC") @RequestHeader(value = "x-fapi-customer-last-logged-time", required = false) @DateTimeFormat(pattern = HTTP_DATE_FORMAT) DateTime xFapiCustomerLastLoggedTime, @ApiParam(value = "The PSU's IP address if the PSU is currently logged in with the TPP.") @RequestHeader(value = "x-fapi-customer-ip-address", required = false) String xFapiCustomerIpAddress, @ApiParam(value = "An RFC4122 UID used as a correlation id.") @RequestHeader(value = "x-fapi-interaction-id", required = false) String xFapiInteractionId, @ApiParam(value = "Indicates the user-agent that the PSU is using.") @RequestHeader(value = "x-customer-user-agent", required = false) String xCustomerUserAgent, @ApiParam(value = "The AISP ID") @RequestHeader(value = "x-ob-aisp_id", required = false) String aispId, HttpServletRequest request) throws OBErrorResponseException {
    log.info("Received a new account access consent");
    String consentId = createNewConsentId(body);
    log.info("Create a new Account access consent ID {}", consentId);
    OBReadConsentResponse1 response = new OBReadConsentResponse1().data(new OBReadConsentResponse1Data().consentId(consentId).status(OBExternalRequestStatus1Code.AWAITINGAUTHORISATION).creationDateTime(DateTime.now()).permissions(body.getData().getPermissions()).expirationDateTime(body.getData().getExpirationDateTime()).statusUpdateDateTime(DateTime.now()).transactionFromDateTime(body.getData().getTransactionFromDateTime()).transactionToDateTime(body.getData().getTransactionToDateTime())).risk(body.getRisk());
    FRAccountAccessConsent accountAccessConsent = new FRAccountAccessConsent();
    accountAccessConsent.setId(consentId);
    accountAccessConsent.setConsentId(consentId);
    accountAccessConsent.setAccountAccessConsent(toFRReadConsentResponse(response));
    accountAccessConsent.setAisp(tppRepository.findByClientId(aispId));
    accountAccessConsent.setObVersion(VersionPathExtractor.getVersionFromPath(request));
    consentMetricService.sendConsentActivity(new ConsentStatusEntry(accountAccessConsent.getId(), accountAccessConsent.getStatus().name()));
    accountAccessConsent = frAccountAccessConsentRepository.save(accountAccessConsent);
    log.debug("Account access consent created {}", accountAccessConsent.getAccountAccessConsent());
    return ResponseEntity.status(HttpStatus.CREATED).body(response);
}
Also used : FRAccountAccessConsent(com.forgerock.openbanking.common.model.openbanking.persistence.account.FRAccountAccessConsent) FRReadConsentResponseConverter.toOBReadConsentResponse1(com.forgerock.openbanking.common.services.openbanking.converter.account.FRReadConsentResponseConverter.toOBReadConsentResponse1) ConsentStatusEntry(com.forgerock.openbanking.analytics.model.entries.ConsentStatusEntry)

Example 7 with ConsentStatusEntry

use of com.forgerock.openbanking.analytics.model.entries.ConsentStatusEntry in project openbanking-aspsp by OpenBankingToolkit.

the class AccountRequestsApiController method createAccountRequest.

@Override
public ResponseEntity<OBReadResponse1> createAccountRequest(@ApiParam(value = "Create an Account Request", required = true) @Valid @RequestBody OBReadRequest1 body, @ApiParam(value = "The unique id of the ASPSP to which the request is issued. The unique id will be issued by OB.", required = true) @RequestHeader(value = "x-fapi-financial-id", required = true) String xFapiFinancialId, @ApiParam(value = "An Authorisation Token as per https://tools.ietf.org/html/rfc6750", required = true) @RequestHeader(value = "Authorization", required = true) String authorization, @ApiParam(value = "Header containing a detached JWS signature of the body of the payload.", required = true) @RequestHeader(value = "x-jws-signature", required = false) String xJwsSignature, @ApiParam(value = "The time when the PSU last logged in with the TPP.  All dates in the HTTP headers are represented as RFC 7231 Full Dates. An example is below:  Sun, 10 Sep 2017 19:43:31 UTC") @RequestHeader(value = "x-fapi-customer-last-logged-time", required = false) @DateTimeFormat(pattern = HTTP_DATE_FORMAT) DateTime xFapiCustomerLastLoggedTime, @ApiParam(value = "The PSU's IP address if the PSU is currently logged in with the TPP.") @RequestHeader(value = "x-fapi-customer-ip-address", required = false) String xFapiCustomerIpAddress, @ApiParam(value = "An RFC4122 UID used as a correlation id.") @RequestHeader(value = "x-fapi-interaction-id", required = false) String xFapiInteractionId, @ApiParam(value = "Indicates the user-agent that the PSU is using.") @RequestHeader(value = "x-customer-user-agent", required = false) String xCustomerUserAgent, @ApiParam(value = "The AISP ID") @RequestHeader(value = "x-ob-aisp_id", required = false) String aispId, HttpServletRequest request) throws OBErrorResponseException {
    LOGGER.info("Received a new account request");
    String accountRequestId = IntentType.ACCOUNT_REQUEST.generateIntentId();
    LOGGER.info("Create a new account request ID {}", accountRequestId);
    OBReadResponse1 response = new OBReadResponse1().data(new OBReadDataResponse1().accountRequestId(accountRequestId).status(OBExternalRequestStatus1Code.AWAITINGAUTHORISATION).creationDateTime(DateTime.now()).permissions(body.getData().getPermissions()).expirationDateTime(body.getData().getExpirationDateTime()).transactionFromDateTime(body.getData().getTransactionFromDateTime()).transactionToDateTime(body.getData().getTransactionToDateTime())).risk(body.getRisk());
    FRAccountRequest accountRequest = new FRAccountRequest();
    accountRequest.setId(accountRequestId);
    accountRequest.setAccountRequestId(accountRequestId);
    accountRequest.setAccountRequest(toFRReadResponse(response));
    accountRequest.setAisp(tppRepository.findByClientId(aispId));
    accountRequest.setObVersion(VersionPathExtractor.getVersionFromPath(request));
    accountRequest = frAccountRequestRepository.save(accountRequest);
    consentMetricService.sendConsentActivity(new ConsentStatusEntry(accountRequest.getId(), accountRequest.getStatus().name()));
    LOGGER.debug("Account request created {}", accountRequest.getAccountRequest());
    return ResponseEntity.status(HttpStatus.CREATED).body(response);
}
Also used : FRReadResponseConverter.toOBReadResponse1(com.forgerock.openbanking.common.services.openbanking.converter.account.FRReadResponseConverter.toOBReadResponse1) OBReadResponse1(uk.org.openbanking.datamodel.account.OBReadResponse1) FRAccountRequest(com.forgerock.openbanking.common.model.openbanking.persistence.account.FRAccountRequest) OBReadDataResponse1(uk.org.openbanking.datamodel.account.OBReadDataResponse1) ConsentStatusEntry(com.forgerock.openbanking.analytics.model.entries.ConsentStatusEntry)

Example 8 with ConsentStatusEntry

use of com.forgerock.openbanking.analytics.model.entries.ConsentStatusEntry in project openbanking-aspsp by OpenBankingToolkit.

the class InternationalScheduledPaymentApiController method update.

@Override
public ResponseEntity<FRInternationalScheduledConsent> update(@RequestBody FRInternationalScheduledConsent paymentSetup) {
    LOGGER.debug("Update payment {}", paymentSetup);
    consentMetricService.sendConsentActivity(new ConsentStatusEntry(paymentSetup.getId(), paymentSetup.getStatus().name()));
    return new ResponseEntity<>(consentRepository.save(paymentSetup), HttpStatus.OK);
}
Also used : ResponseEntity(org.springframework.http.ResponseEntity) ConsentStatusEntry(com.forgerock.openbanking.analytics.model.entries.ConsentStatusEntry)

Example 9 with ConsentStatusEntry

use of com.forgerock.openbanking.analytics.model.entries.ConsentStatusEntry in project openbanking-aspsp by OpenBankingToolkit.

the class DomesticScheduledPaymentApiController method update.

@Override
public ResponseEntity<FRDomesticScheduledConsent> update(@RequestBody FRDomesticScheduledConsent paymentSetup) {
    LOGGER.debug("Update payment {}", paymentSetup);
    consentMetricService.sendConsentActivity(new ConsentStatusEntry(paymentSetup.getId(), paymentSetup.getStatus().name()));
    return new ResponseEntity<>(consentRepository.save(paymentSetup), HttpStatus.OK);
}
Also used : ResponseEntity(org.springframework.http.ResponseEntity) ConsentStatusEntry(com.forgerock.openbanking.analytics.model.entries.ConsentStatusEntry)

Example 10 with ConsentStatusEntry

use of com.forgerock.openbanking.analytics.model.entries.ConsentStatusEntry in project openbanking-aspsp by OpenBankingToolkit.

the class DomesticStandingOrderApiController method update.

@Override
public ResponseEntity<FRDomesticStandingOrderConsent> update(@RequestBody FRDomesticStandingOrderConsent paymentSetup) {
    LOGGER.debug("Update payment {}", paymentSetup);
    consentMetricService.sendConsentActivity(new ConsentStatusEntry(paymentSetup.getId(), paymentSetup.getStatus().name()));
    return new ResponseEntity<>(consentRepository.save(paymentSetup), HttpStatus.OK);
}
Also used : ResponseEntity(org.springframework.http.ResponseEntity) ConsentStatusEntry(com.forgerock.openbanking.analytics.model.entries.ConsentStatusEntry)

Aggregations

ConsentStatusEntry (com.forgerock.openbanking.analytics.model.entries.ConsentStatusEntry)54 Tpp (com.forgerock.openbanking.model.Tpp)39 ResponseEntity (org.springframework.http.ResponseEntity)10 FRWriteDomesticStandingOrderConsent (com.forgerock.openbanking.common.model.openbanking.domain.payment.FRWriteDomesticStandingOrderConsent)6 FRWriteInternationalStandingOrderConsent (com.forgerock.openbanking.common.model.openbanking.domain.payment.FRWriteInternationalStandingOrderConsent)6 FRDomesticStandingOrderConsent (com.forgerock.openbanking.common.model.openbanking.persistence.payment.FRDomesticStandingOrderConsent)6 FRInternationalStandingOrderConsent (com.forgerock.openbanking.common.model.openbanking.persistence.payment.FRInternationalStandingOrderConsent)6 FRWriteDomesticStandingOrderConsentConverter.toFRWriteDomesticStandingOrderConsent (com.forgerock.openbanking.common.services.openbanking.converter.payment.FRWriteDomesticStandingOrderConsentConverter.toFRWriteDomesticStandingOrderConsent)6 FRWriteInternationalStandingOrderConsentConverter.toFRWriteInternationalStandingOrderConsent (com.forgerock.openbanking.common.services.openbanking.converter.payment.FRWriteInternationalStandingOrderConsentConverter.toFRWriteInternationalStandingOrderConsent)6 FRWriteDomesticConsent (com.forgerock.openbanking.common.model.openbanking.domain.payment.FRWriteDomesticConsent)5 FRWriteDomesticScheduledConsent (com.forgerock.openbanking.common.model.openbanking.domain.payment.FRWriteDomesticScheduledConsent)5 FRWriteInternationalConsent (com.forgerock.openbanking.common.model.openbanking.domain.payment.FRWriteInternationalConsent)5 FRWriteInternationalScheduledConsent (com.forgerock.openbanking.common.model.openbanking.domain.payment.FRWriteInternationalScheduledConsent)5 FRDomesticConsent (com.forgerock.openbanking.common.model.openbanking.persistence.payment.FRDomesticConsent)5 FRDomesticScheduledConsent (com.forgerock.openbanking.common.model.openbanking.persistence.payment.FRDomesticScheduledConsent)5 FRInternationalConsent (com.forgerock.openbanking.common.model.openbanking.persistence.payment.FRInternationalConsent)5 FRInternationalScheduledConsent (com.forgerock.openbanking.common.model.openbanking.persistence.payment.FRInternationalScheduledConsent)5 FRWriteDomesticConsentConverter.toFRWriteDomesticConsent (com.forgerock.openbanking.common.services.openbanking.converter.payment.FRWriteDomesticConsentConverter.toFRWriteDomesticConsent)5 FRWriteDomesticScheduledConsentConverter.toFRWriteDomesticScheduledConsent (com.forgerock.openbanking.common.services.openbanking.converter.payment.FRWriteDomesticScheduledConsentConverter.toFRWriteDomesticScheduledConsent)5 FRWriteInternationalConsentConverter.toFRWriteInternationalConsent (com.forgerock.openbanking.common.services.openbanking.converter.payment.FRWriteInternationalConsentConverter.toFRWriteInternationalConsent)5