use of com.forgerock.openbanking.analytics.model.entries.ConsentStatusEntry in project openbanking-aspsp by OpenBankingToolkit.
the class FilePaymentApiController method update.
@Override
public ResponseEntity<FRFileConsent> update(@RequestBody FRFileConsent paymentSetup) {
log.debug("Update file payment {}", paymentSetup);
consentMetricService.sendConsentActivity(new ConsentStatusEntry(paymentSetup.getId(), paymentSetup.getStatus().name()));
return ResponseEntity.ok(consentRepository.save(paymentSetup));
}
use of com.forgerock.openbanking.analytics.model.entries.ConsentStatusEntry in project openbanking-aspsp by OpenBankingToolkit.
the class InternationalPaymentApiController method update.
@Override
public ResponseEntity<FRInternationalConsent> update(@RequestBody FRInternationalConsent paymentSetup) {
LOGGER.debug("Update payment {}", paymentSetup);
consentMetricService.sendConsentActivity(new ConsentStatusEntry(paymentSetup.getId(), paymentSetup.getStatus().name()));
return new ResponseEntity<>(internationalConsentRepository.save(paymentSetup), HttpStatus.OK);
}
use of com.forgerock.openbanking.analytics.model.entries.ConsentStatusEntry in project openbanking-aspsp by OpenBankingToolkit.
the class InternationalStandingOrderApiController method update.
@Override
public ResponseEntity<FRInternationalStandingOrderConsent> update(@RequestBody FRInternationalStandingOrderConsent paymentSetup) {
LOGGER.debug("Update payment {}", paymentSetup);
consentMetricService.sendConsentActivity(new ConsentStatusEntry(paymentSetup.getId(), paymentSetup.getStatus().name()));
return new ResponseEntity<>(consentRepository.save(paymentSetup), HttpStatus.OK);
}
use of com.forgerock.openbanking.analytics.model.entries.ConsentStatusEntry in project openbanking-aspsp by OpenBankingToolkit.
the class DomesticPaymentApiController method update.
@Override
public ResponseEntity<FRDomesticConsent> update(@RequestBody FRDomesticConsent paymentSetup) {
LOGGER.debug("Update payment {}", paymentSetup);
consentMetricService.sendConsentActivity(new ConsentStatusEntry(paymentSetup.getId(), paymentSetup.getStatus().name()));
return new ResponseEntity<>(consentRepository.save(paymentSetup), HttpStatus.OK);
}
use of com.forgerock.openbanking.analytics.model.entries.ConsentStatusEntry in project openbanking-aspsp by OpenBankingToolkit.
the class InternationalPaymentConsentsApiController method createInternationalPaymentConsents.
@Override
public ResponseEntity<OBWriteInternationalConsentResponse5> createInternationalPaymentConsents(OBWriteInternationalConsent5 obWriteInternationalConsent5, String authorization, String xIdempotencyKey, String xJwsSignature, DateTime xFapiAuthDate, String xFapiCustomerIpAddress, String xFapiInteractionId, String xCustomerUserAgent, String clientId, HttpServletRequest request, Principal principal) throws OBErrorResponseException {
log.debug("Received: '{}'", obWriteInternationalConsent5);
FRWriteInternationalConsent frWriteInternationalConsent = toFRWriteInternationalConsent(obWriteInternationalConsent5);
log.trace("Converted to: '{}'", frWriteInternationalConsent);
final Tpp tpp = tppRepository.findByClientId(clientId);
log.debug("Got TPP '{}' for client Id '{}'", tpp, clientId);
Optional<FRInternationalConsent> consentByIdempotencyKey = internationalConsentRepository.findByIdempotencyKeyAndPispId(xIdempotencyKey, tpp.getId());
if (consentByIdempotencyKey.isPresent()) {
validateIdempotencyRequest(xIdempotencyKey, frWriteInternationalConsent, consentByIdempotencyKey.get(), () -> consentByIdempotencyKey.get().getInternationalConsent());
log.info("Idempotent request is valid. Returning [201 CREATED] but take no further action.");
return ResponseEntity.status(HttpStatus.CREATED).body(responseEntity(consentByIdempotencyKey.get()));
}
log.debug("No consent with matching idempotency key has been found. Creating new consent.");
log.debug("Got TPP '{}' for client Id '{}'", tpp, clientId);
FRInternationalConsent internationalConsent = FRInternationalConsent.builder().id(IntentType.PAYMENT_INTERNATIONAL_CONSENT.generateIntentId()).status(ConsentStatusCode.AWAITINGAUTHORISATION).internationalConsent(frWriteInternationalConsent).pispId(tpp.getId()).pispName(tpp.getOfficialName()).statusUpdate(DateTime.now()).obVersion(VersionPathExtractor.getVersionFromPath(request)).build();
log.debug("Saving consent: '{}'", internationalConsent);
consentMetricService.sendConsentActivity(new ConsentStatusEntry(internationalConsent.getId(), internationalConsent.getStatus().name()));
internationalConsent = internationalConsentRepository.save(internationalConsent);
log.info("Created consent id: '{}'", internationalConsent.getId());
return ResponseEntity.status(HttpStatus.CREATED).body(responseEntity(internationalConsent));
}
Aggregations