diff options
-rw-r--r-- | src/main/java/at/gv/egiz/moazs/scheme/Msg2MzsConverter.java | 21 | ||||
-rw-r--r-- | src/main/resources/mzs/app2mzs.xsd | 12 |
2 files changed, 30 insertions, 3 deletions
diff --git a/src/main/java/at/gv/egiz/moazs/scheme/Msg2MzsConverter.java b/src/main/java/at/gv/egiz/moazs/scheme/Msg2MzsConverter.java index f7d14cd..1390986 100644 --- a/src/main/java/at/gv/egiz/moazs/scheme/Msg2MzsConverter.java +++ b/src/main/java/at/gv/egiz/moazs/scheme/Msg2MzsConverter.java @@ -24,6 +24,7 @@ package at.gv.egiz.moazs.scheme; import at.gv.zustellung.app2mzs.xsd.DeliveryNotificationType; import at.gv.zustellung.app2mzs.xsd.*; import at.gv.zustellung.msg.xsd.*; +import at.gv.zustellung.msg.xsd.ERVConfirmedDeliveryType; import org.springframework.stereotype.Component; import javax.xml.bind.JAXBElement; @@ -34,6 +35,7 @@ import static at.gv.egiz.moazs.MoaZSException.moaZSException; import static at.gv.zustellung.app2mzs.xsd.DeliveryNotificationType.AdditionalFormat.additionalFormatBuilder; import static at.gv.zustellung.app2mzs.xsd.DeliveryNotificationType.deliveryNotificationTypeBuilder; import static at.gv.zustellung.app2mzs.xsd.DeliveryResponseType.deliveryResponseTypeBuilder; +import static at.gv.zustellung.app2mzs.xsd.ERVConfirmedDeliveryType.ERVConfirmedDeliveryTypeBuilder; import static at.gv.zustellung.app2mzs.xsd.ErrorType.errorTypeBuilder; import static at.gv.zustellung.app2mzs.xsd.PartialSuccessType.partialSuccessTypeBuilder; import static at.gv.zustellung.app2mzs.xsd.SuccessType.successTypeBuilder; @@ -120,8 +122,8 @@ public class Msg2MzsConverter { builder.withError(extractError(msgNotification, error, signedNotification)) .withNotificationsPerformed(error.getNotificationsPerformed()); } else if(answer.getValue() instanceof ERVConfirmedDeliveryType) { - ERVConfirmedDeliveryType ervConfirmed = (ERVConfirmedDeliveryType) answer.getValue(); - builder.withERVConfirmedDelivery(ervConfirmed); + var ervConfirmed = (ERVConfirmedDeliveryType) answer.getValue(); + builder.withERVConfirmedDelivery(extractERVconfirmedDelivery(msgNotification, ervConfirmed, signedNotification)); } else { throw moaZSException(UNKNOWN_ANSWER_ERROR_MSG); } @@ -159,6 +161,21 @@ public class Msg2MzsConverter { .build(); } + private at.gv.zustellung.app2mzs.xsd.ERVConfirmedDeliveryType extractERVconfirmedDelivery( + at.gv.zustellung.msg.xsd.DeliveryNotificationType msgNotification, + ERVConfirmedDeliveryType ervConfirmed,Optional<byte[]> signedNotification) { + + return ERVConfirmedDeliveryTypeBuilder() + .withAppDeliveryID(msgNotification.getAppDeliveryID()) + .withDeliverySystem(msgNotification.getDeliverySystem()) + .withZSDeliveryID(msgNotification.getZSDeliveryID()) + .withGZ(msgNotification.getGZ()) + .withSignedDeliveryRequestStatus(signedNotification.orElse(null)) + .withERVConfirmedDelivery(ervConfirmed) + .build(); + } + + private List<DeliveryNotificationType.AdditionalFormat> convert( List<at.gv.zustellung.msg.xsd.DeliveryNotificationType.AdditionalFormat> additionalFormat) { return additionalFormat.stream() diff --git a/src/main/resources/mzs/app2mzs.xsd b/src/main/resources/mzs/app2mzs.xsd index 6a4ffda..4b22a63 100644 --- a/src/main/resources/mzs/app2mzs.xsd +++ b/src/main/resources/mzs/app2mzs.xsd @@ -169,7 +169,7 @@ <xs:choice> <xs:element ref="Success"/> <xs:element ref="Error"/> - <xs:element ref="msg:ERVConfirmedDelivery"/> + <xs:element ref="ERVConfirmedDelivery"/> </xs:choice> <xs:element ref="msg:SenderDetails"/> <xs:element ref="msg:ReceiverDetails"/> @@ -245,6 +245,16 @@ </xs:extension> </xs:complexContent> </xs:complexType> + <xs:element name="ERVConfirmedDelivery" type="ERVConfirmedDeliveryType" /> + <xs:complexType name="ERVConfirmedDeliveryType"> + <xs:complexContent> + <xs:extension base="MessageType"> + <xs:sequence> + <xs:element ref="msg:ERVConfirmedDelivery"/> + </xs:sequence> + </xs:extension> + </xs:complexContent> + </xs:complexType> <xs:complexType name="MessageType"> <xs:annotation> <xs:documentation>abstract message type</xs:documentation> |