Search in sources :

Example 1 with ProductElementType

use of com.axelor.apps.account.ebics.schema.h003.ProductElementType 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 ProductElementType

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

the class EbicsXmlFactory method createNoPubKeyDigestsRequestStaticHeaderType.

/**
 * Creates a new <code>NoPubKeyDigestsRequestStaticHeaderType</code> XML object
 *
 * @param hostId the host ID
 * @param nonce a random nonce
 * @param timestamp the current time stamp
 * @param partnerId the partner ID
 * @param userId the user ID
 * @param product the <code>ProductElementType</code> element
 * @param orderDetails the <code>OrderDetailsType</code> element
 * @param securityMedium the user security medium
 * @return
 */
public static NoPubKeyDigestsRequestStaticHeaderType createNoPubKeyDigestsRequestStaticHeaderType(String hostId, byte[] nonce, Calendar timestamp, String partnerId, String userId, ProductElementType product, OrderDetailsType orderDetails, String securityMedium) {
    NoPubKeyDigestsRequestStaticHeaderType newNoPubKeyDigestsRequestStaticHeaderType = NoPubKeyDigestsRequestStaticHeaderType.Factory.newInstance();
    newNoPubKeyDigestsRequestStaticHeaderType.setHostID(hostId);
    newNoPubKeyDigestsRequestStaticHeaderType.setNonce(nonce);
    newNoPubKeyDigestsRequestStaticHeaderType.setTimestamp(timestamp);
    newNoPubKeyDigestsRequestStaticHeaderType.setPartnerID(partnerId);
    newNoPubKeyDigestsRequestStaticHeaderType.setUserID(userId);
    newNoPubKeyDigestsRequestStaticHeaderType.setProduct(product);
    newNoPubKeyDigestsRequestStaticHeaderType.setOrderDetails(orderDetails);
    newNoPubKeyDigestsRequestStaticHeaderType.setSecurityMedium(securityMedium);
    return newNoPubKeyDigestsRequestStaticHeaderType;
}
Also used : NoPubKeyDigestsRequestStaticHeaderType(com.axelor.apps.account.ebics.schema.h003.NoPubKeyDigestsRequestStaticHeaderType)

Example 3 with ProductElementType

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

the class EbicsXmlFactory method createUnsecuredRequestStaticHeaderType.

/**
 * Creates a new <code>EmptyMutableHeaderType</code> XML object
 *
 * @param hostId the host ID
 * @param partnerId the partner ID
 * @param userId the user ID
 * @param product the <code>ProductElementType</code> element
 * @param orderDetails the <code>OrderDetailsType</code> element
 * @param securityMedium the security medium
 * @return the <code>EmptyMutableHeaderType</code> XML object
 */
public static UnsecuredRequestStaticHeaderType createUnsecuredRequestStaticHeaderType(String hostId, String partnerId, String userId, ProductElementType product, OrderDetailsType orderDetails, String securityMedium) {
    UnsecuredRequestStaticHeaderType newUnsecuredRequestStaticHeaderType = UnsecuredRequestStaticHeaderType.Factory.newInstance();
    newUnsecuredRequestStaticHeaderType.setHostID(hostId);
    newUnsecuredRequestStaticHeaderType.setPartnerID(partnerId);
    newUnsecuredRequestStaticHeaderType.setUserID(userId);
    newUnsecuredRequestStaticHeaderType.setProduct(product);
    newUnsecuredRequestStaticHeaderType.setOrderDetails(orderDetails);
    newUnsecuredRequestStaticHeaderType.setSecurityMedium(securityMedium);
    return newUnsecuredRequestStaticHeaderType;
}
Also used : UnsecuredRequestStaticHeaderType(com.axelor.apps.account.ebics.schema.h003.UnsecuredRequestStaticHeaderType)

Example 4 with ProductElementType

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

the class NoPubKeyDigestsRequestElement method build.

@Override
public void build() throws AxelorException {
    EbicsNoPubKeyDigestsRequest request;
    Body body;
    Header header;
    EmptyMutableHeaderType mutable;
    NoPubKeyDigestsRequestStaticHeaderType xstatic;
    ProductElementType product;
    OrderDetailsType orderDetails;
    EbicsUser ebicsUser = session.getUser();
    EbicsPartner ebicsPartner = ebicsUser.getEbicsPartner();
    OrderAttribute orderAttribute = new OrderAttribute(OrderType.HPB, ebicsPartner.getEbicsTypeSelect());
    orderAttribute.build();
    product = EbicsXmlFactory.creatProductElementType(session.getProduct().getLanguage(), session.getProduct().getName());
    orderDetails = EbicsXmlFactory.createOrderDetailsType(orderAttribute.getOrderAttributes(), null, OrderType.HPB.getOrderType());
    xstatic = EbicsXmlFactory.createNoPubKeyDigestsRequestStaticHeaderType(session.getBankID(), EbicsUtils.generateNonce(), Calendar.getInstance(), ebicsPartner.getPartnerId(), ebicsUser.getUserId(), product, orderDetails, ebicsUser.getSecurityMedium());
    mutable = EbicsXmlFactory.createEmptyMutableHeaderType();
    header = EbicsXmlFactory.createDigestsRequestHeader(true, mutable, xstatic);
    body = EbicsXmlFactory.createDigestsRequestBody();
    request = EbicsXmlFactory.createEbicsNoPubKeyDigestsRequest(1, "H003", header, body);
    document = EbicsXmlFactory.createEbicsNoPubKeyDigestsRequestDocument(request);
}
Also used : OrderDetailsType(com.axelor.apps.account.ebics.schema.h003.OrderDetailsType) Header(com.axelor.apps.account.ebics.schema.h003.EbicsNoPubKeyDigestsRequestDocument.EbicsNoPubKeyDigestsRequest.Header) EbicsNoPubKeyDigestsRequest(com.axelor.apps.account.ebics.schema.h003.EbicsNoPubKeyDigestsRequestDocument.EbicsNoPubKeyDigestsRequest) EbicsUser(com.axelor.apps.bankpayment.db.EbicsUser) OrderAttribute(com.axelor.apps.bankpayment.ebics.client.OrderAttribute) ProductElementType(com.axelor.apps.account.ebics.schema.h003.ProductElementType) EbicsPartner(com.axelor.apps.bankpayment.db.EbicsPartner) Body(com.axelor.apps.account.ebics.schema.h003.EbicsNoPubKeyDigestsRequestDocument.EbicsNoPubKeyDigestsRequest.Body) NoPubKeyDigestsRequestStaticHeaderType(com.axelor.apps.account.ebics.schema.h003.NoPubKeyDigestsRequestStaticHeaderType) EmptyMutableHeaderType(com.axelor.apps.account.ebics.schema.h003.EmptyMutableHeaderType)

Example 5 with ProductElementType

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

the class EbicsXmlFactory method creatProductElementType.

/**
 * Creates a new <code>ProductElementType</code> XML object
 *
 * @param language the language
 * @param product the product name
 * @return the <code>ProductElementType</code> XML object
 */
public static ProductElementType creatProductElementType(String language, String product) {
    ProductElementType newProductElementType = ProductElementType.Factory.newInstance();
    newProductElementType.setLanguage(language);
    newProductElementType.setStringValue(product);
    return newProductElementType;
}
Also used : ProductElementType(com.axelor.apps.account.ebics.schema.h003.ProductElementType)

Aggregations

ProductElementType (com.axelor.apps.account.ebics.schema.h003.ProductElementType)3 EmptyMutableHeaderType (com.axelor.apps.account.ebics.schema.h003.EmptyMutableHeaderType)2 NoPubKeyDigestsRequestStaticHeaderType (com.axelor.apps.account.ebics.schema.h003.NoPubKeyDigestsRequestStaticHeaderType)2 OrderDetailsType (com.axelor.apps.account.ebics.schema.h003.OrderDetailsType)2 UnsecuredRequestStaticHeaderType (com.axelor.apps.account.ebics.schema.h003.UnsecuredRequestStaticHeaderType)2 EbicsNoPubKeyDigestsRequest (com.axelor.apps.account.ebics.schema.h003.EbicsNoPubKeyDigestsRequestDocument.EbicsNoPubKeyDigestsRequest)1 Body (com.axelor.apps.account.ebics.schema.h003.EbicsNoPubKeyDigestsRequestDocument.EbicsNoPubKeyDigestsRequest.Body)1 Header (com.axelor.apps.account.ebics.schema.h003.EbicsNoPubKeyDigestsRequestDocument.EbicsNoPubKeyDigestsRequest.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 DataTransfer (com.axelor.apps.account.ebics.schema.h003.EbicsUnsecuredRequestDocument.EbicsUnsecuredRequest.Body.DataTransfer)1 OrderData (com.axelor.apps.account.ebics.schema.h003.EbicsUnsecuredRequestDocument.EbicsUnsecuredRequest.Body.DataTransfer.OrderData)1 Header (com.axelor.apps.account.ebics.schema.h003.EbicsUnsecuredRequestDocument.EbicsUnsecuredRequest.Header)1 EbicsPartner (com.axelor.apps.bankpayment.db.EbicsPartner)1 EbicsUser (com.axelor.apps.bankpayment.db.EbicsUser)1 OrderAttribute (com.axelor.apps.bankpayment.ebics.client.OrderAttribute)1 AxelorException (com.axelor.exception.AxelorException)1