Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User/mmi/43308 failure scen repair #210

Merged
merged 20 commits into from Sep 23, 2021
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1,32 @@
### Failure Scenarios
This Chapter describes the different scenarios of failure when using the fiskaltrust.Middleware and how to handle them.

#### Failure of the fiskaltrust.Middleware
If a cash register cannot communicate with the fiskaltrust.Middleware it is most likely due to a failure of the fiskaltrust Middleware. Such a failure means that the electronic recording system is not operational and there is no access to the appropriate journal.
mijomilicevic marked this conversation as resolved.
Show resolved Hide resolved

![](./images/07-no-middleware-connection.png)
mijomilicevic marked this conversation as resolved.
Show resolved Hide resolved

In this case, the following steps must be taken:

- The cash register or input station must automatically produce a receipt and its copy.
- The receipt must be marked with the identification "electronic recording system failed" and with the current failure counter.
- This copy needs to be kept until the failure is resolved. The creation and storing of the receipt copy can also be done electronically by the cash register or terminal.
- After re-establishing the communication to fiskaltrust.Middleware, the cash register or the input station must send all receipts marked with the identification "receipt copy, electronic recording system failed" to fiskaltrust.Middleware. The ReceiptCase must be flagged with the code "failed receipt" in order to indicate the failure to fiskaltrust.Middleware, which will then issue a receipt response with the the ftState "Late Signing Mode".
volllly marked this conversation as resolved.
Show resolved Hide resolved

An alternative way of handling such situation is the generation of a handwritten receipt. A carbon copy (or another copy, e.g. electronic copy) must be created and archived. After re-establishing communication with fikaltrust.Middleware, these copies are subsequently to be recorded as receipts. The receipt code has to be combined with the "failed receipt" code in order to notify fiskaltrust.Middleware of the failure.

![](./images/08-late-signing-mode.png)

After fiskaltrust.Middleware has received an "end of failure receipt", the status of failure is terminated by receiving a response with normal state code.

![](./images/09-end-late-signing-mode.png)

#### Failure of the Signature Creation Unit
If the communication to the secure Signature Creation Device fails, the POS System can continue to operate until the SSCD is accessible again. Receipts created in a state where no communication is possible with the SSCD device are protected by the security mechanism of fiskaltrust.The fiskaltrust.Middleware will respond with the ftState = 0x02 "SSCD communication failed". The POS System receives the response and processes the data it contains. For following Requests no more communication attempts are done to avoid long waiting times for each Receipt request/Receipt response sequence.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might make sense to only speak about "SCU" here and not mix it with SSCD, e.g. like that:
"If the communication to the SCU fails (e.g. when the secure Signature Creation Device is not reachable), ..."

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also:

Suggested change
If the communication to the secure Signature Creation Device fails, the POS System can continue to operate until the SSCD is accessible again. Receipts created in a state where no communication is possible with the SSCD device are protected by the security mechanism of fiskaltrust.The fiskaltrust.Middleware will respond with the ftState = 0x02 "SSCD communication failed". The POS System receives the response and processes the data it contains. For following Requests no more communication attempts are done to avoid long waiting times for each Receipt request/Receipt response sequence.
If the communication to the secure Signature Creation Device fails, the POS System can continue to operate until the SSCD is accessible again. Receipts created in a state where no communication is possible with the SSCD device are protected by the security mechanism of fiskaltrust. The fiskaltrust.Middleware will respond with the ftState = `0x02` "SSCD communication failed". The POS System receives the response and processes the data it contains. For following Requests no more communication attempts are done to avoid long waiting times for each Receipt request/Receipt response sequence.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might make sense to write a paragraph about the failed mode and why we introduced it (the "official" pattern is called "circuit breaker")

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added failed-mode/circuit breaker explanation



![](./images/10-no-scu-connection.png)

When the SSCD is reachable again, a Zero-Receipt must be sent, which forces a communication retry towards the SSCD device. If the fiskaltrust.Middleware is able to connect to the SSCD again, the ftState = 0x00 (ok) is returned to the POS system via the response and the fiskaltrust.Middleware is ready for normal operation again. Furthermore, the response contains a listing of the requests that were not signed by the TSE. The requests affected by the failure of the communication with the SCU do not have to be sent to the Queue again after the problem has been resolved.
mijomilicevic marked this conversation as resolved.
Show resolved Hide resolved

![](./images/11-reestablished-connection.png)
Expand Up @@ -26,36 +26,26 @@ This additional receipt data, generated by fiskaltrust.SecurityMechanism, is sen

![](./images/01-security-mechanism.png)

<span id="_Toc527986801" class="anchor"></span>*Illustration 1. Process of the cash register integration with fiskaltrust.SecurityMechanism*

#### Workflow - regular operation

The following diagram illustrates the regular creation of a receipt with fiskaltrust.Middleware. The implementation of a fiskaltrust.SecurityMechanism may differ between countries and derive from their national laws – for details please refer to the appropriate appendix.

![](./images/02-regular-operation.png)

<span id="_Toc527986802" class="anchor"></span>*Illustration 2. Workflow - regular operation*

#### Workflow - special receipts

The following diagram illustrates the creation of a special receipt with fiskaltrust.Middleware. For a general description of special receipts, please refer to ["Receipt for special functions"](#c-receipt-for-special-functions-54) Chapter. For national laws on receipts, refer to the appropriate appendix.

![](./images/03-special-receipts.png)

<span id="_1597121563" class="anchor"></span>*Illustration 3. Workflow - special receipts*

#### Workflow - failure of communication or failure of the fiskaltrust.Middleware (timeout)

The following diagram illustrates the workflow of a failure of fiskaltrust.Middleware. For a description of recovering, please refer to the appropriate appendix.

![](./images/04-service-failure-timeout.png)

<span id="_Toc527986805" class="anchor"></span>*Illustration 4. Workflow - failure of the fiskaltrust.Middleware (timeout)*

![](./images/05-service-failure.png)

<span id="_Toc527986806" class="anchor"></span>*Illustration 5. Workflow - failure of the fiskaltrust.Middleware*

### <span id="c-receipt-for-special-functions-54">Receipt for special functions</span>

There are several receipt requirements fulfilled by the fiskaltrust.Middleware in addition to the usual receipts produced by business transactions. Those special receipts can support the process of collecting additional information.
Expand Down Expand Up @@ -83,16 +73,7 @@ This receipt has a meaningful response from fiskaltrust.SecurityMechanism only t
A closed queue can’t be reopened with a start receipt. Instead, a new queue has to be generated and initialized with a start receipt.

##### End of Failure Receipt (Collective Failure Report)

If the fiskaltrust.Middleware stopped responding, if the response does not comply with the interface description, or if a cash register cannot communicate with fiskaltrust.Middleware anymore, it is most likely due to a failure of fiskaltrust.Middleware. Such a failure means that the electronic recording system is not operational and there is no access to the appropriate journal. In such case, the following steps must be taken:

- The cash register or input station must automatically produce a receipt and its copy.
- The receipt must be marked with the identification "electronic recording system failed" and with the current failure counter.
- This copy needs to be kept until the failure is resolved. The creation and storing of the receipt copy can also be done electronically by the cash register or terminal.
- After re-establishing the communication to fiskaltrust.Middleware, the cash register or the input station must send all receipts marked with the identification "receipt copy, electronic recording system failed" to fiskaltrust.Middleware. The ReceiptCase must be flagged with the code "failed receipt" in order to indicate the failure to fiskaltrust.Middleware, which will then issue a receipt response with the identification "electronic recording system failed" for each receipt.

An alternative way of handling such situation is the generation of a handwritten receipt. A carbon copy (or another copy, e.g. electronic copy) must be created and archived. After re-establishing communication with fikaltrust.Middleware, these copies are subsequently to be recorded as receipts. The receipt code has to be combined with the "failed receipt" code in order to notify fiskaltrust.Middleware of the failure.

The End of failure Receipt is required to exit the late signing mode when the receipts created during a failure are transferred.
After fiskaltrust.Middleware has received an "end of failure receipt", the status of failure is terminated by receiving a response with normal state code.

### Receipt structure
Expand Down Expand Up @@ -137,4 +118,4 @@ The fiskaltrust.ReceiptJournal is used to record, hash, and chain all requests t

### fiskaltrust.ActionJournal

The fiskaltrust.ActionJournal collects all operational incidents. This can be the date and time of start or failure of the service, as well as any other information related to fiskaltrust.Middleware and fiskaltrust.SecurityMechanism.
The fiskaltrust.ActionJournal collects all operational incidents. This can be the date and time of start or failure of the service, as well as any other information related to fiskaltrust.Middleware and fiskaltrust.SecurityMechanism.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion doc/toc.md
@@ -1,6 +1,7 @@
# [General Part](general/general.md)
## [Terminology](general/terminology/terminology.md)
## [Cash Register Integration](general/cash-register-integration/cash-register-integration.md)
## [Cash Register Integration](general/cash-register-integration/cash-register-integration-regular-workflow.md)
## [Cash Register Integration](general/cash-register-integration/cash-register-integration-failure-scenarios.md)
## [Data Structures](general/data-structures/data-structures.md)
## [Function structures](general/function-structures/function-structures.md)
## [Communication](general/communication/communication.md)
Expand Down
13 changes: 10 additions & 3 deletions toc.js
Expand Up @@ -12,16 +12,23 @@ module.exports = {
items: [
'middleware-doc/doc/general/general',
'middleware-doc/doc/general/terminology/terminology',
'middleware-doc/doc/general/cash-register-integration/cash-register-integration',
{
type: 'category',
label: 'Cash register integration',
items: [
mijomilicevic marked this conversation as resolved.
Show resolved Hide resolved
'middleware-doc/doc/general/cash-register-integration/cash-register-integration-regular-workflow',
'middleware-doc/doc/general/cash-register-integration/cash-register-integration-failure-scenarios',
]
},
'middleware-doc/doc/general/data-structures/data-structures',
'middleware-doc/doc/general/function-structures/function-structures',
'middleware-doc/doc/general/communication/communication',
{
type: 'category',
label: 'Operation modes',
items: [
'middleware-doc/doc/general/operation-modes/operation-modes',
'middleware-doc/doc/general/operation-modes/configuration',
'middleware-doc/doc/general/operation-modes/operation-modes',
'middleware-doc/doc/general/operation-modes/configuration',
]
},
'middleware-doc/doc/general/installation/installation',
Expand Down