=begin #UltraCart Rest API V2 #UltraCart REST API Version 2 OpenAPI spec version: 2.0.0 Contact: support@ultracart.com Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 2.4.15-SNAPSHOT =end require 'uri' module UltracartClient class CheckoutApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # City/State for Zip # Look up the city and state for the shipping zip code. Useful for building an auto complete for parts of the shipping address # @param cart Cart # @param [Hash] opts the optional parameters # @return [CityStateZip] def city_state(cart, opts = {}) data, _status_code, _headers = city_state_with_http_info(cart, opts) data end # City/State for Zip # Look up the city and state for the shipping zip code. Useful for building an auto complete for parts of the shipping address # @param cart Cart # @param [Hash] opts the optional parameters # @return [Array<(CityStateZip, Fixnum, Hash)>] CityStateZip data, response status code and response headers def city_state_with_http_info(cart, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CheckoutApi.city_state ...' end # verify the required parameter 'cart' is set if @api_client.config.client_side_validation && cart.nil? fail ArgumentError, "Missing the required parameter 'cart' when calling CheckoutApi.city_state" end # resource path local_var_path = '/checkout/city_state' # query parameters query_params = {} # header parameters header_params = {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(cart) auth_names = ['ultraCartBrowserApiKey', 'ultraCartOauth', 'ultraCartSimpleApiKey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'CityStateZip') if @api_client.config.debugging @api_client.config.logger.debug "API called: CheckoutApi#city_state\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Finalize Order # Finalize the cart into an order. This method can not be called with browser key authentication. It is ONLY meant for server side code to call. # @param finalize_request Finalize request # @param [Hash] opts the optional parameters # @return [CartFinalizeOrderResponse] def finalize_order(finalize_request, opts = {}) data, _status_code, _headers = finalize_order_with_http_info(finalize_request, opts) data end # Finalize Order # Finalize the cart into an order. This method can not be called with browser key authentication. It is ONLY meant for server side code to call. # @param finalize_request Finalize request # @param [Hash] opts the optional parameters # @return [Array<(CartFinalizeOrderResponse, Fixnum, Hash)>] CartFinalizeOrderResponse data, response status code and response headers def finalize_order_with_http_info(finalize_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CheckoutApi.finalize_order ...' end # verify the required parameter 'finalize_request' is set if @api_client.config.client_side_validation && finalize_request.nil? fail ArgumentError, "Missing the required parameter 'finalize_request' when calling CheckoutApi.finalize_order" end # resource path local_var_path = '/checkout/cart/finalizeOrder' # query parameters query_params = {} # header parameters header_params = {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(finalize_request) auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'CartFinalizeOrderResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: CheckoutApi#finalize_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get affirm checkout (by cart id) # Get a Affirm checkout object for the specified cart_id parameter. # @param cart_id Cart ID to retrieve # @param [Hash] opts the optional parameters # @return [CartAffirmCheckoutResponse] def get_affirm_checkout(cart_id, opts = {}) data, _status_code, _headers = get_affirm_checkout_with_http_info(cart_id, opts) data end # Get affirm checkout (by cart id) # Get a Affirm checkout object for the specified cart_id parameter. # @param cart_id Cart ID to retrieve # @param [Hash] opts the optional parameters # @return [Array<(CartAffirmCheckoutResponse, Fixnum, Hash)>] CartAffirmCheckoutResponse data, response status code and response headers def get_affirm_checkout_with_http_info(cart_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CheckoutApi.get_affirm_checkout ...' end # verify the required parameter 'cart_id' is set if @api_client.config.client_side_validation && cart_id.nil? fail ArgumentError, "Missing the required parameter 'cart_id' when calling CheckoutApi.get_affirm_checkout" end # resource path local_var_path = '/checkout/cart/{cart_id}/affirmCheckout'.sub('{' + 'cart_id' + '}', cart_id.to_s) # query parameters query_params = {} # header parameters header_params = {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ultraCartBrowserApiKey', 'ultraCartOauth', 'ultraCartSimpleApiKey'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'CartAffirmCheckoutResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: CheckoutApi#get_affirm_checkout\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Allowed countries # Lookup the allowed countries for this merchant id # @param [Hash] opts the optional parameters # @return [CheckoutAllowedCountriesResponse] def get_allowed_countries(opts = {}) data, _status_code, _headers = get_allowed_countries_with_http_info(opts) data end # Allowed countries # Lookup the allowed countries for this merchant id # @param [Hash] opts the optional parameters # @return [Array<(CheckoutAllowedCountriesResponse, Fixnum, Hash)>] CheckoutAllowedCountriesResponse data, response status code and response headers def get_allowed_countries_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CheckoutApi.get_allowed_countries ...' end # resource path local_var_path = '/checkout/allowedCountries' # query parameters query_params = {} # header parameters header_params = {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ultraCartBrowserApiKey', 'ultraCartOauth', 'ultraCartSimpleApiKey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'CheckoutAllowedCountriesResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: CheckoutApi#get_allowed_countries\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get cart # If the cookie is set on the browser making the request then it will return their active cart. Otherwise it will create a new cart. # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [CartResponse] def get_cart(opts = {}) data, _status_code, _headers = get_cart_with_http_info(opts) data end # Get cart # If the cookie is set on the browser making the request then it will return their active cart. Otherwise it will create a new cart. # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [Array<(CartResponse, Fixnum, Hash)>] CartResponse data, response status code and response headers def get_cart_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CheckoutApi.get_cart ...' end # resource path local_var_path = '/checkout/cart' # query parameters query_params = {} query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil? # header parameters header_params = {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ultraCartBrowserApiKey', 'ultraCartOauth', 'ultraCartSimpleApiKey'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'CartResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: CheckoutApi#get_cart\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get cart (by cart id) # Get a cart specified by the cart_id parameter. # @param cart_id Cart ID to retrieve # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [CartResponse] def get_cart_by_cart_id(cart_id, opts = {}) data, _status_code, _headers = get_cart_by_cart_id_with_http_info(cart_id, opts) data end # Get cart (by cart id) # Get a cart specified by the cart_id parameter. # @param cart_id Cart ID to retrieve # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [Array<(CartResponse, Fixnum, Hash)>] CartResponse data, response status code and response headers def get_cart_by_cart_id_with_http_info(cart_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CheckoutApi.get_cart_by_cart_id ...' end # verify the required parameter 'cart_id' is set if @api_client.config.client_side_validation && cart_id.nil? fail ArgumentError, "Missing the required parameter 'cart_id' when calling CheckoutApi.get_cart_by_cart_id" end # resource path local_var_path = '/checkout/cart/{cart_id}'.sub('{' + 'cart_id' + '}', cart_id.to_s) # query parameters query_params = {} query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil? # header parameters header_params = {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ultraCartBrowserApiKey', 'ultraCartOauth', 'ultraCartSimpleApiKey'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'CartResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: CheckoutApi#get_cart_by_cart_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get cart (by return code) # Get a cart specified by the return code parameter. # @param return_code Return code to lookup cart ID by # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [CartResponse] def get_cart_by_return_code(return_code, opts = {}) data, _status_code, _headers = get_cart_by_return_code_with_http_info(return_code, opts) data end # Get cart (by return code) # Get a cart specified by the return code parameter. # @param return_code Return code to lookup cart ID by # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [Array<(CartResponse, Fixnum, Hash)>] CartResponse data, response status code and response headers def get_cart_by_return_code_with_http_info(return_code, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CheckoutApi.get_cart_by_return_code ...' end # verify the required parameter 'return_code' is set if @api_client.config.client_side_validation && return_code.nil? fail ArgumentError, "Missing the required parameter 'return_code' when calling CheckoutApi.get_cart_by_return_code" end # resource path local_var_path = '/checkout/return/{return_code}'.sub('{' + 'return_code' + '}', return_code.to_s) # query parameters query_params = {} query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil? # header parameters header_params = {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ultraCartBrowserApiKey', 'ultraCartOauth', 'ultraCartSimpleApiKey'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'CartResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: CheckoutApi#get_cart_by_return_code\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get cart (by return token) # Get a cart specified by the encrypted return token parameter. # @param [Hash] opts the optional parameters # @option opts [String] :return_token Return token provided by StoreFront Communications # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [CartResponse] def get_cart_by_return_token(opts = {}) data, _status_code, _headers = get_cart_by_return_token_with_http_info(opts) data end # Get cart (by return token) # Get a cart specified by the encrypted return token parameter. # @param [Hash] opts the optional parameters # @option opts [String] :return_token Return token provided by StoreFront Communications # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [Array<(CartResponse, Fixnum, Hash)>] CartResponse data, response status code and response headers def get_cart_by_return_token_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CheckoutApi.get_cart_by_return_token ...' end # resource path local_var_path = '/checkout/return_token' # query parameters query_params = {} query_params[:'return_token'] = opts[:'return_token'] if !opts[:'return_token'].nil? query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil? # header parameters header_params = {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ultraCartBrowserApiKey', 'ultraCartOauth', 'ultraCartSimpleApiKey'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'CartResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: CheckoutApi#get_cart_by_return_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get state/province list for a country code # Lookup a state/province list for a given country code # @param country_code Two letter ISO country code # @param [Hash] opts the optional parameters # @return [CheckoutStateProvinceResponse] def get_state_provinces_for_country(country_code, opts = {}) data, _status_code, _headers = get_state_provinces_for_country_with_http_info(country_code, opts) data end # Get state/province list for a country code # Lookup a state/province list for a given country code # @param country_code Two letter ISO country code # @param [Hash] opts the optional parameters # @return [Array<(CheckoutStateProvinceResponse, Fixnum, Hash)>] CheckoutStateProvinceResponse data, response status code and response headers def get_state_provinces_for_country_with_http_info(country_code, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CheckoutApi.get_state_provinces_for_country ...' end # verify the required parameter 'country_code' is set if @api_client.config.client_side_validation && country_code.nil? fail ArgumentError, "Missing the required parameter 'country_code' when calling CheckoutApi.get_state_provinces_for_country" end # resource path local_var_path = '/checkout/stateProvincesForCountry/{country_code}'.sub('{' + 'country_code' + '}', country_code.to_s) # query parameters query_params = {} # header parameters header_params = {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ultraCartBrowserApiKey', 'ultraCartOauth', 'ultraCartSimpleApiKey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'CheckoutStateProvinceResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: CheckoutApi#get_state_provinces_for_country\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Handoff cart # Handoff the browser to UltraCart for view cart on StoreFront, transfer to PayPal, transfer to Affirm, transfer to Sezzle or finalization of the order (including upsell processing). # @param handoff_request Handoff request # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [CheckoutHandoffResponse] def handoff_cart(handoff_request, opts = {}) data, _status_code, _headers = handoff_cart_with_http_info(handoff_request, opts) data end # Handoff cart # Handoff the browser to UltraCart for view cart on StoreFront, transfer to PayPal, transfer to Affirm, transfer to Sezzle or finalization of the order (including upsell processing). # @param handoff_request Handoff request # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [Array<(CheckoutHandoffResponse, Fixnum, Hash)>] CheckoutHandoffResponse data, response status code and response headers def handoff_cart_with_http_info(handoff_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CheckoutApi.handoff_cart ...' end # verify the required parameter 'handoff_request' is set if @api_client.config.client_side_validation && handoff_request.nil? fail ArgumentError, "Missing the required parameter 'handoff_request' when calling CheckoutApi.handoff_cart" end # resource path local_var_path = '/checkout/cart/handoff' # query parameters query_params = {} query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil? # header parameters header_params = {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(handoff_request) auth_names = ['ultraCartBrowserApiKey', 'ultraCartOauth', 'ultraCartSimpleApiKey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'CheckoutHandoffResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: CheckoutApi#handoff_cart\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Profile login # Login in to the customer profile specified by cart.billing.email and password # @param login_request Login request # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [CartProfileLoginResponse] def login(login_request, opts = {}) data, _status_code, _headers = login_with_http_info(login_request, opts) data end # Profile login # Login in to the customer profile specified by cart.billing.email and password # @param login_request Login request # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [Array<(CartProfileLoginResponse, Fixnum, Hash)>] CartProfileLoginResponse data, response status code and response headers def login_with_http_info(login_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CheckoutApi.login ...' end # verify the required parameter 'login_request' is set if @api_client.config.client_side_validation && login_request.nil? fail ArgumentError, "Missing the required parameter 'login_request' when calling CheckoutApi.login" end # resource path local_var_path = '/checkout/cart/profile/login' # query parameters query_params = {} query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil? # header parameters header_params = {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(login_request) auth_names = ['ultraCartBrowserApiKey', 'ultraCartOauth', 'ultraCartSimpleApiKey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'CartProfileLoginResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: CheckoutApi#login\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Profile logout # Log the cart out of the current profile. No error will occur if they are not logged in. # @param cart Cart # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [CartResponse] def logout(cart, opts = {}) data, _status_code, _headers = logout_with_http_info(cart, opts) data end # Profile logout # Log the cart out of the current profile. No error will occur if they are not logged in. # @param cart Cart # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [Array<(CartResponse, Fixnum, Hash)>] CartResponse data, response status code and response headers def logout_with_http_info(cart, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CheckoutApi.logout ...' end # verify the required parameter 'cart' is set if @api_client.config.client_side_validation && cart.nil? fail ArgumentError, "Missing the required parameter 'cart' when calling CheckoutApi.logout" end # resource path local_var_path = '/checkout/cart/profile/logout' # query parameters query_params = {} query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil? # header parameters header_params = {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(cart) auth_names = ['ultraCartBrowserApiKey', 'ultraCartOauth', 'ultraCartSimpleApiKey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'CartResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: CheckoutApi#logout\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Profile registration # Register a new customer profile. Requires the cart.billing object to be populated along with the password. # @param register_request Register request # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [CartProfileRegisterResponse] def register(register_request, opts = {}) data, _status_code, _headers = register_with_http_info(register_request, opts) data end # Profile registration # Register a new customer profile. Requires the cart.billing object to be populated along with the password. # @param register_request Register request # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [Array<(CartProfileRegisterResponse, Fixnum, Hash)>] CartProfileRegisterResponse data, response status code and response headers def register_with_http_info(register_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CheckoutApi.register ...' end # verify the required parameter 'register_request' is set if @api_client.config.client_side_validation && register_request.nil? fail ArgumentError, "Missing the required parameter 'register_request' when calling CheckoutApi.register" end # resource path local_var_path = '/checkout/cart/profile/register' # query parameters query_params = {} query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil? # header parameters header_params = {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(register_request) auth_names = ['ultraCartBrowserApiKey', 'ultraCartOauth', 'ultraCartSimpleApiKey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'CartProfileRegisterResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: CheckoutApi#register\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Register affiliate click # Register an affiliate click. Used by custom checkouts that are completely API based and do not perform checkout handoff. # @param register_affiliate_click_request Register affiliate click request # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [RegisterAffiliateClickResponse] def register_affiliate_click(register_affiliate_click_request, opts = {}) data, _status_code, _headers = register_affiliate_click_with_http_info(register_affiliate_click_request, opts) data end # Register affiliate click # Register an affiliate click. Used by custom checkouts that are completely API based and do not perform checkout handoff. # @param register_affiliate_click_request Register affiliate click request # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [Array<(RegisterAffiliateClickResponse, Fixnum, Hash)>] RegisterAffiliateClickResponse data, response status code and response headers def register_affiliate_click_with_http_info(register_affiliate_click_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CheckoutApi.register_affiliate_click ...' end # verify the required parameter 'register_affiliate_click_request' is set if @api_client.config.client_side_validation && register_affiliate_click_request.nil? fail ArgumentError, "Missing the required parameter 'register_affiliate_click_request' when calling CheckoutApi.register_affiliate_click" end # resource path local_var_path = '/checkout/affiliateClick/register' # query parameters query_params = {} query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil? # header parameters header_params = {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(register_affiliate_click_request) auth_names = ['ultraCartBrowserApiKey', 'ultraCartOauth', 'ultraCartSimpleApiKey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'RegisterAffiliateClickResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: CheckoutApi#register_affiliate_click\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Related items # Retrieve all the related items for the cart contents. Expansion is limited to content, content.assignments, content.attributes, content.multimedia, content.multimedia.thumbnails, options, pricing, and pricing.tiers. # @param cart Cart # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See item resource documentation for examples # @return [ItemsResponse] def related_items_for_cart(cart, opts = {}) data, _status_code, _headers = related_items_for_cart_with_http_info(cart, opts) data end # Related items # Retrieve all the related items for the cart contents. Expansion is limited to content, content.assignments, content.attributes, content.multimedia, content.multimedia.thumbnails, options, pricing, and pricing.tiers. # @param cart Cart # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See item resource documentation for examples # @return [Array<(ItemsResponse, Fixnum, Hash)>] ItemsResponse data, response status code and response headers def related_items_for_cart_with_http_info(cart, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CheckoutApi.related_items_for_cart ...' end # verify the required parameter 'cart' is set if @api_client.config.client_side_validation && cart.nil? fail ArgumentError, "Missing the required parameter 'cart' when calling CheckoutApi.related_items_for_cart" end # resource path local_var_path = '/checkout/related_items' # query parameters query_params = {} query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil? # header parameters header_params = {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(cart) auth_names = ['ultraCartBrowserApiKey', 'ultraCartOauth', 'ultraCartSimpleApiKey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'ItemsResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: CheckoutApi#related_items_for_cart\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Related items (specific item) # Retrieve all the related items for the cart contents. Expansion is limited to content, content.assignments, content.attributes, content.multimedia, content.multimedia.thumbnails, options, pricing, and pricing.tiers. # @param item_id Item ID to retrieve related items for # @param cart Cart # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See item resource documentation for examples # @return [ItemsResponse] def related_items_for_item(item_id, cart, opts = {}) data, _status_code, _headers = related_items_for_item_with_http_info(item_id, cart, opts) data end # Related items (specific item) # Retrieve all the related items for the cart contents. Expansion is limited to content, content.assignments, content.attributes, content.multimedia, content.multimedia.thumbnails, options, pricing, and pricing.tiers. # @param item_id Item ID to retrieve related items for # @param cart Cart # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See item resource documentation for examples # @return [Array<(ItemsResponse, Fixnum, Hash)>] ItemsResponse data, response status code and response headers def related_items_for_item_with_http_info(item_id, cart, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CheckoutApi.related_items_for_item ...' end # verify the required parameter 'item_id' is set if @api_client.config.client_side_validation && item_id.nil? fail ArgumentError, "Missing the required parameter 'item_id' when calling CheckoutApi.related_items_for_item" end # verify the required parameter 'cart' is set if @api_client.config.client_side_validation && cart.nil? fail ArgumentError, "Missing the required parameter 'cart' when calling CheckoutApi.related_items_for_item" end # resource path local_var_path = '/checkout/relatedItems/{item_id}'.sub('{' + 'item_id' + '}', item_id.to_s) # query parameters query_params = {} query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil? # header parameters header_params = {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(cart) auth_names = ['ultraCartBrowserApiKey', 'ultraCartOauth', 'ultraCartSimpleApiKey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'ItemsResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: CheckoutApi#related_items_for_item\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Setup Browser Application # Setup a browser key authenticated application with checkout permissions. This REST call must be made with an authentication scheme that is not browser key. The new application will be linked to the application that makes this call. If this application is disabled / deleted, then so will the application setup by this call. The purpose of this call is to allow an OAuth applicaiton, such as the Wordpress plugin, to setup the proper browser based authentication for the REST checkout API to use. # @param browser_key_request Setup browser key request # @param [Hash] opts the optional parameters # @return [CheckoutSetupBrowserKeyResponse] def setup_browser_key(browser_key_request, opts = {}) data, _status_code, _headers = setup_browser_key_with_http_info(browser_key_request, opts) data end # Setup Browser Application # Setup a browser key authenticated application with checkout permissions. This REST call must be made with an authentication scheme that is not browser key. The new application will be linked to the application that makes this call. If this application is disabled / deleted, then so will the application setup by this call. The purpose of this call is to allow an OAuth applicaiton, such as the Wordpress plugin, to setup the proper browser based authentication for the REST checkout API to use. # @param browser_key_request Setup browser key request # @param [Hash] opts the optional parameters # @return [Array<(CheckoutSetupBrowserKeyResponse, Fixnum, Hash)>] CheckoutSetupBrowserKeyResponse data, response status code and response headers def setup_browser_key_with_http_info(browser_key_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CheckoutApi.setup_browser_key ...' end # verify the required parameter 'browser_key_request' is set if @api_client.config.client_side_validation && browser_key_request.nil? fail ArgumentError, "Missing the required parameter 'browser_key_request' when calling CheckoutApi.setup_browser_key" end # resource path local_var_path = '/checkout/browser_key' # query parameters query_params = {} # header parameters header_params = {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(browser_key_request) auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey'] data, status_code, headers = @api_client.call_api(:PUT, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'CheckoutSetupBrowserKeyResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: CheckoutApi#setup_browser_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update cart # Update the cart. # @param cart Cart # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [CartResponse] def update_cart(cart, opts = {}) data, _status_code, _headers = update_cart_with_http_info(cart, opts) data end # Update cart # Update the cart. # @param cart Cart # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [Array<(CartResponse, Fixnum, Hash)>] CartResponse data, response status code and response headers def update_cart_with_http_info(cart, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CheckoutApi.update_cart ...' end # verify the required parameter 'cart' is set if @api_client.config.client_side_validation && cart.nil? fail ArgumentError, "Missing the required parameter 'cart' when calling CheckoutApi.update_cart" end # resource path local_var_path = '/checkout/cart' # query parameters query_params = {} query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil? # header parameters header_params = {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(cart) auth_names = ['ultraCartBrowserApiKey', 'ultraCartOauth', 'ultraCartSimpleApiKey'] data, status_code, headers = @api_client.call_api(:PUT, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'CartResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: CheckoutApi#update_cart\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Validate # Validate the cart for errors. Specific checks can be passed and multiple validations can occur throughout your checkout flow. # @param validation_request Validation request # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [CartValidationResponse] def validate_cart(validation_request, opts = {}) data, _status_code, _headers = validate_cart_with_http_info(validation_request, opts) data end # Validate # Validate the cart for errors. Specific checks can be passed and multiple validations can occur throughout your checkout flow. # @param validation_request Validation request # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [Array<(CartValidationResponse, Fixnum, Hash)>] CartValidationResponse data, response status code and response headers def validate_cart_with_http_info(validation_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CheckoutApi.validate_cart ...' end # verify the required parameter 'validation_request' is set if @api_client.config.client_side_validation && validation_request.nil? fail ArgumentError, "Missing the required parameter 'validation_request' when calling CheckoutApi.validate_cart" end # resource path local_var_path = '/checkout/cart/validate' # query parameters query_params = {} query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil? # header parameters header_params = {} header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version() # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(validation_request) auth_names = ['ultraCartBrowserApiKey', 'ultraCartOauth', 'ultraCartSimpleApiKey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'CartValidationResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: CheckoutApi#validate_cart\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end