=begin #Subskribe API #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) OpenAPI spec version: 1.0.0 Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 2.4.41 =end require 'uri' module SubskribeDevClient class PaymentsApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Get payments # Returns the payments for the specified account # @param id id of the account # @param [Hash] opts the optional parameters # @return [Array] def get_account_payment(id, opts = {}) data, _status_code, _headers = get_account_payment_with_http_info(id, opts) data end # Get payments # Returns the payments for the specified account # @param id id of the account # @param [Hash] opts the optional parameters # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers def get_account_payment_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PaymentsApi.get_account_payment ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling PaymentsApi.get_account_payment" end # resource path local_var_path = '/payments/account/{id}'.sub('{' + 'id' + '}', 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']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ApiKeyAuth'] 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: PaymentsApi#get_account_payment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get account payment management link # Returns a payment management link for an account # @param id # @param [Hash] opts the optional parameters # @return [String] def get_account_payment_management_link(id, opts = {}) data, _status_code, _headers = get_account_payment_management_link_with_http_info(id, opts) data end # Get account payment management link # Returns a payment management link for an account # @param id # @param [Hash] opts the optional parameters # @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers def get_account_payment_management_link_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PaymentsApi.get_account_payment_management_link ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling PaymentsApi.get_account_payment_management_link" end # resource path local_var_path = '/payments/account-payment/{id}'.sub('{' + 'id' + '}', 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']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ApiKeyAuth'] 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 => 'String') if @api_client.config.debugging @api_client.config.logger.debug "API called: PaymentsApi#get_account_payment_management_link\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get payment details # Gets the details of the specified payment # @param id id of the payment # @param [Hash] opts the optional parameters # @return [PaymentJson] def get_payment(id, opts = {}) data, _status_code, _headers = get_payment_with_http_info(id, opts) data end # Get payment details # Gets the details of the specified payment # @param id id of the payment # @param [Hash] opts the optional parameters # @return [Array<(PaymentJson, Fixnum, Hash)>] PaymentJson data, response status code and response headers def get_payment_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PaymentsApi.get_payment ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling PaymentsApi.get_payment" end # resource path local_var_path = '/payments/{id}'.sub('{' + 'id' + '}', 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']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ApiKeyAuth'] 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 => 'PaymentJson') if @api_client.config.debugging @api_client.config.logger.debug "API called: PaymentsApi#get_payment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get payment balance # Gets the balance of a payment # @param id id of the payment # @param [Hash] opts the optional parameters # @return [PaymentBalanceJson] def get_payment_balance(id, opts = {}) data, _status_code, _headers = get_payment_balance_with_http_info(id, opts) data end # Get payment balance # Gets the balance of a payment # @param id id of the payment # @param [Hash] opts the optional parameters # @return [Array<(PaymentBalanceJson, Fixnum, Hash)>] PaymentBalanceJson data, response status code and response headers def get_payment_balance_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PaymentsApi.get_payment_balance ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling PaymentsApi.get_payment_balance" end # resource path local_var_path = '/payments/{id}/balance'.sub('{' + 'id' + '}', 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']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ApiKeyAuth'] 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 => 'PaymentBalanceJson') if @api_client.config.debugging @api_client.config.logger.debug "API called: PaymentsApi#get_payment_balance\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get payment configuration # Returns the payment configuration for your tenant # @param [Hash] opts the optional parameters # @return [PaymentConfiguration] def get_payment_configuration(opts = {}) data, _status_code, _headers = get_payment_configuration_with_http_info(opts) data end # Get payment configuration # Returns the payment configuration for your tenant # @param [Hash] opts the optional parameters # @return [Array<(PaymentConfiguration, Fixnum, Hash)>] PaymentConfiguration data, response status code and response headers def get_payment_configuration_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PaymentsApi.get_payment_configuration ...' end # resource path local_var_path = '/payments/configuration' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ApiKeyAuth'] 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 => 'PaymentConfiguration') if @api_client.config.debugging @api_client.config.logger.debug "API called: PaymentsApi#get_payment_configuration\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get all payments # Returns all payments for you tenant. The results are paginated. To fetch all take the cursor returned from a call and pass it to a subsequent call. # @param [Hash] opts the optional parameters # @option opts [String] :cursor cursor returned from previous call # @option opts [Integer] :limit number of results per page # @return [PaymentJsonPaginationResponse] def get_payments(opts = {}) data, _status_code, _headers = get_payments_with_http_info(opts) data end # Get all payments # Returns all payments for you tenant. The results are paginated. To fetch all take the cursor returned from a call and pass it to a subsequent call. # @param [Hash] opts the optional parameters # @option opts [String] :cursor cursor returned from previous call # @option opts [Integer] :limit number of results per page # @return [Array<(PaymentJsonPaginationResponse, Fixnum, Hash)>] PaymentJsonPaginationResponse data, response status code and response headers def get_payments_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PaymentsApi.get_payments ...' end # resource path local_var_path = '/payments' # query parameters query_params = {} query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ApiKeyAuth'] 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 => 'PaymentJsonPaginationResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: PaymentsApi#get_payments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update payment configuration # Updates the payment configuration for your tenant. # @param [Hash] opts the optional parameters # @option opts [Array] :body Payment types to set. Options can be one or more of the allowable values # @return [PaymentConfiguration] def update_payment_configuration(opts = {}) data, _status_code, _headers = update_payment_configuration_with_http_info(opts) data end # Update payment configuration # Updates the payment configuration for your tenant. # @param [Hash] opts the optional parameters # @option opts [Array] :body Payment types to set. Options can be one or more of the allowable values # @return [Array<(PaymentConfiguration, Fixnum, Hash)>] PaymentConfiguration data, response status code and response headers def update_payment_configuration_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PaymentsApi.update_payment_configuration ...' end # resource path local_var_path = '/payments/configuration' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(opts[:'body']) auth_names = ['ApiKeyAuth'] 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 => 'PaymentConfiguration') if @api_client.config.debugging @api_client.config.logger.debug "API called: PaymentsApi#update_payment_configuration\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Voids a payment # Voids the specified payment per the specified parameters # @param id # @param [Hash] opts the optional parameters # @option opts [VoidPaymentJson] :body # @return [PaymentJson] def void_payment(id, opts = {}) data, _status_code, _headers = void_payment_with_http_info(id, opts) data end # Voids a payment # Voids the specified payment per the specified parameters # @param id # @param [Hash] opts the optional parameters # @option opts [VoidPaymentJson] :body # @return [Array<(PaymentJson, Fixnum, Hash)>] PaymentJson data, response status code and response headers def void_payment_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PaymentsApi.void_payment ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling PaymentsApi.void_payment" end # resource path local_var_path = '/payments/{id}/void'.sub('{' + 'id' + '}', 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']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(opts[:'body']) auth_names = ['ApiKeyAuth'] 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 => 'PaymentJson') if @api_client.config.debugging @api_client.config.logger.debug "API called: PaymentsApi#void_payment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end