LOGGER.debug("Price ="+price);
try {
//CA call preparation
LOGGER.debug("CA call preparation");
SIPSApiWeb api = new SIPSApiWeb(getPaymentInitFile());
SIPSDataObject call = (SIPSDataObject) new SIPSCallParm();
if(Portal.isPaymentDevMode()) {
call.setValue("merchant_id", "013044876511111");
} else {
call.setValue("merchant_id", "047959265100018");//0+jayasoft siret
}
String locale = "en";
Context ctx = ContextHolder.getContext();
if (ctx!=null) {
locale = ctx.getLocale().getLanguage();
}
call.setValue("language", locale);
call.setValue("order_id", String.valueOf(o.getId()));
call.setValue("customer_id", String.valueOf(o.getBuyer().getId()));
call.setValue("merchant_country", "fr");
//TODO compute Tax
call.setValue("amount", ""+Math.round(price*100));
call.setValue("currency_code", "978");
call.setValue("normal_return_url", server+"/account/register/validateBillingForm.do?" + Params.GENERAL.PARAMS.LOCALE + "=" + locale);
call.setValue("cancel_return_url", server+"/cancelPaymentServlet?" + Params.GENERAL.PARAMS.LOCALE + "=" + locale);
call.setValue("automatic_response_url", server+"/account/register/validatePayment.do?" + Params.GENERAL.PARAMS.LOCALE + "=" + locale);
LOGGER.info("CA call to render card html");
return api.sipsPaymentCallFunc(call);
} 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) {