Class: NewStoreApi::TaxQuotationsController

Inherits:
BaseController show all
Defined in:
lib/new_store_api/controllers/tax_quotations_controller.rb

Overview

TaxQuotationsController

Constant Summary

Constants inherited from BaseController

BaseController::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseController

#config, #http_call_back

Instance Method Summary collapse

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_tax_quotation(body, store_id: nil) ⇒ QuotationResultDto

🚧 BETA: This endpoint is in beta and may change.
See API Lifecycle Documentation for details.
Calculates a tax quotation from cart items using the configured tax strategy. Monetary amounts are accepted and returned in the currency's minor unit. here

Parameters:

  • body (QuotationDto)

    Required parameter: TODO: type description

  • store_id (String) (defaults to: nil)

    Optional parameter: Store identifier.

Returns:



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/new_store_api/controllers/tax_quotations_controller.rb', line 25

def create_tax_quotation(body,
                         store_id: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/taxes/quotations',
                                 Server::API)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter(store_id, key: 'store-id'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(QuotationResultDto.method(:from_hash)))
    .execute
end