Package SampleCAT
Class CAT
- All Implemented Interfaces:
CATInterface
,JposBaseInterface
Sample device specific accessor class. The device uses the following commands:
- p%d\3 Set print line width. Parameters: Line width (must be ≥ 28).
- l%d\3 Lock or unlock terminal. Parameters: 0: unlock, 1: lock
- b\3 Begin transaction. s, v or r must follow.
- s%f\3 Set sale amount. Parameters: Amount.
- c%d\2%d\3 Commit operation. Parameters: No. of transaction to be committed, result (0: Verification error, 1: Signature verified). Mandatory after sign-based sale operations.
- r%f\3 Set return amount. Parameters: Amount.
- v%d\3 Void transaction. Parameters: No. of transaction to be voided.
- a\3 Abort operation.
- L%d\3 Lock terminal. Parameters: Result code (0: OK, 4: just locked).
- U%d\3 Unlock terminal. Parameters: Result code (0: OK, 4: just unlocked).
- B%d\3 Begin transaction. Parameters: Result code (0: OK, 4: just locked, 6: waiting for commit, 7: authorization active).
- E%d\3 End. Parameters: Result code (0: OK, 3: Abort, 4: locked, 5: no transaction, 6: wait for commit, 7: other operation active, 8: invalid transaction).
- E%d\2%s\2%s\2%s\2%s\2%s\2%s\2%s\2%s\2%s\3 End processing. Parameters: Result code (0: OK, 1: wait for commit, 2: Error), Result code (0: no error), approval result (0: OK, 1111: check, else error), balance, tip (included in balance), card issuer (abbreviation, see IssuerList), card no (last 4 digits), expiration date, transaction number, transaction time (format YYYYmmddTHHMMSS).
- D%d\2%s\3 Display line. Parameters: line no (0-3), contents (UTF-8).
- P%d\2%s\3 Print ticket. Parameters: count (1-2), ticket data (UTF-8), may contain line feeds.
-
Field Summary
Fields inherited from class de.gmxhome.conrad.jpos.jpos_base.cat.CATProperties
AccountNumber, AdditionalSecurityInformation, ApprovalCode, Balance, CapAdditionalSecurityInformation, CapAuthorizeCompletion, CapAuthorizePreSales, CapAuthorizeRefund, CapAuthorizeVoid, CapAuthorizeVoidPreSales, CapCashDeposit, CapCenterResultCode, CapCheckCard, CapDailyLog, CapInstallments, CapLockTerminal, CapLogStatus, CapPaymentDetail, CapTaxOthers, CapTrainingMode, CapTransactionNumber, CapUnlockTerminal, CardCompanyID, CenterResultCode, DailyLog, LogStatus, PaymentCondition, PaymentDetail, PaymentMedia, SequenceNumber, SettledAmount, SlipNumber, TrainingMode, TransactionNumber, TransactionType
Fields inherited from class de.gmxhome.conrad.jpos.jpos_base.JposCommonProperties
AllowAlwaysSetProperties, AllowDeprecatedMethods, AsyncInputActive, AsyncMode, AutoDisable, CapStatisticsReporting, CapUpdateStatistics, CheckHealthText, Claimed, Claiming, ClaimWaiters, CurrentCommands, CurrentUnitID, DataCount, DataEventEnabled, DataEventList, Device, DeviceEnabled, DeviceServiceDescription, DeviceServiceVersion, DevProps, ErrorString, ErrorUnits, EventCB, EventList, EventSource, EventString, EventUnitID, EventUnits, ExclusiveAllowed, ExclusiveNo, ExclusiveUse, ExclusiveYes, FirstEnableHappened, FlagWhenIdle, FlagWhenIdleStatusValue, FreezeEvents, Index, LogicalName, MaximumConfirmationEventWaitingTime, OutputID, PowerNotify, PowerState, SerializedRequestRunner, SerializedRequests, State, StrictFIFOEventHandling, SuspendedCommands, SuspendedConcurrentCommands, UnitsOnline, UsesSubsystemUnits
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
authorizeRefund(AuthorizeRefund request)
Final part of AuthorizeRefund method.void
authorizeSales(AuthorizeSales request)
Final part of AuthorizeSales method.authorizeVoid(int sequenceNumber, long amount, long taxOthers, int timeout)
Validation part of AuthorizeVoid method.void
authorizeVoid(AuthorizeVoid request)
Final part of AuthorizeVoid method.void
checkHealth(int level)
Final part of CheckHealth method.void
claim(int timeout)
Final part of setting claim.void
Clear output processing.void
deviceEnabled(boolean enable)
Final part of setting DeviceEnabled.void
Will be called whenever DeviceEnabled will be set to true if power notification is enabled (PowerNotify = PN_ENABLED).void
release()
Final part of release method.Methods inherited from class de.gmxhome.conrad.jpos.jpos_base.cat.CATProperties
accessDailyLog, accessDailyLog, additionalSecurityInformation, authorizeCompletion, authorizeCompletion, authorizePreSales, authorizePreSales, authorizeRefund, authorizeSales, authorizeVoidPreSales, authorizeVoidPreSales, cashDeposit, cashDeposit, checkCard, checkCard, initOnOpen, lockTerminal, lockTerminal, paymentMedia, trainingMode, unlockTerminal, unlockTerminal
Methods inherited from class de.gmxhome.conrad.jpos.jpos_base.JposCommonProperties
addProperties, asyncMode, attachWaiter, autoDisable, checkForDeprecation, checkProperties, clearDataProperties, clearErrorProperties, clearInput, clearOutputErrorProperties, close, compareFirmwareVersion, dataEventEnabled, directIO, directIO, flagWhenIdle, freezeEvents, getClaimingInstance, initOnClaim, initOnEnable, initOnFirstEnable, newJposOutputRequest, open, powerNotify, releaseWaiter, removeFromPropertySetList, resetStatistics, retrieveStatistics, retryInput, retryOutput, signalWaiter, unitDataCount, updateFirmware, updateFirmware, updateStatistics, waitWaiter
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface de.gmxhome.conrad.jpos.jpos_base.JposBaseInterface
asyncMode, autoDisable, clearInput, close, compareFirmwareVersion, dataEventEnabled, directIO, directIO, flagWhenIdle, freezeEvents, newJposOutputRequest, open, powerNotify, removeFromPropertySetList, resetStatistics, retrieveStatistics, retryInput, retryOutput, unitDataCount, updateFirmware, updateFirmware, updateStatistics
-
Constructor Details
-
CAT
Constructor. Gets instance of Device to be used as communication object. Device index for sample is always 0.- Parameters:
dev
- Instance of Device that controls the communication with the terminal.
-
-
Method Details
-
claim
public void claim(int timeout) throws jpos.JposExceptionDescription copied from interface:JposBaseInterface
Final part of setting claim. Can be overwritten within derived classes. This method will be called only if the following plausibility checks lead to a positive result:- Device has not been closed,
- The device is not claimed,
- ExclusiveUse dos not equal ExclusiveNo,
- timeout is negative not equal to FOREVER.
- Specified by:
claim
in interfaceJposBaseInterface
- Overrides:
claim
in classJposCommonProperties
- Parameters:
timeout
- see UPOS specification, method Claim- Throws:
jpos.JposException
- If an error occurs while claiming the device
-
release
public void release() throws jpos.JposExceptionDescription copied from interface:JposBaseInterface
Final part of release method. Can be overwritten in derived class, if necessary. This method will be called only if the following plausibility checks lead to a positive result:- Device is claimed,
- ExclusiveUse equals ExclusiveYes: Device is not enabled.
- Specified by:
release
in interfaceJposBaseInterface
- Overrides:
release
in classJposCommonProperties
- Throws:
jpos.JposException
- See UPOS specification, method Release
-
checkHealth
public void checkHealth(int level) throws jpos.JposExceptionDescription copied from interface:JposBaseInterface
Final part of CheckHealth method. Can be overwritten in derived class, if necessary. Keep in mind that dvice class specific checks (e.g. check of Claimed or DeviceEnabled) must be done within derived classes. This method will be called only if the following plausibility checks lead to a positive result:- Device is neither enabled nor claimed.
- Specified by:
checkHealth
in interfaceJposBaseInterface
- Overrides:
checkHealth
in classJposCommonProperties
- Parameters:
level
- See UPOS specification, method CheckHealth- Throws:
jpos.JposException
- See UPOS specification, method CheckHealth
-
deviceEnabled
public void deviceEnabled(boolean enable) throws jpos.JposExceptionDescription copied from interface:JposBaseInterface
Final part of setting DeviceEnabled. Can be overwritten within derived classes. Performs initOnEnable method of corresponding property set in addition to setting DeviceEnabled. This method will be called only if the following plausibility checks lead to a positive result:- Device has not been closed,
- ExclusiveUse equals ExclusiveYes: Device is claimed,
- DeviceEnabled != enabled.
- Specified by:
deviceEnabled
in interfaceJposBaseInterface
- Overrides:
deviceEnabled
in classJposCommonProperties
- Parameters:
enable
- True to enable, false to disable- Throws:
jpos.JposException
- If an error occurs during enable or disable
-
handlePowerStateOnEnable
public void handlePowerStateOnEnable() throws jpos.JposExceptionDescription copied from interface:JposBaseInterface
Will be called whenever DeviceEnabled will be set to true if power notification is enabled (PowerNotify = PN_ENABLED). Should update the PowerState property. Further processing like firing a StatusUpdateEvent is not necessary, this will be made by the framework automatically.- Specified by:
handlePowerStateOnEnable
in interfaceJposBaseInterface
- Overrides:
handlePowerStateOnEnable
in classJposCommonProperties
- Throws:
jpos.JposException
- If an error occurs.
-
authorizeSales
Description copied from interface:CATInterface
Final part of AuthorizeSales method. Can be overwritten within derived classes, if necessary. The parameters of the method will be passed via a AuthorizeSales object. This method will be called when the corresponding operation shall be performed, either synchronously or asynchronously. All plausibility checks have been made before, only runtime errors can occur.- Specified by:
authorizeSales
in interfaceCATInterface
- Overrides:
authorizeSales
in classCATProperties
- Parameters:
request
- Output request object returned by validation method that contains all parameters to be used by AuthorizeSales.- Throws:
jpos.JposException
- If an error occurs.
-
authorizeVoid
public AuthorizeVoid authorizeVoid(int sequenceNumber, long amount, long taxOthers, int timeout) throws jpos.JposExceptionDescription copied from interface:CATInterface
Validation part of AuthorizeVoid method. Can be overwritten within derived classes, if necessary. This method shall only perform additional validation. It will be called before the service buffers the method call for synchronous or asynchronous execution. This method will be called only if the following plausibility checks lead to a positive result:- Device is enabled,
- Device is not busy,
- CapAuthorizeVoid is true,
- amount > 0, taxOthers $ge; 0,
- timeout is JPOS_FOREVER or ≥ 0.
- Specified by:
authorizeVoid
in interfaceCATInterface
- Overrides:
authorizeVoid
in classCATProperties
- Parameters:
sequenceNumber
- Sequence number, any value.amount
- Purchase amount for approval.taxOthers
- Tax and other amounts for approval.timeout
- operation timeout.- Returns:
- AuthorizeVoid object for use in final part.
- Throws:
jpos.JposException
- If an error occurs.
-
authorizeVoid
Description copied from interface:CATInterface
Final part of AuthorizeVoid method. Can be overwritten within derived classes, if necessary. The parameters of the method will be passed via a AuthorizeVoid object. This method will be called when the corresponding operation shall be performed, either synchronously or asynchronously. All plausibility checks have been made before, only runtime errors can occur.- Specified by:
authorizeVoid
in interfaceCATInterface
- Overrides:
authorizeVoid
in classCATProperties
- Parameters:
request
- Output request object returned by validation method that contains all parameters to be used by AuthorizeVoid.- Throws:
jpos.JposException
- If an error occurs.
-
authorizeRefund
Description copied from interface:CATInterface
Final part of AuthorizeRefund method. Can be overwritten within derived classes, if necessary. The parameters of the method will be passed via a AuthorizeRefund object. This method will be called when the corresponding operation shall be performed, either synchronously or asynchronously. All plausibility checks have been made before, only runtime errors can occur.- Specified by:
authorizeRefund
in interfaceCATInterface
- Overrides:
authorizeRefund
in classCATProperties
- Parameters:
request
- Output request object returned by validation method that contains all parameters to be used by AuthorizeRefund.- Throws:
jpos.JposException
- If an error occurs.
-
clearOutput
public void clearOutput() throws jpos.JposExceptionDescription copied from interface:JposBaseInterface
Clear output processing. Removes all OutputCompleteEvents and ErrorEvents from event queue and sets State to S_IDLE. Clears all outstanding commands of the given property set as well. This method will be called only if the following plausibility checks lead to a positive result:- Device has not been closed,
- ExclusiveUse equals ExclusiveYes: Device is claimed.
- Specified by:
clearOutput
in interfaceJposBaseInterface
- Overrides:
clearOutput
in classJposCommonProperties
- Throws:
jpos.JposException
- See UPOS specification, method ClearOutput
-