Class PosCapability
java.lang.Object
org.jpos.iso.PosFlags
org.jpos.iso.PosCapability
Structured representation of DE-027 (POS Capability) in the jPOS CMF.
DE-027 is a 27-byte fixed-length field that describes the capabilities
of the point-of-service terminal. It is the capability counterpart
of PosDataCode (DE-022), which records what actually happened.
Wire layout
Bytes 1- 4 Sub-field 27-1: card reading capability (B4, bit-flags) Bytes 5- 8 Sub-field 27-2: cardholder verification cap. (B4, bit-flags) Byte 9 Sub-field 27-3: approval code length (N1, ASCII) Bytes 10-12 Sub-field 27-4: cardholder receipt length (N3, ASCII) Bytes 13-15 Sub-field 27-5: card acceptor receipt length (N3, ASCII) Bytes 16-18 Sub-field 27-6: cardholder display length (N3, ASCII) Bytes 19-21 Sub-field 27-7: card acceptor display length (N3, ASCII) Bytes 22-24 Sub-field 27-8: ICC scripts data length (N3, ASCII) Byte 25 Sub-field 27-9: track 3 rewrite capability (A1, 'Y'/'N') Byte 26 Sub-field 27-10: card capture capability (A1, 'Y'/'N') Byte 27 Sub-field 27-11: PIN input length capability (B1, binary)
Sub-fields 27-1 and 27-2 share the same bit-flag tables as DE-022.
The PosDataCode.ReadingMethod and PosDataCode.VerificationMethod
enums are therefore reused directly.
The bit-numbering convention follows ISO 8583: B1 = MSB = 0x80.
Internally, PosFlags maps flag intValue() 1 to the LSB of
each 4-byte word and serialises little-endian within each word—identical to
PosDataCode. See the DE-022 spec note for the historical rationale.
Usage example:
// Build and pack
PosCapability cap = PosCapability.builder()
.readingCapability(PosDataCode.ReadingMethod.MAGNETIC_STRIPE)
.readingCapability(PosDataCode.ReadingMethod.ICC)
.verificationCapability(PosDataCode.VerificationMethod.ONLINE_PIN)
.verificationCapability(PosDataCode.VerificationMethod.MANUAL_SIGNATURE)
.approvalCodeLength(6)
.cardholderReceiptLength(40)
.cardAcceptorReceiptLength(40)
.cardholderDisplayLength(16)
.cardAcceptorDisplayLength(16)
.iccScriptDataLength(128)
.track3RewriteCapable(false)
.cardCaptureCapable(false)
.pinInputLength(12)
.build();
msg.set(new ISOBinaryField(27, cap.pack()));
// Unpack
PosCapability received = PosCapability.unpack(msg.getBytes(27));
if (received.canReadICC()) { ... }
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class PosFlags
PosFlags.FlagModifier and TypeClassDescriptionstatic interfaceSingle flag identified by its byte offset and bit-mask withinPosFlags.getBytes(). -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic PosCapability.Builderbuilder()Returns a newPosCapability.Builderfor constructing aPosCapability.booleanReturnstrueif the terminal can capture (retain) cards (sub-field 27-10).booleancanRead(PosDataCode.ReadingMethod method) Returnstrueif the terminal supports the given card reading method.booleanReturnstrueif the terminal supports contactless (RFID) reading.booleanReturnstrueif the terminal can read ICC (chip) cards.booleanReturnstrueif the terminal can read magnetic stripe cards.booleanReturnstrueif the terminal can rewrite magnetic stripe track 3 (sub-field 27-9).booleanReturnstrueif the terminal supports the given cardholder verification method.booleanReturnstrueif the terminal supports offline encrypted PIN entry.booleanReturnstrueif the terminal supports offline PIN entry in clear.booleanReturnstrueif the terminal supports online PIN entry.booleanReturnstrueif the terminal supports manual signature verification.voiddump(PrintStream p, String indent) Dumps a human-readable representation of thisPosCapabilityto the given stream.intReturns the maximum approval code length supported by this terminal (sub-field 27-3).byte[]getBytes()Returns the raw 27-byte wire buffer backing this instance.intReturns the maximum card acceptor display data length in characters (sub-field 27-7).intReturns the maximum card acceptor (merchant) receipt data length in characters (sub-field 27-5).intReturns the maximum cardholder display data length in characters (sub-field 27-6).intReturns the maximum cardholder receipt data length in characters (sub-field 27-4).intReturns the maximum ICC scripts data length in bytes (sub-field 27-8).intReturns the maximum PIN length the terminal's PIN pad can accept (sub-field 27-11).byte[]pack()Returns aPosCapability.Builderpre-populated with all values from this instance, allowing selective modification.static PosCapabilityunpack(byte[] data) Unpacks aPosCapabilityfrom a 27-byte wire buffer.
-
Field Details
-
WIRE_LENGTH
-
-
Method Details
-
getBytes
-
builder
Returns a newPosCapability.Builderfor constructing aPosCapability.- Returns:
- a new builder
-
unpack
Unpacks aPosCapabilityfrom a 27-byte wire buffer.- Parameters:
data- exactly 27 bytes- Returns:
- the decoded
PosCapability - Throws:
IllegalArgumentException- ifdatais null or not exactly 27 bytes
-
pack
-
toBuilder
Returns aPosCapability.Builderpre-populated with all values from this instance, allowing selective modification.- Returns:
- a builder initialised from this instance
-
canRead
Returnstrueif the terminal supports the given card reading method.- Parameters:
method- the reading method to test- Returns:
trueif the bit formethodis set
-
canReadICC
Returnstrueif the terminal can read ICC (chip) cards.- Returns:
trueifPosDataCode.ReadingMethod.ICCis set
-
canReadMagstripe
Returnstrueif the terminal can read magnetic stripe cards.- Returns:
trueifPosDataCode.ReadingMethod.MAGNETIC_STRIPEis set
-
canReadContactless
Returnstrueif the terminal supports contactless (RFID) reading.- Returns:
trueifPosDataCode.ReadingMethod.CONTACTLESSis set
-
canVerify
Returnstrueif the terminal supports the given cardholder verification method.- Parameters:
method- the verification method to test- Returns:
trueif the bit formethodis set
-
canVerifyOnlinePin
Returnstrueif the terminal supports online PIN entry.- Returns:
trueifPosDataCode.VerificationMethod.ONLINE_PINis set
-
canVerifyOfflinePinInClear
Returnstrueif the terminal supports offline PIN entry in clear.- Returns:
trueifPosDataCode.VerificationMethod.OFFLINE_PIN_IN_CLEARis set
-
canVerifyOfflinePinEncrypted
Returnstrueif the terminal supports offline encrypted PIN entry.- Returns:
trueifPosDataCode.VerificationMethod.OFFLINE_PIN_ENCRYPTEDis set
-
canVerifySignature
Returnstrueif the terminal supports manual signature verification.- Returns:
trueifPosDataCode.VerificationMethod.MANUAL_SIGNATUREis set
-
getApprovalCodeLength
Returns the maximum approval code length supported by this terminal (sub-field 27-3).- Returns:
- approval code length, 0–9
-
getCardholderReceiptLength
Returns the maximum cardholder receipt data length in characters (sub-field 27-4). A value of 0 indicates no receipt capability.- Returns:
- cardholder receipt length, 0–999
-
getCardAcceptorReceiptLength
Returns the maximum card acceptor (merchant) receipt data length in characters (sub-field 27-5). A value of 0 indicates no receipt capability.- Returns:
- card acceptor receipt length, 0–999
-
getCardholderDisplayLength
Returns the maximum cardholder display data length in characters (sub-field 27-6). A value of 0 indicates no display capability.- Returns:
- cardholder display length, 0–999
-
getCardAcceptorDisplayLength
Returns the maximum card acceptor display data length in characters (sub-field 27-7). A value of 0 indicates no display capability.- Returns:
- card acceptor display length, 0–999
-
getIccScriptDataLength
Returns the maximum ICC scripts data length in bytes (sub-field 27-8). A value of 0 indicates no ICC script capability.- Returns:
- ICC scripts data length, 0–999
-
canRewriteTrack3
Returnstrueif the terminal can rewrite magnetic stripe track 3 (sub-field 27-9).- Returns:
trueif track 3 rewrite is supported
-
canCaptureCard
Returnstrueif the terminal can capture (retain) cards (sub-field 27-10).- Returns:
trueif card capture is supported
-
getPinInputLength
Returns the maximum PIN length the terminal's PIN pad can accept (sub-field 27-11).- Returns:
- PIN input length capability, 0–255
-
dump
Dumps a human-readable representation of thisPosCapabilityto the given stream.- Parameters:
p- the output streamindent- indentation prefix
-