cancel
Showing results for 
Search instead for 
Did you mean: 

Cancel temporary receipts using CCOM API

JoergAldinger
Active Contributor

Hello all,

We are trying to schedule a receipt cancellation for "temporary"/"preliminary" receipts, so that they do not accumulate on CCOM in large quantities for long periods.

However, we can't figure out the correct request. Here's our last try and the resulting error message ("missing organizational unit id"):

We have tried several additional properties, such as posGroupId and others, but can't figure out what we're missing. Can anyone help? sebastian.magin maybe?

Thanks and best regards,

Joerg.

0 Kudos

Hi Joerg,

Can you explain a bit more detailed what you mean by "temporary"/"preliminary" receipts? Are we talking about receipts in Table Service mode that have been in status open for a very long time?

Best regards

Sebastian

JoergAldinger
Active Contributor
0 Kudos

Hello sebastian.magin ,

No, basically "Parked" receipts are what I'm referring to. Sorry for not being clear. What we would like to achieve is set the receipts with status 4 (parked) to status 6 (aborted/void) after some amount of time (24 hours, one week, or whatever the customer requires). We could of course do this in the database itself, but we don't want to cause any inconsistencies doing so.

Thanks for the follow-up!

Joerg.

Accepted Solutions (0)

Answers (1)

Answers (1)

0 Kudos

Hi Joerg,

I would suggest you to use a combination of the following two requests:

The GET request will give you the full receipt from the manager.

The PUT request allows you to update a receipt.

You need another request to find the list of parked receipts. The following endpoint is unofficial so be careful when you use it.

GET internal/receipt/parked?posSystemId=<prefix>

This endpoint returns a list of parked receipts. It requires the prefix of a posSystem as a query-parameter.

When you combine the above mentioned request you can achieve your task. First of all use the parked receipt endpoint to fetch the list of parked receipts and identify the receipts that you want to cancel. Then you use the IDs those receipts to fetch the full receipt from the manager. Finally, you adapt the receipt and update it using a PUT request.

Best regards,

Sebastian

JoergAldinger
Active Contributor
0 Kudos

Hello sebastian.magin

I have prepared the process as you indicated. However, when I execute the PUT request, I am getting the response:

{ "errorCode" : "8", "errorMessage" : "Entity already exists" }
cancel_receipt() {
        response=`curl $verbose -G "$baseurl/api/internal/sync/receipts/$1" -H "X-Csrf-Token: $token" -b $cookiejar -s`
        echo "{\"receipt\": $response }" | jq '.receipt.status = "6"' > $tmp
        response=`curl $verbose -X PUT "$baseurl/api/internal/sync/receipts/$1" -H "X-Csrf-Token: $token" -H "Content-Type: application/json" -d @$tmp -b $cookiejar -s`
        echo $response
}

This is the function I am executing, basically just wrapping the receipt object and changing the status to 6...

Please let me know what could be wrong here...

Thanks!

Joerg.