Asynchronous order completion
Sometimes intermittent network issues can cause the post payment steps of order completion to fail for an online sale. Connect will retry those parts of the process that have failed, but, because this happens synchronously, the client application will have to wait for a response. This may delay its ability to complete other tasks. To avoid this Connect may be configured to complete orders asynchronously, which allows it to retry the parts of the order-completion process that failed.
If Connect is configured in this way and you wish to retrieve updated loyalty points, print streams, or email information, this information can be obtained via polling or push notifications. Speak with the Connect administrators to determine whether asynchronous order completion is enabled and if so which retrieval method is recommended.
Note that asynchronous order completion will only take place after payment has successfully been recorded at the Cinema.
Polling
If asynchronous order completion is enabled, the CompleteOrder endpoint will return a BackgroundJobUrl
. This URL can be
polled until the order has been completed.
POST: /RESTTicketing.svc/order/payment
Response:
{
"ExtendedResultCode": 0,
"Result": 0,
"CinemaID": "0002",
"VistaBookingNumber": "4887",
"VistaBookingId": "WL37LZH",
"VistaTransNumber": "4509",
"HistoryID": "",
"PrintStream": "",
"PrintStreamCollection": null,
"PaymentInfoCollection": [
{ }
],
"BalanceList": null,
"PassCollection": null,
"ErrorDescription": null,
"BackgroundJobUrl": "https://abccinemas/api/WSVistaWebClient/BackgroundJob.svc/41cac4cdf31848b8a9d7d7f40a2f1c65",
"LoyaltyPointsCost": null,
"OrderEmails": []
}
A request can then be made to the BackgroundJobUrl
to get the status of the order.
GET: {{BackgroundJobUrl}}
Response:
{
"Status": "Pending",
"ResultCode": 0,
"CinemaId": "0002",
"UserSessionId": "58026",
"VistaBookingNumber": 4888,
"VistaBookingId": "WK33LX6",
"VistaTransNumber": 4510,
"BalanceList": [],
"ReceiptPrintStream": null,
"TicketPrintStream": null,
"OrderEmails": []
}
Once the order has been completed the Status
value will change to "Complete" and any requested additional information will be returned.
GET: {{BackgroundJobUrl}}
Response:
{
"Status": "Complete",
"ResultCode": 0,
"CinemaId": "0002",
"UserSessionId": "58026",
"VistaBookingNumber": 4888,
"VistaBookingId": "WK33LX6",
"VistaTransNumber": 4510,
"BalanceList": [],
"ReceiptPrintStream": "",
"TicketPrintStream": "",
"OrderEmails": [
{
"EmailAddress": "benjamin.button@email.com",
"Successful": true,
"EmailType": 0
}
]
}
Push notifications
Alternatively, an Azure Service Bus can be used to to push notifications on order completion. Talk to your Connect administrator to determine whether this service has been set up and to retrieve any connection details required. A .NET example of how to connect to an Azure Service Bus can be found in this Microsoft documentation
Pushed from Notification Queue
Response:
{
"Status": "Complete",
"ResultCode": 0,
"CinemaId": "004",
"UserSessionId": "55c0937b7988af907cb59e73ddcd99c8",
"VistaBookingNumber": 10099,
"VistaBookingId": "WG6FD9F",
"VistaTransNumber": 24663,
"BalanceTypes": null,
"ReceiptPrintStream": null,
"TicketPrintStream": null,
"OrderEmails": [
{
"EmailAddress": "james.cole@email.com",
"Successful": true,
"EmailType": 0
}
]
}