use of com.axelor.apps.account.ebics.schema.h003.FDLOrderParamsType in project axelor-open-suite by axelor.
the class DInitializationRequestElement method buildInitialization.
@Override
public void buildInitialization() throws AxelorException {
EbicsRequest request;
Header header;
Body body;
MutableHeaderType mutable;
StaticHeaderType xstatic;
Product product;
BankPubKeyDigests bankPubKeyDigests;
Authentication authentication;
Encryption encryption;
OrderType orderType;
StaticHeaderOrderDetailsType orderDetails;
mutable = EbicsXmlFactory.createMutableHeaderType("Initialisation", null);
product = EbicsXmlFactory.createProduct(session.getProduct().getLanguage(), session.getProduct().getName());
authentication = EbicsXmlFactory.createAuthentication("X002", "http://www.w3.org/2001/04/xmlenc#sha256", decodeHex(KeyUtil.getKeyDigest(session.getBankX002Key())));
encryption = EbicsXmlFactory.createEncryption("E002", "http://www.w3.org/2001/04/xmlenc#sha256", decodeHex(KeyUtil.getKeyDigest(session.getBankE002Key())));
bankPubKeyDigests = EbicsXmlFactory.createBankPubKeyDigests(authentication, encryption);
orderType = EbicsXmlFactory.createOrderType(type.getOrderType());
EbicsUser ebicsUser = session.getUser();
EbicsPartner ebicsPartner = ebicsUser.getEbicsPartner();
OrderAttribute orderAttribute = new OrderAttribute(type, ebicsPartner.getEbicsTypeSelect());
orderAttribute.build();
if (type.equals(com.axelor.apps.bankpayment.ebics.client.OrderType.FDL)) {
FDLOrderParamsType fDLOrderParamsType;
FileFormatType fileFormat;
fileFormat = EbicsXmlFactory.createFileFormatType(Locale.FRANCE.getCountry().toUpperCase(), session.getSessionParam("FORMAT"));
fDLOrderParamsType = EbicsXmlFactory.createFDLOrderParamsType(fileFormat);
if (startRange != null && endRange != null) {
DateRange range;
range = EbicsXmlFactory.createDateRange(startRange, endRange);
fDLOrderParamsType.setDateRange(range);
}
if (Boolean.getBoolean(session.getSessionParam("TEST"))) {
Parameter parameter;
Value value;
value = EbicsXmlFactory.createValue("String", "TRUE");
parameter = EbicsXmlFactory.createParameter("TEST", value);
fDLOrderParamsType.setParameterArray(new Parameter[] { parameter });
}
orderDetails = EbicsXmlFactory.createStaticHeaderOrderDetailsType(ebicsUser.getNextOrderId(), orderAttribute.getOrderAttributes(), orderType, fDLOrderParamsType);
} else {
StandardOrderParamsType standardOrderParamsType;
standardOrderParamsType = EbicsXmlFactory.createStandardOrderParamsType();
// FIXME Some banks cannot handle OrderID element in download process. Add parameter in
// configuration!!!
orderDetails = EbicsXmlFactory.createStaticHeaderOrderDetailsType(// session.getUser().getPartner().nextOrderId(),
ebicsUser.getNextOrderId(), orderAttribute.getOrderAttributes(), orderType, standardOrderParamsType);
}
xstatic = EbicsXmlFactory.createStaticHeaderType(session.getBankID(), nonce, ebicsPartner.getPartnerId(), product, ebicsUser.getSecurityMedium(), ebicsUser.getUserId(), Calendar.getInstance(), orderDetails, bankPubKeyDigests);
header = EbicsXmlFactory.createEbicsRequestHeader(true, mutable, xstatic);
body = EbicsXmlFactory.createEbicsRequestBody();
request = EbicsXmlFactory.createEbicsRequest(1, "H003", header, body);
document = EbicsXmlFactory.createEbicsRequestDocument(request);
}
use of com.axelor.apps.account.ebics.schema.h003.FDLOrderParamsType in project axelor-open-suite by axelor.
the class EbicsXmlFactory method createStaticHeaderOrderDetailsType.
/**
* Creates a new <code>StaticHeaderOrderDetailsType</code> XML object
*
* @param orderId the order ID
* @param orderAttribute the order attribute
* @param orderType the order type
* @param orderParams the <code>FDLOrderParamsType</code> element
* @return the <code>StaticHeaderOrderDetailsType</code> XML object
*/
public static StaticHeaderOrderDetailsType createStaticHeaderOrderDetailsType(String orderId, String orderAttribute, OrderType orderType, FDLOrderParamsType orderParams) {
StaticHeaderOrderDetailsType newStaticHeaderOrderDetailsType = StaticHeaderOrderDetailsType.Factory.newInstance();
if (orderId != null) {
// newStaticHeaderOrderDetailsType.setOrderID(orderId);
}
newStaticHeaderOrderDetailsType.setOrderAttribute(com.axelor.apps.account.ebics.schema.h003.OrderAttributeType.Enum.forString(orderAttribute));
newStaticHeaderOrderDetailsType.setOrderType(orderType);
newStaticHeaderOrderDetailsType.setOrderParams(orderParams);
qualifySubstitutionGroup(newStaticHeaderOrderDetailsType.getOrderParams(), FDLOrderParamsDocument.type.getDocumentElementName(), null);
return newStaticHeaderOrderDetailsType;
}
use of com.axelor.apps.account.ebics.schema.h003.FDLOrderParamsType in project axelor-open-suite by axelor.
the class EbicsXmlFactory method createFDLOrderParamsType.
/**
* Creates a new <code>FDLOrderParamsType</code> XML object
*
* @param fileFormat the <code>FileFormatType</code> element
* @return the <code>FDLOrderParamsType</code> XML object
*/
public static FDLOrderParamsType createFDLOrderParamsType(FileFormatType fileFormat) {
FDLOrderParamsType newFDLOrderParamsType = FDLOrderParamsType.Factory.newInstance();
newFDLOrderParamsType.setFileFormat(fileFormat);
return newFDLOrderParamsType;
}
Aggregations