Class: NewStoreApi::OrdersController
- Inherits:
-
BaseController
- Object
- BaseController
- NewStoreApi::OrdersController
- Defined in:
- lib/new_store_api/controllers/orders_controller.rb
Overview
OrdersController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#create_order(request_id, tenant, x_newstore_tenant, body) ⇒ Object
TODO: type endpoint description here here description here can be found [here](https://gitlab.com/newstore/engineering/order-management/order-mana gement/-/blob/main/services/sales_order/definitions/schemas/add_sales_orde r_items.json).
-
#show_order(order_id, state: nil, transaction_state: nil) ⇒ SignatureResponseV1Dto
🚧 BETA: This endpoint is in beta and may change.
- #show_return(order_id, return_id, state: nil, transaction_state: nil) ⇒ SignatureResponseV1Dto
🚧 BETA: This endpoint is in beta and may change.Methods inherited from BaseController
#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent
Constructor Details
This class inherits a constructor from NewStoreApi::BaseController
Instance Method Details
#create_order(request_id, tenant, x_newstore_tenant, body) ⇒ Object
TODO: type endpoint description here here description here can be found [here](https://gitlab.com/newstore/engineering/order-management/order-mana gement/-/blob/main/services/sales_order/definitions/schemas/add_sales_orde r_items.json). The same schema is used for
AddSalesOrderItemsJSONgRPC call.107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
# File 'lib/new_store_api/controllers/orders_controller.rb', line 107 def create_order(request_id, tenant, x_newstore_tenant, body) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/order-management/orders', Server::API) .header_param(new_parameter(request_id, key: 'Request-Id')) .header_param(new_parameter(tenant, key: 'Tenant')) .header_param(new_parameter(x_newstore_tenant, key: 'X-Newstore-Tenant')) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(APIHelper.method(:json_serialize)) .auth(Single.new('oauth'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize))) .execute end
#show_order(order_id, state: nil, transaction_state: nil) ⇒ SignatureResponseV1Dto
🚧 BETA: This endpoint is in beta and may change.Get fiscal transactions and signatures for an order (sale or exchange). This API should be used to get the fiscal transaction for returned items that were part of an exchange. Based on the country, the transactions array in the response for exchanges will contain one of the following: * 1 `exchange` transaction that represents both the returned and the sold part of the exchanged items. * 2 transactions, 1 `sale` transactions and `return` transaction each representing their respective parts of the exchanged items. description here type description here
See API Lifecycle Documentation for details.33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
# File 'lib/new_store_api/controllers/orders_controller.rb', line 33 def show_order(order_id, state: nil, transaction_state: nil) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/orders/{orderId}', Server::API) .template_param(new_parameter(order_id, key: 'orderId') .should_encode(true)) .query_param(new_parameter(state, key: 'state')) .query_param(new_parameter(transaction_state, key: 'transaction_state')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('oauth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(SignatureResponseV1Dto.method(:from_hash))) .execute end
#show_return(order_id, return_id, state: nil, transaction_state: nil) ⇒ SignatureResponseV1Dto
🚧 BETA: This endpoint is in beta and may change.Get fiscal transactions and signatures for an item return. This API covers returns that are not part of an exchange. For getting the return part of the exchange use the GET `/orders/orderId` API here description here type description here
See API Lifecycle Documentation for details.72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
# File 'lib/new_store_api/controllers/orders_controller.rb', line 72 def show_return(order_id, return_id, state: nil, transaction_state: nil) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/orders/{orderId}/returns/{returnId}', Server::API) .template_param(new_parameter(order_id, key: 'orderId') .should_encode(true)) .template_param(new_parameter(return_id, key: 'returnId') .should_encode(true)) .query_param(new_parameter(state, key: 'state')) .query_param(new_parameter(transaction_state, key: 'transaction_state')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('oauth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(SignatureResponseV1Dto.method(:from_hash))) .execute end
- #show_return(order_id, return_id, state: nil, transaction_state: nil) ⇒ SignatureResponseV1Dto