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

RFC: France copy receipt #192

Merged
merged 11 commits into from
Aug 7, 2023
Merged

RFC: France copy receipt #192

merged 11 commits into from
Aug 7, 2023

Conversation

volllly
Copy link
Contributor

@volllly volllly commented Aug 1, 2023

Adding a ftJournalFRCopyReceipts table in the FR Queue where we store copy receipts.

Rendered

  • Remove tmp code changes form the repo
  • Finish proposal
  • Answer unresolved/open questions

@volllly volllly requested a review from StefanKert August 2, 2023 09:20
@volllly volllly marked this pull request as ready for review August 2, 2023 09:20
@volllly volllly requested a review from a team as a code owner August 2, 2023 09:20
rfcs/192-fr-copy-receipt-performance.md Outdated Show resolved Hide resolved
rfcs/192-fr-copy-receipt-performance.md Outdated Show resolved Hide resolved
rfcs/192-fr-copy-receipt-performance.md Outdated Show resolved Hide resolved
rfcs/192-fr-copy-receipt-performance.md Outdated Show resolved Hide resolved
rfcs/192-fr-copy-receipt-performance.md Outdated Show resolved Hide resolved
rfcs/192-fr-copy-receipt-performance.md Outdated Show resolved Hide resolved
@StefanKert
Copy link
Member

StefanKert commented Aug 3, 2023

One thing that we can also consider as potential solution is using the RawData that is stored in the JournalFR. For CopyReceipts we are only considering items with Type 'C'. These items include the JWT token the data for those 'C' entries has always the same format:

{
  "qid": "4db995af-2a1e-4830-87db-09d14efc519c",
  "cbid": "CB-test-copy-receipt-issue",
  "siret": "30000000846572",
  "rid": "ft69#C1",
  "dt": "2023-07-21T14:57:42.9424889Z",
  "qiid": "1955a4a0-4deb-4b2e-8b8d-470864b4514f",
  "crr": "6ef0cabd-a07d-4132-9190-c229031f60bc",
  "csn": "08db89e71fd0e7b8",
  "rc": 5067112530745229000
}

We should be able to parse this data from JournalFR and group by the crrs IMO

private int GetCountOfExistingCopies(string cbPreviousReceiptReference)
{
   var count = 0;
   var copyJournals = parentStorage.JournalFRTableByType("C");
   foreach (var journal in copyJournals)
   {
      var handler = new JwtSecurityTokenHandler(); // or something similar for reading jwt tokens
      var jwtSecurityToken = handler.ReadJwtToken(token);
      var copiedReceiptReference = tokenS.Claims.First(claim => claim.Type == "crr").Value;
      if (copiedReceiptReference == cbPreviousReceiptReference)
      {
         count++;
      }
   }

   return count;
}

@volllly
Copy link
Contributor Author

volllly commented Aug 7, 2023

One thing that we can also consider as potential solution is using the RawData that is stored in the JournalFR. For CopyReceipts we are only considering items with Type 'C'. These items include the JWT token the data for those 'C' entries has always the same format:

This suggestion has been added to the RFC and released to sandbox as the first rc version in fiskaltrust.service.sqlite.1.2.23219.65461-rc1.

@volllly volllly merged commit d2635f3 into main Aug 7, 2023
7 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Aug 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants