use of com.axelor.apps.bankpayment.ebics.client.KeyManagement in project axelor-open-suite by axelor.
the class EbicsService method sendSPRRequest.
/**
* Sends the SPR order to the bank.
*
* @param userId the user ID
* @param product the session product
* @throws AxelorException
*/
@Transactional
public void sendSPRRequest(EbicsUser ebicsUser, EbicsProduct product) throws AxelorException {
EbicsSession session = new EbicsSession(ebicsUser);
if (product == null) {
product = defaultProduct;
}
session.setProduct(product);
KeyManagement keyManager = new KeyManagement(session);
try {
keyManager.lockAccess();
ebicsUser.setStatusSelect(EbicsUserRepository.STATUS_WAITING_SENDING_SIGNATURE_CERTIFICATE);
userService.getNextOrderId(ebicsUser);
userRepo.save(ebicsUser);
} catch (Exception e) {
TraceBackService.trace(e);
throw new AxelorException(e, TraceBackRepository.CATEGORY_CONFIGURATION_ERROR);
}
}
use of com.axelor.apps.bankpayment.ebics.client.KeyManagement in project axelor-open-suite by axelor.
the class EbicsService method sendINIRequest.
/**
* Sends an INI request to the ebics bank server
*
* @param userId the user ID
* @param product the application product
* @throws AxelorException
* @throws JDOMException
* @throws IOException
*/
@Transactional
public void sendINIRequest(EbicsUser ebicsUser, EbicsProduct product) throws AxelorException {
if (ebicsUser.getStatusSelect() != EbicsUserRepository.STATUS_WAITING_SENDING_SIGNATURE_CERTIFICATE) {
return;
}
try {
userService.getNextOrderId(ebicsUser);
EbicsSession session = new EbicsSession(ebicsUser);
if (product == null) {
product = defaultProduct;
}
session.setProduct(product);
KeyManagement keyManager = new KeyManagement(session);
keyManager.sendINI();
ebicsUser.setStatusSelect(EbicsUserRepository.STATUS_WAITING_AUTH_AND_ENCRYPT_CERTIFICATES);
userRepo.save(ebicsUser);
} catch (Exception e) {
TraceBackService.trace(e);
throw new AxelorException(e, TraceBackRepository.CATEGORY_CONFIGURATION_ERROR);
}
}
use of com.axelor.apps.bankpayment.ebics.client.KeyManagement in project axelor-open-suite by axelor.
the class EbicsService method sendHPBRequest.
/**
* Sends a HPB request to the ebics server.
*
* @param userId the user ID.
* @param product the application product.
* @throws AxelorException
*/
@Transactional
public X509Certificate[] sendHPBRequest(EbicsUser user, EbicsProduct product) throws AxelorException {
EbicsSession session = new EbicsSession(user);
if (product == null) {
product = defaultProduct;
}
session.setProduct(product);
KeyManagement keyManager = new KeyManagement(session);
try {
return keyManager.sendHPB();
} catch (Exception e) {
TraceBackService.trace(e);
throw new AxelorException(e, TraceBackRepository.CATEGORY_CONFIGURATION_ERROR);
}
}
use of com.axelor.apps.bankpayment.ebics.client.KeyManagement in project axelor-open-suite by axelor.
the class EbicsService method sendHIARequest.
/**
* Sends a HIA request to the ebics server.
*
* @param userId the user ID.
* @param product the application product.
* @throws AxelorException
*/
@Transactional
public void sendHIARequest(EbicsUser ebicsUser, EbicsProduct product) throws AxelorException {
if (ebicsUser.getStatusSelect() != EbicsUserRepository.STATUS_WAITING_AUTH_AND_ENCRYPT_CERTIFICATES) {
return;
}
userService.getNextOrderId(ebicsUser);
EbicsSession session = new EbicsSession(ebicsUser);
if (product == null) {
product = defaultProduct;
}
session.setProduct(product);
KeyManagement keyManager = new KeyManagement(session);
try {
keyManager.sendHIA();
ebicsUser.setStatusSelect(EbicsUserRepository.STATUS_ACTIVE_CONNECTION);
userRepo.save(ebicsUser);
} catch (IOException | AxelorException | JDOMException e) {
TraceBackService.trace(e);
throw new AxelorException(e, TraceBackRepository.CATEGORY_CONFIGURATION_ERROR);
}
}
Aggregations