Overview
  • Package
  • Class
  • Tree
  • Todo

Packages

  • AddonValue
    • Interfaces
  • AdminHttpViewControllers
  • ApiV2Controllers
  • Authentication
    • Collections
    • Entities
    • Factories
    • Interfaces
    • Strategies
  • Category
    • Collections
    • Entities
    • Factories
    • Interfaces
    • Providers
    • Repositories
    • Storages
  • Customer
    • Address
    • Country
    • CountryZone
    • Interfaces
    • Storages
    • Validation
    • ValueObjects
  • Email
    • Collections
    • Entities
    • Exceptions
    • Interfaces
    • Repository
    • ValueObjects
  • Extensions
    • Customers
    • Emails
    • Helpers
    • Invoices
    • Orders
    • Serializers
    • Templates
  • Http
    • Collections
    • Exceptions
    • Factories
    • Interfaces
    • ValueObjects
  • HttpViewControllers
  • InfoBox
    • Collections
    • Entities
    • Factories
    • Interfaces
    • Repositories
  • Invoice
    • Interfaces
    • ValueObjects
  • Loaders
    • CrossCuttingLoader
    • GXCoreLoader
    • Interfaces
  • Modules
    • Collections
    • Controllers
    • Interfaces
  • None
  • Order
    • Collections
    • Entities
    • Factories
    • Interfaces
    • Repositories
    • Storages
    • ValueObjects
  • Precheck
  • Product
    • Collections
    • Entities
    • Factories
    • Interfaces
    • Providers
    • Repositories
    • Storages
  • ProductModule
    • Collections
    • Deleter
    • Entities
    • Factories
    • Interface
    • Interfaces
    • Reader
    • Repositories
    • Writer
  • Shared
    • ClassFinder
    • Exceptions
    • FileSystem
    • Interfaces
    • Storage
    • Types
  • SharedShoppingCart
    • Interfaces
  • Slider
    • Collections
    • Entities
    • Factories
    • Interfaces
    • Repositories
    • Storages
  • Statistics
    • Interfaces
  • UserConfiguration
    • Interfaces
    • Repository

Classes

  • AbstractApiV2Controller
  • AbstractImagesApiV2Controller
  • AddressesApiV2Controller
  • AttachmentsApiV2Controller
  • CategoriesApiV2Controller
  • CategoryIconsApiV2Controller
  • CategoryImagesApiV2Controller
  • CountriesApiV2Controller
  • CustomersApiV2Controller
  • DefaultApiV2Controller
  • EmailsApiV2Controller
  • HttpApiV2Controller
  • OrdersApiV2Controller
  • OrdersHistoryApiV2Controller
  • OrdersItemsApiV2Controller
  • OrdersItemsAttributesApiV2Controller
  • OrdersTotalsApiV2Controller
  • ProductImagesApiV2Controller
  • ProductsApiV2Controller
  • ProductsLinksApiV2Controller
  • ZonesApiV2Controller

Class OrdersApiV2Controller

Class OrdersApiV2Controller

Provides a gateway to the OrderWriteService and OrderReadService classes, which handle the shop order resources.

AbstractApiV2Controller
Extended by HttpApiV2Controller
Extended by OrdersApiV2Controller
Package: ApiV2Controllers
Category: System
Located at Controllers/Api/v2/OrdersApiV2Controller.inc.php

Methods summary

protected
# __initialize( )

Initializes API Controller

Initializes API Controller

public
# post( )

Api

{post} /orders Create Order

Apidescription

This method enables the creation of a new order into the system. The order can be bound to an existing customer or be standalone as implemented in the OrderService. Make sure that you check the Order resource representation. To see an example usage take a look at docs/REST/samples/order-service/create_order.php.


Apierror

400-BadRequest The body of the request was empty.

Apierrorexample

Error-Response HTTP/1.1 400 Bad Request { "code": 400, "status": "error", "message": "Order data were not provided." }


Apigroup

Orders

Apiname

CreateOrder

Apiparam

{String} statusId Order status ID, use one of the existing statuses IDs.
{String} purchaseDate Must have the 'Y-m-d H:i:s' format.
{String} currencyCode Order's currency code, use one of the existing currency codes.
{String} languageCode Use one of the existing language codes.
{Number} totalWeight The total weight of the order items.
{String} comment Order's comments.

{Object} paymentType Contains information about the payment type, use values that match with the shop's modules.


{String} paymentType.title The payment title.
{String} paymentType.module The payment module name.

{Object} shippingType Contains information about the shipping type, use values that match with the shop's modules.


{String} shippingType.title The shipping title.
{String} shippingType.module The shipping module name.
{Object} customer Contains the order's customer information.
{String} customer.number Customer's number (often referred as CID).
{String} customer.email Customer's email address.
{String} customer.phone Customer's telephone number.
{String} customer.vatId Customer's VAT ID number.
{Object} customer.status Contains information about the customer's status on the system.
{Number} customer.status.id The customer's status ID must be one of the existing statuses in the shop.
{String} customer.status.name The customer-status name.
{String} customer.status.image The customer-status image (check the value from the shop).
{Number} customer.status.discount The discount that is made to this customer status.
{Boolean} customer.status.isGuest Defines whether the customer is a guest.

{Object} addresses Contains the address information of the order. There are three different kind of addresses: customer, billing and delivery.


{Object} addresses.customer Contains the customer-address data.
{String} addresses.customer.gender The gender value can be either "m" or "f".
{String} addresses.customer.firstname First name of the address block.
{String} addresses.customer.lastname Last name of the address block.
{String} addresses.customer.company Company name of the address block.
{String} addresses.customer.street Street of the address block.
{string} addresses.customer.houseNumber The house number of the address block.
{string} addresses.customer.additionalAddressInfo Additional information of the address block.
{String} addresses.customer.suburb Suburb of the address block.
{String} addresses.customer.postcode Postcode of the address block.
{String} addresses.customer.city City of the address block.

{String} addresses.customer.countryId Country ID of the address block. You can use the "countries" resource of the API to get the available countries.


{String} addresses.customer.zoneId Zone ID of the address block. You can use the "zones" resource of the API to get the available countries.


{Boolean} addresses.customer.b2bStatus Whether the customer has the b2bStatus.

{Object} addresses.billing{...} Contains the address block for the billing. It expects the same value types as the customer-address block. See the JSON example above.


{Object} addresses.delivery{...} Contains the address block for the billing. It expects the same value types as the customer-address block. See the JSON example above.


{Array} items Every order contains a list of order items which can also have their own attributes.
{String} items.model Item's model value.
{String} items.name Item's name value.
{Number} items.quantity Quantity of the purchase.
{Number} items.price The initial price of the order item.
{Number} items.finalPrice The final price of the order item.
{Number} items.tax The tax applied to the value.
{Boolean} items.isTaxAllowed Whether tax is allowed.
{Number} items.discount Percentage of the discount made for this order.
{String} items.shippingTimeInformation Include shipping information to the order.
{String} items.checkoutInformation Include checkout information to the order.
{String} items.quantityUnitName The Quantity unit name of the order item.

{Array} items.attributes Contains some attributes or properties of the order item. The difference between the attributes and the properties is that attributes must have the "optionId" and "optionValueId" values while properties must only have the "combisId" value. The properties system is still included as a fallback to old releases of the shop, so we will use the "attributes" term in this document.


{String} items.attributes.name Attribute's name.
{String} items.attributes.value Attribute's value.
{Number} items.attributes.price Give the attributes price.

{String} items.attributes.priceType Make sure that you use one of the existing price types of the shop.


{Number} items.attributes.optionId Only-attributes need this value.
{Number} items.attributes.optionValueId Only-attributes need this value.
{Number} items.attributes.combisId Only-properties need this value.
{Array} items.downloadInformation Contains the downloads of the order item.
{String} items.downloadInformation.filename Contains a non empty filename.

{Number} items.downloadInformation.maxDaysAllowed Contains the number of days where downloads are possible.


{Number} items.downloadInformation.countAvailable Contains the number of possible downloads.
{Object} items.addonValues (Optional) Contains key value pairs of additional order item data.

{Array} totals Contains the order totals. The order totals are entries that display analytic information about the charges of the user.


{String} totals.title Order total's title.
{Number} totals.value The value stands for the money.
{String} totals.valueText String representation of the value containing the currency code.

{String} totals.class Internal order-total class. A list of possible values can be seen in the database once you create a complete order record.


{Number} totals.sortOrder Defines the order of the totals list as they are being displayed.
{Object} addonValues (Optional) Contains key value pairs of additional order data.

Apiparamexample

{json} Request-Body { "id": 400210, "statusId": 1, "purchaseDate": "2015-11-06 12:22:39", "currencyCode": "EUR", "languageCode": "DE", "totalWeight": 0.123, "comment": "", "paymentType": { "title": "cod", "module": "cod" }, "shippingType": { "title": "Pauschale Versandkosten (Standar", "module": "flat_flat" }, "customer": { "id": 1, "number": "", "email": "admin@shop.de", "phone": "0421 - 22 34 678", "vatId": "", "status": { "id": 0, "name": "Admin", "image": "admin_status.gif", "discount": 0, "isGuest": false } }, "addresses": { "customer": { "gender": "m", "firstname": "John", "lastname": "Doe", "company": "JD Company", "street": "Test Street", "houseNumber": "123", "additionalAddressInfo": "1. Etage", "suburb": "", "postcode": "28219", "city": "Bremen", "countryId": 81, "zoneId": 0, "b2bStatus": false }, "billing": { "gender": "m", "firstname": "John", "lastname": "Doe", "company": "JD Company", "street": "Test Street", "houseNumber": "123", "additionalAddressInfo": "1. Etage", "suburb": "", "postcode": "28219", "city": "Bremen", "countryId": 81, "zoneId": 0, "b2bStatus": false }, "delivery": { "gender": "m", "firstname": "John", "lastname": "Doe", "company": "JD Company", "street": "Test Street", "houseNumber": "123", "additionalAddressInfo": "1. Etage", "suburb": "", "postcode": "28219", "city": "Bremen", "countryId": 81, "zoneId": 0, "b2bStatus": false } }, "items": [ { "id": 1, "model": "12345-s-black", "name": "Ein Artikel", "quantity": 1, "price": 11, "finalPrice": 11, "tax": 19, "isTaxAllowed": true, "discount": 0, "shippingTimeInformation": "", "checkoutInformation": "Checkout information goes here ...", "quantityUnitName": "Liter", "attributes": [ { "id": 1, "name": "Farbe", "value": "rot", "price": 0, "priceType": "+", "optionId": 1, "optionValueId": 1, "combisId": null } ], "downloadInformation": [ { "filename": "Dokument.pdf", "maxDaysAllowed": 5, "countAvailable": 14 } ], "addonValues": { "productId": "2", "quantityUnitId": "1" } } ], "totals": [ { "id": 1, "title": "Zwischensumme:", "value": 50, "valueText": "50,00 EUR", "class": "ot_subtotal", "sortOrder": 10 } ], "statusHistory": [ { "id": 1, "statusId": 1, "dateAdded": "2015-11-06 12:22:39", "comment": "", "customerNotified": true } ], "addonValues": { "customerIp": "", "downloadAbandonmentStatus": "0", "serviceAbandonmentStatus": "0", "ccType": "", "ccOwner": "", "ccNumber": "", "ccExpires": "", "ccStart": "", "ccIssue": "", "ccCvv": "" } }


Apisuccess

(Success 201) Response-Body If successful, this method returns a complete Order resource in the response body.


Apiversion

2.2.0
public
# put( )

Api

{put} /orders/:id Update Order

Apidescription

Use this method to update an existing order record. It uses the complete order JSON resource so it might be useful to fetch it through a GET request, alter its values and PUT it back in order to perform the update operation. Take a look in the POST method for more detailed explanation on every resource property. To see an example usage take a look at docs/REST/samples/order-service/update_order.php


Apierror

400-BadRequest The body of the request was empty or the order record ID was not provided or is invalid.


Apierrorexample

Error-Response (Empty request body) HTTP/1.1 400 Bad Request { "code": 400, "status": "error", "message": "Order data were not provided." }


Error-Response (Missing or invalid ID) HTTP/1.1 400 Bad Request { "code": 400, "status": "error", "message": "Order record ID was not provided or is invalid." }


Apigroup

Orders

Apiname

UpdateOrder

Apisuccess

Response-Body If successful, this method returns the updated Order resource in the response body.


Apiversion

2.2.0
public
# patch( )

Api

{patch} /orders/:id/status Update Order Status

Apidescription

Use this method if you want to update the status of an existing order and create an order history entry. The status history entry must also contain extra information as shown in the JSON example.


Apierror

400-BadRequest Order data were not provided or order record ID was not provided or is invalid.

Apierrorexample

Error-Response (Empty request body) HTTP/1.1 400 Bad Request { "code": 400, "status": "error", "message": "Order data were not provided." }


Error-Response (Missing or invalid ID) HTTP/1.1 400 Bad Request { "code": 400, "status": "error", "message": "Order record ID was not provided or is invalid." }


Apigroup

Orders

Apiname

UpdateOrderStatus

Apiparam

{Number} statusId The new status ID will also be set in the order record.
{String} comment Assign a comment to the status history entry.
{Boolean} customerNotified Defines whether the customer was notified by this change.

Apiparamexample

{json} Order Status History { "statusId": 1, "comment": "This is the entry comment", "customerNotified": false }


Apisuccess

(200) Request-Body If successful, this method returns the complete order status history resource in the response body.


Apisuccessexample

{json} Success-Response { "id": 984, "statusId": 3, "dateAdded": "2016-01-22 10:52:11", "comment": "This is the entry's comments", "customerNotified": true }


Apiversion

2.3.0
public
# delete( )

Api

{delete} /orders/:id Delete Order

Apidescription

Remove an entire Order record from the database. This method will also remove the order-items along with their attributes and the order-total records. To see an example usage take a look at docs/REST/samples/order-service/remove_order.php


Apierror

400-BadRequest The order ID value was invalid.

Apierrorexample

Error-Response HTTP/1.1 400 Bad Request { "code": 400, "status": "error", "message": "Order record ID was not provided in the resource URL." }


Apiexample

{curl} Delete Order With ID = 400597 curl -X DELETE --user admin@shop.de:12345 http://shop.de/api.php/v2/orders/400597


Apigroup

Orders

Apiname

DeleteOrder

Apisuccessexample

{json} Success-Response { "code": 200, "status": "success", "action": "delete", "resource": "Order", "orderId": 400597 }


Apiversion

2.1.0
public
# get( )

Api

{get} /orders/:id Get Orders

Apidescription

Get multiple or a single order record through a GET request. This method supports all the GET parameters that are mentioned in the "Introduction" section of this documentation.

Important: Whenever you make requests that will return multiple orders the response will contain a smaller version of each order record called order-list-item. This is done for better performance because the creation of a complete order record takes significant time (many objects are involved). If you still need the complete data of an order record you will have to make an extra GET request with the ID provided.


Apiexample

{curl} Get All Orders curl -i --user admin@shop.de:12345 http://shop.de/api.php/v2/orders


{curl} Get Order With ID = 400242 curl -i --user admin@shop.de:12345 http://shop.de/api.php/v2/orders/400242


{curl} Search Orders curl -i --user admin@shop.de:12345 http://shop.de/api.php/v2/orders?q=DE


{curl} Get Order's Items curl -i --user admin@shop.de:12345 http://shop.de/api.php/v2/orders/400573/items


{curl} Get Order Item's Attributes curl -i --user admin@shop.de:12345 http://shop.de/api.php/v2/orders/400573/items/57/attributes


{curl} Get Orders Totals curl -i --user admin@shop.de:12345 http://shop.de/api.php/v2/orders/400573/totals


Apigroup

Orders

Apiname

GetOrder

Apiversion

2.3.0

Methods inherited from HttpApiV2Controller

_linkResponse(), _locateResource(), _mapResponse(), _minimizeResponse(), _paginateResponse(), _searchResponse(), _setJsonValue(), _sortResponse(), _writeResponse()

Methods inherited from AbstractApiV2Controller

__construct()

Constants summary

Constants inherited from AbstractApiV2Controller

DEFAULT_CONTROLLER_NAME, DEFAULT_PAGE_ITEMS, DEFAULT_RATE_LIMIT, DEFAULT_RATE_RESET_PERIOD

Properties summary

protected OrderWriteService $orderWriteService

Order write service.

Order write service.

#
protected OrderReadService $orderReadService

Order read service.

Order read service.

#
protected OrderJsonSerializer $orderJsonSerializer

Order JSON serializer.

Order JSON serializer.

#
protected OrderListItemJsonSerializer $orderListItemJsonSerializer

Order list item JSON serializer.

Order list item JSON serializer.

#
protected array $subresource

Sub resources.

Sub resources.

#

Properties inherited from AbstractApiV2Controller

$api, $uri

API documentation generated by ApiGen