# Migration to V4

## Authorization result

### TokenId

property `AccessToken` has been renamed to `TokenId` in [authorization result](/authentication/authentication-schemes/jwt-bearer-authentication.md).

## Article category

### SortHint

`SortHint` property has been added to achieve user defined article categories sorting in cash register application. This optional property is of nullable integer type. Article categories with lowest value are displayed first, `null` have lowest priority. Categories with same `SortHint` value are sorted alphabetically.

Example:

<table><thead><tr><th width="266.5">SortHint</th><th>Description</th></tr></thead><tbody><tr><td>0</td><td>Beers</td></tr><tr><td>0</td><td>Drinks</td></tr><tr><td>1</td><td>Pizza</td></tr><tr><td>2</td><td>Wine</td></tr><tr><td>null</td><td>Beverages</td></tr><tr><td>null</td><td>Specials</td></tr></tbody></table>

### Tags

New optional `string` collection property that helps to associate user-defined tags with article category. Based on tags collection, new reports are available in statistics in both PORTOS CashRegister (Pokladňa) and PORTOS BackOffice applications.

## Customer

The customer resource has has undergone many improvements, e.g. each customer account can now be associated with multiple cards. Please see table below for more information.

| Name (v3)        | Name (v4)            | Note                                                                                                                                                                                                                                                                                              |
| ---------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| -                | `ActivationTime`     | New property that specifies date and time, from which customer account can be associated with `Ticket`.                                                                                                                                                                                           |
| `Address`        | `Address`            | Object properties has been changed. `ZipCode` has been renamed to `PotalCode`. New `Coordinates` property has been added (object with `Longitude` and `Latitude` properties). New `Note` property has been added (optional `string` property to store additional information related to address). |
| -                | `BirthDate`          | Optional customer birth date.                                                                                                                                                                                                                                                                     |
| `CardId`         | -                    | This property has been removed. Card identifier is moved to `SerialNumber` property of element in `Cards` collection.                                                                                                                                                                             |
| -                | `Cards`              | Collection of cards associated with this customer.                                                                                                                                                                                                                                                |
| -                | `Company`            | New property that aggregates company-related information. Properties: `Name`, `CRN`, `VatId`, `TaxId`.                                                                                                                                                                                            |
| `Contact`        | -                    | This property has been removed. `Fax` and `Mobile` properties has been removed (values are available in `Meta` object after migration). `Phone` and `Email` values are moved to root object (`Customer.Phone` and `Customer.Email`).                                                              |
|                  | `CreditTransactions` | Collection of transactions that affects `Credit` property.                                                                                                                                                                                                                                        |
| `CRN`            | -                    | Moved to `Customer.Company.CRN`.                                                                                                                                                                                                                                                                  |
| -                | `DeliveryAddress`    | New optional delivery address property of type `CustomerAddress`.                                                                                                                                                                                                                                 |
| `ExpirationDate` | `ExpirationTime`     | Renamed.                                                                                                                                                                                                                                                                                          |
| -                | `ExternalId`         | Optional unique identifier supplied by external system.                                                                                                                                                                                                                                           |
| -                | `FirstName`          | Optional customer first (given) name.                                                                                                                                                                                                                                                             |
|                  | `Gender`             | Optional gender. One of folowing: `Male`, `Female` or `null` (for unknown or other).                                                                                                                                                                                                              |
| -                | `Id`                 | New unique identifier (in v3, `CardId` has been used as unique identifier).                                                                                                                                                                                                                       |
| -                | `IsCompany`          | Boolean value that specifies whether this customer represents company.                                                                                                                                                                                                                            |
|                  | `LastName`           | Optional customer last (family) name.                                                                                                                                                                                                                                                             |
| `Name`           | `FullName`           | Renamed.                                                                                                                                                                                                                                                                                          |
| -                | `Note`               | Optional note related to customer.                                                                                                                                                                                                                                                                |
| -                | `Meta`               | Object that hold any additional data (may be supplied by external system).                                                                                                                                                                                                                        |
| -                | `Status`             | New overall status of customer card. Value is one of following: `Valid`, `NotYetValid`, `Expired`.                                                                                                                                                                                                |
| `TaxId`          | -                    | Moved to `Customer.Company.TaxId`.                                                                                                                                                                                                                                                                |
| `VatId`          | -                    | Moved to `Customer.Company.VatId`.                                                                                                                                                                                                                                                                |

## Plu

| Name (v3)           | Name (v4)           | Note                                                                                                                                                |
| ------------------- | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| `LastPurchasePrice` | `LastPurchasePrice` | Now stored as price excluding VAT (in previous version, this property included VAT).                                                                |
| `RetailPrice`       | `RetailPrice`       | Now stored as price excluding VAT (in previous version, this property included VAT).                                                                |
| `StockValue`        | `StockValue`        | Now stored as price excluding VAT (in previous version, this property included VAT).                                                                |
| `Type`              | `Type`              | Range of allowed values has been reduced to `StockItem`, `Recipe` and `Service`. Removed types (`Credit` and `Discount`) are migrated to `Service`. |
| -                   | `SpecialRegulation` | Optional property that describes reason to associate given product with 0% VAT rate. This property has been added to comply with eKasa legislation. |
| -                   | `IsCashbackAllowed` | Determines whether the sale of this product will generate cashback to the customer.                                                                 |
| -                   | `IsFavorite`        | Boolean property to easier product lookup in cash register application.                                                                             |
| -                   | `SortHint`          | Same sorting rules as `ArticleCategory.SortHint` are applied.                                                                                       |

## Ticket

Serveral new properties were added to `Ticket` model. No properties were removed nor renamed.

| Name (v4)       | Note                                                                                                                                                                   |
| --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `CloseDate`     | Formerly located in `CloseInfo.CloseDate`.                                                                                                                             |
| `ExternalId`    | Optional identifier supplied by external system.                                                                                                                       |
| `InvoiceNumber` | Invoice number. Has value only when `Type` is `Invoice`.                                                                                                               |
| `IsParagon`     | Specifies whether this ticket represents paragon.                                                                                                                      |
| `IssueDate`     | Date of issue. May be different from `OpenDate`, when paragon receipt is registered.                                                                                   |
| `ParagonNumber` | Paragon sequence number. Has value only when `IsParagon` is `true`.                                                                                                    |
| `State`         | Specifies ticket status. Allowed values: `Open`, `Closed` (receipt has been printed for given ticket)                                                                  |
| `Type`          | Specifies ticket type. Allowed values: `CashRegister`, `Invalid`, `Invoice`. Invalid receipts are used in training mode. Invoice is ticket without `Items` collection. |

## TicketCloseInfo

`CloseInfo` property of `Ticket`.

| Name (v3) | Name (v4) | Note                                                                                                                              |
| --------- | --------- | --------------------------------------------------------------------------------------------------------------------------------- |
| CloseDate | -         | Property has been removed in favor of `Ticket.CloseDate`.                                                                         |
| -         | `EKasa`   | Contains properties related to eKasa legislation. Properties: `TicketId`, `TicketIsOnline`, `TicketForm` and `TicketFormOptions`. |

## TicketItem

| Name (v3)         | Name (v4)                 | Note                                                                                                                                                                |
| ----------------- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| -                 | `ExternalId`              | Optional identifier supplied by external system.                                                                                                                    |
| -                 | `Type`                    | Type of ticket item. Allowed values: `Positive`, `ReturnedContainer`, `Returned`, `Correction`, `Discount`, `Advance`, `Voucher` and `Credit`.                      |
| `UnitPriceBrutto` | `UnitPrice`               | Property has been renamed and value now contains unit price excluding VAT.                                                                                          |
| -                 | `ReferenceFiscalTicketId` | Reference to ticket identifier, which can be found in `Ticket.CloseInfo.EKasa.TicketId`. Required for `TicketItem` with `Type` equal to `Correction` or `Returned`. |
| -                 | `VoucherNumber`           | Voucher number. Specified only when `Type` is `Voucher`.                                                                                                            |
| -                 | `IsQuantityFixed`         | Specifies whether Quantity cannot be changed.                                                                                                                       |
| -                 | `CourseNumber`            | Formerly located in `TicketItem.Plu.CourseNumber`.                                                                                                                  |

## TicketItemPlu

| Name (v3)      | Name (v4)           | Note                                                                                                                                                |
| -------------- | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| `CourseNumber` | -                   | Property was moved up, to `TicketItem` model.                                                                                                       |
| -              | `IsCashbackAllowed` | Determines whether the sale of this product will generate cashback to the customer.                                                                 |
| -              | `SpecialRegulation` | Optional property that describes reason to associate given product with 0% VAT rate. This property has been added to comply with eKasa legislation. |
| `Type`         | `Type`              | Range of allowed values has been reduced to `StockItem`, `Recipe` and `Service`. Removed types (`Credit` and `Discount`) are migrated to `Service`. |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.portos.sk/previous-versions/migration-to-v4.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
