Search in sources :

Example 6 with Value

use of com.axelor.apps.account.ebics.schema.h003.ParameterDocument.Parameter.Value 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);
}
Also used : EbicsRequest(com.axelor.apps.account.ebics.schema.h003.EbicsRequestDocument.EbicsRequest) FileFormatType(com.axelor.apps.account.ebics.schema.h003.FileFormatType) StandardOrderParamsType(com.axelor.apps.account.ebics.schema.h003.StandardOrderParamsType) EbicsUser(com.axelor.apps.bankpayment.db.EbicsUser) FDLOrderParamsType(com.axelor.apps.account.ebics.schema.h003.FDLOrderParamsType) Product(com.axelor.apps.account.ebics.schema.h003.StaticHeaderType.Product) StaticHeaderOrderDetailsType(com.axelor.apps.account.ebics.schema.h003.StaticHeaderOrderDetailsType) StaticHeaderType(com.axelor.apps.account.ebics.schema.h003.StaticHeaderType) Encryption(com.axelor.apps.account.ebics.schema.h003.StaticHeaderType.BankPubKeyDigests.Encryption) EbicsPartner(com.axelor.apps.bankpayment.db.EbicsPartner) BankPubKeyDigests(com.axelor.apps.account.ebics.schema.h003.StaticHeaderType.BankPubKeyDigests) MutableHeaderType(com.axelor.apps.account.ebics.schema.h003.MutableHeaderType) DateRange(com.axelor.apps.account.ebics.schema.h003.FDLOrderParamsType.DateRange) OrderType(com.axelor.apps.account.ebics.schema.h003.StaticHeaderOrderDetailsType.OrderType) Header(com.axelor.apps.account.ebics.schema.h003.EbicsRequestDocument.EbicsRequest.Header) Authentication(com.axelor.apps.account.ebics.schema.h003.StaticHeaderType.BankPubKeyDigests.Authentication) Value(com.axelor.apps.account.ebics.schema.h003.ParameterDocument.Parameter.Value) OrderAttribute(com.axelor.apps.bankpayment.ebics.client.OrderAttribute) Parameter(com.axelor.apps.account.ebics.schema.h003.ParameterDocument.Parameter) Body(com.axelor.apps.account.ebics.schema.h003.EbicsRequestDocument.EbicsRequest.Body)

Example 7 with Value

use of com.axelor.apps.account.ebics.schema.h003.ParameterDocument.Parameter.Value in project axelor-open-suite by axelor.

the class EbicsXmlFactory method createEncryptionPubKeyDigest.

/**
 * Create the <code>EncryptionPubKeyDigest</code> XML object
 *
 * @param version the encryption version
 * @param algorithm the encryption algorithm
 * @param value the encryption value
 * @return the <code>EncryptionPubKeyDigest</code> XML object
 */
public static EncryptionPubKeyDigest createEncryptionPubKeyDigest(String version, String algorithm, byte[] value) {
    EncryptionPubKeyDigest newEncryptionPubKeyDigest = EncryptionPubKeyDigest.Factory.newInstance();
    newEncryptionPubKeyDigest.setVersion(version);
    newEncryptionPubKeyDigest.setAlgorithm(algorithm);
    newEncryptionPubKeyDigest.setByteArrayValue(value);
    return newEncryptionPubKeyDigest;
}
Also used : EncryptionPubKeyDigest(com.axelor.apps.account.ebics.schema.h003.DataEncryptionInfoType.EncryptionPubKeyDigest)

Example 8 with Value

use of com.axelor.apps.account.ebics.schema.h003.ParameterDocument.Parameter.Value in project axelor-open-suite by axelor.

the class EbicsXmlFactory method createParameter.

/**
 * Creates a new <code>Parameter</code> XML object
 *
 * @param name the parameter name
 * @param value the parameter value
 * @return the <code>Parameter</code> XML object
 */
public static Parameter createParameter(String name, Value value) {
    Parameter newParameter = Parameter.Factory.newInstance();
    newParameter.setName(name);
    newParameter.setValue(value);
    return newParameter;
}
Also used : Parameter(com.axelor.apps.account.ebics.schema.h003.ParameterDocument.Parameter)

Example 9 with Value

use of com.axelor.apps.account.ebics.schema.h003.ParameterDocument.Parameter.Value in project axelor-open-suite by axelor.

the class EbicsXmlFactory method createProduct.

/**
 * Create the <code>Product</code> XML object
 *
 * @param language the product language
 * @param value the product value
 * @return the <code>Product</code> XML object
 */
public static Product createProduct(String language, String value) {
    Product newProduct = Product.Factory.newInstance();
    newProduct.setLanguage(language);
    newProduct.setStringValue(value);
    return newProduct;
}
Also used : Product(com.axelor.apps.account.ebics.schema.h003.StaticHeaderType.Product)

Example 10 with Value

use of com.axelor.apps.account.ebics.schema.h003.ParameterDocument.Parameter.Value in project axelor-open-suite by axelor.

the class EbicsXmlFactory method createFileFormatType.

/**
 * Creates a new <code>FileFormatType</code> XML object
 *
 * @param countryCode the country code
 * @param value the file format value
 * @return the <code>FileFormatType</code> XML object
 */
public static FileFormatType createFileFormatType(String countryCode, String value) {
    FileFormatType newFileFormatType = FileFormatType.Factory.newInstance();
    newFileFormatType.setCountryCode(countryCode);
    newFileFormatType.setStringValue(value);
    return newFileFormatType;
}
Also used : FileFormatType(com.axelor.apps.account.ebics.schema.h003.FileFormatType)

Aggregations

FileFormatType (com.axelor.apps.account.ebics.schema.h003.FileFormatType)3 Parameter (com.axelor.apps.account.ebics.schema.h003.ParameterDocument.Parameter)3 Value (com.axelor.apps.account.ebics.schema.h003.ParameterDocument.Parameter.Value)3 Authentication (com.axelor.apps.account.ebics.schema.h003.StaticHeaderType.BankPubKeyDigests.Authentication)3 Encryption (com.axelor.apps.account.ebics.schema.h003.StaticHeaderType.BankPubKeyDigests.Encryption)3 Product (com.axelor.apps.account.ebics.schema.h003.StaticHeaderType.Product)3 EncryptionPubKeyDigest (com.axelor.apps.account.ebics.schema.h003.DataEncryptionInfoType.EncryptionPubKeyDigest)2 SignatureData (com.axelor.apps.account.ebics.schema.h003.DataTransferRequestType.SignatureData)2 EbicsRequest (com.axelor.apps.account.ebics.schema.h003.EbicsRequestDocument.EbicsRequest)2 Body (com.axelor.apps.account.ebics.schema.h003.EbicsRequestDocument.EbicsRequest.Body)2 Header (com.axelor.apps.account.ebics.schema.h003.EbicsRequestDocument.EbicsRequest.Header)2 MutableHeaderType (com.axelor.apps.account.ebics.schema.h003.MutableHeaderType)2 StaticHeaderOrderDetailsType (com.axelor.apps.account.ebics.schema.h003.StaticHeaderOrderDetailsType)2 OrderType (com.axelor.apps.account.ebics.schema.h003.StaticHeaderOrderDetailsType.OrderType)2 StaticHeaderType (com.axelor.apps.account.ebics.schema.h003.StaticHeaderType)2 BankPubKeyDigests (com.axelor.apps.account.ebics.schema.h003.StaticHeaderType.BankPubKeyDigests)2 EbicsPartner (com.axelor.apps.bankpayment.db.EbicsPartner)2 EbicsUser (com.axelor.apps.bankpayment.db.EbicsUser)2 OrderAttribute (com.axelor.apps.bankpayment.ebics.client.OrderAttribute)2 DataTransferRequestType (com.axelor.apps.account.ebics.schema.h003.DataTransferRequestType)1