Update order item
To update any order item is necessary to use update order item endpoint.
It is possible to update some properties of order item with pre-selected offerBundle, provide new offerBundleId to the orderItem, or choose new product configuration for the order item.
PUT {{ marketUrl }}/orders/{orderNumber}/items/{orderItemNumber}
Update OrderItem with new product configuration¶
In some situations when it is necessary to replace product in the order with another one, instead of deleting of order item and adding new one it could be simpler to provide new product configurations to the existing order item.
{
"orderQuantity": 1,
"orderedItem": {
"product": {
"identifier": "nova_zurichcard24"
},
"validFrom": "2021-10-22T10:00:00",
"traveler": [
{
"id":"helma_lovers",
"givenName": "Helma",
"familyName": "Lovers",
"birthDate": "2000-02-18T15:00:00",
"gender": "Female",
"Nationality": "CH",
"Passport": "no passport"
},
{
"id":"huan_lovers",
"givenName": "Huan",
"familyName": "Lovers",
"birthDate": "2010-02-18T15:00:00"
}
]
}
}
PUT {{ marketUrl }}/orders/{orderId}/items/{orderId}-3
{
"orderItem": {
"orderItemNumber": "{{ orderId }}-3",
"orderItemStatus": "Placed",
"orderQuantity": 1,
"orderedItem": {
"product": {
"identifier": "nova_zurichcard24",
"productIdentifier": "nova_zurichcard",
"sku": "895",
"name": "ZVV Zürich Card, ZVV Zürich Card 24 hours",
"dataGovernance": {
"provider": {
"acronym": "sbb"
},
"term": {
"code": "ZHT-AGB|ZHT-DPP"
},
"source": {
"acronym": "ZHT"
}
},
"priceList": [
{
"priceCHF": 19.0,
"maxAllowedAge": 15,
"minAllowedAge": 5
},
{
"priceCHF": 27.0,
"maxAllowedAge": 2500,
"minAllowedAge": 15
}
],
"taxRate": 0.077
},
"validFrom": "2021-10-22T10:00:00+00:00",
"traveler": [
{
"priceCHF": 27.0,
"identifier": "d1a32fc6-88b5-df51-0258-91d46b6148a3",
"gender": "Female",
"givenName": "Helma",
"familyName": "Lovers",
"birthDate": "2000-02-18T00:00:00",
"nationality": "CH",
"passport": "no passport"
},
{
"priceCHF": 19.0,
"identifier": "d9b703f2-6043-d06a-3fcf-430e756c8309",
"givenName": "Huan",
"familyName": "Lovers",
"birthDate": "2010-02-18T00:00:00"
}
]
},
"orderDelivery": "e-ticket",
"amount": 46.0,
"amountCHF": 46.0,
"taxRate": 3.542,
"taxCHF": 3.542,
"ticket": [],
"offerBundleId": "901696d2-510d-4429-91cb-6d01c44254a9"
},
"validationMessages": []
}
Update OrderItem with offer bundle¶
If it is necessary to update orderItem which already contains offerBundleId, then there 2 ways how to deal with it:
- to keep same offer, then provide same offerBundleId in the request
- to update orderItem with new offerBundleId - provide new offerBundleId in the request (or product configurations without offerBundleId)
Information
OfferBundleId can be absent in case product doesn't support offers. In that case offerBundleId is not needed
{
"orderQuantity": 1,
"offerBundleId": "5230c53b-042f-4429-b72c-b2e77e6119f7"
}
PUT {{ marketUrl }}/orders/{orderId}/items/{orderId}-2
{
"orderItem": {
"orderItemNumber": "{{ orderId }}-2",
"orderItemStatus": "Placed",
"orderQuantity": 1,
"orderedItem": {
"product": {
"identifier": "nova_zurichcard72",
"productIdentifier": "nova_zurichcard",
"sku": "898",
"name": "ZVV Zürich Card, ZVV Zürich Card 72 hours",
"dataGovernance": {
"provider": {
"acronym": "sbb"
},
"term": {
"code": "ZHT-AGB|ZHT-DPP"
},
"source": {
"acronym": "ZHT"
}
},
"priceList": [
{
"priceCHF": 37.0,
"maxAllowedAge": 15,
"minAllowedAge": 5
},
{
"priceCHF": 53.0,
"maxAllowedAge": 2500,
"minAllowedAge": 15
}
],
"taxRate": 0.077
},
"validFrom": "2021-10-15T06:00:00+00:00",
"traveler": [
{
"priceCHF": 53.0,
"identifier": "jhon",
"givenName": "Smith",
"familyName": "Jhon",
"birthDate": "1980-02-18T00:00:00"
},
{
"priceCHF": 53.0,
"identifier": "jessika",
"givenName": "Smith",
"familyName": "Jessika",
"birthDate": "1979-02-18T00:00:00"
}
]
},
"orderDelivery": "e-ticket",
"amount": 106.0,
"amountCHF": 106.0,
"taxRate": 8.161999999999999,
"taxCHF": 8.161999999999999,
"ticket": [],
"offerBundleId": "5230c53b-042f-4429-b72c-b2e77e6119f7"
},
"validationMessages": []
}
Update OrderItem with offer bundle and update travelers¶
During the searching for offerBundle it is not necessary to provide all of the travelers properties. When an orderItem is created with an offerBundle which does not provide all required fields for order travelers then validation errors will be returned. To resolve those validation error is necessary to send update order item request with selected offerBundleId and updated travelers (it is necessary to use same travelers identifiers).
Information
Required travelers fields for zurich card offerBundle are: birthDate
Required travelers fields for order with zurich card are: birthDate, givenName, familyName
Warning
It is not allowed to update required fields and travelers identifier in the offerBundle. Any attempts will be ignored.
{
"product": {
"identifier": "nova_zurichcard72"
},
"validFrom": "2021-10-15T00:00:00",
"traveler": [
{
"identifier": "jhon",
"birthDate": "1980-02-18"
},
{
"identifier": "jessika",
"birthDate": "1979-02-18T15:00:00"
}
]
}
POST {{ marketUrl }}/orders/{orderId}/offers
{
"validationMessages": [],
"offerBundle": [
{
"id": "73136c89-74a3-445a-828b-a37eca2c0baf",
"totalPrice": 10600,
"currency": "CHF",
"expiresAt": "2021-10-10T09:46:06-06:00",
"offer": [
{
"id": "0192b5ce-ac89-4e61-85b4-9250bdfeb2f4",
"expiresAt": "2021-10-10T09:46:06-06:00",
"title": "ZVV Zürich Card 72 hours",
"description": ".\tA ticket for visitors and guests who would like to combine their stay with a visit to a museum or an excursion to the local recreation area, also valid for travel between the airport and the city.\n\n.\tZones 110 111 121 140 150 154 155.\n\n.\tPeriod of validity: 72 hours.\n\n.\tAvailable for 2nd class travel.\n\n.\tReduced fare for children from their 6th to their 16th birthday.\n\n.\twww.zuerichcard.com",
"travelerId": "jessika",
"price": 5300,
"currency": "CHF"
},
{
"id": "1a962365-4936-4713-a7d9-48a804c45602",
"expiresAt": "2021-10-10T09:46:06-06:00",
"title": "ZVV Zürich Card 72 hours",
"description": ".\tA ticket for visitors and guests who would like to combine their stay with a visit to a museum or an excursion to the local recreation area, also valid for travel between the airport and the city.\n\n.\tZones 110 111 121 140 150 154 155.\n\n.\tPeriod of validity: 72 hours.\n\n.\tAvailable for 2nd class travel.\n\n.\tReduced fare for children from their 6th to their 16th birthday.\n\n.\twww.zuerichcard.com",
"travelerId": "jhon",
"price": 5300,
"currency": "CHF"
}
]
}
]
}
{
"orderQuantity": 1,
"offerBundleId": "73136c89-74a3-445a-828b-a37eca2c0baf",
"orderedItem": {
"traveler": [
{
"identifier": "jessika",
"birthDate": "1979-02-18T15:00:00",
"familyName": "Jessika",
"givenName": "Smith"
},
{
"identifier": "jhon",
"birthDate": "1980-02-18",
"familyName": "Jhon",
"givenName": "Smith"
}
]
}
}
PUT {{ marketUrl }}/orders/{orderId}/items/{orderId}-1
{
"orderItem": {
"orderItemNumber": "{{ orderId }}-1",
"orderItemStatus": "Placed",
"orderQuantity": 1,
"orderedItem": {
"product": {
"identifier": "nova_zurichcard72",
"productIdentifier": "nova_zurichcard",
"sku": "898",
"name": "ZVV Zürich Card, ZVV Zürich Card 72 hours",
"dataGovernance": {
"provider": {
"acronym": "sbb"
},
"term": {
"code": "ZHT-AGB|ZHT-DPP"
},
"source": {
"acronym": "ZHT"
}
},
"priceList": [
{
"priceCHF": 37.0,
"maxAllowedAge": 15,
"minAllowedAge": 5
},
{
"priceCHF": 53.0,
"maxAllowedAge": 2500,
"minAllowedAge": 15
}
],
"taxRate": 0.077
},
"validFrom": "2021-10-15T06:00:00+00:00",
"traveler": [
{
"priceCHF": 53.0,
"identifier": "jhon",
"givenName": "Smith",
"familyName": "Jhon",
"birthDate": "1980-02-18T00:00:00"
},
{
"priceCHF": 53.0,
"identifier": "jessika",
"givenName": "Smith",
"familyName": "Jessika",
"birthDate": "1979-02-18T00:00:00"
}
]
},
"orderDelivery": "e-ticket",
"amount": 106.0,
"amountCHF": 106.0,
"taxRate": 8.161999999999999,
"taxCHF": 8.161999999999999,
"ticket": [],
"offerBundleId": "73136c89-74a3-445a-828b-a37eca2c0baf"
},
"validationMessages": []
}