Search in sources :

Example 1 with OrderData

use of com.axelor.apps.account.ebics.schema.h003.DataTransferRequestType.OrderData in project axelor-open-suite by axelor.

the class UnsecuredRequestElement method build.

@Override
public void build() throws AxelorException {
    Header header;
    Body body;
    EmptyMutableHeaderType mutable;
    UnsecuredRequestStaticHeaderType xstatic;
    ProductElementType productType;
    OrderDetailsType orderDetails;
    DataTransfer dataTransfer;
    OrderData orderData;
    EbicsUnsecuredRequest request;
    orderDetails = EbicsXmlFactory.createOrderDetailsType("DZNNN", session.getUser().getNextOrderId(), orderType.getOrderType());
    productType = EbicsXmlFactory.creatProductElementType(Optional.ofNullable(AuthUtils.getUser()).map(User::getLanguage).orElse(null), session.getProduct().getName());
    try {
        xstatic = EbicsXmlFactory.createUnsecuredRequestStaticHeaderType(session.getBankID(), session.getUser().getEbicsPartner().getPartnerId(), session.getUser().getUserId(), productType, orderDetails, session.getUser().getSecurityMedium());
        mutable = EbicsXmlFactory.createEmptyMutableHeaderType();
        header = EbicsXmlFactory.createHeader(true, mutable, xstatic);
        orderData = EbicsXmlFactory.createOrderData(this.orderData);
        dataTransfer = EbicsXmlFactory.createDataTransfer(orderData);
        body = EbicsXmlFactory.createBody(dataTransfer);
        request = EbicsXmlFactory.createEbicsUnsecuredRequest(header, body, 1, "H003");
        document = EbicsXmlFactory.createEbicsUnsecuredRequestDocument(request);
    } catch (AxelorException e) {
        e.printStackTrace();
    }
}
Also used : AxelorException(com.axelor.exception.AxelorException) OrderDetailsType(com.axelor.apps.account.ebics.schema.h003.OrderDetailsType) Header(com.axelor.apps.account.ebics.schema.h003.EbicsUnsecuredRequestDocument.EbicsUnsecuredRequest.Header) DataTransfer(com.axelor.apps.account.ebics.schema.h003.EbicsUnsecuredRequestDocument.EbicsUnsecuredRequest.Body.DataTransfer) ProductElementType(com.axelor.apps.account.ebics.schema.h003.ProductElementType) OrderData(com.axelor.apps.account.ebics.schema.h003.EbicsUnsecuredRequestDocument.EbicsUnsecuredRequest.Body.DataTransfer.OrderData) EbicsUnsecuredRequest(com.axelor.apps.account.ebics.schema.h003.EbicsUnsecuredRequestDocument.EbicsUnsecuredRequest) Body(com.axelor.apps.account.ebics.schema.h003.EbicsUnsecuredRequestDocument.EbicsUnsecuredRequest.Body) EmptyMutableHeaderType(com.axelor.apps.account.ebics.schema.h003.EmptyMutableHeaderType) UnsecuredRequestStaticHeaderType(com.axelor.apps.account.ebics.schema.h003.UnsecuredRequestStaticHeaderType)

Example 2 with OrderData

use of com.axelor.apps.account.ebics.schema.h003.DataTransferRequestType.OrderData in project axelor-open-suite by axelor.

the class EbicsXmlFactory method createDataTransfer.

/**
 * Creates a new <code>DataTransfer</code> XML object
 *
 * @param orderData the <code>OrderData</code> element
 * @return the <code>DataTransfer</code> XML object
 */
public static DataTransfer createDataTransfer(OrderData orderData) {
    DataTransfer newDataTransfer = DataTransfer.Factory.newInstance();
    newDataTransfer.setOrderData(orderData);
    return newDataTransfer;
}
Also used : DataTransfer(com.axelor.apps.account.ebics.schema.h003.EbicsUnsecuredRequestDocument.EbicsUnsecuredRequest.Body.DataTransfer)

Example 3 with OrderData

use of com.axelor.apps.account.ebics.schema.h003.DataTransferRequestType.OrderData in project axelor-open-suite by axelor.

the class UTransferRequestElement method buildTransfer.

@Override
public void buildTransfer() throws AxelorException {
    EbicsRequest request;
    Header header;
    Body body;
    MutableHeaderType mutable;
    SegmentNumber segmentNumber;
    StaticHeaderType xstatic;
    OrderData orderData;
    DataTransferRequestType dataTransfer;
    segmentNumber = EbicsXmlFactory.createSegmentNumber(this.segmentNumber, lastSegment);
    mutable = EbicsXmlFactory.createMutableHeaderType("Transfer", segmentNumber);
    xstatic = EbicsXmlFactory.createStaticHeaderType(session.getBankID(), transactionId);
    header = EbicsXmlFactory.createEbicsRequestHeader(true, mutable, xstatic);
    orderData = EbicsXmlFactory.createEbicsRequestOrderData(IOUtils.getFactoryContent(content));
    dataTransfer = EbicsXmlFactory.createDataTransferRequestType(orderData);
    // TODO CHECK
    body = EbicsXmlFactory.createEbicsRequestBody(dataTransfer);
    request = EbicsXmlFactory.createEbicsRequest(1, "H003", header, body);
    document = EbicsXmlFactory.createEbicsRequestDocument(request);
    ByteArrayOutputStream bout = new ByteArrayOutputStream();
    try {
        this.save(bout);
    } catch (JDOMException e) {
        // TODO Bloc catch généré automatiquement
        e.printStackTrace();
    }
    System.out.println("Requete data ----------------------------------------------------------------------------");
    System.out.println(bout.toString());
}
Also used : EbicsRequest(com.axelor.apps.account.ebics.schema.h003.EbicsRequestDocument.EbicsRequest) MutableHeaderType(com.axelor.apps.account.ebics.schema.h003.MutableHeaderType) SegmentNumber(com.axelor.apps.account.ebics.schema.h003.MutableHeaderType.SegmentNumber) DataTransferRequestType(com.axelor.apps.account.ebics.schema.h003.DataTransferRequestType) Header(com.axelor.apps.account.ebics.schema.h003.EbicsRequestDocument.EbicsRequest.Header) StaticHeaderType(com.axelor.apps.account.ebics.schema.h003.StaticHeaderType) OrderData(com.axelor.apps.account.ebics.schema.h003.DataTransferRequestType.OrderData) ByteArrayOutputStream(java.io.ByteArrayOutputStream) JDOMException(org.jdom.JDOMException) Body(com.axelor.apps.account.ebics.schema.h003.EbicsRequestDocument.EbicsRequest.Body)

Example 4 with OrderData

use of com.axelor.apps.account.ebics.schema.h003.DataTransferRequestType.OrderData in project axelor-open-suite by axelor.

the class EbicsXmlFactory method createOrderData.

/**
 * Creates a new <code>OrderData</code> XML object
 *
 * @param orderData the order data as byte array
 * @return the <code>OrderData</code> XML object
 */
public static OrderData createOrderData(byte[] orderData) {
    OrderData newOrderData = OrderData.Factory.newInstance();
    newOrderData.setByteArrayValue(orderData);
    return newOrderData;
}
Also used : OrderData(com.axelor.apps.account.ebics.schema.h003.EbicsUnsecuredRequestDocument.EbicsUnsecuredRequest.Body.DataTransfer.OrderData)

Example 5 with OrderData

use of com.axelor.apps.account.ebics.schema.h003.DataTransferRequestType.OrderData in project axelor-open-suite by axelor.

the class EbicsXmlFactory method createDataTransferRequestType.

/**
 * Create the <code>DataTransferRequestType</code> XML object
 *
 * @param orderData the <code>
 *     com.axelor.apps.account.ebics.schema.h003.DataTransferRequestType.OrderData</code> element
 * @return the <code>DataTransferRequestType</code> XML object
 */
public static DataTransferRequestType createDataTransferRequestType(com.axelor.apps.account.ebics.schema.h003.DataTransferRequestType.OrderData orderData) {
    DataTransferRequestType newDataTransferRequestType = DataTransferRequestType.Factory.newInstance();
    newDataTransferRequestType.setOrderData(orderData);
    return newDataTransferRequestType;
}
Also used : DataTransferRequestType(com.axelor.apps.account.ebics.schema.h003.DataTransferRequestType)

Aggregations

DataTransferRequestType (com.axelor.apps.account.ebics.schema.h003.DataTransferRequestType)2 DataTransfer (com.axelor.apps.account.ebics.schema.h003.EbicsUnsecuredRequestDocument.EbicsUnsecuredRequest.Body.DataTransfer)2 OrderData (com.axelor.apps.account.ebics.schema.h003.EbicsUnsecuredRequestDocument.EbicsUnsecuredRequest.Body.DataTransfer.OrderData)2 OrderData (com.axelor.apps.account.ebics.schema.h003.DataTransferRequestType.OrderData)1 EbicsRequest (com.axelor.apps.account.ebics.schema.h003.EbicsRequestDocument.EbicsRequest)1 Body (com.axelor.apps.account.ebics.schema.h003.EbicsRequestDocument.EbicsRequest.Body)1 Header (com.axelor.apps.account.ebics.schema.h003.EbicsRequestDocument.EbicsRequest.Header)1 EbicsUnsecuredRequest (com.axelor.apps.account.ebics.schema.h003.EbicsUnsecuredRequestDocument.EbicsUnsecuredRequest)1 Body (com.axelor.apps.account.ebics.schema.h003.EbicsUnsecuredRequestDocument.EbicsUnsecuredRequest.Body)1 Header (com.axelor.apps.account.ebics.schema.h003.EbicsUnsecuredRequestDocument.EbicsUnsecuredRequest.Header)1 EmptyMutableHeaderType (com.axelor.apps.account.ebics.schema.h003.EmptyMutableHeaderType)1 MutableHeaderType (com.axelor.apps.account.ebics.schema.h003.MutableHeaderType)1 SegmentNumber (com.axelor.apps.account.ebics.schema.h003.MutableHeaderType.SegmentNumber)1 OrderDetailsType (com.axelor.apps.account.ebics.schema.h003.OrderDetailsType)1 ProductElementType (com.axelor.apps.account.ebics.schema.h003.ProductElementType)1 StaticHeaderType (com.axelor.apps.account.ebics.schema.h003.StaticHeaderType)1 UnsecuredRequestStaticHeaderType (com.axelor.apps.account.ebics.schema.h003.UnsecuredRequestStaticHeaderType)1 AxelorException (com.axelor.exception.AxelorException)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 JDOMException (org.jdom.JDOMException)1