Overview
The Central Transaction Repository (CTR) API integrates the Vynamic Retail Platform applications or any third-party POS systems with the Central Transaction Repository (CTR) storage.
CTR is a centralized, cloud-based long-term storage that stores, retrieves and maintains transaction details (documents) and event data.
Features
The CTR API provides the following features:
Transactions:
- Storing transaction details in CTR (POST/documents).
- Retrieving a list of stored POS transactions or documents from CTR (POST/documents/search).
- Retrieving from CTR the extended information on the stored POS transactions or documents, including their derivative documents (POST/documents/search-extended).
- Retrieving/tracking the total number of items yet to be returned using the original receipt, avoiding duplications in different shops/locations (POST/search/items).
- Retrieving stored POS transactions or documents from CTR in raw (GET/documents/raw) or unified (GET/documents/unified) format.
- Retrieving stored POS transactions or documents from CTR by ctrTransactionId in raw (GET/documents/raw/{ctrTransactionId}) or unified (GET/documents/unified/{ctrTransactionId}) format.
- Retrieving raw (POST/documents/raw-list) or unified (POST/documents/unified-list) information for a list of documents.
- Reloading of raw documents for processing into the unified format (from Cold Storage to Hot Storage) based on a list of CTR identifiers (POST/reload/processingList).
- Reloading of unified documents for reporting purposes from Hot Storage to the reporting database based on a list of CTR identifiers (POST/reload/reportingList).
- Retrieving and processing set-item details (itemContentLines)available in a duty-free transaction (GET/documents/unified) (GET/documents/unified/{ctrTransactionId}) (POST/documents/unified-list).
Analytics:
- Retrieving collection of average sales for specified shop items (POST/analytics/avg-sales-for-items).
- Retrieving collection of future movements for specified shop items (POST/analytics/future-movements).
- Retrieving the number of transactions for a business unit per chosen date range (POST/statistics).
Export configurations:
- Managing CTR's export configurations, so that only documents which meet the criteria are exported from CTR. Export configurations can be:
- registered (POST/config), updated (PUT/config/{id}) and unregistered (PATCH/config/{id}/unregister) in CTR
- retrieved from CTR (GET/config to retrieve all configurations and GET/config/{id} to retrieve a specific configuration)
- To manage export service which enables or disables an export configuration from CTR.
- Enables an export configuration from CTR(PATCH/config/enable).
- Disables an export configuration from CTR (PATCH/config/disable).
Process codes:
- Registering process codes (POST/processCode) in CTR and assigning process flag values to specific documents (POST/processCode/setProcessFlag), so that later the client can retrieve documents with a specified process code and flag value (POST/processCode/getDocumentsByProcessFlag).
- Checking of the process code existence (GET /processCode/exists) and retrieving documents with a specific process code and the CTR document Id (ctrTransactionId) value (GET /processCode/getProcessFlag).
Reports:
- Generating reports configured in CTR by adding certain parameters, according to a list of predefined report types. (POST/report/init to initiate a report with input parameters defined, GET/report/status/{exportId} to check status of a successfully initiated report, GET/report/download/{exportId} to download the ready report).
Report endpoints give access to analytical information for a particular period and could be used for example to evaluate the current customer billing metrics set according to standard pricing strategies. The generated report is prepared in the selected format (json or csv) and packed in the ZIP archive that is returned as a response.
Currently, the following Report Types are configured in CTR:
- Number of active business units - the number-of-active-business-units report is generated to check the total number of active sites in the system during a selected period, to prepare the correct invoice for customers.
- Number of active workstations - the number-of-active-workstations report is generated to check the total number of active touchpoints in the system during a selected period of time, to prepare the correct invoice for customers.
- Number of active documents registered in the system - the number-of-active-documents report is generated to check the total number of documents registered by CTR during a selected period of time, to prepare the correct invoice for customers.
- Average sales - the avg-sales-for-items report is generated to check the average sales of specified items per item ID, per business unit, for a selected period of time, to prepare correct invoice(s) for customers.
- Future movements - The future-movements report is generated to check the collection of future movements of specified items per item ID, per business unit, for a selected period of time, to prepare correct invoice(s) for customers.
- Billing data - the billing-data report type provides the following details:
- Total number of transactions performed on a POS for a given timeframe.
- Total number of transactions performed per day and per business unit basis
- The respective document types generated as part of the transaction(s)
- Accounting ledger - the accounting-ledger report is generated to display transactional data attached to item(s) by filtering by financial group/account or ledger IDs.
- contains end of day aggregates,
- provides granular details of each transaction(s) per day,
- accessible by the respective dealer responsible for specific transaction(s).
Events:
- Storing information about events, and retrieving them for auditing purposes: POST /events - initiates registering and storing an event, GET /events/{dbId} - retrieves an event based on internal identifiers, defined values and properties useful for further analysis, POST /events/search - searches and sorts events by a variety of filters.
Events endpoints store and retrieve details on all "non sale" activities, for example: cash drawer openings, suspended transactions, price changes, void receipts, customer or item modifications, etc.
Documents Batch Export:
- Extracting all unified documents in a single .zip file by using the respective filters obtained from the GET /search/filters. (POST /documentsBatch/init to initiate export for batch documents in a unified format, GET /documentsBatch/status/ {requestId} to check status of an export process, GET /documentsBatch/download/{requestId} to download the generated DocumentsBatch file).
Rehydration:
- Rehydration is the process to fully reconstitute documents from archive, so the transferred data can be accessed and used.
- When you encounter problems accessing documents from CTR and are informed that the required data are in the Archive Tier, you can initiate Rehydration Process using the POST /rehydration/init endpoint.
- The GET /rehydration/status/{rehydrationProcessId} endpoint retrieves the status of a rehydration process using the respective rehydrationProcessId.
Validation:
- A validation mechanism is adopted to enhance document processing, that ensures the correctness of values in the unified model. The GET /validation/details/{ctrUId} endpoint retrieves details about validation problems using ctrUid.
Health Check:
- GET /healthCheck endpoint allows the API client to check the status of the dependent backend services. On the 200 response, the client receives the overall status information: healthy, degraded, unhealthy.
Scheduler:
- CTR includes the Scheduler Service, to reload report-schedules configured in Vynamic Reporting Retail Management > Reporting > Report Builder > Vynamic Reporting - Scheduler.
Third Party Delivery Status:
- A tracking and validation mechanism in CTR (Central Transaction Repository) to track and verify whether documents have been successfully delivered to third-party client systems.
Customer:
- A new endpoint POST /api/v1/Customer/customer-visit has been introduced, which returns the customer visit information from the Central Transaction Repository so that the customer's visit history can be displayed on the Customer dashboard.
Request parameters such as Customer loyalty ID, Start date of the analysis period (dateFrom), and End date of the analysis period (dateTo) should return the following parameters in the response:
- lastVisit - the date of the customer's most recent eligible transaction within the specified period.
- countOfvisit - the total number of eligible customer transactions within the specified period.
Document structure and derivative documents
CTR supports arranging documents in a graph-like structure, meaning one document can be related to another document, which in turn can be related to another document. Only one document can sit at the top of the hierarchy (master document). The master document can have both direct and indirect children.
Important: This graph-like structure is represented as a one-dimensional array in JSON.
Using search filters
The POST/documents/search and POST/documents/search-extended endpoints enables using a range of filters such as, for example, businessUnitName or documentDateTime, to narrow down the search results.
Important: GET /search/filters endpoint returns a list of available filters used in search controllers.
To filter down search results, enter the filter's name as a value in the filters.name request parameter, and enter the filter's value(s) in the filters.value or filter.valueArray parameters.
Example
To search for all documents generated by FCx, use applicationId as a value in the filters.name parameter, and use FCx as a value in the filters.value parameter.
Security
The CTR API supports OAuth 2.0 for authentication purposes.
The supported protocol for the CTR API is HTTPS.