=begin #Square Connect API OpenAPI spec version: 2.0 Contact: developers@squareup.com Generated by: https://github.com/swagger-api/swagger-codegen.git =end require "uri" module SquareConnect class V1TransactionsApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # CreateRefund # Issues a refund for a previously processed payment. You must issue a refund within 60 days of the associated payment. You cannot issue a partial refund for a split tender payment. You must instead issue a full or partial refund for a particular tender, by providing the applicable tender id to the V1CreateRefund endpoint. Issuing a full refund for a split tender payment refunds all tenders associated with the payment. Issuing a refund for a card payment is not reversible. For development purposes, you can create fake cash payments in Square Point of Sale and refund them. # @param location_id The ID of the original payment's associated location. # @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. # @param [Hash] opts the optional parameters # @return [V1Refund] def create_refund(location_id, body, opts = {}) data, _status_code, _headers = create_refund_with_http_info(location_id, body, opts) return data end # CreateRefund # Issues a refund for a previously processed payment. You must issue a refund within 60 days of the associated payment. You cannot issue a partial refund for a split tender payment. You must instead issue a full or partial refund for a particular tender, by providing the applicable tender id to the V1CreateRefund endpoint. Issuing a full refund for a split tender payment refunds all tenders associated with the payment. Issuing a refund for a card payment is not reversible. For development purposes, you can create fake cash payments in Square Point of Sale and refund them. # @param location_id The ID of the original payment's associated location. # @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. # @param [Hash] opts the optional parameters # @return [Array<(V1Refund, Fixnum, Hash)>] V1Refund data, response status code and response headers def create_refund_with_http_info(location_id, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: V1TransactionsApi.create_refund ..." end # verify the required parameter 'location_id' is set fail ArgumentError, "Missing the required parameter 'location_id' when calling V1TransactionsApi.create_refund" if location_id.nil? # verify the required parameter 'body' is set fail ArgumentError, "Missing the required parameter 'body' when calling V1TransactionsApi.create_refund" if body.nil? # resource path local_var_path = "/v1/{location_id}/refunds".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # 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']) header_params['Square-Version'] = "2019-06-12" # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(body) auth_names = ['oauth2'] 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 => 'V1Refund') if @api_client.config.debugging @api_client.config.logger.debug "API called: V1TransactionsApi#create_refund\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # ListBankAccounts # Provides non-confidential details for all of a location's associated bank accounts. This endpoint does not provide full bank account numbers, and there is no way to obtain a full bank account number with the Connect API. # @param location_id The ID of the location to list bank accounts for. # @param [Hash] opts the optional parameters # @return [Array] def list_bank_accounts(location_id, opts = {}) data, _status_code, _headers = list_bank_accounts_with_http_info(location_id, opts) return data end # ListBankAccounts # Provides non-confidential details for all of a location's associated bank accounts. This endpoint does not provide full bank account numbers, and there is no way to obtain a full bank account number with the Connect API. # @param location_id The ID of the location to list bank accounts for. # @param [Hash] opts the optional parameters # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers def list_bank_accounts_with_http_info(location_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: V1TransactionsApi.list_bank_accounts ..." end # verify the required parameter 'location_id' is set fail ArgumentError, "Missing the required parameter 'location_id' when calling V1TransactionsApi.list_bank_accounts" if location_id.nil? # resource path local_var_path = "/v1/{location_id}/bank-accounts".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # 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']) header_params['Square-Version'] = "2019-06-12" # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['oauth2'] 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 => 'Array') if @api_client.config.debugging @api_client.config.logger.debug "API called: V1TransactionsApi#list_bank_accounts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # ListOrders # Provides summary information for a merchant's online store orders. # @param location_id The ID of the location to list online store orders for. # @param [Hash] opts the optional parameters # @option opts [String] :order TThe order in which payments are listed in the response. # @option opts [Integer] :limit The maximum number of payments to return in a single response. This value cannot exceed 200. # @option opts [String] :batch_token A pagination cursor to retrieve the next set of results for your original query to the endpoint. # @return [Array] def list_orders(location_id, opts = {}) data, _status_code, _headers = list_orders_with_http_info(location_id, opts) return data end # ListOrders # Provides summary information for a merchant's online store orders. # @param location_id The ID of the location to list online store orders for. # @param [Hash] opts the optional parameters # @option opts [String] :order TThe order in which payments are listed in the response. # @option opts [Integer] :limit The maximum number of payments to return in a single response. This value cannot exceed 200. # @option opts [String] :batch_token A pagination cursor to retrieve the next set of results for your original query to the endpoint. # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers def list_orders_with_http_info(location_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: V1TransactionsApi.list_orders ..." end # verify the required parameter 'location_id' is set fail ArgumentError, "Missing the required parameter 'location_id' when calling V1TransactionsApi.list_orders" if location_id.nil? if opts[:'order'] && !['DESC', 'ASC'].include?(opts[:'order']) fail ArgumentError, 'invalid value for "order", must be one of DESC, ASC' end # resource path local_var_path = "/v1/{location_id}/orders".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s) # query parameters query_params = {} query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'batch_token'] = opts[:'batch_token'] if !opts[:'batch_token'].nil? # header parameters header_params = {} # 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']) header_params['Square-Version'] = "2019-06-12" # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['oauth2'] 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 => 'Array') if @api_client.config.debugging @api_client.config.logger.debug "API called: V1TransactionsApi#list_orders\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # ListPayments # Provides summary information for all payments taken for a given Square account during a date range. Date ranges cannot exceed 1 year in length. See Date ranges for details of inclusive and exclusive dates. *Note**: Details for payments processed with Square Point of Sale while in offline mode may not be transmitted to Square for up to 72 hours. Offline payments have a `created_at` value that reflects the time the payment was originally processed, not the time it was subsequently transmitted to Square. Consequently, the ListPayments endpoint might list an offline payment chronologically between online payments that were seen in a previous request. # @param location_id The ID of the location to list payments for. If you specify me, this endpoint returns payments aggregated from all of the business's locations. # @param [Hash] opts the optional parameters # @option opts [String] :order The order in which payments are listed in the response. # @option opts [String] :begin_time The beginning of the requested reporting period, in ISO 8601 format. If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time minus one year. # @option opts [String] :end_time The end of the requested reporting period, in ISO 8601 format. If this value is more than one year greater than begin_time, this endpoint returns an error. Default value: The current time. # @option opts [Integer] :limit The maximum number of payments to return in a single response. This value cannot exceed 200. # @option opts [String] :batch_token A pagination cursor to retrieve the next set of results for your original query to the endpoint. # @option opts [BOOLEAN] :include_partial Indicates whether or not to include partial payments in the response. Partial payments will have the tenders collected so far, but the itemizations will be empty until the payment is completed. # @return [Array] def list_payments(location_id, opts = {}) data, _status_code, _headers = list_payments_with_http_info(location_id, opts) return data end # ListPayments # Provides summary information for all payments taken for a given Square account during a date range. Date ranges cannot exceed 1 year in length. See Date ranges for details of inclusive and exclusive dates. *Note**: Details for payments processed with Square Point of Sale while in offline mode may not be transmitted to Square for up to 72 hours. Offline payments have a `created_at` value that reflects the time the payment was originally processed, not the time it was subsequently transmitted to Square. Consequently, the ListPayments endpoint might list an offline payment chronologically between online payments that were seen in a previous request. # @param location_id The ID of the location to list payments for. If you specify me, this endpoint returns payments aggregated from all of the business's locations. # @param [Hash] opts the optional parameters # @option opts [String] :order The order in which payments are listed in the response. # @option opts [String] :begin_time The beginning of the requested reporting period, in ISO 8601 format. If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time minus one year. # @option opts [String] :end_time The end of the requested reporting period, in ISO 8601 format. If this value is more than one year greater than begin_time, this endpoint returns an error. Default value: The current time. # @option opts [Integer] :limit The maximum number of payments to return in a single response. This value cannot exceed 200. # @option opts [String] :batch_token A pagination cursor to retrieve the next set of results for your original query to the endpoint. # @option opts [BOOLEAN] :include_partial Indicates whether or not to include partial payments in the response. Partial payments will have the tenders collected so far, but the itemizations will be empty until the payment is completed. # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers def list_payments_with_http_info(location_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: V1TransactionsApi.list_payments ..." end # verify the required parameter 'location_id' is set fail ArgumentError, "Missing the required parameter 'location_id' when calling V1TransactionsApi.list_payments" if location_id.nil? if opts[:'order'] && !['DESC', 'ASC'].include?(opts[:'order']) fail ArgumentError, 'invalid value for "order", must be one of DESC, ASC' end # resource path local_var_path = "/v1/{location_id}/payments".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s) # query parameters query_params = {} query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil? query_params[:'begin_time'] = opts[:'begin_time'] if !opts[:'begin_time'].nil? query_params[:'end_time'] = opts[:'end_time'] if !opts[:'end_time'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'batch_token'] = opts[:'batch_token'] if !opts[:'batch_token'].nil? query_params[:'include_partial'] = opts[:'include_partial'] if !opts[:'include_partial'].nil? # header parameters header_params = {} # 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']) header_params['Square-Version'] = "2019-06-12" # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['oauth2'] 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 => 'Array') if @api_client.config.debugging @api_client.config.logger.debug "API called: V1TransactionsApi#list_payments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # ListRefunds # Provides the details for all refunds initiated by a merchant or any of the merchant's mobile staff during a date range. Date ranges cannot exceed one year in length. # @param location_id The ID of the location to list refunds for. # @param [Hash] opts the optional parameters # @option opts [String] :order TThe order in which payments are listed in the response. # @option opts [String] :begin_time The beginning of the requested reporting period, in ISO 8601 format. If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time minus one year. # @option opts [String] :end_time The end of the requested reporting period, in ISO 8601 format. If this value is more than one year greater than begin_time, this endpoint returns an error. Default value: The current time. # @option opts [Integer] :limit The approximate number of refunds to return in a single response. Default: 100. Max: 200. Response may contain more results than the prescribed limit when refunds are made simultaneously to multiple tenders in a payment or when refunds are generated in an exchange to account for the value of returned goods. # @option opts [String] :batch_token A pagination cursor to retrieve the next set of results for your original query to the endpoint. # @return [Array] def list_refunds(location_id, opts = {}) data, _status_code, _headers = list_refunds_with_http_info(location_id, opts) return data end # ListRefunds # Provides the details for all refunds initiated by a merchant or any of the merchant's mobile staff during a date range. Date ranges cannot exceed one year in length. # @param location_id The ID of the location to list refunds for. # @param [Hash] opts the optional parameters # @option opts [String] :order TThe order in which payments are listed in the response. # @option opts [String] :begin_time The beginning of the requested reporting period, in ISO 8601 format. If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time minus one year. # @option opts [String] :end_time The end of the requested reporting period, in ISO 8601 format. If this value is more than one year greater than begin_time, this endpoint returns an error. Default value: The current time. # @option opts [Integer] :limit The approximate number of refunds to return in a single response. Default: 100. Max: 200. Response may contain more results than the prescribed limit when refunds are made simultaneously to multiple tenders in a payment or when refunds are generated in an exchange to account for the value of returned goods. # @option opts [String] :batch_token A pagination cursor to retrieve the next set of results for your original query to the endpoint. # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers def list_refunds_with_http_info(location_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: V1TransactionsApi.list_refunds ..." end # verify the required parameter 'location_id' is set fail ArgumentError, "Missing the required parameter 'location_id' when calling V1TransactionsApi.list_refunds" if location_id.nil? if opts[:'order'] && !['DESC', 'ASC'].include?(opts[:'order']) fail ArgumentError, 'invalid value for "order", must be one of DESC, ASC' end # resource path local_var_path = "/v1/{location_id}/refunds".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s) # query parameters query_params = {} query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil? query_params[:'begin_time'] = opts[:'begin_time'] if !opts[:'begin_time'].nil? query_params[:'end_time'] = opts[:'end_time'] if !opts[:'end_time'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'batch_token'] = opts[:'batch_token'] if !opts[:'batch_token'].nil? # header parameters header_params = {} # 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']) header_params['Square-Version'] = "2019-06-12" # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['oauth2'] 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 => 'Array') if @api_client.config.debugging @api_client.config.logger.debug "API called: V1TransactionsApi#list_refunds\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # ListSettlements # Provides summary information for all deposits and withdrawals initiated by Square to a linked bank account during a date range. Date ranges cannot exceed one year in length. *Note**: the ListSettlements endpoint does not provide entry information. # @param location_id The ID of the location to list settlements for. If you specify me, this endpoint returns payments aggregated from all of the business's locations. # @param [Hash] opts the optional parameters # @option opts [String] :order TThe order in which payments are listed in the response. # @option opts [String] :begin_time The beginning of the requested reporting period, in ISO 8601 format. If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time minus one year. # @option opts [String] :end_time The end of the requested reporting period, in ISO 8601 format. If this value is more than one year greater than begin_time, this endpoint returns an error. Default value: The current time. # @option opts [Integer] :limit The maximum number of payments to return in a single response. This value cannot exceed 200. # @option opts [String] :status Provide this parameter to retrieve only settlements with a particular status (SENT or FAILED). # @option opts [String] :batch_token A pagination cursor to retrieve the next set of results for your original query to the endpoint. # @return [Array] def list_settlements(location_id, opts = {}) data, _status_code, _headers = list_settlements_with_http_info(location_id, opts) return data end # ListSettlements # Provides summary information for all deposits and withdrawals initiated by Square to a linked bank account during a date range. Date ranges cannot exceed one year in length. *Note**: the ListSettlements endpoint does not provide entry information. # @param location_id The ID of the location to list settlements for. If you specify me, this endpoint returns payments aggregated from all of the business's locations. # @param [Hash] opts the optional parameters # @option opts [String] :order TThe order in which payments are listed in the response. # @option opts [String] :begin_time The beginning of the requested reporting period, in ISO 8601 format. If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time minus one year. # @option opts [String] :end_time The end of the requested reporting period, in ISO 8601 format. If this value is more than one year greater than begin_time, this endpoint returns an error. Default value: The current time. # @option opts [Integer] :limit The maximum number of payments to return in a single response. This value cannot exceed 200. # @option opts [String] :status Provide this parameter to retrieve only settlements with a particular status (SENT or FAILED). # @option opts [String] :batch_token A pagination cursor to retrieve the next set of results for your original query to the endpoint. # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers def list_settlements_with_http_info(location_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: V1TransactionsApi.list_settlements ..." end # verify the required parameter 'location_id' is set fail ArgumentError, "Missing the required parameter 'location_id' when calling V1TransactionsApi.list_settlements" if location_id.nil? if opts[:'order'] && !['DESC', 'ASC'].include?(opts[:'order']) fail ArgumentError, 'invalid value for "order", must be one of DESC, ASC' end if opts[:'status'] && !['SENT', 'FAILED'].include?(opts[:'status']) fail ArgumentError, 'invalid value for "status", must be one of SENT, FAILED' end # resource path local_var_path = "/v1/{location_id}/settlements".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s) # query parameters query_params = {} query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil? query_params[:'begin_time'] = opts[:'begin_time'] if !opts[:'begin_time'].nil? query_params[:'end_time'] = opts[:'end_time'] if !opts[:'end_time'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil? query_params[:'batch_token'] = opts[:'batch_token'] if !opts[:'batch_token'].nil? # header parameters header_params = {} # 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']) header_params['Square-Version'] = "2019-06-12" # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['oauth2'] 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 => 'Array') if @api_client.config.debugging @api_client.config.logger.debug "API called: V1TransactionsApi#list_settlements\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # RetrieveBankAccount # Provides non-confidential details for a merchant's associated bank account. This endpoint does not provide full bank account numbers, and there is no way to obtain a full bank account number with the Connect API. # @param location_id The ID of the bank account's associated location. # @param bank_account_id The bank account's Square-issued ID. You obtain this value from Settlement objects returned. # @param [Hash] opts the optional parameters # @return [V1BankAccount] def retrieve_bank_account(location_id, bank_account_id, opts = {}) data, _status_code, _headers = retrieve_bank_account_with_http_info(location_id, bank_account_id, opts) return data end # RetrieveBankAccount # Provides non-confidential details for a merchant's associated bank account. This endpoint does not provide full bank account numbers, and there is no way to obtain a full bank account number with the Connect API. # @param location_id The ID of the bank account's associated location. # @param bank_account_id The bank account's Square-issued ID. You obtain this value from Settlement objects returned. # @param [Hash] opts the optional parameters # @return [Array<(V1BankAccount, Fixnum, Hash)>] V1BankAccount data, response status code and response headers def retrieve_bank_account_with_http_info(location_id, bank_account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: V1TransactionsApi.retrieve_bank_account ..." end # verify the required parameter 'location_id' is set fail ArgumentError, "Missing the required parameter 'location_id' when calling V1TransactionsApi.retrieve_bank_account" if location_id.nil? # verify the required parameter 'bank_account_id' is set fail ArgumentError, "Missing the required parameter 'bank_account_id' when calling V1TransactionsApi.retrieve_bank_account" if bank_account_id.nil? # resource path local_var_path = "/v1/{location_id}/bank-accounts/{bank_account_id}".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s).sub('{' + 'bank_account_id' + '}', bank_account_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # 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']) header_params['Square-Version'] = "2019-06-12" # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['oauth2'] 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 => 'V1BankAccount') if @api_client.config.debugging @api_client.config.logger.debug "API called: V1TransactionsApi#retrieve_bank_account\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # RetrieveOrder # Provides comprehensive information for a single online store order, including the order's history. # @param location_id The ID of the order's associated location. # @param order_id The order's Square-issued ID. You obtain this value from Order objects returned by the List Orders endpoint # @param [Hash] opts the optional parameters # @return [V1Order] def retrieve_order(location_id, order_id, opts = {}) data, _status_code, _headers = retrieve_order_with_http_info(location_id, order_id, opts) return data end # RetrieveOrder # Provides comprehensive information for a single online store order, including the order's history. # @param location_id The ID of the order's associated location. # @param order_id The order's Square-issued ID. You obtain this value from Order objects returned by the List Orders endpoint # @param [Hash] opts the optional parameters # @return [Array<(V1Order, Fixnum, Hash)>] V1Order data, response status code and response headers def retrieve_order_with_http_info(location_id, order_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: V1TransactionsApi.retrieve_order ..." end # verify the required parameter 'location_id' is set fail ArgumentError, "Missing the required parameter 'location_id' when calling V1TransactionsApi.retrieve_order" if location_id.nil? # verify the required parameter 'order_id' is set fail ArgumentError, "Missing the required parameter 'order_id' when calling V1TransactionsApi.retrieve_order" if order_id.nil? # resource path local_var_path = "/v1/{location_id}/orders/{order_id}".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s).sub('{' + 'order_id' + '}', order_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # 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']) header_params['Square-Version'] = "2019-06-12" # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['oauth2'] 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 => 'V1Order') if @api_client.config.debugging @api_client.config.logger.debug "API called: V1TransactionsApi#retrieve_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # RetrievePayment # Provides comprehensive information for a single payment. # @param location_id The ID of the payment's associated location. # @param payment_id The Square-issued payment ID. payment_id comes from Payment objects returned by the List Payments endpoint, Settlement objects returned by the List Settlements endpoint, or Refund objects returned by the List Refunds endpoint. # @param [Hash] opts the optional parameters # @return [V1Payment] def retrieve_payment(location_id, payment_id, opts = {}) data, _status_code, _headers = retrieve_payment_with_http_info(location_id, payment_id, opts) return data end # RetrievePayment # Provides comprehensive information for a single payment. # @param location_id The ID of the payment's associated location. # @param payment_id The Square-issued payment ID. payment_id comes from Payment objects returned by the List Payments endpoint, Settlement objects returned by the List Settlements endpoint, or Refund objects returned by the List Refunds endpoint. # @param [Hash] opts the optional parameters # @return [Array<(V1Payment, Fixnum, Hash)>] V1Payment data, response status code and response headers def retrieve_payment_with_http_info(location_id, payment_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: V1TransactionsApi.retrieve_payment ..." end # verify the required parameter 'location_id' is set fail ArgumentError, "Missing the required parameter 'location_id' when calling V1TransactionsApi.retrieve_payment" if location_id.nil? # verify the required parameter 'payment_id' is set fail ArgumentError, "Missing the required parameter 'payment_id' when calling V1TransactionsApi.retrieve_payment" if payment_id.nil? # resource path local_var_path = "/v1/{location_id}/payments/{payment_id}".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s).sub('{' + 'payment_id' + '}', payment_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # 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']) header_params['Square-Version'] = "2019-06-12" # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['oauth2'] 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 => 'V1Payment') if @api_client.config.debugging @api_client.config.logger.debug "API called: V1TransactionsApi#retrieve_payment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # RetrieveSettlement # Provides comprehensive information for a single settlement. The returned `Settlement` objects include an `entries` field that lists the transactions that contribute to the settlement total. Most settlement entries correspond to a payment payout, but settlement entries are also generated for less common events, like refunds, manual adjustments, or chargeback holds. Square initiates its regular deposits as indicated in the [Deposit Options with Square](https://squareup.com/help/us/en/article/3807) help article. Details for a regular deposit are usually not available from Connect API endpoints before 10 p.m. PST the same day. Square does not know when an initiated settlement **completes**, only whether it has failed. A completed settlement is typically reflected in a bank account within 3 business days, but in exceptional cases it may take longer. # @param location_id The ID of the settlements's associated location. # @param settlement_id The settlement's Square-issued ID. You obtain this value from Settlement objects returned by the List Settlements endpoint. # @param [Hash] opts the optional parameters # @return [V1Settlement] def retrieve_settlement(location_id, settlement_id, opts = {}) data, _status_code, _headers = retrieve_settlement_with_http_info(location_id, settlement_id, opts) return data end # RetrieveSettlement # Provides comprehensive information for a single settlement. The returned `Settlement` objects include an `entries` field that lists the transactions that contribute to the settlement total. Most settlement entries correspond to a payment payout, but settlement entries are also generated for less common events, like refunds, manual adjustments, or chargeback holds. Square initiates its regular deposits as indicated in the [Deposit Options with Square](https://squareup.com/help/us/en/article/3807) help article. Details for a regular deposit are usually not available from Connect API endpoints before 10 p.m. PST the same day. Square does not know when an initiated settlement **completes**, only whether it has failed. A completed settlement is typically reflected in a bank account within 3 business days, but in exceptional cases it may take longer. # @param location_id The ID of the settlements's associated location. # @param settlement_id The settlement's Square-issued ID. You obtain this value from Settlement objects returned by the List Settlements endpoint. # @param [Hash] opts the optional parameters # @return [Array<(V1Settlement, Fixnum, Hash)>] V1Settlement data, response status code and response headers def retrieve_settlement_with_http_info(location_id, settlement_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: V1TransactionsApi.retrieve_settlement ..." end # verify the required parameter 'location_id' is set fail ArgumentError, "Missing the required parameter 'location_id' when calling V1TransactionsApi.retrieve_settlement" if location_id.nil? # verify the required parameter 'settlement_id' is set fail ArgumentError, "Missing the required parameter 'settlement_id' when calling V1TransactionsApi.retrieve_settlement" if settlement_id.nil? # resource path local_var_path = "/v1/{location_id}/settlements/{settlement_id}".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s).sub('{' + 'settlement_id' + '}', settlement_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # 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']) header_params['Square-Version'] = "2019-06-12" # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['oauth2'] 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 => 'V1Settlement') if @api_client.config.debugging @api_client.config.logger.debug "API called: V1TransactionsApi#retrieve_settlement\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # UpdateOrder # Updates the details of an online store order. Every update you perform on an order corresponds to one of three actions: # @param location_id The ID of the order's associated location. # @param order_id The order's Square-issued ID. You obtain this value from Order objects returned by the List Orders endpoint # @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. # @param [Hash] opts the optional parameters # @return [V1Order] def update_order(location_id, order_id, body, opts = {}) data, _status_code, _headers = update_order_with_http_info(location_id, order_id, body, opts) return data end # UpdateOrder # Updates the details of an online store order. Every update you perform on an order corresponds to one of three actions: # @param location_id The ID of the order's associated location. # @param order_id The order's Square-issued ID. You obtain this value from Order objects returned by the List Orders endpoint # @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. # @param [Hash] opts the optional parameters # @return [Array<(V1Order, Fixnum, Hash)>] V1Order data, response status code and response headers def update_order_with_http_info(location_id, order_id, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: V1TransactionsApi.update_order ..." end # verify the required parameter 'location_id' is set fail ArgumentError, "Missing the required parameter 'location_id' when calling V1TransactionsApi.update_order" if location_id.nil? # verify the required parameter 'order_id' is set fail ArgumentError, "Missing the required parameter 'order_id' when calling V1TransactionsApi.update_order" if order_id.nil? # verify the required parameter 'body' is set fail ArgumentError, "Missing the required parameter 'body' when calling V1TransactionsApi.update_order" if body.nil? # resource path local_var_path = "/v1/{location_id}/orders/{order_id}".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s).sub('{' + 'order_id' + '}', order_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # 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']) header_params['Square-Version'] = "2019-06-12" # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(body) auth_names = ['oauth2'] 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 => 'V1Order') if @api_client.config.debugging @api_client.config.logger.debug "API called: V1TransactionsApi#update_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end