From b7223a1c9e99eb45d5e83bd041ca97c15b151a37 Mon Sep 17 00:00:00 2001 From: CGantert345 <57003061+CGantert345@users.noreply.github.com> Date: Mon, 12 Apr 2021 19:22:00 +0200 Subject: included open ticket test --- .../api/asn/omv1/IncludedOpenTicketType.java | 3 +- .../barcode/ticket/api/asn/omv1/VatDetailType.java | 1 - .../ticket/api/asn/omv2/CountermarkData.java | 2 +- .../barcode/ticket/api/asn/omv2/FIPTicketData.java | 2 +- .../api/asn/omv2/IncludedOpenTicketType.java | 5 +- .../ticket/api/asn/omv2/OpenTicketData.java | 2 +- .../uic/barcode/ticket/api/asn/omv2/PassData.java | 2 +- .../ticket/api/asn/omv2/StationPassageData.java | 2 +- .../barcode/ticket/api/asn/omv2/TrainLinkType.java | 2 +- .../barcode/ticket/api/asn/omv2/TravelerType.java | 40 +- .../ticket/api/asn/omv2/ValidityPeriodType.java | 4 +- src/resources/uicBarcodeFCBv2.0.2.asn | 4 +- .../ticket/api/test/OpenTicketComplexTestV1.java | 89 +++++ .../ticket/api/test/OpenTicketComplexTestV2.java | 96 +++++ .../test/testtickets/CustomerCardTestTicketV1.java | 1 + .../test/testtickets/CustomerCardTestTicketV2.java | 4 +- .../test/testtickets/OpenTestComplexTicketV1.java | 401 ++++++++++++++++++++ .../test/testtickets/OpenTestComplexTicketV2.java | 411 +++++++++++++++++++++ 18 files changed, 1042 insertions(+), 29 deletions(-) create mode 100644 src/test/java/org/uic/barcode/ticket/api/test/OpenTicketComplexTestV1.java create mode 100644 src/test/java/org/uic/barcode/ticket/api/test/OpenTicketComplexTestV2.java create mode 100644 src/test/java/org/uic/barcode/ticket/api/test/testtickets/OpenTestComplexTicketV1.java create mode 100644 src/test/java/org/uic/barcode/ticket/api/test/testtickets/OpenTestComplexTicketV2.java diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/IncludedOpenTicketType.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/IncludedOpenTicketType.java index 7ab0334..62e5a86 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/IncludedOpenTicketType.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/IncludedOpenTicketType.java @@ -72,6 +72,7 @@ public class IncludedOpenTicketType extends Object { @FieldOrder(order = 8) @IntRange(minValue=-1,maxValue=700) + @Asn1Default(value = "0") @Asn1Optional public Long validFromDay; @FieldOrder(order = 9) @@ -84,6 +85,7 @@ public class IncludedOpenTicketType extends Object { @FieldOrder(order = 11) @IntRange(minValue=0,maxValue=370) + @Asn1Default(value = "0") @Asn1Optional public Long validUntilDay; @FieldOrder(order = 12) @@ -95,7 +97,6 @@ public class IncludedOpenTicketType extends Object { @Asn1Optional public Long validUntilUTCOffset; @FieldOrder(order = 14) - @Asn1Default(value="second") @Asn1Optional public TravelClassType classCode; @FieldOrder(order = 15) diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/VatDetailType.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/VatDetailType.java index 82d8950..ab36642 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv1/VatDetailType.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv1/VatDetailType.java @@ -23,7 +23,6 @@ import org.uic.barcode.asn1.datatypes.Asn1BigInteger; import org.uic.barcode.asn1.datatypes.Asn1Optional; import org.uic.barcode.asn1.datatypes.CharacterRestriction; import org.uic.barcode.asn1.datatypes.FieldOrder; -import org.uic.barcode.asn1.datatypes.HasExtensionMarker; import org.uic.barcode.asn1.datatypes.IntRange; import org.uic.barcode.asn1.datatypes.RestrictedString; import org.uic.barcode.asn1.datatypes.Sequence; diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/CountermarkData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/CountermarkData.java index 435c6ef..aefdc3b 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/CountermarkData.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/CountermarkData.java @@ -136,7 +136,7 @@ public class CountermarkData extends Object { @Asn1Optional public Long validFromUTCOffset; @FieldOrder(order = 25) - @IntRange(minValue=0,maxValue=370) + @IntRange(minValue=-1,maxValue=370) @Asn1Optional public Long validUntilDay; @FieldOrder(order = 26) diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/FIPTicketData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/FIPTicketData.java index c6a98e4..447c994 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/FIPTicketData.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/FIPTicketData.java @@ -70,7 +70,7 @@ public class FIPTicketData extends Object { @Asn1Optional public Long validFromDay; @FieldOrder(order = 7) - @IntRange(minValue=0,maxValue=370) + @IntRange(minValue=-1,maxValue=370) @Asn1Optional public Long validUntilDay; @FieldOrder(order = 8) diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/IncludedOpenTicketType.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/IncludedOpenTicketType.java index 3b13d66..35a9c73 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/IncludedOpenTicketType.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/IncludedOpenTicketType.java @@ -72,6 +72,7 @@ public class IncludedOpenTicketType extends Object { @FieldOrder(order = 8) @IntRange(minValue=-1,maxValue=700) + @Asn1Default(value = "0") @Asn1Optional public Long validFromDay; @FieldOrder(order = 9) @@ -83,7 +84,8 @@ public class IncludedOpenTicketType extends Object { @Asn1Optional public Long validFromUTCOffset; @FieldOrder(order = 11) - @IntRange(minValue=0,maxValue=370) + @IntRange(minValue=-1,maxValue=370) + @Asn1Default(value = "0") @Asn1Optional public Long validUntilDay; @FieldOrder(order = 12) @@ -95,7 +97,6 @@ public class IncludedOpenTicketType extends Object { @Asn1Optional public Long validUntilUTCOffset; @FieldOrder(order = 14) - @Asn1Default(value="second") @Asn1Optional public TravelClassType classCode; @FieldOrder(order = 15) diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/OpenTicketData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/OpenTicketData.java index 9900640..44a7188 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/OpenTicketData.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/OpenTicketData.java @@ -129,7 +129,7 @@ public class OpenTicketData extends Object { @FieldOrder(order = 22) @Asn1Default(value = "0") - @IntRange(minValue=0,maxValue=370) + @IntRange(minValue=-1,maxValue=370) @Asn1Optional public Long validUntilDay; @FieldOrder(order = 23) diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/PassData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/PassData.java index dbc81c3..dad76dc 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/PassData.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/PassData.java @@ -91,7 +91,7 @@ public class PassData extends Object { @Asn1Optional public Long validFromUTCOffset; @FieldOrder(order = 12) - @IntRange(minValue=0,maxValue=370) + @IntRange(minValue=-1,maxValue=370) @Asn1Optional public Long validUntilDay; @FieldOrder(order = 13) diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/StationPassageData.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/StationPassageData.java index a378bb7..1e6c720 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/StationPassageData.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/StationPassageData.java @@ -105,7 +105,7 @@ public class StationPassageData extends Object { @FieldOrder(order = 17) @Asn1Default(value="0") - @IntRange(minValue=0,maxValue=370) + @IntRange(minValue=-1,maxValue=370) @Asn1Optional public Long validUntilDay; @FieldOrder(order = 18) diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TrainLinkType.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TrainLinkType.java index 16a101e..4724db6 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TrainLinkType.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TrainLinkType.java @@ -43,7 +43,7 @@ public class TrainLinkType extends Object { @Asn1Optional public String trainIA5; @FieldOrder(order = 2) - @IntRange(minValue=0,maxValue=370) + @IntRange(minValue=-1,maxValue=370) public Long travelDate; @FieldOrder(order = 3) diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TravelerType.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TravelerType.java index b0efae0..30a7dfc 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TravelerType.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/TravelerType.java @@ -78,31 +78,35 @@ public class TravelerType extends Object { @Asn1Optional public Long yearOfBirth; @FieldOrder(order = 10) - @IntRange(minValue=0,maxValue=366) - @Asn1Optional public Long dayOfBirth; - + @IntRange(minValue=1,maxValue=12) + @Asn1Optional public Long monthOfBirth; + @FieldOrder(order = 11) - public Boolean ticketHolder = true; + @IntRange(minValue=1,maxValue=31) + @Asn1Optional public Long dayOfBirth; @FieldOrder(order = 12) - @Asn1Optional public PassengerType passengerType; + public Boolean ticketHolder = true; @FieldOrder(order = 13) - @Asn1Optional public Boolean passengerWithReducedMobility; + @Asn1Optional public PassengerType passengerType; @FieldOrder(order = 14) + @Asn1Optional public Boolean passengerWithReducedMobility; + + @FieldOrder(order = 15) @IntRange(minValue=1,maxValue=999) @Asn1Optional public Long countryOfResidence; - @FieldOrder(order = 15) + @FieldOrder(order = 16) @IntRange(minValue=1,maxValue=999) @Asn1Optional public Long countryOfPassport; - @FieldOrder(order = 16) + @FieldOrder(order = 17) @IntRange(minValue=1,maxValue=999) @Asn1Optional public Long countryOfIdCard; - @FieldOrder(order = 17) + @FieldOrder(order = 18) @Asn1Optional public SequenceOfCustomerStatusType status; @@ -286,8 +290,14 @@ public class TravelerType extends Object { this.status = status; } - - + public Long getMonthOfBirth() { + return monthOfBirth; + } + + public void setMonthOfBirth(Long monthOfBirth) { + this.monthOfBirth = monthOfBirth; + } + public void setDateOfBirth(Date date){ if (date == null) return; @@ -296,9 +306,9 @@ public class TravelerType extends Object { cal.setTime(date); this.yearOfBirth = new Long( cal.get(Calendar.YEAR)); - this.dayOfBirth = new Long (cal.get(Calendar.DAY_OF_YEAR)); + this.monthOfBirth = new Long(cal.get(Calendar.MONTH) + 1); + this.dayOfBirth = new Long (cal.get(Calendar.DAY_OF_MONTH)); - } public Date getDateOfBirth() { @@ -310,13 +320,15 @@ public class TravelerType extends Object { cal.clear(); cal.setTimeZone(TimeZone.getTimeZone("UTC")); cal.set(Calendar.YEAR, this.yearOfBirth.intValue()); - cal.set(Calendar.DAY_OF_YEAR, this.dayOfBirth.intValue()); + cal.set(Calendar.MONTH, (int)(this.monthOfBirth - 1)); + cal.set(Calendar.DAY_OF_MONTH, this.dayOfBirth.intValue()); cal.set(Calendar.HOUR_OF_DAY,0); cal.set(Calendar.MINUTE,0); return cal.getTime(); } + } diff --git a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/ValidityPeriodType.java b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/ValidityPeriodType.java index 7b08f73..e3b9aa6 100644 --- a/src/main/java/org/uic/barcode/ticket/api/asn/omv2/ValidityPeriodType.java +++ b/src/main/java/org/uic/barcode/ticket/api/asn/omv2/ValidityPeriodType.java @@ -34,7 +34,7 @@ public class ValidityPeriodType extends Object { } @FieldOrder(order = 0) - @IntRange(minValue=0,maxValue=700) + @IntRange(minValue=-1,maxValue=700) @Asn1Default(value="0") @Asn1Optional public Long validFromDay; @@ -47,7 +47,7 @@ public class ValidityPeriodType extends Object { @Asn1Optional public Long validFromUTCOffset; @FieldOrder(order = 3) - @IntRange(minValue=0,maxValue=370) + @IntRange(minValue=-1,maxValue=370) @Asn1Default(value="0") @Asn1Optional public Long validUntilDay; diff --git a/src/resources/uicBarcodeFCBv2.0.2.asn b/src/resources/uicBarcodeFCBv2.0.2.asn index 15c8c3d..5ac906d 100644 --- a/src/resources/uicBarcodeFCBv2.0.2.asn +++ b/src/resources/uicBarcodeFCBv2.0.2.asn @@ -240,7 +240,7 @@ ASN-Module DEFINITIONS AUTOMATIC TAGS ::= BEGIN trainIA5 IA5String OPTIONAL, -- planned departure date of the delayed train in local time at the station where delay - - became relevant (see below) + -- became relevant (see below) -- number of year departureYear INTEGER (2016..2269) OPTIONAL, -- number of the day in the year (1.1. = 1) @@ -868,7 +868,7 @@ ASN-Module DEFINITIONS AUTOMATIC TAGS ::= BEGIN -- in case no UTC offset is provided (RECOMMENDED) the local date time in the time zone of the current location of the traveler -- offset in units of 15 minutes from local time to UTC -- (UTC = local + offset * 15 Minutes) - validFromUTCOffset INTEGER (-60..60) OPTIONAL, the + validFromUTCOffset INTEGER (-60..60) OPTIONAL, -- end of validity (local time) -- number of days from valid from day, 0 = valid on valid-from-date diff --git a/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketComplexTestV1.java b/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketComplexTestV1.java new file mode 100644 index 0000000..4b1d61e --- /dev/null +++ b/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketComplexTestV1.java @@ -0,0 +1,89 @@ +package org.uic.barcode.ticket.api.test; + +import java.text.ParseException; +import java.util.TimeZone; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.uic.barcode.asn1.uper.UperEncoder; +import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData; +import org.uic.barcode.ticket.api.test.testtickets.OpenTestComplexTicketV1; + + + +/** + * The Class FipTimeZoneTestV1. + * + * + * + */ +public class OpenTicketComplexTestV1 { + + + + /** The ticket decoded 1. */ + UicRailTicketData ticket = null; + + byte[] encodedInTimeZone1 = null; + + + TimeZone defaulttimeZone = null; + + /** + * Prepare tickets. + */ + @Before public void prepare() { + + defaulttimeZone = TimeZone.getDefault(); + + //encode in UTC time zone + TimeZone.setDefault(TimeZone.getTimeZone("UTC")); + + + } + + /** + * clean up + */ + @After public void resetTimeZone() { + TimeZone.setDefault(defaulttimeZone); + } + + + /** + * Test encode test tickets in UTC and decode in CET. + * + * @throws IllegalArgumentException the illegal argument exception + * @throws IllegalAccessException the illegal access exception + * @throws ParseException + */ + @Test public void decoding() { + + //get tickets + String hex = OpenTestComplexTicketV1.getEncodingHex(); + byte[] content = UperEncoder.bytesFromHexString(hex); + ticket = UperEncoder.decode(content, UicRailTicketData.class); + + assert(ticket != null); + + } + + @Test public void encoding() throws IllegalArgumentException, IllegalAccessException, ParseException { + + //get tickets + ticket = OpenTestComplexTicketV1.getUicTestTicket(); + byte[] encoded = UperEncoder.encode(ticket); + + assert(encoded != null); + assert(encoded.length > 20); + + String encodedHex = UperEncoder.hexStringFromBytes(encoded); + String expectedHex = OpenTestComplexTicketV1.getEncodingHex(); + + assert(expectedHex.equals(encodedHex)); + + } + + +} diff --git a/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketComplexTestV2.java b/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketComplexTestV2.java new file mode 100644 index 0000000..da167c4 --- /dev/null +++ b/src/test/java/org/uic/barcode/ticket/api/test/OpenTicketComplexTestV2.java @@ -0,0 +1,96 @@ +package org.uic.barcode.ticket.api.test; + +import java.text.ParseException; +import java.util.TimeZone; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.uic.barcode.asn1.uper.UperEncoder; +import org.uic.barcode.ticket.api.asn.omv2.UicRailTicketData; +import org.uic.barcode.ticket.api.test.testtickets.OpenTestComplexTicketV2; + + + +/** + * The Class FipTimeZoneTestV2. + * + * + * + */ +public class OpenTicketComplexTestV2 { + + + + /** The ticket decoded 1. */ + UicRailTicketData ticket = null; + + byte[] encodedInTimeZone1 = null; + + + TimeZone defaulttimeZone = null; + + /** + * Prepare tickets. + */ + @Before public void prepare() { + + defaulttimeZone = TimeZone.getDefault(); + + //encode in UTC time zone + TimeZone.setDefault(TimeZone.getTimeZone("UTC")); + + + } + + /** + * clean up + */ + @After public void resetTimeZone() { + TimeZone.setDefault(defaulttimeZone); + } + + + /** + * Test encode test tickets in UTC and decode in CET. + * + * @throws IllegalArgumentException the illegal argument exception + * @throws IllegalAccessException the illegal access exception + * @throws ParseException + */ + @Test public void decoding() { + + //get tickets + String hex = OpenTestComplexTicketV2.getEncodingHex(); + byte[] content = UperEncoder.bytesFromHexString(hex); + ticket = UperEncoder.decode(content, UicRailTicketData.class); + + assert(ticket != null); + + } + + @Test public void encoding() throws IllegalArgumentException, IllegalAccessException, ParseException { + + //get tickets + String hex = OpenTestComplexTicketV2.getEncodingHex(); + byte[] content = UperEncoder.bytesFromHexString(hex); + ticket = UperEncoder.decode(content, UicRailTicketData.class); + + + //ticket = OpenTestComplexTicketV2.getUicTestTicket(); + byte[] encoded = UperEncoder.encode(ticket); + + + + assert(encoded != null); + assert(encoded.length > 20); + + String encodedHex = UperEncoder.hexStringFromBytes(encoded); + String expectedHex = OpenTestComplexTicketV2.getEncodingHex(); + + assert(expectedHex.equals(encodedHex)); + + } + + +} diff --git a/src/test/java/org/uic/barcode/ticket/api/test/testtickets/CustomerCardTestTicketV1.java b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/CustomerCardTestTicketV1.java index 09faac8..89cfb55 100644 --- a/src/test/java/org/uic/barcode/ticket/api/test/testtickets/CustomerCardTestTicketV1.java +++ b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/CustomerCardTestTicketV1.java @@ -115,6 +115,7 @@ import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData; tr.setIdCard("12345"); tr.setFirstName("John"); tr.setSecondName("Dow"); + tr.setYearOfBirth(1990L); tr.setDayOfBirth(100L); tr.setGender(GenderType.male); tr.setIdCard("IEDZ235FT"); diff --git a/src/test/java/org/uic/barcode/ticket/api/test/testtickets/CustomerCardTestTicketV2.java b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/CustomerCardTestTicketV2.java index 7f01b94..9630169 100644 --- a/src/test/java/org/uic/barcode/ticket/api/test/testtickets/CustomerCardTestTicketV2.java +++ b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/CustomerCardTestTicketV2.java @@ -115,7 +115,9 @@ import org.uic.barcode.ticket.api.asn.omv2.UicRailTicketData; tr.setIdCard("12345"); tr.setFirstName("John"); tr.setSecondName("Dow"); - tr.setDayOfBirth(100L); + tr.setYearOfBirth(1990L); + tr.setMonthOfBirth(1L); + tr.setDayOfBirth(21L); tr.setGender(GenderType.male); tr.setIdCard("IEDZ235FT"); return tr; diff --git a/src/test/java/org/uic/barcode/ticket/api/test/testtickets/OpenTestComplexTicketV1.java b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/OpenTestComplexTicketV1.java new file mode 100644 index 0000000..90c6861 --- /dev/null +++ b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/OpenTestComplexTicketV1.java @@ -0,0 +1,401 @@ +package org.uic.barcode.ticket.api.test.testtickets; + +import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringUTF8; +import org.uic.barcode.asn1.datatypesimpl.SequenceOfUnrestrictedLong; +import org.uic.barcode.ticket.api.asn.omv1.CardReferenceType; +import org.uic.barcode.ticket.api.asn.omv1.ControlData; +import org.uic.barcode.ticket.api.asn.omv1.CustomerStatusType; +import org.uic.barcode.ticket.api.asn.omv1.DocumentData; +import org.uic.barcode.ticket.api.asn.omv1.ExtensionData; +import org.uic.barcode.ticket.api.asn.omv1.IncludedOpenTicketType; +import org.uic.barcode.ticket.api.asn.omv1.IssuingData; +import org.uic.barcode.ticket.api.asn.omv1.LinkMode; +import org.uic.barcode.ticket.api.asn.omv1.OpenTicketData; +import org.uic.barcode.ticket.api.asn.omv1.PassengerType; +import org.uic.barcode.ticket.api.asn.omv1.RegionalValidityType; +import org.uic.barcode.ticket.api.asn.omv1.RouteSectionType; +import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCardReferenceType; +import org.uic.barcode.ticket.api.asn.omv1.SequenceOfCustomerStatusType; +import org.uic.barcode.ticket.api.asn.omv1.SequenceOfDocumentData; +import org.uic.barcode.ticket.api.asn.omv1.SequenceOfExtensionData; +import org.uic.barcode.ticket.api.asn.omv1.SequenceOfIncludedOpenTicketType; +import org.uic.barcode.ticket.api.asn.omv1.SequenceOfRegionalValidityType; +import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTariffType; +import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTicketLinkType; +import org.uic.barcode.ticket.api.asn.omv1.SequenceOfTravelerType; +import org.uic.barcode.ticket.api.asn.omv1.SequenceOfVatDetail; +import org.uic.barcode.ticket.api.asn.omv1.StationPassageData; +import org.uic.barcode.ticket.api.asn.omv1.TariffType; +import org.uic.barcode.ticket.api.asn.omv1.TicketDetailData; +import org.uic.barcode.ticket.api.asn.omv1.TicketLinkType; +import org.uic.barcode.ticket.api.asn.omv1.TicketType; +import org.uic.barcode.ticket.api.asn.omv1.TokenType; +import org.uic.barcode.ticket.api.asn.omv1.TravelClassType; +import org.uic.barcode.ticket.api.asn.omv1.TravelerData; +import org.uic.barcode.ticket.api.asn.omv1.TravelerType; +import org.uic.barcode.ticket.api.asn.omv1.UicRailTicketData; +import org.uic.barcode.ticket.api.asn.omv1.VatDetailType; +import org.uic.barcode.ticket.api.asn.omv1.ZoneType; + + + public class OpenTestComplexTicketV1 { + + public static UicRailTicketData getUicTestTicket() { + UicRailTicketData ticket = new UicRailTicketData(); + populateTicket(ticket); + return ticket; + } + + /* + value UicRailTicketData ::= { + issuingDetail { + issuingYear 2018 + issuingDay 1 + specimen TRUE, + securePaperTicket FALSE, + activated TRUE, + issuerPNR "issuerTestPNR", + issuedOnLine 12 + } + ,travelerDetail{ + traveler { + { + firstName "John" + ,secondName "Dow" + ,idCard "12345" + ,ticketHolder TRUE + ,status {{customerStatusDescr "senior" }} + } + } + ,groupName "myGroup" + } + ,transportDocument { + { + token {tokenProviderIA5 "VDV", token '82DA'H } + ,ticket openTicket : { + returnIncluded FALSE + ,classCode first + ,vatDetail { + { country 80 + ,percentage 70 + ,amount 10 + ,vatId "IUDGTE" + } + } + ,infoText "openTicketInfo" + ,includedAddOns { + { productOwnerNum 1080 + ,validRegion { zones : { zoneId { 100 } } } + ,validFromDay 0 + ,validFromTime 1000 + ,validUntilDay 1 + ,validUntilTime 1000 + ,classCode second + ,tariffs { + { numberOfPassengers 2 + ,passengerType adult + ,restrictedToCountryOfResidence FALSE + ,restrictedToRouteSection { fromStationNum 8000001 , toStationNum 8010000 } + } + } + ,infoText "included ticket" + } + } + } + } + ,{ + ticket stationPassage : { + productName "passage" + ,stationNameUTF8 { "Amsterdam" } + ,validFromDay 0 + ,numberOfDaysValid 123 + } + } + } + ,controlDetail { + identificationByCardReference { + { trailingCardIdNum 100 } + } + ,identificationByIdCard FALSE + ,identificationByPassportId FALSE + ,passportValidationRequired FALSE + ,onlineValidationRequired FALSE + ,ageCheckRequired FALSE + ,reductionCardCheckRequired FALSE + ,infoText "cd" + ,includedTickets { + { referenceIA5 "UED12435867" + ,issuerName "OEBB" + ,issuerPNR "PNR" + ,productOwnerIA5 "test" + ,ticketType pass + ,linkMode onlyValidInCombination + + } + } + } + ,extension { + { extensionId "1", extensionData '82DA'H } + ,{ extensionId "2", extensionData '83DA'H } + } + } + */ + + + + public static String getEncodingHex() { + return "78022020050DD3CF9F5CBCAA65E7D284EA40218A02D000822537B43701A237BB" + + "82B164CDA358088373CBBB4EFE40EDAF28EE4DEEAE004A03AD12B01416D08000" + + "00080E040713C46010A069356247A91439BDC195B951A58DAD95D125B999BC05" + + "02B41821B8090020080B23E800BE8201620010287A12007A390F0F696E636C75" + + "646564207469636B6574120220103B830B9B9B0B3B28084A0B6B9BA32B93230B" + + "680202F698040100B20004C6C802B70BAB1623164D19B570D9B8227A2A12101D" + + "09D4813A65E7D0A0402C40A0B680590141ED00"; + } + + + + private static void populateTicket(UicRailTicketData ticket) { + + ticket.setControlDetail(new ControlData()); + populate(ticket.getControlDetail()); + + + ticket.setIssuingDetail(new IssuingData()); + populateIssuingData(ticket.getIssuingDetail()); + + TravelerData td = new TravelerData(); + populateTravelerData(td); + ticket.setTravelerDetail(td); + + SequenceOfDocumentData ds = new SequenceOfDocumentData(); + + + //OpenTicket + DocumentData do1 = new DocumentData(); + addOpenTicketData(do1); + ds.add(do1); + + //StationPassage + DocumentData do2 = new DocumentData(); + addStationPassage(do2); + ds.add(do2); + + ticket.setTransportDocument(ds); + + SequenceOfExtensionData ed = new SequenceOfExtensionData(); + populateExtensionSequence(ed); + ticket.setExtension(ed); + + } + + private static void addStationPassage(DocumentData dd) { + TicketDetailData tdd = new TicketDetailData(); + StationPassageData sp = new StationPassageData(); + sp.setProductName("passage"); + sp.setValidFromDay(0L); + sp.setNumberOfDaysValid(123L); + SequenceOfStringUTF8 ss = new SequenceOfStringUTF8(); + ss.add("Amsterdam"); + sp.setStationNameUTF8(ss); + tdd.setStationPassage(sp); + dd.setTicket(tdd); + } + + /* + * + * returnIncluded FALSE + ,classCode first + ,vatDetail { + { country 80 + ,percentage 70 + ,amount 10 + ,vatId "IUDGTE" + } + } + ,infoText "openTicketInfo" + */ + private static void addOpenTicketData(DocumentData dd) { + TokenType to = new TokenType(); + to.setTokenProviderIA5("VDV"); + byte[] ba = { (byte) 0x82, (byte) 0xDA }; + to.setToken(ba); + dd.setToken(to); + + TicketDetailData tdd = new TicketDetailData(); + OpenTicketData otd = new OpenTicketData(); + otd.setInfoText("openTicketInfo"); + otd.setClassCode(TravelClassType.first); + otd.setReturnIncluded(false); + + otd.setIncludedAddOns(new SequenceOfIncludedOpenTicketType()); + otd.getIncludedAddOns().add(getIncludedOpenTicket()); + + otd.setVatDetails(new SequenceOfVatDetail()); + otd.getVatDetails().add(getVatDetail()); + + tdd.setOpenTicket(otd); + dd.setTicket(tdd); + + } + + private static VatDetailType getVatDetail() { + VatDetailType v = new VatDetailType(); + v.setAmount(10L); + v.setCountry(80L); + v.setPercentage(70L); + v.setVatId("IUDGTE"); + return v; + } + + /* + { productOwnerNum 1080 + ,validRegion { zones : { zoneId { 100 } } } + ,validFromDay 0 + ,validFromTime 1000 + ,validUntilDay 1 + ,validUntilTime 1000 + ,classCode second + ,tariffs { + { numberOfPassengers 2 + ,passengerType adult + ,restrictedToCountryOfResidence FALSE + ,restrictedToRouteSection { fromStationNum 8000001 , toStationNum 8010000 } + } + } + ,infoText "included ticket" + } + */ + + private static IncludedOpenTicketType getIncludedOpenTicket() { + IncludedOpenTicketType t = new IncludedOpenTicketType(); + t.setClassCode(TravelClassType.second); + t.setInfoText("included ticket"); + t.setProductOwnerNum(1080L); + t.setValidRegion(new SequenceOfRegionalValidityType()); + t.getValidRegion().add(getZone()); + t.setValidFromDay(0L); + t.setValidFromTime(1000L); + t.setValidUntilDay(1L); + t.setValidUntilTime(1000L); + t.setTariffs(new SequenceOfTariffType()); + t.getTariffs().add(getTariff()); + return t; + } + + + + + private static RegionalValidityType getZone() { + + RegionalValidityType r = new RegionalValidityType(); + ZoneType z = new ZoneType(); + z.setZoneId(new SequenceOfUnrestrictedLong()); + z.getZoneId().add(100L); + r.setZones(z); + return r; + } + + private static void populateTravelerData(TravelerData td) { + td.setGroupName("myGroup"); + SequenceOfTravelerType trs = new SequenceOfTravelerType(); + TravelerType tr = new TravelerType(); + tr.setIdCard("12345"); + tr.setFirstName("John"); + tr.setSecondName("Dow"); + tr.setTicketHolder(true); + SequenceOfCustomerStatusType ts = new SequenceOfCustomerStatusType(); + CustomerStatusType cst = new CustomerStatusType(); + cst.setCustomerStatusDescr("senior"); + ts.add(cst); + tr.setStatus(ts); + trs.add(tr); + td.setTraveler(trs); + } + + + private static void populateIssuingData(IssuingData issuingDetail) { + issuingDetail.setIssuingYear(2018L); + issuingDetail.setIssuingDay(1L); + issuingDetail.setIssuerPNR("issuerTestPNR"); + issuingDetail.setSpecimen(true); + issuingDetail.setSecurePaperTicket(false); + issuingDetail.setActivated(true); + issuingDetail.setIssuedOnLine(12L); + } + + + private static void populateExtensionSequence(SequenceOfExtensionData ed) { + ExtensionData ed1 = new ExtensionData(); + ed1.setExtensionId("1"); + byte[] ba1 = { (byte) 0x82, (byte) 0xDA }; + ed1.setExtensionData(ba1); + ExtensionData ed2 = new ExtensionData(); + ed2.setExtensionId("2"); + byte[] ba2 = { (byte) 0x83, (byte) 0xDA }; + ed2.setExtensionData(ba2); + ed.add(ed1); + ed.add(ed2); + } + + + private static void populate(ControlData controlDetail) { + controlDetail.infoText = "cd"; + controlDetail.setAgeCheckRequired(false); + controlDetail.setIdentificationByIdCard(false); + controlDetail.setIdentificationByPassportId(false); + controlDetail.setOnlineValidationRequired(false); + controlDetail.setPassportValidationRequired(false); + controlDetail.setReductionCardCheckRequired(false); + controlDetail.setIdentificationByCardReference(new SequenceOfCardReferenceType()); + controlDetail.getIdentificationByCardReference().add(populateCardRefrence()); + SequenceOfTicketLinkType sit = new SequenceOfTicketLinkType(); + populateLinkedTickets(sit); + controlDetail.setIncludedTickets(sit); + } + + + /* + * + */ + private static void populateLinkedTickets(SequenceOfTicketLinkType sequenceOfTicketLinkType) { + TicketLinkType tlt = new TicketLinkType(); + tlt.productOwnerIA5="test"; + tlt.setTicketType(TicketType.pass); + tlt.setIssuerPNR("PNR"); + tlt.setReferenceIA5("UED12435867"); + tlt.setLinkMode(LinkMode.onlyValidInCombination); + tlt.setIssuerName("OEBB"); + sequenceOfTicketLinkType.add(tlt); + } + + /* + { + trailingCardIdNum 100 + } + */ + private static CardReferenceType populateCardRefrence() { + CardReferenceType cr = new CardReferenceType(); + cr.setTrailingCardIdNum(100L); + return cr; + } + + private static TariffType getTariff() { + TariffType t = new TariffType(); + t.setNumberOfPassengers(2L); + t.setPassengerType(PassengerType.adult); + t.setRestrictedToRouteSection(getRouteSection()); + t.setRestrictedToCountryOfResidence(false); + return t; + } + + private static RouteSectionType getRouteSection() { + RouteSectionType r = new RouteSectionType(); + r.setFromStationNum(8000001L); + r.setToStationNum(8010000L); + + return r; + } + + + } diff --git a/src/test/java/org/uic/barcode/ticket/api/test/testtickets/OpenTestComplexTicketV2.java b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/OpenTestComplexTicketV2.java new file mode 100644 index 0000000..b5c5146 --- /dev/null +++ b/src/test/java/org/uic/barcode/ticket/api/test/testtickets/OpenTestComplexTicketV2.java @@ -0,0 +1,411 @@ +package org.uic.barcode.ticket.api.test.testtickets; + +import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringUTF8; +import org.uic.barcode.asn1.datatypesimpl.SequenceOfUnrestrictedLong; +import org.uic.barcode.ticket.api.asn.omv2.CardReferenceType; +import org.uic.barcode.ticket.api.asn.omv2.ControlData; +import org.uic.barcode.ticket.api.asn.omv2.CustomerStatusType; +import org.uic.barcode.ticket.api.asn.omv2.DocumentData; +import org.uic.barcode.ticket.api.asn.omv2.ExtensionData; +import org.uic.barcode.ticket.api.asn.omv2.IncludedOpenTicketType; +import org.uic.barcode.ticket.api.asn.omv2.IssuingData; +import org.uic.barcode.ticket.api.asn.omv2.LinkMode; +import org.uic.barcode.ticket.api.asn.omv2.OpenTicketData; +import org.uic.barcode.ticket.api.asn.omv2.PassengerType; +import org.uic.barcode.ticket.api.asn.omv2.RegionalValidityType; +import org.uic.barcode.ticket.api.asn.omv2.RouteSectionType; +import org.uic.barcode.ticket.api.asn.omv2.SequenceOfCardReferenceType; +import org.uic.barcode.ticket.api.asn.omv2.SequenceOfCustomerStatusType; +import org.uic.barcode.ticket.api.asn.omv2.SequenceOfDocumentData; +import org.uic.barcode.ticket.api.asn.omv2.SequenceOfExtensionData; +import org.uic.barcode.ticket.api.asn.omv2.SequenceOfIncludedOpenTicketType; +import org.uic.barcode.ticket.api.asn.omv2.SequenceOfRegionalValidityType; +import org.uic.barcode.ticket.api.asn.omv2.SequenceOfTariffType; +import org.uic.barcode.ticket.api.asn.omv2.SequenceOfTicketLinkType; +import org.uic.barcode.ticket.api.asn.omv2.SequenceOfTravelerType; +import org.uic.barcode.ticket.api.asn.omv2.SequenceOfVatDetail; +import org.uic.barcode.ticket.api.asn.omv2.StationPassageData; +import org.uic.barcode.ticket.api.asn.omv2.TariffType; +import org.uic.barcode.ticket.api.asn.omv2.TicketDetailData; +import org.uic.barcode.ticket.api.asn.omv2.TicketLinkType; +import org.uic.barcode.ticket.api.asn.omv2.TicketType; +import org.uic.barcode.ticket.api.asn.omv2.TokenType; +import org.uic.barcode.ticket.api.asn.omv2.TravelClassType; +import org.uic.barcode.ticket.api.asn.omv2.TravelerData; +import org.uic.barcode.ticket.api.asn.omv2.TravelerType; +import org.uic.barcode.ticket.api.asn.omv2.UicRailTicketData; +import org.uic.barcode.ticket.api.asn.omv2.VatDetailType; +import org.uic.barcode.ticket.api.asn.omv2.ZoneType; + + + public class OpenTestComplexTicketV2 { + + public static UicRailTicketData getUicTestTicket() { + UicRailTicketData ticket = new UicRailTicketData(); + populateTicket(ticket); + return ticket; + } + + /* + value UicRailTicketData ::= { + issuingDetail { + issuingYear 2018 + issuingDay 1 + specimen TRUE, + securePaperTicket FALSE, + activated TRUE, + issuerPNR "issuerTestPNR", + issuedOnLine 12 + } + ,travelerDetail{ + traveler { + { + firstName "John" + ,secondName "Dow" + ,idCard "12345" + ,ticketHolder TRUE + ,status {{customerStatusDescr "senior" }} + } + } + ,groupName "myGroup" + } + ,transportDocument { + { + token {tokenProviderIA5 "VDV", token '82DA'H } + ,ticket openTicket : { + returnIncluded FALSE + ,classCode first + ,vatDetail { + { country 80 + ,percentage 70 + ,amount 10 + ,vatId "IUDGTE" + } + } + ,infoText "openTicketInfo" + ,includedAddOns { + { productOwnerNum 1080 + ,validRegion { zones : { zoneId { 100 } } } + ,validFromDay 0 + ,validFromTime 1000 + ,validUntilDay 1 + ,validUntilTime 1000 + ,classCode second + ,tariffs { + { numberOfPassengers 2 + ,passengerType adult + ,restrictedToCountryOfResidence FALSE + ,restrictedToRouteSection { fromStationNum 8000001 , toStationNum 8010000 } + } + } + ,infoText "included ticket" + } + } + } + } + ,{ + ticket stationPassage : { + productName "passage" + ,stationNameUTF8 { "Amsterdam" } + ,validFromDay 0 + ,numberOfDaysValid 123 + } + } + } + ,controlDetail { + identificationByCardReference { + { trailingCardIdNum 100 } + } + ,identificationByIdCard FALSE + ,identificationByPassportId FALSE + ,passportValidationRequired FALSE + ,onlineValidationRequired FALSE + ,ageCheckRequired FALSE + ,reductionCardCheckRequired FALSE + ,infoText "cd" + ,includedTickets { + { referenceIA5 "UED12435867" + ,issuerName "OEBB" + ,issuerPNR "PNR" + ,productOwnerIA5 "test" + ,ticketType pass + ,linkMode onlyValidInCombination + + } + } + } + ,extension { + { extensionId "1", extensionData '82DA'H } + ,{ extensionId "2", extensionData '83DA'H } + } + } + */ + + + + public static String getEncodingHex() { + return + "78022020050DD3CF9F5CBCAA65E7D284EA40218A02D00041129BDA1B80D11BDD" + + "C158B266D1AC0441B9E5DDA77F2076D7947726F757002501D689580A0B684000" + + "0004070040713C46010A069356247A91439BDC195B951A58DAD95D125B999BC0" + + "502B418086E0240080202C8FA004FA0402C4002050F42400F4721E1ED2DCC6D8" + + "EAC8CAC840E8D2C6D6CAE8240440207706173736167650109416D73746572646" + + "16D00405ED300802016400098D90056E17562C462C9A336AE1B37044F4542420" + + "3A13A90274CBCFA140805881416D00B20283DA"; + } + + + + private static void populateTicket(UicRailTicketData ticket) { + + ticket.setControlDetail(new ControlData()); + populate(ticket.getControlDetail()); + + + ticket.setIssuingDetail(new IssuingData()); + populateIssuingData(ticket.getIssuingDetail()); + + TravelerData td = new TravelerData(); + populateTravelerData(td); + ticket.setTravelerDetail(td); + + SequenceOfDocumentData ds = new SequenceOfDocumentData(); + + + //OpenTicket + DocumentData do1 = new DocumentData(); + addOpenTicketData(do1); + ds.add(do1); + + //StationPassage + DocumentData do2 = new DocumentData(); + addStationPassage(do2); + ds.add(do2); + + ticket.setTransportDocument(ds); + + SequenceOfExtensionData ed = new SequenceOfExtensionData(); + populateExtensionSequence(ed); + ticket.setExtension(ed); + + } + + private static void addStationPassage(DocumentData dd) { + TicketDetailData tdd = new TicketDetailData(); + StationPassageData sp = new StationPassageData(); + sp.setProductName("passage"); + sp.setValidFromDay(0L); + sp.setNumberOfDaysValid(123L); + SequenceOfStringUTF8 ss = new SequenceOfStringUTF8(); + ss.add("Amsterdam"); + sp.setStationNameUTF8(ss); + tdd.setStationPassage(sp); + dd.setTicket(tdd); + } + + /* + * + * returnIncluded FALSE + ,classCode first + ,vatDetail { + { country 80 + ,percentage 70 + ,amount 10 + ,vatId "IUDGTE" + } + } + ,infoText "openTicketInfo" + */ + private static void addOpenTicketData(DocumentData dd) { + TokenType to = new TokenType(); + to.setTokenProviderIA5("VDV"); + byte[] ba = { (byte) 0x82, (byte) 0xDA }; + to.setToken(ba); + dd.setToken(to); + + TicketDetailData tdd = new TicketDetailData(); + OpenTicketData otd = new OpenTicketData(); + otd.setInfoText("openTicketInfo"); + otd.setClassCode(TravelClassType.first); + otd.setReturnIncluded(false); + + otd.setIncludedAddOns(new SequenceOfIncludedOpenTicketType()); + otd.getIncludedAddOns().add(getIncludedOpenTicket()); + + otd.setVatDetails(new SequenceOfVatDetail()); + otd.getVatDetails().add(getVatDetail()); + + tdd.setOpenTicket(otd); + dd.setTicket(tdd); + + } + + private static VatDetailType getVatDetail() { + VatDetailType v = new VatDetailType(); + v.setAmount(10L); + v.setCountry(80L); + v.setPercentage(70L); + v.setVatId("IUDGTE"); + return v; + } + + /* + { productOwnerNum 1080 + ,validRegion { zones : { zoneId { 100 } } } + ,validFromDay 0 + ,validFromTime 1000 + ,validUntilDay 1 + ,validUntilTime 1000 + ,classCode second + ,tariffs { + { numberOfPassengers 2 + ,passengerType adult + ,restrictedToCountryOfResidence FALSE + ,restrictedToRouteSection { fromStationNum 8000001 , toStationNum 8010000 } + } + } + ,infoText "included ticket" + } + */ + + private static IncludedOpenTicketType getIncludedOpenTicket() { + IncludedOpenTicketType t = new IncludedOpenTicketType(); + t.setClassCode(TravelClassType.second); + t.setInfoText("included ticket"); + t.setProductOwnerNum(1080L); + t.setValidRegion(new SequenceOfRegionalValidityType()); + t.getValidRegion().add(getZone()); + t.setValidFromDay(0L); + t.setValidFromTime(1000L); + t.setValidUntilDay(1L); + t.setValidUntilTime(1000L); + t.setTariffs(new SequenceOfTariffType()); + t.getTariffs().add(getTariff()); + return t; + } + + + + + private static RegionalValidityType getZone() { + + RegionalValidityType r = new RegionalValidityType(); + ZoneType z = new ZoneType(); + z.setZoneId(new SequenceOfUnrestrictedLong()); + z.getZoneId().add(100L); + r.setZones(z); + return r; + } + + private static void populateTravelerData(TravelerData td) { + td.setGroupName("myGroup"); + SequenceOfTravelerType trs = new SequenceOfTravelerType(); + TravelerType tr = new TravelerType(); + tr.setIdCard("12345"); + tr.setFirstName("John"); + tr.setSecondName("Dow"); + tr.setTicketHolder(true); + SequenceOfCustomerStatusType ts = new SequenceOfCustomerStatusType(); + CustomerStatusType cst = new CustomerStatusType(); + cst.setCustomerStatusDescr("senior"); + ts.add(cst); + tr.setStatus(ts); + trs.add(tr); + td.setTraveler(trs); + } + +/* + * issuingDetail { + issuingYear 2018 + issuingDay 1 + specimen TRUE, + securePaperTicket FALSE, + activated TRUE, + issuerPNR "issuerTestPNR", + issuedOnLine 12 + } + */ + private static void populateIssuingData(IssuingData issuingDetail) { + issuingDetail.setIssuingYear(2018L); + issuingDetail.setIssuingDay(1L); + issuingDetail.setIssuerPNR("issuerTestPNR"); + issuingDetail.setSpecimen(true); + issuingDetail.setSecurePaperTicket(false); + issuingDetail.setActivated(true); + issuingDetail.setIssuedOnLine(12L); + } + + + private static void populateExtensionSequence(SequenceOfExtensionData ed) { + ExtensionData ed1 = new ExtensionData(); + ed1.setExtensionId("1"); + byte[] ba1 = { (byte) 0x82, (byte) 0xDA }; + ed1.setExtensionData(ba1); + ExtensionData ed2 = new ExtensionData(); + ed2.setExtensionId("2"); + byte[] ba2 = { (byte) 0x83, (byte) 0xDA }; + ed2.setExtensionData(ba2); + ed.add(ed1); + ed.add(ed2); + } + + + private static void populate(ControlData controlDetail) { + controlDetail.infoText = "cd"; + controlDetail.setAgeCheckRequired(false); + controlDetail.setIdentificationByIdCard(false); + controlDetail.setIdentificationByPassportId(false); + controlDetail.setOnlineValidationRequired(false); + controlDetail.setPassportValidationRequired(false); + controlDetail.setReductionCardCheckRequired(false); + controlDetail.setIdentificationByCardReference(new SequenceOfCardReferenceType()); + controlDetail.getIdentificationByCardReference().add(populateCardRefrence()); + SequenceOfTicketLinkType sit = new SequenceOfTicketLinkType(); + populateLinkedTickets(sit); + controlDetail.setIncludedTickets(sit); + } + + + /* + * + */ + private static void populateLinkedTickets(SequenceOfTicketLinkType sequenceOfTicketLinkType) { + TicketLinkType tlt = new TicketLinkType(); + tlt.productOwnerIA5="test"; + tlt.setTicketType(TicketType.pass); + tlt.setIssuerPNR("PNR"); + tlt.setReferenceIA5("UED12435867"); + tlt.setLinkMode(LinkMode.onlyValidInCombination); + tlt.setIssuerName("OEBB"); + sequenceOfTicketLinkType.add(tlt); + } + + /* + { + trailingCardIdNum 100 + } + */ + private static CardReferenceType populateCardRefrence() { + CardReferenceType cr = new CardReferenceType(); + cr.setTrailingCardIdNum(100L); + return cr; + } + + private static TariffType getTariff() { + TariffType t = new TariffType(); + t.setNumberOfPassengers(2L); + t.setPassengerType(PassengerType.adult); + t.setRestrictedToRouteSection(getRouteSection()); + t.setRestrictedToCountryOfResidence(false); + return t; + } + + private static RouteSectionType getRouteSection() { + RouteSectionType r = new RouteSectionType(); + r.setFromStationNum(8000001L); + r.setToStationNum(8010000L); + + return r; + } + + } -- cgit v1.2.3