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

DE: cbReceiptReference exception thrown for wrong receiptCase #188

Closed
saschaknapp opened this issue Jul 24, 2023 · 1 comment · Fixed by #210
Closed

DE: cbReceiptReference exception thrown for wrong receiptCase #188

saschaknapp opened this issue Jul 24, 2023 · 1 comment · Fixed by #210
Assignees
Labels
bug Something isn't working market-de

Comments

@saschaknapp
Copy link
Contributor

saschaknapp commented Jul 24, 2023

Description:
When a single open transaction in the TSE should be closed then the "Failed-Transaction-Receipt" can be used. In such cases the cbReceiptReference has to be set or the following exception is thrown:
CbReceiptReference must be set for one transaction! If you want to close multiple transactions, pass an array value for 'CurrentStartedTransactionNumbers' via ftReceiptCaseData

Issue:
As this exception is only relevant for the "Fail-transaction-Receipt" it should only be thrown in the described case. But currently the middleware throws this exception even when the "Fail-transaction-receipt" isn't used. Example receipt request:

<ftReceiptCase type="number">4919338172267167745</ftReceiptCase>
  <ftReceiptCaseData type="string">KAZ060001185#03.05.22#07:41:05</ftReceiptCaseData>
  <ftCashboxID type="string">XXXXX</ftCashboxID>
  <cbTerminalID type="string">XXXXX</cbTerminalID>
  <cbUser type="string">{"ID":"XXXXXX","Name":""}</cbUser>
  <cbCustomer type="string">{"CustomerId":"","CustomerName":"","CustomerName2":"","CustomerStreet":"","CustomerStreet2":"","CustomerZip":"","CustomerCity":"","CustomerCountry":"","CustomerVATId":""}</cbCustomer>
  <cbReceiptReference type="string"></cbReceiptReference>
  <cbPreviousReceiptReference type="string">KAZ060001185</cbPreviousReceiptReference>
  <cbReceiptMoment type="string">2022-05-03T05:41:05Z</cbReceiptMoment>
  <cbChargeItems type="array">
    <item type="object">
      <ProductNumber type="string"></ProductNumber>
      <Description type="string">Vorgangsbeginn</Description>
      <a:item item="Description 2" type="string" xmlns:a="item"></a:item>
      <a:item item="Description 3" type="string" xmlns:a="item"></a:item>
      <Quantity type="number">0</Quantity>
      <UnitPrice type="number">0</UnitPrice>
      <Amount type="number">0</Amount>
      <VATRate type="number">0</VATRate>
      <VATAmount type="number">0</VATAmount>
      <ftChargeItemCase type="string">4919338167972134912</ftChargeItemCase>
      <ftChargeItemCaseData type="string">{"Reason Code":"Cashbox Verkauf Prozeß"}</ftChargeItemCaseData>
      <Moment type="string">2022-05-03T05:41:05Z</Moment>
    </item>
    <item type="object">
      <ProductNumber type="string"></ProductNumber>
      <Description type="string">Buche Wechselgeld aus</Description>
      <a:item item="Description 2" type="string" xmlns:a="item"></a:item>
      <a:item item="Description 3" type="string" xmlns:a="item"></a:item>
      <Quantity type="number">-1</Quantity>
      <UnitPrice type="number">-1054.32</UnitPrice>
      <Amount type="number">-1054.32</Amount>
      <VATRate type="number">0</VATRate>
      <VATAmount type="number">0</VATAmount>
      <ftChargeItemCase type="string">4919338167972135059</ftChargeItemCase>
      <ftChargeItemCaseData type="string">{Schließe Cashbox}</ftChargeItemCaseData>
      <Moment type="string">2022-05-03T05:41:05Z</Moment>
    </item>
  </cbChargeItems>
  <cbPayItems type="array">
    <item type="object">
      <Quantity type="number">-1</Quantity>
      <Amount type="number">-1054.32</Amount>
      <Description type="string">Buche Wechselgeld aus</Description>
      <ftPayItemCase type="string">4919338167972135000</ftPayItemCase>
      <ftPayItemCaseData type="string">{Schließe Cashbox}</ftPayItemCaseData>
      <Moment type="string">2022-05-03T05:41:05Z</Moment>
    </item>
  </cbPayItems>  

This is a regular receiptRequest with a "Failed receipt" flag and therefore shouldn't result in this exception. Possible cause: The condition that checks if the receipt is a "Fail-transaction-receipt" is negated and that might result in all receipts being checked except the relevant "Fail-transaction-receipt" if (string.IsNullOrEmpty(request.cbReceiptReference) && !request.IsFailTransactionReceipt() && !string.IsNullOrEmpty(request.ftReceiptCaseData) && !request.ftReceiptCaseData.Contains("CurrentStartedTransactionNumbers"))

if (string.IsNullOrEmpty(request.cbReceiptReference) && !request.IsFailTransactionReceipt() && !string.IsNullOrEmpty(request.ftReceiptCaseData) && !request.ftReceiptCaseData.Contains("CurrentStartedTransactionNumbers"))

@saschaknapp saschaknapp added the bug Something isn't working label Jul 24, 2023
@saschaknapp saschaknapp changed the title DE: cbReceiptReference exception thrown for wrong receipt DE: cbReceiptReference exception thrown for wrong receiptCase Jul 24, 2023
@StefanKert StefanKert self-assigned this Jul 27, 2023
This was referenced Jul 28, 2023
forsthug added a commit that referenced this issue Oct 19, 2023
…ption-thrown-for-wrong-receiptCase

#188-DE: cbReceiptReference exception thrown for wrong receiptCase
@forsthug
Copy link
Contributor

done

@volllly volllly linked a pull request Oct 24, 2023 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working market-de
Projects
None yet
4 participants