class HelloextendApiClient::ContractsApi
Attributes
Public Class Methods
# File lib/helloextend_api_client/api/contracts_api.rb, line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end
Public Instance Methods
Get invoice information for a contract Extend automatically generates an invoice to the merchant whenever a warranty contract is sold. If it helps with your record-keeping and back end reconciliation, you can get the invoice details using this API call. If you sent us a purchase order number when making the 'Create a warranty contract' call, we'll include that in the invoice, too, for your reference. @param store_id [String] Unique identifier for a Store on Extend @param contract_id [String] Unique identifier for an Extend warranty Contract
@param [Hash] opts the optional parameters @return [Invoice]
# File lib/helloextend_api_client/api/contracts_api.rb, line 28 def contract_invoice(store_id, contract_id, opts = {}) data, _status_code, _headers = contract_invoice_with_http_info(store_id, contract_id, opts) data end
Get invoice information for a contract Extend automatically generates an invoice to the merchant whenever a warranty contract is sold. If it helps with your record-keeping and back end reconciliation, you can get the invoice details using this API call. If you sent us a purchase order number when making the 'Create a warranty contract' call, we'll include that in the invoice, too, for your reference. @param store_id [String] Unique identifier for a Store on Extend @param contract_id [String] Unique identifier for an Extend warranty Contract
@param [Hash] opts the optional parameters @return [Array<(Invoice
, Integer, Hash)>] Invoice
data, response status code and response headers
# File lib/helloextend_api_client/api/contracts_api.rb, line 39 def contract_invoice_with_http_info(store_id, contract_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContractsApi.contract_invoice ...' end # verify the required parameter 'store_id' is set if @api_client.config.client_side_validation && store_id.nil? fail ArgumentError, "Missing the required parameter 'store_id' when calling ContractsApi.contract_invoice" end # verify the required parameter 'contract_id' is set if @api_client.config.client_side_validation && contract_id.nil? fail ArgumentError, "Missing the required parameter 'contract_id' when calling ContractsApi.contract_invoice" end # resource path local_var_path = '/stores/{storeId}/contracts/{contractId}/invoice'.sub('{' + 'storeId' + '}', CGI.escape(store_id.to_s)).sub('{' + 'contractId' + '}', CGI.escape(contract_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'Invoice' # auth_names auth_names = opts[:auth_names] || ['ExtendAccessToken'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ContractsApi#contract_invoice\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Create a warranty contract @param store_id [String] Unique identifier for a Store on Extend @param contract [Contract] @param [Hash] opts the optional parameters @return [Contract]
# File lib/helloextend_api_client/api/contracts_api.rb, line 95 def create_contracts(store_id, contract, opts = {}) data, _status_code, _headers = create_contracts_with_http_info(store_id, contract, opts) data end
Create a warranty contract @param store_id [String] Unique identifier for a Store on Extend @param contract [Contract] @param [Hash] opts the optional parameters @return [Array<(Contract
, Integer, Hash)>] Contract
data, response status code and response headers
# File lib/helloextend_api_client/api/contracts_api.rb, line 105 def create_contracts_with_http_info(store_id, contract, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContractsApi.create_contracts ...' end # verify the required parameter 'store_id' is set if @api_client.config.client_side_validation && store_id.nil? fail ArgumentError, "Missing the required parameter 'store_id' when calling ContractsApi.create_contracts" end # verify the required parameter 'contract' is set if @api_client.config.client_side_validation && contract.nil? fail ArgumentError, "Missing the required parameter 'contract' when calling ContractsApi.create_contracts" end # resource path local_var_path = '/stores/{storeId}/contracts'.sub('{' + 'storeId' + '}', CGI.escape(store_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[: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 = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(contract) # return_type return_type = opts[:return_type] || 'Contract' # auth_names auth_names = opts[:auth_names] || ['ExtendAccessToken'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ContractsApi#create_contracts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Cancel a warranty contract and request a refund This endpoint is your way to report a refunded warranty contract to Extend. If a customer returns an item for which a warranty was purchased, or just the warranty itself, to your store, you should let Extend know so we can cancel the warranty contract. We will also refund you, the merchant, in the next invoice. The amount Extend will refund you (and the amount you should refund to the customer), depends on the date of the refund and the terms of the warranty contract. <div class='wrapper tip'><h2>Pro Tip! Check the refund amount before you refund your customer</h2> To make sure you refund your customer the same amount as Extend will be refunding you, there is a three-step process: <ul><li>Send the cancellation API request to Extend with query parameter "commit" set to FALSE. This gives you a preview of the cancellation, Including the amount that would be refunded (the "cancellation quote") </li><li>Issue a refund to the customer for the amount matching the cancellation quote</li><li>Re-send the cancellation API request to Extend with query parameter "commit" set to TRUE. This will cause Extend to cancel the contract and issue the merchant refund for the amount matching the cancellation quote</li></ul></div><div class='wrapper important'><h2>Important:</h2> Please note that this endpoint <strong>does not cause Extend to refund the customer</strong> - they would get the refund from the store where they purchased the product and warranty contract. A successful call to this endpoint <strong>will void the customer’s warranty contract</strong>, and initiate reimbursement to you, the merchant.</div> @param store_id [String] Unique identifier for a Store on Extend @param contract_id [String] Unique identifier for an Extend warranty Contract
@param [Hash] opts the optional parameters @option opts [Boolean] :commit Use the value <strong>"false"</strong> to get a preview of the cancellation quote - the amount you will be refunded for the cancelled contract. If you use the value <strong>"true"</strong> or omit the query parameter, Extend will execute the contract cancellation. @return [nil]
# File lib/helloextend_api_client/api/contracts_api.rb, line 165 def refund_contract(store_id, contract_id, opts = {}) refund_contract_with_http_info(store_id, contract_id, opts) nil end
Cancel a warranty contract and request a refund This endpoint is your way to report a refunded warranty contract to Extend. If a customer returns an item for which a warranty was purchased, or just the warranty itself, to your store, you should let Extend know so we can cancel the warranty contract. We will also refund you, the merchant, in the next invoice. The amount Extend will refund you (and the amount you should refund to the customer), depends on the date of the refund and the terms of the warranty contract. <div class='wrapper tip'><h2>Pro Tip! Check the refund amount before you refund your customer</h2> To make sure you refund your customer the same amount as Extend will be refunding you, there is a three-step process: <ul><li>Send the cancellation API request to Extend with query parameter "commit" set to FALSE. This gives you a preview of the cancellation, Including the amount that would be refunded (the "cancellation quote") </li><li>Issue a refund to the customer for the amount matching the cancellation quote</li><li>Re-send the cancellation API request to Extend with query parameter "commit" set to TRUE. This will cause Extend to cancel the contract and issue the merchant refund for the amount matching the cancellation quote</li></ul></div><div class='wrapper important'><h2>Important:</h2> Please note that this endpoint <strong>does not cause Extend to refund the customer</strong> - they would get the refund from the store where they purchased the product and warranty contract. A successful call to this endpoint <strong>will void the customer’s warranty contract</strong>, and initiate reimbursement to you, the merchant.</div> @param store_id [String] Unique identifier for a Store on Extend @param contract_id [String] Unique identifier for an Extend warranty Contract
@param [Hash] opts the optional parameters @option opts [Boolean] :commit Use the value <strong>"false"</strong> to get a preview of the cancellation quote - the amount you will be refunded for the cancelled contract. If you use the value <strong>"true"</strong> or omit the query parameter, Extend will execute the contract cancellation. @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
# File lib/helloextend_api_client/api/contracts_api.rb, line 177 def refund_contract_with_http_info(store_id, contract_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ContractsApi.refund_contract ...' end # verify the required parameter 'store_id' is set if @api_client.config.client_side_validation && store_id.nil? fail ArgumentError, "Missing the required parameter 'store_id' when calling ContractsApi.refund_contract" end # verify the required parameter 'contract_id' is set if @api_client.config.client_side_validation && contract_id.nil? fail ArgumentError, "Missing the required parameter 'contract_id' when calling ContractsApi.refund_contract" end # resource path local_var_path = '/stores/{storeId}/contracts/{contractId}/refund'.sub('{' + 'storeId' + '}', CGI.escape(store_id.to_s)).sub('{' + 'contractId' + '}', CGI.escape(contract_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'commit'] = opts[:'commit'] if !opts[:'commit'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] # auth_names auth_names = opts[:auth_names] || ['ExtendAccessToken'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ContractsApi#refund_contract\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end