use of com.axelor.apps.bankpayment.ebics.certificate.CertificateManager in project axelor-open-suite by axelor.
the class EbicsController method generateCertificate.
@Transactional
public void generateCertificate(ActionRequest request, ActionResponse response) {
EbicsUser ebicsUser = Beans.get(EbicsUserRepository.class).find(request.getContext().asType(EbicsUser.class).getId());
if (ebicsUser.getStatusSelect() != EbicsUserRepository.STATUS_WAITING_CERTIFICATE_CONFIG && ebicsUser.getStatusSelect() != EbicsUserRepository.STATUS_CERTIFICATES_SHOULD_BE_RENEWED) {
return;
}
CertificateManager cm = new CertificateManager(ebicsUser);
try {
cm.create();
ebicsUser.setStatusSelect(EbicsUserRepository.STATUS_WAITING_SENDING_SIGNATURE_CERTIFICATE);
Beans.get(EbicsUserRepository.class).save(ebicsUser);
} catch (GeneralSecurityException | IOException e) {
e.printStackTrace();
}
response.setReload(true);
}
Aggregations