// TODO g�rer annulation ou refus de paiement
pendingOrder.setStatus(Order.ORDER_PAYMENT_REFUSED);
LOGGER.info("order " + pendingOrder.getId() + " payment refused, code : " + bankResponseCode);
DaoFactory.getOrderDao().save(pendingOrder);
LOGGER.warn("Payment refused by bank return code:"+bankResponseCode);
PaymentRefusedException e = new PaymentRefusedException(bankResponseCode);
e.appendError(RessourceBundleApplicationMessage.error("registration.payment-form.error." + bankResponseCode, null));
throw e;
}
} else {
LOGGER.info("payment already done for order " + pendingOrder.getId());
}
return paymentInfo;
} else {
throw ServiceException.create("Internal error", "No order found withid="+orderId+" defined in transaction id="+transactionId, null);
}
} catch (FileNotFoundException e) {
throw ServiceException.create("Internal error", "Configuration file not found", e);
} catch (RegistrationException e) {
throw ServiceException.create("Internal error", "Unable to add user", e);
} catch (SIPSException e) {
throw ServiceException.create("Internal error", "Payment api throw an error", e);
} catch (ServiceException se) {
throw se;
} catch (Exception e) {
throw ServiceException.create("Internal error", "Unable to process payment :"+e.getMessage(), e);
}
}