=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 BillingApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Create an automated invoice rule # Creates an automated invoice rule with the specified parameters # @param body automated invoice rule # @param [Hash] opts the optional parameters # @return [AutomatedInvoiceRule] def add_automated_invoice_rule(body, opts = {}) data, _status_code, _headers = add_automated_invoice_rule_with_http_info(body, opts) data end # Create an automated invoice rule # Creates an automated invoice rule with the specified parameters # @param body automated invoice rule # @param [Hash] opts the optional parameters # @return [Array<(AutomatedInvoiceRule, Fixnum, Hash)>] AutomatedInvoiceRule data, response status code and response headers def add_automated_invoice_rule_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.add_automated_invoice_rule ...' end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling BillingApi.add_automated_invoice_rule" end # resource path local_var_path = '/automatedInvoiceRules' # 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']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(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 => 'AutomatedInvoiceRule') if @api_client.config.debugging @api_client.config.logger.debug "API called: BillingApi#add_automated_invoice_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Add a new billing schedule for subscription line item # Creates a new billing schedule entry for an event based charge # @param body new billing event # @param [Hash] opts the optional parameters # @return [String] def add_billing_schedule(body, opts = {}) data, _status_code, _headers = add_billing_schedule_with_http_info(body, opts) data end # Add a new billing schedule for subscription line item # Creates a new billing schedule entry for an event based charge # @param body new billing event # @param [Hash] opts the optional parameters # @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers def add_billing_schedule_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.add_billing_schedule ...' end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling BillingApi.add_billing_schedule" end # resource path local_var_path = '/invoices/schedule' # 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(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 => 'String') if @api_client.config.debugging @api_client.config.logger.debug "API called: BillingApi#add_billing_schedule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create an alias for a subscription id/charge id pair # This allows you to specify a string alias for a subscription id and a charge id. This can be useful when, for example, you want to upload usage statistics and would rather specify your own id (or another external id), rather than referring to Subskribe's internal ids. # @param alias_id alias to map to create the mapping for # @param [Hash] opts the optional parameters # @option opts [String] :subscription_id the subscription id # @option opts [String] :charge_id the charge id # @return [nil] def add_subscription_charge_alias(alias_id, opts = {}) add_subscription_charge_alias_with_http_info(alias_id, opts) nil end # Create an alias for a subscription id/charge id pair # This allows you to specify a string alias for a subscription id and a charge id. This can be useful when, for example, you want to upload usage statistics and would rather specify your own id (or another external id), rather than referring to Subskribe's internal ids. # @param alias_id alias to map to create the mapping for # @param [Hash] opts the optional parameters # @option opts [String] :subscription_id the subscription id # @option opts [String] :charge_id the charge id # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def add_subscription_charge_alias_with_http_info(alias_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.add_subscription_charge_alias ...' end # verify the required parameter 'alias_id' is set if @api_client.config.client_side_validation && alias_id.nil? fail ArgumentError, "Missing the required parameter 'alias_id' when calling BillingApi.add_subscription_charge_alias" end # resource path local_var_path = '/alias/subscriptionCharge/{aliasId}'.sub('{' + 'aliasId' + '}', alias_id.to_s) # query parameters query_params = {} query_params[:'subscriptionId'] = opts[:'subscription_id'] if !opts[:'subscription_id'].nil? query_params[:'chargeId'] = opts[:'charge_id'] if !opts[:'charge_id'].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(:PUT, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: BillingApi#add_subscription_charge_alias\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Apply a credit memo # Applies a credit memo per the specified parameters # @param body application details in json # @param [Hash] opts the optional parameters # @return [nil] def apply_credit_memo(body, opts = {}) apply_credit_memo_with_http_info(body, opts) nil end # Apply a credit memo # Applies a credit memo per the specified parameters # @param body application details in json # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def apply_credit_memo_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.apply_credit_memo ...' end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling BillingApi.apply_credit_memo" end # resource path local_var_path = '/settlements/applyCreditMemo' # 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']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(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) if @api_client.config.debugging @api_client.config.logger.debug "API called: BillingApi#apply_credit_memo\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create a bulk invoice run # Creates a bulk invoice run as specified by the input parameters. On success the id of the run is returned. # @param body json representing the run parameters # @param [Hash] opts the optional parameters # @return [String] def create_bulk_invoice_run(body, opts = {}) data, _status_code, _headers = create_bulk_invoice_run_with_http_info(body, opts) data end # Create a bulk invoice run # Creates a bulk invoice run as specified by the input parameters. On success the id of the run is returned. # @param body json representing the run parameters # @param [Hash] opts the optional parameters # @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers def create_bulk_invoice_run_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.create_bulk_invoice_run ...' end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling BillingApi.create_bulk_invoice_run" end # resource path local_var_path = '/invoices/bulk' # 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(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 => 'String') if @api_client.config.debugging @api_client.config.logger.debug "API called: BillingApi#create_bulk_invoice_run\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Generate invoice PDF # Generates a PDF version of the specified invoice. Once generated, PDF can be later fetched via a call to /{invoiceNumber}/pdf. # @param invoice_number # @param [Hash] opts the optional parameters # @return [nil] def create_invoice_document(invoice_number, opts = {}) create_invoice_document_with_http_info(invoice_number, opts) nil end # Generate invoice PDF # Generates a PDF version of the specified invoice. Once generated, PDF can be later fetched via a call to /{invoiceNumber}/pdf. # @param invoice_number # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def create_invoice_document_with_http_info(invoice_number, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.create_invoice_document ...' end # verify the required parameter 'invoice_number' is set if @api_client.config.client_side_validation && invoice_number.nil? fail ArgumentError, "Missing the required parameter 'invoice_number' when calling BillingApi.create_invoice_document" end # resource path local_var_path = '/invoices/{invoiceNumber}/pdf'.sub('{' + 'invoiceNumber' + '}', invoice_number.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(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: BillingApi#create_invoice_document\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete an existing billing schedule # Billing schedules must be deleted in reverse chronological order. # @param id billing schedule entry id # @param [Hash] opts the optional parameters # @return [nil] def delete_billing_schedule(id, opts = {}) delete_billing_schedule_with_http_info(id, opts) nil end # Delete an existing billing schedule # Billing schedules must be deleted in reverse chronological order. # @param id billing schedule entry id # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def delete_billing_schedule_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.delete_billing_schedule ...' 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 BillingApi.delete_billing_schedule" end # resource path local_var_path = '/invoices/schedule/{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(:DELETE, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: BillingApi#delete_billing_schedule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete invoice # Deletes the specified invoice # @param number number of the invoice # @param [Hash] opts the optional parameters # @return [InvoiceJson] def delete_invoice(number, opts = {}) data, _status_code, _headers = delete_invoice_with_http_info(number, opts) data end # Delete invoice # Deletes the specified invoice # @param number number of the invoice # @param [Hash] opts the optional parameters # @return [Array<(InvoiceJson, Fixnum, Hash)>] InvoiceJson data, response status code and response headers def delete_invoice_with_http_info(number, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.delete_invoice ...' end # verify the required parameter 'number' is set if @api_client.config.client_side_validation && number.nil? fail ArgumentError, "Missing the required parameter 'number' when calling BillingApi.delete_invoice" end # resource path local_var_path = '/invoices/{number}'.sub('{' + 'number' + '}', number.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(: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 => 'InvoiceJson') if @api_client.config.debugging @api_client.config.logger.debug "API called: BillingApi#delete_invoice\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete the specified alias # Deletes the specified alias mapping # @param alias_id # @param [Hash] opts the optional parameters # @return [nil] def delete_subscription_charge_alias(alias_id, opts = {}) delete_subscription_charge_alias_with_http_info(alias_id, opts) nil end # Delete the specified alias # Deletes the specified alias mapping # @param alias_id # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def delete_subscription_charge_alias_with_http_info(alias_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.delete_subscription_charge_alias ...' end # verify the required parameter 'alias_id' is set if @api_client.config.client_side_validation && alias_id.nil? fail ArgumentError, "Missing the required parameter 'alias_id' when calling BillingApi.delete_subscription_charge_alias" end # resource path local_var_path = '/alias/subscriptionCharge/{aliasId}'.sub('{' + 'aliasId' + '}', alias_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(:DELETE, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: BillingApi#delete_subscription_charge_alias\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Generate subscription invoices # Generates the invoices for the given subscription # @param subscription_id id of the subscription # @param target_date Time in seconds since Epoch (GMT) to generate invoice from # @param invoice_charge_inclusion_option types of charges to include # @param [Hash] opts the optional parameters # @option opts [Integer] :invoice_date Time in seconds since Epoch (GMT) to set invoice date to # @return [Array] def generate_invoice(subscription_id, target_date, invoice_charge_inclusion_option, opts = {}) data, _status_code, _headers = generate_invoice_with_http_info(subscription_id, target_date, invoice_charge_inclusion_option, opts) data end # Generate subscription invoices # Generates the invoices for the given subscription # @param subscription_id id of the subscription # @param target_date Time in seconds since Epoch (GMT) to generate invoice from # @param invoice_charge_inclusion_option types of charges to include # @param [Hash] opts the optional parameters # @option opts [Integer] :invoice_date Time in seconds since Epoch (GMT) to set invoice date to # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers def generate_invoice_with_http_info(subscription_id, target_date, invoice_charge_inclusion_option, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.generate_invoice ...' end # verify the required parameter 'subscription_id' is set if @api_client.config.client_side_validation && subscription_id.nil? fail ArgumentError, "Missing the required parameter 'subscription_id' when calling BillingApi.generate_invoice" end # verify the required parameter 'target_date' is set if @api_client.config.client_side_validation && target_date.nil? fail ArgumentError, "Missing the required parameter 'target_date' when calling BillingApi.generate_invoice" end # verify the required parameter 'invoice_charge_inclusion_option' is set if @api_client.config.client_side_validation && invoice_charge_inclusion_option.nil? fail ArgumentError, "Missing the required parameter 'invoice_charge_inclusion_option' when calling BillingApi.generate_invoice" end # verify enum value if @api_client.config.client_side_validation && !['INCLUDE_USAGE', 'EXCLUDE_USAGE', 'ONLY_USAGE'].include?(invoice_charge_inclusion_option) fail ArgumentError, "invalid value for 'invoice_charge_inclusion_option', must be one of INCLUDE_USAGE, EXCLUDE_USAGE, ONLY_USAGE" end # resource path local_var_path = '/invoices/generate' # query parameters query_params = {} query_params[:'subscriptionId'] = subscription_id query_params[:'targetDate'] = target_date query_params[:'invoiceChargeInclusionOption'] = invoice_charge_inclusion_option query_params[:'invoiceDate'] = opts[:'invoice_date'] if !opts[:'invoice_date'].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(: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 => 'Array') if @api_client.config.debugging @api_client.config.logger.debug "API called: BillingApi#generate_invoice\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get the contact for accounts receivable # Returns the details of the account receivable contact for your tenant # @param [Hash] opts the optional parameters # @return [AccountReceivableContactJson] def get_account_receivable_contact(opts = {}) data, _status_code, _headers = get_account_receivable_contact_with_http_info(opts) data end # Get the contact for accounts receivable # Returns the details of the account receivable contact for your tenant # @param [Hash] opts the optional parameters # @return [Array<(AccountReceivableContactJson, Fixnum, Hash)>] AccountReceivableContactJson data, response status code and response headers def get_account_receivable_contact_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.get_account_receivable_contact ...' end # resource path local_var_path = '/accountReceivableContact' # 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 => 'AccountReceivableContactJson') if @api_client.config.debugging @api_client.config.logger.debug "API called: BillingApi#get_account_receivable_contact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get automated invoice rule details # Returns the details of the specified automated invoice rule # @param id id of the automated invoice rule # @param [Hash] opts the optional parameters # @return [nil] def get_automated_invoice_rule(id, opts = {}) get_automated_invoice_rule_with_http_info(id, opts) nil end # Get automated invoice rule details # Returns the details of the specified automated invoice rule # @param id id of the automated invoice rule # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def get_automated_invoice_rule_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.get_automated_invoice_rule ...' 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 BillingApi.get_automated_invoice_rule" end # resource path local_var_path = '/automatedInvoiceRules/{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) if @api_client.config.debugging @api_client.config.logger.debug "API called: BillingApi#get_automated_invoice_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get automated invoice rules for a tenant # Returns all the configured automated invoice rules for the tenant # @param [Hash] opts the optional parameters # @return [nil] def get_automated_invoice_rules(opts = {}) get_automated_invoice_rules_with_http_info(opts) nil end # Get automated invoice rules for a tenant # Returns all the configured automated invoice rules for the tenant # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def get_automated_invoice_rules_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.get_automated_invoice_rules ...' end # resource path local_var_path = '/automatedInvoiceRules' # 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) if @api_client.config.debugging @api_client.config.logger.debug "API called: BillingApi#get_automated_invoice_rules\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get billing schedules for a subscription line item # Retrieve all billing schedules for a subscription line item # @param subscription_id # @param subscription_charge_id # @param [Hash] opts the optional parameters # @return [Array] def get_billing_schedules(subscription_id, subscription_charge_id, opts = {}) data, _status_code, _headers = get_billing_schedules_with_http_info(subscription_id, subscription_charge_id, opts) data end # Get billing schedules for a subscription line item # Retrieve all billing schedules for a subscription line item # @param subscription_id # @param subscription_charge_id # @param [Hash] opts the optional parameters # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers def get_billing_schedules_with_http_info(subscription_id, subscription_charge_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.get_billing_schedules ...' end # verify the required parameter 'subscription_id' is set if @api_client.config.client_side_validation && subscription_id.nil? fail ArgumentError, "Missing the required parameter 'subscription_id' when calling BillingApi.get_billing_schedules" end # verify the required parameter 'subscription_charge_id' is set if @api_client.config.client_side_validation && subscription_charge_id.nil? fail ArgumentError, "Missing the required parameter 'subscription_charge_id' when calling BillingApi.get_billing_schedules" end # resource path local_var_path = '/invoices/schedule' # query parameters query_params = {} query_params[:'subscriptionId'] = subscription_id query_params[:'subscriptionChargeId'] = subscription_charge_id # 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: BillingApi#get_billing_schedules\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get bulk invoice run details # Returns the details of the specified bulk invoice run # @param bulk_invoice_run_id id of the run # @param [Hash] opts the optional parameters # @return [BulkInvoiceRun] def get_bulk_invoice_run(bulk_invoice_run_id, opts = {}) data, _status_code, _headers = get_bulk_invoice_run_with_http_info(bulk_invoice_run_id, opts) data end # Get bulk invoice run details # Returns the details of the specified bulk invoice run # @param bulk_invoice_run_id id of the run # @param [Hash] opts the optional parameters # @return [Array<(BulkInvoiceRun, Fixnum, Hash)>] BulkInvoiceRun data, response status code and response headers def get_bulk_invoice_run_with_http_info(bulk_invoice_run_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.get_bulk_invoice_run ...' end # verify the required parameter 'bulk_invoice_run_id' is set if @api_client.config.client_side_validation && bulk_invoice_run_id.nil? fail ArgumentError, "Missing the required parameter 'bulk_invoice_run_id' when calling BillingApi.get_bulk_invoice_run" end # resource path local_var_path = '/invoices/bulk/{bulkInvoiceRunId}'.sub('{' + 'bulkInvoiceRunId' + '}', bulk_invoice_run_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 => 'BulkInvoiceRun') if @api_client.config.debugging @api_client.config.logger.debug "API called: BillingApi#get_bulk_invoice_run\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get items for bulk invoice run # Returns the items associated with the specified bulk invoice run # @param bulk_invoice_run_id id of the run # @param [Hash] opts the optional parameters # @return [Array] def get_bulk_invoice_run_items(bulk_invoice_run_id, opts = {}) data, _status_code, _headers = get_bulk_invoice_run_items_with_http_info(bulk_invoice_run_id, opts) data end # Get items for bulk invoice run # Returns the items associated with the specified bulk invoice run # @param bulk_invoice_run_id id of the run # @param [Hash] opts the optional parameters # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers def get_bulk_invoice_run_items_with_http_info(bulk_invoice_run_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.get_bulk_invoice_run_items ...' end # verify the required parameter 'bulk_invoice_run_id' is set if @api_client.config.client_side_validation && bulk_invoice_run_id.nil? fail ArgumentError, "Missing the required parameter 'bulk_invoice_run_id' when calling BillingApi.get_bulk_invoice_run_items" end # resource path local_var_path = '/invoices/bulk/{bulkInvoiceRunId}/runItems'.sub('{' + 'bulkInvoiceRunId' + '}', bulk_invoice_run_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: BillingApi#get_bulk_invoice_run_items\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get dunning settings # Returns the dunning settings for your tenant # @param [Hash] opts the optional parameters # @return [DunningSettingJson] def get_dunning_setting(opts = {}) data, _status_code, _headers = get_dunning_setting_with_http_info(opts) data end # Get dunning settings # Returns the dunning settings for your tenant # @param [Hash] opts the optional parameters # @return [Array<(DunningSettingJson, Fixnum, Hash)>] DunningSettingJson data, response status code and response headers def get_dunning_setting_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.get_dunning_setting ...' end # resource path local_var_path = '/dunningSetting' # 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 => 'DunningSettingJson') if @api_client.config.debugging @api_client.config.logger.debug "API called: BillingApi#get_dunning_setting\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get invoice details # Returns the details of the specified invoice number # @param number number of the invoice # @param [Hash] opts the optional parameters # @return [InvoiceJson] def get_invoice(number, opts = {}) data, _status_code, _headers = get_invoice_with_http_info(number, opts) data end # Get invoice details # Returns the details of the specified invoice number # @param number number of the invoice # @param [Hash] opts the optional parameters # @return [Array<(InvoiceJson, Fixnum, Hash)>] InvoiceJson data, response status code and response headers def get_invoice_with_http_info(number, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.get_invoice ...' end # verify the required parameter 'number' is set if @api_client.config.client_side_validation && number.nil? fail ArgumentError, "Missing the required parameter 'number' when calling BillingApi.get_invoice" end # resource path local_var_path = '/invoices/{number}'.sub('{' + 'number' + '}', number.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 => 'InvoiceJson') if @api_client.config.debugging @api_client.config.logger.debug "API called: BillingApi#get_invoice\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get invoice balance # Returns the balance of the specified invoice number # @param number number of the invoice # @param [Hash] opts the optional parameters # @return [InvoiceBalanceJson] def get_invoice_balance(number, opts = {}) data, _status_code, _headers = get_invoice_balance_with_http_info(number, opts) data end # Get invoice balance # Returns the balance of the specified invoice number # @param number number of the invoice # @param [Hash] opts the optional parameters # @return [Array<(InvoiceBalanceJson, Fixnum, Hash)>] InvoiceBalanceJson data, response status code and response headers def get_invoice_balance_with_http_info(number, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.get_invoice_balance ...' end # verify the required parameter 'number' is set if @api_client.config.client_side_validation && number.nil? fail ArgumentError, "Missing the required parameter 'number' when calling BillingApi.get_invoice_balance" end # resource path local_var_path = '/invoices/{number}/balance'.sub('{' + 'number' + '}', number.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 => 'InvoiceBalanceJson') if @api_client.config.debugging @api_client.config.logger.debug "API called: BillingApi#get_invoice_balance\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Download invoice PDF # Downloads the PDF for an invoice after it has been generated via a POST to /{invoiceNumber}/pdf. The data return will be the PDF document contents. # @param invoice_number number of the invoice # @param [Hash] opts the optional parameters # @return [nil] def get_invoice_document_pdf(invoice_number, opts = {}) get_invoice_document_pdf_with_http_info(invoice_number, opts) nil end # Download invoice PDF # Downloads the PDF for an invoice after it has been generated via a POST to /{invoiceNumber}/pdf. The data return will be the PDF document contents. # @param invoice_number number of the invoice # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def get_invoice_document_pdf_with_http_info(invoice_number, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.get_invoice_document_pdf ...' end # verify the required parameter 'invoice_number' is set if @api_client.config.client_side_validation && invoice_number.nil? fail ArgumentError, "Missing the required parameter 'invoice_number' when calling BillingApi.get_invoice_document_pdf" end # resource path local_var_path = '/invoices/{invoiceNumber}/pdf'.sub('{' + 'invoiceNumber' + '}', invoice_number.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) if @api_client.config.debugging @api_client.config.logger.debug "API called: BillingApi#get_invoice_document_pdf\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get all invoices for a subscription # Returns all invoices for a subscription. The result is paginated. Use the cursor returned from a request in subsequent calls to retrieve all results. # @param [Hash] opts the optional parameters # @option opts [String] :subscription_id # @option opts [String] :status status filter for invoices # @option opts [String] :cursor used to iterate through all results # @option opts [Integer] :limit number of items per page # @return [InvoiceJsonPaginationResponse] def get_invoices(opts = {}) data, _status_code, _headers = get_invoices_with_http_info(opts) data end # Get all invoices for a subscription # Returns all invoices for a subscription. The result is paginated. Use the cursor returned from a request in subsequent calls to retrieve all results. # @param [Hash] opts the optional parameters # @option opts [String] :subscription_id # @option opts [String] :status status filter for invoices # @option opts [String] :cursor used to iterate through all results # @option opts [Integer] :limit number of items per page # @return [Array<(InvoiceJsonPaginationResponse, Fixnum, Hash)>] InvoiceJsonPaginationResponse data, response status code and response headers def get_invoices_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.get_invoices ...' end if @api_client.config.client_side_validation && opts[:'status'] && !['DRAFT', 'POSTED', 'PAID', 'CONVERTED', 'VOIDED'].include?(opts[:'status']) fail ArgumentError, 'invalid value for "status", must be one of DRAFT, POSTED, PAID, CONVERTED, VOIDED' end # resource path local_var_path = '/invoices' # query parameters query_params = {} query_params[:'subscriptionId'] = opts[:'subscription_id'] if !opts[:'subscription_id'].nil? query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil? 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 => 'InvoiceJsonPaginationResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: BillingApi#get_invoices\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get the invoice document JSON that is used to render invoice PDF # Invoice document JSON that contains all details required to render full Invoice document # @param invoice_number number of the invoice # @param [Hash] opts the optional parameters # @return [nil] def get_raw_invoice_document_json(invoice_number, opts = {}) get_raw_invoice_document_json_with_http_info(invoice_number, opts) nil end # Get the invoice document JSON that is used to render invoice PDF # Invoice document JSON that contains all details required to render full Invoice document # @param invoice_number number of the invoice # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def get_raw_invoice_document_json_with_http_info(invoice_number, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.get_raw_invoice_document_json ...' end # verify the required parameter 'invoice_number' is set if @api_client.config.client_side_validation && invoice_number.nil? fail ArgumentError, "Missing the required parameter 'invoice_number' when calling BillingApi.get_raw_invoice_document_json" end # resource path local_var_path = '/invoices/{invoiceNumber}/documentJson'.sub('{' + 'invoiceNumber' + '}', invoice_number.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) if @api_client.config.debugging @api_client.config.logger.debug "API called: BillingApi#get_raw_invoice_document_json\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get settlement application details # Gets the details of specified settlement application. # @param id id of the settlement application # @param [Hash] opts the optional parameters # @return [SettlementApplication] def get_settlement_application(id, opts = {}) data, _status_code, _headers = get_settlement_application_with_http_info(id, opts) data end # Get settlement application details # Gets the details of specified settlement application. # @param id id of the settlement application # @param [Hash] opts the optional parameters # @return [Array<(SettlementApplication, Fixnum, Hash)>] SettlementApplication data, response status code and response headers def get_settlement_application_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.get_settlement_application ...' 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 BillingApi.get_settlement_application" end # resource path local_var_path = '/settlements/{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 => 'SettlementApplication') if @api_client.config.debugging @api_client.config.logger.debug "API called: BillingApi#get_settlement_application\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get settlement applications # Returns the settlement applications for the specified invoice number. # @param invoice_number number of the invoice # @param [Hash] opts the optional parameters # @return [Array] def get_settlement_applications(invoice_number, opts = {}) data, _status_code, _headers = get_settlement_applications_with_http_info(invoice_number, opts) data end # Get settlement applications # Returns the settlement applications for the specified invoice number. # @param invoice_number number of the invoice # @param [Hash] opts the optional parameters # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers def get_settlement_applications_with_http_info(invoice_number, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.get_settlement_applications ...' end # verify the required parameter 'invoice_number' is set if @api_client.config.client_side_validation && invoice_number.nil? fail ArgumentError, "Missing the required parameter 'invoice_number' when calling BillingApi.get_settlement_applications" end # resource path local_var_path = '/settlements' # query parameters query_params = {} query_params[:'invoiceNumber'] = invoice_number # 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: BillingApi#get_settlement_applications\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get the details of an alias # Returns the details of the specified alias id including the subscription id and the charge id it is mapped to. # @param alias_id # @param [Hash] opts the optional parameters # @return [SubscriptionChargeAlias] def get_subscription_charge_alias(alias_id, opts = {}) data, _status_code, _headers = get_subscription_charge_alias_with_http_info(alias_id, opts) data end # Get the details of an alias # Returns the details of the specified alias id including the subscription id and the charge id it is mapped to. # @param alias_id # @param [Hash] opts the optional parameters # @return [Array<(SubscriptionChargeAlias, Fixnum, Hash)>] SubscriptionChargeAlias data, response status code and response headers def get_subscription_charge_alias_with_http_info(alias_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.get_subscription_charge_alias ...' end # verify the required parameter 'alias_id' is set if @api_client.config.client_side_validation && alias_id.nil? fail ArgumentError, "Missing the required parameter 'alias_id' when calling BillingApi.get_subscription_charge_alias" end # resource path local_var_path = '/alias/subscriptionCharge/{aliasId}'.sub('{' + 'aliasId' + '}', alias_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 => 'SubscriptionChargeAlias') if @api_client.config.debugging @api_client.config.logger.debug "API called: BillingApi#get_subscription_charge_alias\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get usage # Returns the usage invoice items for the specified subscription and charge # @param subscription_id id of the subscription # @param charge_id id of the charge # @param [Hash] opts the optional parameters # @return [Array] def get_usage_for_subscription_charge(subscription_id, charge_id, opts = {}) data, _status_code, _headers = get_usage_for_subscription_charge_with_http_info(subscription_id, charge_id, opts) data end # Get usage # Returns the usage invoice items for the specified subscription and charge # @param subscription_id id of the subscription # @param charge_id id of the charge # @param [Hash] opts the optional parameters # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers def get_usage_for_subscription_charge_with_http_info(subscription_id, charge_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.get_usage_for_subscription_charge ...' end # verify the required parameter 'subscription_id' is set if @api_client.config.client_side_validation && subscription_id.nil? fail ArgumentError, "Missing the required parameter 'subscription_id' when calling BillingApi.get_usage_for_subscription_charge" end # verify the required parameter 'charge_id' is set if @api_client.config.client_side_validation && charge_id.nil? fail ArgumentError, "Missing the required parameter 'charge_id' when calling BillingApi.get_usage_for_subscription_charge" end # resource path local_var_path = '/invoices/usage' # query parameters query_params = {} query_params[:'subscriptionId'] = subscription_id query_params[:'chargeId'] = charge_id # 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: BillingApi#get_usage_for_subscription_charge\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get aliases for a subscription # Returns all aliases for the specified subscription id. # @param [Hash] opts the optional parameters # @option opts [String] :subscription_id id of the subscription # @return [Array] def list_aliases_for_subscription(opts = {}) data, _status_code, _headers = list_aliases_for_subscription_with_http_info(opts) data end # Get aliases for a subscription # Returns all aliases for the specified subscription id. # @param [Hash] opts the optional parameters # @option opts [String] :subscription_id id of the subscription # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers def list_aliases_for_subscription_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.list_aliases_for_subscription ...' end # resource path local_var_path = '/alias/subscriptionCharge' # query parameters query_params = {} query_params[:'subscriptionId'] = opts[:'subscription_id'] if !opts[:'subscription_id'].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 => 'Array') if @api_client.config.debugging @api_client.config.logger.debug "API called: BillingApi#list_aliases_for_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Mark invoice as posted # Marks the specified invoice as posted # @param number number of the invoice # @param [Hash] opts the optional parameters # @return [InvoiceJson] def post_invoice(number, opts = {}) data, _status_code, _headers = post_invoice_with_http_info(number, opts) data end # Mark invoice as posted # Marks the specified invoice as posted # @param number number of the invoice # @param [Hash] opts the optional parameters # @return [Array<(InvoiceJson, Fixnum, Hash)>] InvoiceJson data, response status code and response headers def post_invoice_with_http_info(number, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.post_invoice ...' end # verify the required parameter 'number' is set if @api_client.config.client_side_validation && number.nil? fail ArgumentError, "Missing the required parameter 'number' when calling BillingApi.post_invoice" end # resource path local_var_path = '/invoices/{number}/post'.sub('{' + 'number' + '}', number.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(: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 => 'InvoiceJson') if @api_client.config.debugging @api_client.config.logger.debug "API called: BillingApi#post_invoice\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Posts invoices for a bulk run # Marks all invoices associated with the specified bulk run as posted # @param bulk_invoice_run_id id of the run # @param [Hash] opts the optional parameters # @option opts [Array] :body # @return [BulkInvoiceRun] def post_invoices_for_bulk_invoice_run(bulk_invoice_run_id, opts = {}) data, _status_code, _headers = post_invoices_for_bulk_invoice_run_with_http_info(bulk_invoice_run_id, opts) data end # Posts invoices for a bulk run # Marks all invoices associated with the specified bulk run as posted # @param bulk_invoice_run_id id of the run # @param [Hash] opts the optional parameters # @option opts [Array] :body # @return [Array<(BulkInvoiceRun, Fixnum, Hash)>] BulkInvoiceRun data, response status code and response headers def post_invoices_for_bulk_invoice_run_with_http_info(bulk_invoice_run_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.post_invoices_for_bulk_invoice_run ...' end # verify the required parameter 'bulk_invoice_run_id' is set if @api_client.config.client_side_validation && bulk_invoice_run_id.nil? fail ArgumentError, "Missing the required parameter 'bulk_invoice_run_id' when calling BillingApi.post_invoices_for_bulk_invoice_run" end # resource path local_var_path = '/invoices/bulk/{bulkInvoiceRunId}/post'.sub('{' + 'bulkInvoiceRunId' + '}', bulk_invoice_run_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 => 'BulkInvoiceRun') if @api_client.config.debugging @api_client.config.logger.debug "API called: BillingApi#post_invoices_for_bulk_invoice_run\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Preview invoices # Returns a preview of invoice for the specified order id OR subscription id # @param [Hash] opts the optional parameters # @option opts [String] :order_id id of order # @option opts [String] :subscription_id id of subscription # @return [Array] def preview_invoice_by_order_period(opts = {}) data, _status_code, _headers = preview_invoice_by_order_period_with_http_info(opts) data end # Preview invoices # Returns a preview of invoice for the specified order id OR subscription id # @param [Hash] opts the optional parameters # @option opts [String] :order_id id of order # @option opts [String] :subscription_id id of subscription # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers def preview_invoice_by_order_period_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.preview_invoice_by_order_period ...' end # resource path local_var_path = '/invoices/preview' # query parameters query_params = {} query_params[:'orderId'] = opts[:'order_id'] if !opts[:'order_id'].nil? query_params[:'subscriptionId'] = opts[:'subscription_id'] if !opts[:'subscription_id'].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 => 'Array') if @api_client.config.debugging @api_client.config.logger.debug "API called: BillingApi#preview_invoice_by_order_period\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get unbilled usage # Returns the unbilled usage invoice items for the specified subscription # @param subscription_id id of the subscription # @param [Hash] opts the optional parameters # @return [Array] def preview_invoice_by_order_period1(subscription_id, opts = {}) data, _status_code, _headers = preview_invoice_by_order_period1_with_http_info(subscription_id, opts) data end # Get unbilled usage # Returns the unbilled usage invoice items for the specified subscription # @param subscription_id id of the subscription # @param [Hash] opts the optional parameters # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers def preview_invoice_by_order_period1_with_http_info(subscription_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.preview_invoice_by_order_period1 ...' end # verify the required parameter 'subscription_id' is set if @api_client.config.client_side_validation && subscription_id.nil? fail ArgumentError, "Missing the required parameter 'subscription_id' when calling BillingApi.preview_invoice_by_order_period1" end # resource path local_var_path = '/invoices/unbilledUsage' # query parameters query_params = {} query_params[:'subscriptionId'] = subscription_id # 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: BillingApi#preview_invoice_by_order_period1\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Set the contact for accounts receivable # Sets the details of the account receivable contact for your tenant # @param [Hash] opts the optional parameters # @option opts [AccountReceivableContactJson] :account_receivable_contact_json contact details # @return [nil] def put_account_receivable_contact(opts = {}) put_account_receivable_contact_with_http_info(opts) nil end # Set the contact for accounts receivable # Sets the details of the account receivable contact for your tenant # @param [Hash] opts the optional parameters # @option opts [AccountReceivableContactJson] :account_receivable_contact_json contact details # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def put_account_receivable_contact_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.put_account_receivable_contact ...' end # resource path local_var_path = '/accountReceivableContact' # 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[:'account_receivable_contact_json']) 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) if @api_client.config.debugging @api_client.config.logger.debug "API called: BillingApi#put_account_receivable_contact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Send an Invoice Reminder # Sends a reminder email for the specified invoice # @param invoice_number number of the invoice # @param [Hash] opts the optional parameters # @return [nil] def send_invoice_reminder(invoice_number, opts = {}) send_invoice_reminder_with_http_info(invoice_number, opts) nil end # Send an Invoice Reminder # Sends a reminder email for the specified invoice # @param invoice_number number of the invoice # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def send_invoice_reminder_with_http_info(invoice_number, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.send_invoice_reminder ...' end # verify the required parameter 'invoice_number' is set if @api_client.config.client_side_validation && invoice_number.nil? fail ArgumentError, "Missing the required parameter 'invoice_number' when calling BillingApi.send_invoice_reminder" end # resource path local_var_path = '/dunning/sendInvoiceReminder/{invoiceNumber}'.sub('{' + 'invoiceNumber' + '}', invoice_number.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']) # form parameters form_params = {} # http body (model) post_body = nil 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) if @api_client.config.debugging @api_client.config.logger.debug "API called: BillingApi#send_invoice_reminder\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Send a test email # Sends a test email for dunning to the use associated with this API call. Note A user bound api key is required for this operation. # @param reminder_type type of the reminder # @param [Hash] opts the optional parameters # @return [nil] def send_test_dunning_email(reminder_type, opts = {}) send_test_dunning_email_with_http_info(reminder_type, opts) nil end # Send a test email # Sends a test email for dunning to the use associated with this API call. Note A user bound api key is required for this operation. # @param reminder_type type of the reminder # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def send_test_dunning_email_with_http_info(reminder_type, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.send_test_dunning_email ...' end # verify the required parameter 'reminder_type' is set if @api_client.config.client_side_validation && reminder_type.nil? fail ArgumentError, "Missing the required parameter 'reminder_type' when calling BillingApi.send_test_dunning_email" end # verify enum value if @api_client.config.client_side_validation && !['WEEK_BEFORE_DUE_DATE', 'DUE_DATE', 'WEEK_AFTER_DUE_DATE', 'TWO_WEEKS_AFTER_DUE_DATE', 'MONTH_AFTER_DUE_DATE', 'TWO_MONTHS_AFTER_DUE_DATE'].include?(reminder_type) fail ArgumentError, "invalid value for 'reminder_type', must be one of WEEK_BEFORE_DUE_DATE, DUE_DATE, WEEK_AFTER_DUE_DATE, TWO_WEEKS_AFTER_DUE_DATE, MONTH_AFTER_DUE_DATE, TWO_MONTHS_AFTER_DUE_DATE" end # resource path local_var_path = '/dunning/sendTestEmail/{reminderType}'.sub('{' + 'reminderType' + '}', reminder_type.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']) # form parameters form_params = {} # http body (model) post_body = nil 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) if @api_client.config.debugging @api_client.config.logger.debug "API called: BillingApi#send_test_dunning_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update automated invoice rule details # Updates the details of the specified automated invoice rule # @param id id of the automated invoice rule # @param body automated invoice rule # @param [Hash] opts the optional parameters # @return [nil] def update_automated_invoice_rule(id, body, opts = {}) update_automated_invoice_rule_with_http_info(id, body, opts) nil end # Update automated invoice rule details # Updates the details of the specified automated invoice rule # @param id id of the automated invoice rule # @param body automated invoice rule # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def update_automated_invoice_rule_with_http_info(id, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.update_automated_invoice_rule ...' 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 BillingApi.update_automated_invoice_rule" end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling BillingApi.update_automated_invoice_rule" end # resource path local_var_path = '/automatedInvoiceRules/{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 = @api_client.object_to_http_body(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) if @api_client.config.debugging @api_client.config.logger.debug "API called: BillingApi#update_automated_invoice_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update dunning settings # Updates the dunning settings for your tenant # @param [Hash] opts the optional parameters # @option opts [DunningSettingJson] :body json representing the dunning settings # @return [nil] def update_dunning_setting(opts = {}) update_dunning_setting_with_http_info(opts) nil end # Update dunning settings # Updates the dunning settings for your tenant # @param [Hash] opts the optional parameters # @option opts [DunningSettingJson] :body json representing the dunning settings # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def update_dunning_setting_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.update_dunning_setting ...' end # resource path local_var_path = '/dunningSetting' # 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) if @api_client.config.debugging @api_client.config.logger.debug "API called: BillingApi#update_dunning_setting\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update invoice details # Updates the details of the specified invoice. # @param number number of the invoice # @param body json representing invoice details # @param [Hash] opts the optional parameters # @return [InvoiceJson] def update_invoice(number, body, opts = {}) data, _status_code, _headers = update_invoice_with_http_info(number, body, opts) data end # Update invoice details # Updates the details of the specified invoice. # @param number number of the invoice # @param body json representing invoice details # @param [Hash] opts the optional parameters # @return [Array<(InvoiceJson, Fixnum, Hash)>] InvoiceJson data, response status code and response headers def update_invoice_with_http_info(number, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.update_invoice ...' end # verify the required parameter 'number' is set if @api_client.config.client_side_validation && number.nil? fail ArgumentError, "Missing the required parameter 'number' when calling BillingApi.update_invoice" end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling BillingApi.update_invoice" end # resource path local_var_path = '/invoices/{number}'.sub('{' + 'number' + '}', number.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(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 => 'InvoiceJson') if @api_client.config.debugging @api_client.config.logger.debug "API called: BillingApi#update_invoice\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update invoice sequence # Updates the invoice sequence by invoice config id. # @param invoice_config_id invoice config id # @param [Hash] opts the optional parameters # @option opts [Integer] :next_invoice_number long integer value # @return [TenantInvoiceConfig] def update_invoice_sequence(invoice_config_id, opts = {}) data, _status_code, _headers = update_invoice_sequence_with_http_info(invoice_config_id, opts) data end # Update invoice sequence # Updates the invoice sequence by invoice config id. # @param invoice_config_id invoice config id # @param [Hash] opts the optional parameters # @option opts [Integer] :next_invoice_number long integer value # @return [Array<(TenantInvoiceConfig, Fixnum, Hash)>] TenantInvoiceConfig data, response status code and response headers def update_invoice_sequence_with_http_info(invoice_config_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.update_invoice_sequence ...' end # verify the required parameter 'invoice_config_id' is set if @api_client.config.client_side_validation && invoice_config_id.nil? fail ArgumentError, "Missing the required parameter 'invoice_config_id' when calling BillingApi.update_invoice_sequence" end # resource path local_var_path = '/invoices/sequence/{invoiceConfigId}'.sub('{' + 'invoiceConfigId' + '}', invoice_config_id.to_s) # query parameters query_params = {} query_params[:'next invoice number'] = opts[:'next_invoice_number'] if !opts[:'next_invoice_number'].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(: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 => 'TenantInvoiceConfig') if @api_client.config.debugging @api_client.config.logger.debug "API called: BillingApi#update_invoice_sequence\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Mark invoice as voided # Marks the specified invoice as voided # @param number number of the invoice # @param body json representing invoice details # @param [Hash] opts the optional parameters # @return [InvoiceJson] def void_invoice(number, body, opts = {}) data, _status_code, _headers = void_invoice_with_http_info(number, body, opts) data end # Mark invoice as voided # Marks the specified invoice as voided # @param number number of the invoice # @param body json representing invoice details # @param [Hash] opts the optional parameters # @return [Array<(InvoiceJson, Fixnum, Hash)>] InvoiceJson data, response status code and response headers def void_invoice_with_http_info(number, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BillingApi.void_invoice ...' end # verify the required parameter 'number' is set if @api_client.config.client_side_validation && number.nil? fail ArgumentError, "Missing the required parameter 'number' when calling BillingApi.void_invoice" end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling BillingApi.void_invoice" end # resource path local_var_path = '/invoices/{number}/void'.sub('{' + 'number' + '}', number.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(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 => 'InvoiceJson') if @api_client.config.debugging @api_client.config.logger.debug "API called: BillingApi#void_invoice\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end