@Override @PreAuthorize("accountInfoById(#accountId)") public ResponseEntity<TransactionTO> getTransactionById(String accountId, String transactionId) { try { return ResponseEntity.ok(middlewareAccountService.getTransactionById(accountId, transactionId)); } catch (AccountNotFoundMiddlewareException | TransactionNotFoundMiddlewareException e) { logger.error(e.getMessage(), e); throw new NotFoundRestException(e.getMessage()).withDevMessage(e.getMessage()); } catch (InsufficientPermissionMiddlewareException e) { throw forbiddenRestException(e); } }
@Override @PreAuthorize("paymentInfoById(#paymentId)") public ResponseEntity<?> getPaymentById(String paymentId) { try { return ResponseEntity.ok(paymentService.getPaymentById(paymentId)); } catch (PaymentNotFoundMiddlewareException e) { logger.error(e.getMessage(), e); throw new NotFoundRestException(e.getMessage()).withDevMessage(e.getMessage()); } }
private RestException notFoundRestException(AccountNotFoundMiddlewareException e) { logger.error(e.getMessage(), e); return new NotFoundRestException(e.getMessage()).withDevMessage(e.getMessage()); }
@Override @PreAuthorize("tokenUsage('DIRECT_ACCESS') and accountInfoFor(#pisConsent)") public ResponseEntity<SCAConsentResponseTO> grantPIISConsent(AisConsentTO pisConsent) { try { return ResponseEntity.ok(middlewareAccountService.grantAisConsent(pisConsent)); } catch (InsufficientPermissionMiddlewareException e) { logger.error(e.getMessage(), e); throw new ForbiddenRestException(e.getMessage()).withDevMessage(e.getMessage()); } catch (AccountNotFoundMiddlewareException e) { logger.error(e.getMessage(), e); throw new NotFoundRestException(e.getMessage()).withDevMessage(e.getMessage()); } } }
@Override public ResponseEntity<SCALoginResponseTO> authoriseForConsent(String login, String pin, String consentId, String authorisationId, OpTypeTO opType) { try { return ResponseEntity.ok(onlineBankingService.authoriseForConsent(login, pin, consentId, authorisationId, opType)); } catch (UserNotFoundMiddlewareException e) { logger.error(e.getMessage(), e); throw new NotFoundRestException(e.getMessage()).withDevMessage(e.getMessage()); } catch (InsufficientPermissionMiddlewareException e) { logger.error(e.getMessage(), e); throw new ForbiddenRestException(e.getMessage()).withDevMessage(e.getMessage()); } }
/** * Authorize returns a bearer token that can be reused by the consuming application. * * @param login * @param pin * @return */ @Override public ResponseEntity<SCALoginResponseTO> authorise(String login, String pin, UserRoleTO role) { try { return ResponseEntity.ok(onlineBankingService.authorise(login, pin, role)); } catch (UserNotFoundMiddlewareException e) { logger.error(e.getMessage(), e); throw new NotFoundRestException(e.getMessage()).withDevMessage(e.getMessage()); } catch (InsufficientPermissionMiddlewareException e) { logger.error(e.getMessage(), e); throw new ForbiddenRestException(e.getMessage()).withDevMessage(e.getMessage()); } }