=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 ChargebackApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end def self.new_using_api_key(simple_key, verify_ssl = true, debugging = false) api_config = Configuration.new api_config.api_key_prefix['x-ultracart-simple-key'] = simple_key api_config.api_version = '2017-03-01' api_config.verify_ssl = verify_ssl api_client = ApiClient.new(api_config) api_client.config.debugging = debugging UltracartClient::ChargebackApi.new(api_client) end # Delete a chargeback # Delete a chargeback on the UltraCart account. # @param chargeback_dispute_oid The chargeback_dispute_oid to delete. # @param [Hash] opts the optional parameters # @return [ChargebackDisputeResponse] def delete_chargeback(chargeback_dispute_oid, opts = {}) data, _status_code, _headers = delete_chargeback_with_http_info(chargeback_dispute_oid, opts) data end # Delete a chargeback # Delete a chargeback on the UltraCart account. # @param chargeback_dispute_oid The chargeback_dispute_oid to delete. # @param [Hash] opts the optional parameters # @return [Array<(ChargebackDisputeResponse, Fixnum, Hash)>] ChargebackDisputeResponse data, response status code and response headers def delete_chargeback_with_http_info(chargeback_dispute_oid, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ChargebackApi.delete_chargeback ...' end # verify the required parameter 'chargeback_dispute_oid' is set if @api_client.config.client_side_validation && chargeback_dispute_oid.nil? fail ArgumentError, "Missing the required parameter 'chargeback_dispute_oid' when calling ChargebackApi.delete_chargeback" end # resource path local_var_path = '/chargeback/chargebacks/{chargeback_dispute_oid}'.sub('{' + 'chargeback_dispute_oid' + '}', chargeback_dispute_oid.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; charset=UTF-8']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey'] data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'ChargebackDisputeResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: ChargebackApi#delete_chargeback\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Retrieve a chargeback # Retrieves a single chargeback using the specified chargeback dispute oid. # @param chargeback_dispute_oid The chargeback dispute oid 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 [ChargebackDisputeResponse] def get_chargeback_dispute(chargeback_dispute_oid, opts = {}) data, _status_code, _headers = get_chargeback_dispute_with_http_info(chargeback_dispute_oid, opts) data end # Retrieve a chargeback # Retrieves a single chargeback using the specified chargeback dispute oid. # @param chargeback_dispute_oid The chargeback dispute oid 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<(ChargebackDisputeResponse, Fixnum, Hash)>] ChargebackDisputeResponse data, response status code and response headers def get_chargeback_dispute_with_http_info(chargeback_dispute_oid, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ChargebackApi.get_chargeback_dispute ...' end # verify the required parameter 'chargeback_dispute_oid' is set if @api_client.config.client_side_validation && chargeback_dispute_oid.nil? fail ArgumentError, "Missing the required parameter 'chargeback_dispute_oid' when calling ChargebackApi.get_chargeback_dispute" end # resource path local_var_path = '/chargeback/chargebacks/{chargeback_dispute_oid}'.sub('{' + 'chargeback_dispute_oid' + '}', chargeback_dispute_oid.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 = ['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 => 'ChargebackDisputeResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: ChargebackApi#get_chargeback_dispute\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Retrieve chargebacks # Retrieves chargebacks from the account. If no parameters are specified, all chargebacks will be returned. You will need to make multiple API calls in order to retrieve the entire result set since this API performs result set pagination. # @param [Hash] opts the optional parameters # @option opts [String] :order_id Order Id # @option opts [String] :case_number Case number # @option opts [String] :status Status # @option opts [String] :expiration_dts_start Expiration dts start # @option opts [String] :expiration_dts_end Expiration dts end # @option opts [String] :chargeback_dts_start Chargeback dts start # @option opts [String] :chargeback_dts_end Chargeback dts end # @option opts [Integer] :_limit The maximum number of records to return on this one API call. (Max 200) (default to 100) # @option opts [Integer] :_offset Pagination of the record set. Offset is a zero based index. (default to 0) # @option opts [String] :_since Fetch chargebacks that have been created/modified since this date/time. # @option opts [String] :_sort The sort order of the chargebacks. See Sorting documentation for examples of using multiple values and sorting by ascending and descending. # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [ChargebackDisputesResponse] def get_chargeback_disputes(opts = {}) data, _status_code, _headers = get_chargeback_disputes_with_http_info(opts) data end # Retrieve chargebacks # Retrieves chargebacks from the account. If no parameters are specified, all chargebacks will be returned. You will need to make multiple API calls in order to retrieve the entire result set since this API performs result set pagination. # @param [Hash] opts the optional parameters # @option opts [String] :order_id Order Id # @option opts [String] :case_number Case number # @option opts [String] :status Status # @option opts [String] :expiration_dts_start Expiration dts start # @option opts [String] :expiration_dts_end Expiration dts end # @option opts [String] :chargeback_dts_start Chargeback dts start # @option opts [String] :chargeback_dts_end Chargeback dts end # @option opts [Integer] :_limit The maximum number of records to return on this one API call. (Max 200) # @option opts [Integer] :_offset Pagination of the record set. Offset is a zero based index. # @option opts [String] :_since Fetch chargebacks that have been created/modified since this date/time. # @option opts [String] :_sort The sort order of the chargebacks. See Sorting documentation for examples of using multiple values and sorting by ascending and descending. # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [Array<(ChargebackDisputesResponse, Fixnum, Hash)>] ChargebackDisputesResponse data, response status code and response headers def get_chargeback_disputes_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ChargebackApi.get_chargeback_disputes ...' end # resource path local_var_path = '/chargeback/chargebacks' # query parameters query_params = {} query_params[:'order_id'] = opts[:'order_id'] if !opts[:'order_id'].nil? query_params[:'case_number'] = opts[:'case_number'] if !opts[:'case_number'].nil? query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil? query_params[:'expiration_dts_start'] = opts[:'expiration_dts_start'] if !opts[:'expiration_dts_start'].nil? query_params[:'expiration_dts_end'] = opts[:'expiration_dts_end'] if !opts[:'expiration_dts_end'].nil? query_params[:'chargeback_dts_start'] = opts[:'chargeback_dts_start'] if !opts[:'chargeback_dts_start'].nil? query_params[:'chargeback_dts_end'] = opts[:'chargeback_dts_end'] if !opts[:'chargeback_dts_end'].nil? query_params[:'_limit'] = opts[:'_limit'] if !opts[:'_limit'].nil? query_params[:'_offset'] = opts[:'_offset'] if !opts[:'_offset'].nil? query_params[:'_since'] = opts[:'_since'] if !opts[:'_since'].nil? query_params[:'_sort'] = opts[:'_sort'] if !opts[:'_sort'].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 = ['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 => 'ChargebackDisputesResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: ChargebackApi#get_chargeback_disputes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Insert a chargeback # Insert a chargeback on the UltraCart account. # @param chargeback Chargeback to insert # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [ChargebackDisputeResponse] def insert_chargeback(chargeback, opts = {}) data, _status_code, _headers = insert_chargeback_with_http_info(chargeback, opts) data end # Insert a chargeback # Insert a chargeback on the UltraCart account. # @param chargeback Chargeback to insert # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [Array<(ChargebackDisputeResponse, Fixnum, Hash)>] ChargebackDisputeResponse data, response status code and response headers def insert_chargeback_with_http_info(chargeback, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ChargebackApi.insert_chargeback ...' end # verify the required parameter 'chargeback' is set if @api_client.config.client_side_validation && chargeback.nil? fail ArgumentError, "Missing the required parameter 'chargeback' when calling ChargebackApi.insert_chargeback" end # resource path local_var_path = '/chargeback/chargebacks' # 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; charset=UTF-8']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(chargeback) 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 => 'ChargebackDisputeResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: ChargebackApi#insert_chargeback\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update a chargeback # Update a chargeback on the UltraCart account. # @param chargeback Chargeback to update # @param chargeback_dispute_oid The chargeback_dispute_oid to update. # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [ChargebackDisputeResponse] def update_chargeback(chargeback, chargeback_dispute_oid, opts = {}) data, _status_code, _headers = update_chargeback_with_http_info(chargeback, chargeback_dispute_oid, opts) data end # Update a chargeback # Update a chargeback on the UltraCart account. # @param chargeback Chargeback to update # @param chargeback_dispute_oid The chargeback_dispute_oid to update. # @param [Hash] opts the optional parameters # @option opts [String] :_expand The object expansion to perform on the result. See documentation for examples # @return [Array<(ChargebackDisputeResponse, Fixnum, Hash)>] ChargebackDisputeResponse data, response status code and response headers def update_chargeback_with_http_info(chargeback, chargeback_dispute_oid, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ChargebackApi.update_chargeback ...' end # verify the required parameter 'chargeback' is set if @api_client.config.client_side_validation && chargeback.nil? fail ArgumentError, "Missing the required parameter 'chargeback' when calling ChargebackApi.update_chargeback" end # verify the required parameter 'chargeback_dispute_oid' is set if @api_client.config.client_side_validation && chargeback_dispute_oid.nil? fail ArgumentError, "Missing the required parameter 'chargeback_dispute_oid' when calling ChargebackApi.update_chargeback" end # resource path local_var_path = '/chargeback/chargebacks/{chargeback_dispute_oid}'.sub('{' + 'chargeback_dispute_oid' + '}', chargeback_dispute_oid.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; charset=UTF-8']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(chargeback) 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 => 'ChargebackDisputeResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: ChargebackApi#update_chargeback\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end