JavaPOSWorkingGroup / javapos-contracts

Hosts the interfaces and data types of the UnifiedPOS reference implementation for Java.
Other
8 stars 9 forks source link

PointCardRW: Property CapCardEntranceSensor Has Wrong Type #20

Closed mjpcger closed 11 months ago

mjpcger commented 1 year ago

The type of CapCardEntranceSensor is wrong, it must be boolean. Even if the UPOS specification specifies the type as int32 within chapter 28.2 Summary, chapter 28.4.2 CapCardEntranceSensor Property describes in detail that the type is bool and its value either true or false. However, I have no idea how this can be corrected because it is wrong since version 1.5! Has nobody ever implemented a PointCardRW service?!

kuniss commented 1 year ago

Good catch! An specification noncompliance since version 1.5 ...

There is no good solution for that due to JavaPOS's interface name based backward compatibility which is forced by Java's type system. The only solution which come in my mind is to introduce a new boolean property, e.g. CapCardEntranceSensorBool, and mark the old one as deprecated.

mjpcger commented 1 year ago

Since the UPOS specification specifies the property as int32 in the summary and as bool in the properties section, it is perhaps acceptable that the property is defined as int in Java.

However, since the specification only tells us that the value is true or false, we should specify values PCRW_TRUE and PCRW_FALSE in PointCardRWConst for that special case. Alternatively, we should specify JPOS_TRUE and JPOS_FALSE in JposConst to be fit for similar situations in any device class now and in future.

kuniss commented 1 year ago

I like JPOS_TRUE and JPOS_FALSE most!

I would then add to src/main/java/jpos/JposConst.java:

public static final int JPOS_FALSE = 0;
public static final int JPOS_TRUE =  1; 
kuniss commented 11 months ago

Fixed and released in https://github.com/JavaPOSWorkingGroup/javapos-contracts/releases/tag/1.15.2