Class: HelloextendApiClient::ContractsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/helloextend_api_client/api/contracts_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ContractsApi

Returns a new instance of ContractsApi.



19
20
21
# File 'lib/helloextend_api_client/api/contracts_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/helloextend_api_client/api/contracts_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#contract_invoice(store_id, contract_id, opts = {}) ⇒ Invoice

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.

Parameters:

  • store_id (String)

    Unique identifier for a Store on Extend

  • contract_id (String)

    Unique identifier for an Extend warranty Contract

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



28
29
30
31
# 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

#contract_invoice_with_http_info(store_id, contract_id, opts = {}) ⇒ Array<(Invoice, Integer, Hash)>

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 &#39;Create a warranty contract&#39; call, we&#39;ll include that in the invoice, too, for your reference.

Parameters:

  • store_id (String)

    Unique identifier for a Store on Extend

  • contract_id (String)

    Unique identifier for an Extend warranty Contract

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Invoice, Integer, Hash)>)

    Invoice data, response status code and response headers



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# 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_contracts(store_id, contract, opts = {}) ⇒ Contract

Create a warranty contract

Parameters:

  • store_id (String)

    Unique identifier for a Store on Extend

  • contract (Contract)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



95
96
97
98
# 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_contracts_with_http_info(store_id, contract, opts = {}) ⇒ Array<(Contract, Integer, Hash)>

Create a warranty contract

Parameters:

  • store_id (String)

    Unique identifier for a Store on Extend

  • contract (Contract)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Contract, Integer, Hash)>)

    Contract data, response status code and response headers



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# 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

#refund_contract(store_id, contract_id, opts = {}) ⇒ nil

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>

Parameters:

  • store_id (String)

    Unique identifier for a Store on Extend

  • contract_id (String)

    Unique identifier for an Extend warranty Contract

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :commit (Boolean)

    Use the value &lt;strong&gt;&quot;false&quot;&lt;/strong&gt; to get a preview of the cancellation quote - the amount you will be refunded for the cancelled contract. If you use the value &lt;strong&gt;&quot;true&quot;&lt;/strong&gt; or omit the query parameter, Extend will execute the contract cancellation.

Returns:

  • (nil)


165
166
167
168
# 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

#refund_contract_with_http_info(store_id, contract_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

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. &lt;div class&#x3D;&#39;wrapper tip&#39;&gt;&lt;h2&gt;Pro Tip! Check the refund amount before you refund your customer&lt;/h2&gt; To make sure you refund your customer the same amount as Extend will be refunding you, there is a three-step process: &lt;ul&gt;&lt;li&gt;Send the cancellation API request to Extend with query parameter &quot;commit&quot; set to FALSE. This gives you a preview of the cancellation, Including the amount that would be refunded (the &quot;cancellation quote&quot;) &lt;/li&gt;&lt;li&gt;Issue a refund to the customer for the amount matching the cancellation quote&lt;/li&gt;&lt;li&gt;Re-send the cancellation API request to Extend with query parameter &quot;commit&quot; set to TRUE. This will cause Extend to cancel the contract and issue the merchant refund for the amount matching the cancellation quote&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class&#x3D;&#39;wrapper important&#39;&gt;&lt;h2&gt;Important:&lt;/h2&gt; Please note that this endpoint &lt;strong&gt;does not cause Extend to refund the customer&lt;/strong&gt; - they would get the refund from the store where they purchased the product and warranty contract. A successful call to this endpoint &lt;strong&gt;will void the customer’s warranty contract&lt;/strong&gt;, and initiate reimbursement to you, the merchant.&lt;/div&gt;

Parameters:

  • store_id (String)

    Unique identifier for a Store on Extend

  • contract_id (String)

    Unique identifier for an Extend warranty Contract

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :commit (Boolean)

    Use the value &lt;strong&gt;&quot;false&quot;&lt;/strong&gt; to get a preview of the cancellation quote - the amount you will be refunded for the cancelled contract. If you use the value &lt;strong&gt;&quot;true&quot;&lt;/strong&gt; or omit the query parameter, Extend will execute the contract cancellation.

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# 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