WithdrawalsApiV2Controller

Extends \HttpApiV2Controller

Class WithdrawalsApiV2Controller

Provides a gateway to the WithdrawalWriteService and WithdrawalReadService classes, which handle the shop withdrawal resources.

category

System

package

ApiV2Controllers

Methods

AbstractApiV2Controller Constructor

__construct(\Slim\Slim $api, array $uri) 
inherited

Call this constructor from every child controller class in order to set the Slim instance and the request routes arguments to the class.

deprecated

The "__initialize" method will is deprecated and will be removed in a future version. Please use the new "init" for bootstrapping your child API controllers.

Throws
\HttpApiV2Exception

Through _validateRequest

Arguments

$api

\Slim\Slim

Slim framework instance, used for request/response manipulation.

$uri

array

This array contains all the segments of the current request, starting from the resource.

delete

delete() 
api
apiVersion

2.6.0

apiName

DeleteWithdrawal

apiGroup

Withdrawals

apiDescription

Removes a withdrawal record from the system. This method will always return success even if the withdrawal does not exist (due to internal WithdrawalWriteService architecture decisions, which strive to avoid unnecessary failures).

apiExample

{curl} Delete Withdrawal with ID = 84 curl -X DELETE --user admin@shop.de:12345 http://shop.de/api.php/v2/withdrawals/84

apiSuccessExample

{json} Success-Response { "code": 200, "status": "success", "action": "delete", "withdrawalId": 84 }

apiErrorExample

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

get

get() 
api
apiVersion

2.6.0

apiName

GetWithdrawals

apiGroup

Withdrawals

apiDescription

Get multiple or a single withdrawal record through the GET method

apiExample

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

{curl} Get Withdrawal record With ID = 982 curl -i --user admin@shop.de:12345 http://shop.de/api.php/v2/withdrawals/982

apiErrorExample

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

Error-Response (Withdrawal Not Found) HTTP/1.1 404 Not Found { "code": 404, "status": "error", "message": "Withdrawal record could not be found." }

apiError

404-NotFound Withdrawal record could not be found.

getCallableResource

getCallableResource( $controller, array $mappedURI, \Slim\Slim $api) 
inherited static

Arguments

$controller

$mappedURI

array

$api

\Slim\Slim

post

post() 
api
apiVersion

2.6.0

apiName

CreateWithdrawal

apiGroup

Withdrawals

apiDescription

This method enables the creation of a new withdrawal into the system.

apiParamExample

{json} Withdrawal entity { "withdrawalDate": "2018-01-05 00:00:00", "content": "Hiermit widerrufe(n) ich/wir den von mir/uns abgeschlossenen Vertrag ...", "order": { "orderId": 400212, "customerId": 1, "customerGender": "Herr", "customerFirstName": "John", "customerLastName": "Doe", "customerStreetAddress": "Parallelweg 30", "customerPostCode": "28219", "customerCity": "Bremen", "customerCountry": "Germany", "customerEmail": "john@doe.com", "orderDate": "2018-01-05 00:00:00", "deliveryDate": "1970-01-01 00:00:00" }, "createdByAdmin": true }

apiParam

{String} withdrawalDate The withdrawal date. Must have the 'Y-m-d H:i:s' format.

{String} content The withdrawal content.

{Object} order Contains various order specific information.

{Number} order.orderId Order ID.

{Number} order.customerId Customer's ID.

{String} order.customerGender Customer's gender.

{String} order.customerFirstName Customer's first name.

{String} order.customerLastName Customer's last name.

{String} order.customerStreetAddress Customer's street address with house number.

{String} order.customerPostCode Customer's post code.

{String} order.customerCity Customer's city.

{String} order.customerCountry Customer's country.

{String} order.customerEmail Customer's email address.

{String} order.orderDate Order date. Must have the 'Y-m-d H:i:s' format.

{String} order.deliveryDate Delivery date. Must have the 'Y-m-d H:i:s' format.

{Boolean} createdByAdmin Whether the withdrawal was created by customer or by an admin.

apiSuccess

(201) Request-Body If successful, this method returns the complete withdrawal resource in the response body.

apiSuccessExample

{json} Success-Response { "id": 3, "withdrawalDate": "2018-01-05 00:00:00", "content": "Hiermit widerrufe(n) ich/wir den von mir/uns abgeschlossenen Vertrag ...", "order": { "orderId": 400212, "customerId": 1, "customerGender": "Herr", "customerFirstName": "John", "customerLastName": "Doe", "customerStreetAddress": "Parallelweg 30", "customerPostCode": "28219", "customerCity": "Bremen", "customerCountry": "Germany", "customerEmail": "john@doe.com", "orderDate": "2018-01-05 00:00:00", "deliveryDate": "1970-01-01 00:00:00" }, "dateCreated": "2018-01-10 19:10:00", "createdByAdmin": true }

apiError

400-BadRequest The body of the request was empty.

apiErrorExample

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

put

put() 
api
apiVersion

2.6.0

apiName

UpdateWithdrawal

apiGroup

Withdrawals

apiDescription

Use this method to update an existing withdrawal record. Take a look in the POST method for more detailed explanation on every resource property.

apiSuccess

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

apiErrorExample

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

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

apiError

400-BadRequest Withdrawal data were not provided.

Constants

Defines the default page offset for responses that return multiple items.

DEFAULT_PAGE_ITEMS
inherited
var

Default controller to be loaded when no resource was selected.

DEFAULT_CONTROLLER_NAME
inherited
var

Defines the maximum request limit for an authorized client.

DEFAULT_RATE_LIMIT
inherited
var

Defines the duration of an API session in minutes.

DEFAULT_RATE_RESET_PERIOD
inherited
var

Properties