Routes
Transaction
Retrieve Transaction
- The
getmethod in theTransactionControllerhandles a GET request to the/transactions/{transactionId}endpoint. - It retrieves the specified transaction using the
transactionsService, along with related attributes. - The method checks if the transaction belongs to the authenticated user by comparing the transaction's
customer_idor associated order'scustomer_idwith the current user's ID. - If the user is not authorized to view the transaction, the request is aborted with a 403 Forbidden status.
- If authorized, the transaction is returned as a
TransactionResource.
Route::get('/transactions/{transactionId}', 'TransactionController@get');
Details
- Route:
/transactions/{transactionId} - HTTP Request:
GET - Controller:
TransactionController - Method:
get
Tested through Postman
- Endpoint:
https://apis.dev.nl.toolstation.dev/ecom/v1/transactions/0056e1c9-2806-45a7-9499-d473bc030375 - Access Token: Required
- Request Body:
- Response:
{ "error": { "code": "500.99", "message": "Internal Server Error", "info": "https://developers.example.com", "data": null } }