Search in sources :

Example 41 with ConsentStatusEntry

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));
}
Also used : ConsentStatusEntry(com.forgerock.openbanking.analytics.model.entries.ConsentStatusEntry)

Example 42 with ConsentStatusEntry

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);
}
Also used : ResponseEntity(org.springframework.http.ResponseEntity) ConsentStatusEntry(com.forgerock.openbanking.analytics.model.entries.ConsentStatusEntry)

Example 43 with ConsentStatusEntry

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);
}
Also used : ResponseEntity(org.springframework.http.ResponseEntity) ConsentStatusEntry(com.forgerock.openbanking.analytics.model.entries.ConsentStatusEntry)

Example 44 with ConsentStatusEntry

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);
}
Also used : ResponseEntity(org.springframework.http.ResponseEntity) ConsentStatusEntry(com.forgerock.openbanking.analytics.model.entries.ConsentStatusEntry)

Example 45 with ConsentStatusEntry

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));
}
Also used : FRWriteInternationalConsentConverter.toFRWriteInternationalConsent(com.forgerock.openbanking.common.services.openbanking.converter.payment.FRWriteInternationalConsentConverter.toFRWriteInternationalConsent) FRWriteInternationalConsent(com.forgerock.openbanking.common.model.openbanking.domain.payment.FRWriteInternationalConsent) Tpp(com.forgerock.openbanking.model.Tpp) FRInternationalConsent(com.forgerock.openbanking.common.model.openbanking.persistence.payment.FRInternationalConsent) 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