From 7fdbb7106dc209b1bb1de9d8e6b56b8b131466f3 Mon Sep 17 00:00:00 2001 From: CGantert345 <57003061+CGantert345@users.noreply.github.com> Date: Fri, 26 Mar 2021 12:30:43 +0100 Subject: customer card fix and test --- .../barcode/ticket/api/asn/omv1/CustomerCardData.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/org/uic/barcode/ticket/api/asn') diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/CustomerCardData.java b/src/org/uic/barcode/ticket/api/asn/omv1/CustomerCardData.java index d0c5710..d67f857 100644 --- a/src/org/uic/barcode/ticket/api/asn/omv1/CustomerCardData.java +++ b/src/org/uic/barcode/ticket/api/asn/omv1/CustomerCardData.java @@ -21,7 +21,6 @@ package org.uic.barcode.ticket.api.asn.omv1; import java.util.Calendar; import java.util.Date; -import java.util.TimeZone; import org.uic.barcode.asn1.datatypes.Asn1BigInteger; import org.uic.barcode.asn1.datatypes.Asn1Optional; @@ -252,7 +251,6 @@ public class CustomerCardData extends Object { untilCal.setTime(untilDate); int untildays = untilCal.get(Calendar.DAY_OF_YEAR); - int yearDiff = untilCal.get(Calendar.YEAR) - fromCal.get(Calendar.YEAR); this.validUntilYear = new Long( yearDiff); @@ -262,14 +260,15 @@ public class CustomerCardData extends Object { public Date getValidFromDate (){ - if (this.validFromYear == null || this.validFromYear == 0) return null; + if (this.validFromYear == null || this.validFromDay == null) return null; Calendar cal = Calendar.getInstance(); cal.clear(); - cal.setTimeZone(TimeZone.getTimeZone("UTC")); + //cal.setTimeZone(TimeZone.getTimeZone("UTC")); cal.set(Calendar.YEAR, this.validFromYear.intValue()); cal.set(Calendar.DAY_OF_YEAR, this.validFromDay.intValue()); - + cal.set(Calendar.MINUTE,0); + cal.set(Calendar.HOUR_OF_DAY,0); return cal.getTime(); } @@ -277,17 +276,18 @@ public class CustomerCardData extends Object { public Date getValidUntilDate (){ - if (this.validUntilYear == null || this.validUntilYear == 0) return null; + if (this.validUntilYear == null || this.validUntilDay == null) return null; Calendar cal = Calendar.getInstance(); cal.clear(); - cal.setTimeZone(TimeZone.getTimeZone("UTC")); + //cal.setTimeZone(TimeZone.getTimeZone("UTC")); cal.set(Calendar.YEAR, this.validFromYear.intValue()); if (this.validUntilYear != null) { cal.add(Calendar.YEAR, this.validUntilYear.intValue()); } cal.set(Calendar.DAY_OF_YEAR, this.validUntilDay.intValue()); - + cal.set(Calendar.MINUTE,59); + cal.set(Calendar.HOUR_OF_DAY,23); return cal.getTime(); } -- cgit v1.2.3 From 8105ea23970d58a390c1df59fb041fadbb189d29 Mon Sep 17 00:00:00 2001 From: CGantert345 <57003061+CGantert345@users.noreply.github.com> Date: Fri, 26 Mar 2021 16:17:13 +0100 Subject: - voucher, customer card and parking using the upcoming interpretation of local date time --- .../uic/barcode/ticket/api/asn/omv1/ParkingGroundData.java | 6 +++--- src/org/uic/barcode/ticket/api/asn/omv1/VoucherData.java | 9 ++++++--- .../uic/barcode/ticket/api/asn/omv2/CustomerCardData.java | 14 ++++++++------ .../uic/barcode/ticket/api/asn/omv2/ParkingGroundData.java | 6 +++--- src/org/uic/barcode/ticket/api/asn/omv2/VoucherData.java | 9 ++++++--- 5 files changed, 26 insertions(+), 18 deletions(-) (limited to 'src/org/uic/barcode/ticket/api/asn') diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/ParkingGroundData.java b/src/org/uic/barcode/ticket/api/asn/omv1/ParkingGroundData.java index 8119502..8142ee1 100644 --- a/src/org/uic/barcode/ticket/api/asn/omv1/ParkingGroundData.java +++ b/src/org/uic/barcode/ticket/api/asn/omv1/ParkingGroundData.java @@ -47,7 +47,7 @@ public class ParkingGroundData extends Object { @FieldOrder(order = 2) @RestrictedString(CharacterRestriction.IA5String) - public String parkingGroundId; + public String parkingGroundId = ""; @FieldOrder(order = 3) @IntRange(minValue=0,maxValue=370) @@ -335,7 +335,7 @@ public class ParkingGroundData extends Object { public Date getFromParkingDate(Date issuingDate){ - return DateTimeUtils.getDate(issuingDate, this.fromParkingDate, null); + return DateTimeUtils.getDate(issuingDate, this.fromParkingDate, 0L); } @@ -343,7 +343,7 @@ public class ParkingGroundData extends Object { if ( this.toParkingDate == null) return null; - return DateTimeUtils.getDate(issuingDate, this.fromParkingDate + this.toParkingDate, null); + return DateTimeUtils.getDate(issuingDate, this.fromParkingDate + this.toParkingDate, 1439L); } diff --git a/src/org/uic/barcode/ticket/api/asn/omv1/VoucherData.java b/src/org/uic/barcode/ticket/api/asn/omv1/VoucherData.java index f721201..ab9eaea 100644 --- a/src/org/uic/barcode/ticket/api/asn/omv1/VoucherData.java +++ b/src/org/uic/barcode/ticket/api/asn/omv1/VoucherData.java @@ -21,7 +21,6 @@ package org.uic.barcode.ticket.api.asn.omv1; import java.util.Calendar; import java.util.Date; -import java.util.TimeZone; import org.uic.barcode.asn1.datatypes.Asn1BigInteger; import org.uic.barcode.asn1.datatypes.Asn1Optional; @@ -287,9 +286,11 @@ public class VoucherData extends Object { Calendar cal = Calendar.getInstance(); cal.clear(); - cal.setTimeZone(TimeZone.getTimeZone("UTC")); + //cal.setTimeZone(TimeZone.getTimeZone("UTC")); cal.set(Calendar.YEAR, this.validFromYear.intValue()); cal.set(Calendar.DAY_OF_YEAR, this.validFromDay.intValue()); + cal.set(Calendar.MINUTE,0); + cal.set(Calendar.HOUR_OF_DAY,0); return cal.getTime(); @@ -301,9 +302,11 @@ public class VoucherData extends Object { Calendar cal = Calendar.getInstance(); cal.clear(); - cal.setTimeZone(TimeZone.getTimeZone("UTC")); + //cal.setTimeZone(TimeZone.getTimeZone("UTC")); cal.set(Calendar.YEAR, this.validUntilYear.intValue()); cal.set(Calendar.DAY_OF_YEAR, this.validUntilDay.intValue()); + cal.set(Calendar.MINUTE,59); + cal.set(Calendar.HOUR_OF_DAY,23); return cal.getTime(); diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/CustomerCardData.java b/src/org/uic/barcode/ticket/api/asn/omv2/CustomerCardData.java index 4302f44..6ea31c1 100644 --- a/src/org/uic/barcode/ticket/api/asn/omv2/CustomerCardData.java +++ b/src/org/uic/barcode/ticket/api/asn/omv2/CustomerCardData.java @@ -262,14 +262,15 @@ public class CustomerCardData extends Object { public Date getValidFromDate (){ - if (this.validFromYear == null || this.validFromYear == 0) return null; + if (this.validFromYear == null || this.validFromDay == null) return null; Calendar cal = Calendar.getInstance(); cal.clear(); - cal.setTimeZone(TimeZone.getTimeZone("UTC")); + //cal.setTimeZone(TimeZone.getTimeZone("UTC")); cal.set(Calendar.YEAR, this.validFromYear.intValue()); cal.set(Calendar.DAY_OF_YEAR, this.validFromDay.intValue()); - + cal.set(Calendar.MINUTE,0); + cal.set(Calendar.HOUR_OF_DAY,0); return cal.getTime(); } @@ -277,17 +278,18 @@ public class CustomerCardData extends Object { public Date getValidUntilDate (){ - if (this.validUntilYear == null || this.validUntilYear == 0) return null; + if (this.validUntilYear == null || this.validUntilDay == null) return null; Calendar cal = Calendar.getInstance(); cal.clear(); - cal.setTimeZone(TimeZone.getTimeZone("UTC")); + //cal.setTimeZone(TimeZone.getTimeZone("UTC")); cal.set(Calendar.YEAR, this.validFromYear.intValue()); if (this.validUntilYear != null) { cal.add(Calendar.YEAR, this.validUntilYear.intValue()); } cal.set(Calendar.DAY_OF_YEAR, this.validUntilDay.intValue()); - + cal.set(Calendar.MINUTE,59); + cal.set(Calendar.HOUR_OF_DAY,23); return cal.getTime(); } diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/ParkingGroundData.java b/src/org/uic/barcode/ticket/api/asn/omv2/ParkingGroundData.java index 4f6f6d8..0eec185 100644 --- a/src/org/uic/barcode/ticket/api/asn/omv2/ParkingGroundData.java +++ b/src/org/uic/barcode/ticket/api/asn/omv2/ParkingGroundData.java @@ -47,7 +47,7 @@ public class ParkingGroundData extends Object { @FieldOrder(order = 2) @RestrictedString(CharacterRestriction.IA5String) - public String parkingGroundId; + public String parkingGroundId = ""; @FieldOrder(order = 3) @IntRange(minValue=0,maxValue=370) @@ -335,7 +335,7 @@ public class ParkingGroundData extends Object { public Date getFromParkingDate(Date issuingDate){ - return DateTimeUtils.getDate(issuingDate, this.fromParkingDate, null); + return DateTimeUtils.getDate(issuingDate, this.fromParkingDate, 0L); } @@ -343,7 +343,7 @@ public class ParkingGroundData extends Object { if ( this.toParkingDate == null) return null; - return DateTimeUtils.getDate(issuingDate, this.fromParkingDate + this.toParkingDate, null); + return DateTimeUtils.getDate(issuingDate, this.fromParkingDate + this.toParkingDate, 1439L); } diff --git a/src/org/uic/barcode/ticket/api/asn/omv2/VoucherData.java b/src/org/uic/barcode/ticket/api/asn/omv2/VoucherData.java index 458b040..1395976 100644 --- a/src/org/uic/barcode/ticket/api/asn/omv2/VoucherData.java +++ b/src/org/uic/barcode/ticket/api/asn/omv2/VoucherData.java @@ -21,7 +21,6 @@ package org.uic.barcode.ticket.api.asn.omv2; import java.util.Calendar; import java.util.Date; -import java.util.TimeZone; import org.uic.barcode.asn1.datatypes.Asn1BigInteger; import org.uic.barcode.asn1.datatypes.Asn1Optional; @@ -287,9 +286,11 @@ public class VoucherData extends Object { Calendar cal = Calendar.getInstance(); cal.clear(); - cal.setTimeZone(TimeZone.getTimeZone("UTC")); + //cal.setTimeZone(TimeZone.getTimeZone("UTC")); cal.set(Calendar.YEAR, this.validFromYear.intValue()); cal.set(Calendar.DAY_OF_YEAR, this.validFromDay.intValue()); + cal.set(Calendar.MINUTE,0); + cal.set(Calendar.HOUR_OF_DAY,0); return cal.getTime(); @@ -301,9 +302,11 @@ public class VoucherData extends Object { Calendar cal = Calendar.getInstance(); cal.clear(); - cal.setTimeZone(TimeZone.getTimeZone("UTC")); + //cal.setTimeZone(TimeZone.getTimeZone("UTC")); cal.set(Calendar.YEAR, this.validUntilYear.intValue()); cal.set(Calendar.DAY_OF_YEAR, this.validUntilDay.intValue()); + cal.set(Calendar.MINUTE,59); + cal.set(Calendar.HOUR_OF_DAY,23); return cal.getTime(); -- cgit v1.2.3