Class: Invoicetronic_Sdk::SendApi

Inherits:
Object
  • Object
show all
Defined in:
lib/invoicetronic_sdk/api/send_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ SendApi

Returns a new instance of SendApi.



19
20
21
# File 'lib/invoicetronic_sdk/api/send_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/invoicetronic_sdk/api/send_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#send_file_post(file, opts = {}) ⇒ ModelSend

Add an invoice by file Add a new invoice by uploading a file. Supported formats are XML (FatturaPA) and P7M (signed). The invoice will be signed (if requested), validated (if requested), and queued for delivery to SDI. Status updates from SDI will be available in the update endpoint. Send invoices are outbound sales invoices transmitted to customers through Italy's SDI (Sistema di Interscambio). Preserved for two years in the live environment and 15 days in the Sandbox. You can also upload invoices via the Dashboard. ### Idempotency To protect against duplicate submissions caused by network retries, you can send an optional Idempotency-Key header with any unique, client-generated value (up to 255 characters). - The first request with a given key is processed normally, and its response (status, body and Location) is stored for 24 hours. - Any subsequent request that reuses the same key within that window replays the original response instead of sending a second invoice to SDI. - If a request with the same key is still being processed, the retry receives 409 Conflict. - If the same key is reused with a different invoice payload, the request is rejected with 422 Unprocessable Entity: a given key must always map to the same request. Keys are scoped per account, so different accounts can use the same key value without interfering. If the idempotency store is temporarily unavailable, the request is processed normally without idempotency protection.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :validate (Boolean)

    Validate the document first, and reject it on failure. (default to false)

  • :signature (String)

    Whether to digitally sign the document. (default to 'Auto')

  • :idempotency_key (String)

    Optional client-generated key that makes the submission idempotent. Retrying the same request with the same key within 24 hours returns the original response instead of creating a duplicate invoice.

Returns:



30
31
32
33
# File 'lib/invoicetronic_sdk/api/send_api.rb', line 30

def send_file_post(file, opts = {})
  data, _status_code, _headers = send_file_post_with_http_info(file, opts)
  data
end

#send_file_post_with_http_info(file, opts = {}) ⇒ Array<(ModelSend, Integer, Hash)>

Add an invoice by file Add a new invoice by uploading a file. Supported formats are XML (FatturaPA) and P7M (signed). The invoice will be signed (if requested), validated (if requested), and queued for delivery to SDI. Status updates from SDI will be available in the `update` endpoint. Send invoices are outbound sales invoices transmitted to customers through Italy's SDI (Sistema di Interscambio). Preserved for two years in the live environment and 15 days in the Sandbox. You can also upload invoices via the Dashboard. ### Idempotency To protect against duplicate submissions caused by network retries, you can send an optional `Idempotency-Key` header with any unique, client-generated value (up to 255 characters). - The first request with a given key is processed normally, and its response (status, body and `Location`) is stored for 24 hours. - Any subsequent request that reuses the same key within that window replays the original response instead of sending a second invoice to SDI. - If a request with the same key is still being processed, the retry receives `409 Conflict`. - If the same key is reused with a different invoice payload, the request is rejected with `422 Unprocessable Entity`: a given key must always map to the same request. Keys are scoped per account, so different accounts can use the same key value without interfering. If the idempotency store is temporarily unavailable, the request is processed normally without idempotency protection.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :validate (Boolean)

    Validate the document first, and reject it on failure. (default to false)

  • :signature (String)

    Whether to digitally sign the document. (default to 'Auto')

  • :idempotency_key (String)

    Optional client-generated key that makes the submission idempotent. Retrying the same request with the same key within 24 hours returns the original response instead of creating a duplicate invoice.

Returns:

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

    ModelSend data, response status code and response headers



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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/invoicetronic_sdk/api/send_api.rb', line 43

def send_file_post_with_http_info(file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SendApi.send_file_post ...'
  end
  # verify the required parameter 'file' is set
  if @api_client.config.client_side_validation && file.nil?
    fail ArgumentError, "Missing the required parameter 'file' when calling SendApi.send_file_post"
  end
  allowable_values = ["None", "Apply", "Force", "Auto"]
  if @api_client.config.client_side_validation && opts[:'signature'] && !allowable_values.include?(opts[:'signature'])
    fail ArgumentError, "invalid value for \"signature\", must be one of #{allowable_values}"
  end
  if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'].to_s.length > 255
    fail ArgumentError, 'invalid value for "opts[:"idempotency_key"]" when calling SendApi.send_file_post, the character length must be smaller than or equal to 255.'
  end

  # resource path
  local_var_path = '/send/file'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'validate'] = opts[:'validate'] if !opts[:'validate'].nil?
  query_params[:'signature'] = opts[:'signature'] if !opts[:'signature'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['multipart/form-data'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end
  header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?

  # form parameters
  form_params = opts[:form_params] || {}
  form_params['file'] = file

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ModelSend'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Basic']

  new_options = opts.merge(
    :operation => :"SendApi.send_file_post",
    :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: SendApi#send_file_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#send_get(opts = {}) ⇒ Array<ModelSend>

List invoices Retrieve a paginated list of send invoices. Results can be filtered by various criteria such as company, date ranges, document number, current SDI state (latest_state), and free-text search (q). Use ids to fetch specific Send records in a single call (comma-separated, up to 100). Returns invoice metadata; set include_payload to true to include the full invoice content. Send invoices are outbound sales invoices transmitted to customers through Italy's SDI (Sistema di Interscambio). Preserved for two years in the live environment and 15 days in the Sandbox.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :company_id (Integer)

    Company id

  • :identifier (String)

    SDI identifier.

  • :committente (String)

    Vat number or fiscal code.

  • :prestatore (String)

    Vat number or fiscal code.

  • :file_name (String)

    File name.

  • :last_update_from (Time)

    UTC ISO 8601 (2024-11-29T12:34:56Z)

  • :last_update_to (Time)

    UTC ISO 8601 (2024-11-29T12:34:56Z)

  • :date_sent_from (Time)

    UTC ISO 8601 (2024-11-29T12:34:56Z)

  • :date_sent_to (Time)

    UTC ISO 8601 (2024-11-29T12:34:56Z)

  • :document_date_from (Time)

    UTC ISO 8601 (2024-11-29T12:34:56Z)

  • :document_date_to (Time)

    UTC ISO 8601 (2024-11-29T12:34:56Z)

  • :document_number (String)

    Document number.

  • :latest_state (String)

    Filter by the most recent SDI state for the invoice. Matches the `latest_state` field exposed inline on each Send.

  • :include_payload (Boolean)

    Include payload in the response. Defaults to false.

  • :ids (String)

    Comma-separated list of Send ids (max 100). Filters the collection to the matching rows; unknown or unauthorized ids are silently skipped.

  • :page (Integer)

    Page number. (default to 1)

  • :page_size (Integer)

    Items per page. Cannot be greater than 200. (default to 100)

  • :sort (String)

    Sort by field. Prefix with '-' for descending order.

  • :q (String)

    Full-text search across committente, prestatore, identifier, and file name.

Returns:



131
132
133
134
# File 'lib/invoicetronic_sdk/api/send_api.rb', line 131

def send_get(opts = {})
  data, _status_code, _headers = send_get_with_http_info(opts)
  data
end

#send_get_with_http_info(opts = {}) ⇒ Array<(Array<ModelSend>, Integer, Hash)>

List invoices Retrieve a paginated list of send invoices. Results can be filtered by various criteria such as company, date ranges, document number, current SDI state (`latest_state`), and free-text search (`q`). Use `ids` to fetch specific Send records in a single call (comma-separated, up to 100). Returns invoice metadata; set `include_payload` to true to include the full invoice content. Send invoices are outbound sales invoices transmitted to customers through Italy's SDI (Sistema di Interscambio). Preserved for two years in the live environment and 15 days in the Sandbox.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :company_id (Integer)

    Company id

  • :identifier (String)

    SDI identifier.

  • :committente (String)

    Vat number or fiscal code.

  • :prestatore (String)

    Vat number or fiscal code.

  • :file_name (String)

    File name.

  • :last_update_from (Time)

    UTC ISO 8601 (2024-11-29T12:34:56Z)

  • :last_update_to (Time)

    UTC ISO 8601 (2024-11-29T12:34:56Z)

  • :date_sent_from (Time)

    UTC ISO 8601 (2024-11-29T12:34:56Z)

  • :date_sent_to (Time)

    UTC ISO 8601 (2024-11-29T12:34:56Z)

  • :document_date_from (Time)

    UTC ISO 8601 (2024-11-29T12:34:56Z)

  • :document_date_to (Time)

    UTC ISO 8601 (2024-11-29T12:34:56Z)

  • :document_number (String)

    Document number.

  • :latest_state (String)

    Filter by the most recent SDI state for the invoice. Matches the `latest_state` field exposed inline on each Send.

  • :include_payload (Boolean)

    Include payload in the response. Defaults to false.

  • :ids (String)

    Comma-separated list of Send ids (max 100). Filters the collection to the matching rows; unknown or unauthorized ids are silently skipped.

  • :page (Integer)

    Page number. (default to 1)

  • :page_size (Integer)

    Items per page. Cannot be greater than 200. (default to 100)

  • :sort (String)

    Sort by field. Prefix with '-' for descending order.

  • :q (String)

    Full-text search across committente, prestatore, identifier, and file name.

Returns:

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

    Array data, response status code and response headers



159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
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
# File 'lib/invoicetronic_sdk/api/send_api.rb', line 159

def send_get_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SendApi.send_get ...'
  end
  allowable_values = ["Inviato", "Consegnato", "NonConsegnato", "Scartato", "AccettatoDalDestinatario", "RifiutatoDalDestinatario", "ImpossibilitaDiRecapito", "DecorrenzaTermini", "AttestazioneTrasmissioneFattura"]
  if @api_client.config.client_side_validation && opts[:'latest_state'] && !allowable_values.include?(opts[:'latest_state'])
    fail ArgumentError, "invalid value for \"latest_state\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/send'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'company_id'] = opts[:'company_id'] if !opts[:'company_id'].nil?
  query_params[:'identifier'] = opts[:'identifier'] if !opts[:'identifier'].nil?
  query_params[:'committente'] = opts[:'committente'] if !opts[:'committente'].nil?
  query_params[:'prestatore'] = opts[:'prestatore'] if !opts[:'prestatore'].nil?
  query_params[:'file_name'] = opts[:'file_name'] if !opts[:'file_name'].nil?
  query_params[:'last_update_from'] = opts[:'last_update_from'] if !opts[:'last_update_from'].nil?
  query_params[:'last_update_to'] = opts[:'last_update_to'] if !opts[:'last_update_to'].nil?
  query_params[:'date_sent_from'] = opts[:'date_sent_from'] if !opts[:'date_sent_from'].nil?
  query_params[:'date_sent_to'] = opts[:'date_sent_to'] if !opts[:'date_sent_to'].nil?
  query_params[:'document_date_from'] = opts[:'document_date_from'] if !opts[:'document_date_from'].nil?
  query_params[:'document_date_to'] = opts[:'document_date_to'] if !opts[:'document_date_to'].nil?
  query_params[:'document_number'] = opts[:'document_number'] if !opts[:'document_number'].nil?
  query_params[:'latest_state'] = opts[:'latest_state'] if !opts[:'latest_state'].nil?
  query_params[:'include_payload'] = opts[:'include_payload'] if !opts[:'include_payload'].nil?
  query_params[:'ids'] = opts[:'ids'] if !opts[:'ids'].nil?
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Array<ModelSend>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Basic']

  new_options = opts.merge(
    :operation => :"SendApi.send_get",
    :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: SendApi#send_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#send_id_get(id, opts = {}) ⇒ ModelSend

Get a invoice by id Retrieve a send invoice by its internal id. The id is unique and assigned by the system when the invoice is created. Returns invoice metadata; set include_payload to true to include the full invoice content. Send invoices are outbound sales invoices transmitted to customers through Italy's SDI (Sistema di Interscambio). Preserved for two years in the live environment and 15 days in the Sandbox.

Parameters:

  • id (Integer)

    Item id

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

    the optional parameters

Options Hash (opts):

  • :include_payload (Boolean)

    Include payload in the response. Defaults to false. (default to false)

Returns:



232
233
234
235
# File 'lib/invoicetronic_sdk/api/send_api.rb', line 232

def send_id_get(id, opts = {})
  data, _status_code, _headers = send_id_get_with_http_info(id, opts)
  data
end

#send_id_get_with_http_info(id, opts = {}) ⇒ Array<(ModelSend, Integer, Hash)>

Get a invoice by id Retrieve a send invoice by its internal id. The `id` is unique and assigned by the system when the invoice is created. Returns invoice metadata; set `include_payload` to true to include the full invoice content. Send invoices are outbound sales invoices transmitted to customers through Italy's SDI (Sistema di Interscambio). Preserved for two years in the live environment and 15 days in the Sandbox.

Parameters:

  • id (Integer)

    Item id

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

    the optional parameters

Options Hash (opts):

  • :include_payload (Boolean)

    Include payload in the response. Defaults to false. (default to false)

Returns:

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

    ModelSend data, response status code and response headers



243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
# File 'lib/invoicetronic_sdk/api/send_api.rb', line 243

def send_id_get_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SendApi.send_id_get ...'
  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 SendApi.send_id_get"
  end
  # resource path
  local_var_path = '/send/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'include_payload'] = opts[:'include_payload'] if !opts[:'include_payload'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ModelSend'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Basic']

  new_options = opts.merge(
    :operation => :"SendApi.send_id_get",
    :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: SendApi#send_id_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#send_id_payload_get(id, opts = {}) ⇒ nil

Get a send invoice payload by id Retrieve only the payload of a send invoice, without the full invoice metadata. This is useful when you already have the invoice metadata and only need the XML content. The response is a text/plain string, identical to the payload field returned by the standard GET endpoint with include_payload=true. Depending on how the invoice was originally submitted, the payload may be Base64-encoded or plain XML.

Parameters:

  • id (Integer)

    Item id

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

    the optional parameters

Returns:

  • (nil)


297
298
299
300
# File 'lib/invoicetronic_sdk/api/send_api.rb', line 297

def send_id_payload_get(id, opts = {})
  send_id_payload_get_with_http_info(id, opts)
  nil
end

#send_id_payload_get_with_http_info(id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Get a send invoice payload by id Retrieve only the payload of a send invoice, without the full invoice metadata. This is useful when you already have the invoice metadata and only need the XML content. The response is a `text/plain` string, identical to the `payload` field returned by the standard GET endpoint with `include_payload=true`. Depending on how the invoice was originally submitted, the payload may be Base64-encoded or plain XML.

Parameters:

  • id (Integer)

    Item id

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
# File 'lib/invoicetronic_sdk/api/send_api.rb', line 307

def send_id_payload_get_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SendApi.send_id_payload_get ...'
  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 SendApi.send_id_payload_get"
  end
  # resource path
  local_var_path = '/send/{id}/payload'.sub('{' + 'id' + '}', CGI.escape(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/problem+json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Basic']

  new_options = opts.merge(
    :operation => :"SendApi.send_id_payload_get",
    :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: SendApi#send_id_payload_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#send_identifier_get(identifier, opts = {}) ⇒ ModelSend

Get a invoice by identifier Retrieve a send invoice by its SDI identifier. The identifier is assigned by the SDI and becomes available after the invoice has been accepted. Returns invoice metadata; set include_payload to true to include the full invoice content. Send invoices are outbound sales invoices transmitted to customers through Italy's SDI (Sistema di Interscambio). Preserved for two years in the live environment and 15 days in the Sandbox.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :include_payload (Boolean)

    Include payload in the response. Defaults to false. (default to false)

Returns:



361
362
363
364
# File 'lib/invoicetronic_sdk/api/send_api.rb', line 361

def send_identifier_get(identifier, opts = {})
  data, _status_code, _headers = send_identifier_get_with_http_info(identifier, opts)
  data
end

#send_identifier_get_with_http_info(identifier, opts = {}) ⇒ Array<(ModelSend, Integer, Hash)>

Get a invoice by identifier Retrieve a send invoice by its SDI identifier. The `identifier` is assigned by the SDI and becomes available after the invoice has been accepted. Returns invoice metadata; set `include_payload` to true to include the full invoice content. Send invoices are outbound sales invoices transmitted to customers through Italy's SDI (Sistema di Interscambio). Preserved for two years in the live environment and 15 days in the Sandbox.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :include_payload (Boolean)

    Include payload in the response. Defaults to false. (default to false)

Returns:

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

    ModelSend data, response status code and response headers



372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
# File 'lib/invoicetronic_sdk/api/send_api.rb', line 372

def send_identifier_get_with_http_info(identifier, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SendApi.send_identifier_get ...'
  end
  # verify the required parameter 'identifier' is set
  if @api_client.config.client_side_validation && identifier.nil?
    fail ArgumentError, "Missing the required parameter 'identifier' when calling SendApi.send_identifier_get"
  end
  # resource path
  local_var_path = '/send/{identifier}'.sub('{' + 'identifier' + '}', CGI.escape(identifier.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'include_payload'] = opts[:'include_payload'] if !opts[:'include_payload'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ModelSend'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Basic']

  new_options = opts.merge(
    :operation => :"SendApi.send_identifier_get",
    :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: SendApi#send_identifier_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#send_json_post(body, opts = {}) ⇒ ModelSend

Add an invoice by json Add a new invoice using a FatturaPA JSON representation. Property names mirror the FatturaPA XML schema (PascalCase, e.g. FatturaElettronicaHeader). The invoice will be signed (if requested), validated (if requested), and queued for delivery to SDI. Status updates from SDI will be available in the update endpoint. Send invoices are outbound sales invoices transmitted to customers through Italy's SDI (Sistema di Interscambio). Preserved for two years in the live environment and 15 days in the Sandbox. You can also upload invoices via the Dashboard. ### Idempotency To protect against duplicate submissions caused by network retries, you can send an optional Idempotency-Key header with any unique, client-generated value (up to 255 characters). - The first request with a given key is processed normally, and its response (status, body and Location) is stored for 24 hours. - Any subsequent request that reuses the same key within that window replays the original response instead of sending a second invoice to SDI. - If a request with the same key is still being processed, the retry receives 409 Conflict. - If the same key is reused with a different invoice payload, the request is rejected with 422 Unprocessable Entity: a given key must always map to the same request. Keys are scoped per account, so different accounts can use the same key value without interfering. If the idempotency store is temporarily unavailable, the request is processed normally without idempotency protection.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :validate (Boolean)

    Validate the document first, and reject it on failure. (default to false)

  • :signature (String)

    Whether to digitally sign the document. (default to 'Auto')

  • :idempotency_key (String)

    Optional client-generated key that makes the submission idempotent. Retrying the same request with the same key within 24 hours returns the original response instead of creating a duplicate invoice.

Returns:



429
430
431
432
# File 'lib/invoicetronic_sdk/api/send_api.rb', line 429

def send_json_post(body, opts = {})
  data, _status_code, _headers = send_json_post_with_http_info(body, opts)
  data
end

#send_json_post_with_http_info(body, opts = {}) ⇒ Array<(ModelSend, Integer, Hash)>

Add an invoice by json Add a new invoice using a FatturaPA JSON representation. Property names mirror the FatturaPA XML schema (PascalCase, e.g. `FatturaElettronicaHeader`). The invoice will be signed (if requested), validated (if requested), and queued for delivery to SDI. Status updates from SDI will be available in the `update` endpoint. Send invoices are outbound sales invoices transmitted to customers through Italy's SDI (Sistema di Interscambio). Preserved for two years in the live environment and 15 days in the Sandbox. You can also upload invoices via the Dashboard. ### Idempotency To protect against duplicate submissions caused by network retries, you can send an optional `Idempotency-Key` header with any unique, client-generated value (up to 255 characters). - The first request with a given key is processed normally, and its response (status, body and `Location`) is stored for 24 hours. - Any subsequent request that reuses the same key within that window replays the original response instead of sending a second invoice to SDI. - If a request with the same key is still being processed, the retry receives `409 Conflict`. - If the same key is reused with a different invoice payload, the request is rejected with `422 Unprocessable Entity`: a given key must always map to the same request. Keys are scoped per account, so different accounts can use the same key value without interfering. If the idempotency store is temporarily unavailable, the request is processed normally without idempotency protection.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :validate (Boolean)

    Validate the document first, and reject it on failure. (default to false)

  • :signature (String)

    Whether to digitally sign the document. (default to 'Auto')

  • :idempotency_key (String)

    Optional client-generated key that makes the submission idempotent. Retrying the same request with the same key within 24 hours returns the original response instead of creating a duplicate invoice.

Returns:

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

    ModelSend data, response status code and response headers



442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
# File 'lib/invoicetronic_sdk/api/send_api.rb', line 442

def send_json_post_with_http_info(body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SendApi.send_json_post ...'
  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 SendApi.send_json_post"
  end
  allowable_values = ["None", "Apply", "Force", "Auto"]
  if @api_client.config.client_side_validation && opts[:'signature'] && !allowable_values.include?(opts[:'signature'])
    fail ArgumentError, "invalid value for \"signature\", must be one of #{allowable_values}"
  end
  if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'].to_s.length > 255
    fail ArgumentError, 'invalid value for "opts[:"idempotency_key"]" when calling SendApi.send_json_post, the character length must be smaller than or equal to 255.'
  end

  # resource path
  local_var_path = '/send/json'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'validate'] = opts[:'validate'] if !opts[:'validate'].nil?
  query_params[:'signature'] = opts[:'signature'] if !opts[:'signature'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end
  header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(body)

  # return_type
  return_type = opts[:debug_return_type] || 'ModelSend'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Basic']

  new_options = opts.merge(
    :operation => :"SendApi.send_json_post",
    :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: SendApi#send_json_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#send_post(model_send, opts = {}) ⇒ ModelSend

Add an invoice Add a new invoice using a structured Send object. The invoice will be signed (if requested), validated (if requested), and queued for delivery to SDI. Status updates from SDI will be available in the update endpoint. Send invoices are outbound sales invoices transmitted to customers through Italy's SDI (Sistema di Interscambio). Preserved for two years in the live environment and 15 days in the Sandbox. You can also upload invoices via the Dashboard. ### Idempotency To protect against duplicate submissions caused by network retries, you can send an optional Idempotency-Key header with any unique, client-generated value (up to 255 characters). - The first request with a given key is processed normally, and its response (status, body and Location) is stored for 24 hours. - Any subsequent request that reuses the same key within that window replays the original response instead of sending a second invoice to SDI. - If a request with the same key is still being processed, the retry receives 409 Conflict. - If the same key is reused with a different invoice payload, the request is rejected with 422 Unprocessable Entity: a given key must always map to the same request. Keys are scoped per account, so different accounts can use the same key value without interfering. If the idempotency store is temporarily unavailable, the request is processed normally without idempotency protection.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :validate (Boolean)

    Validate the document first, and reject it on failure. (default to false)

  • :signature (String)

    Whether to digitally sign the document. (default to 'Auto')

  • :idempotency_key (String)

    Optional client-generated key that makes the submission idempotent. Retrying the same request with the same key within 24 hours returns the original response instead of creating a duplicate invoice.

Returns:



514
515
516
517
# File 'lib/invoicetronic_sdk/api/send_api.rb', line 514

def send_post(model_send, opts = {})
  data, _status_code, _headers = send_post_with_http_info(model_send, opts)
  data
end

#send_post_with_http_info(model_send, opts = {}) ⇒ Array<(ModelSend, Integer, Hash)>

Add an invoice Add a new invoice using a structured Send object. The invoice will be signed (if requested), validated (if requested), and queued for delivery to SDI. Status updates from SDI will be available in the `update` endpoint. Send invoices are outbound sales invoices transmitted to customers through Italy's SDI (Sistema di Interscambio). Preserved for two years in the live environment and 15 days in the Sandbox. You can also upload invoices via the Dashboard. ### Idempotency To protect against duplicate submissions caused by network retries, you can send an optional `Idempotency-Key` header with any unique, client-generated value (up to 255 characters). - The first request with a given key is processed normally, and its response (status, body and `Location`) is stored for 24 hours. - Any subsequent request that reuses the same key within that window replays the original response instead of sending a second invoice to SDI. - If a request with the same key is still being processed, the retry receives `409 Conflict`. - If the same key is reused with a different invoice payload, the request is rejected with `422 Unprocessable Entity`: a given key must always map to the same request. Keys are scoped per account, so different accounts can use the same key value without interfering. If the idempotency store is temporarily unavailable, the request is processed normally without idempotency protection.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :validate (Boolean)

    Validate the document first, and reject it on failure. (default to false)

  • :signature (String)

    Whether to digitally sign the document. (default to 'Auto')

  • :idempotency_key (String)

    Optional client-generated key that makes the submission idempotent. Retrying the same request with the same key within 24 hours returns the original response instead of creating a duplicate invoice.

Returns:

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

    ModelSend data, response status code and response headers



527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
# File 'lib/invoicetronic_sdk/api/send_api.rb', line 527

def send_post_with_http_info(model_send, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SendApi.send_post ...'
  end
  # verify the required parameter 'model_send' is set
  if @api_client.config.client_side_validation && model_send.nil?
    fail ArgumentError, "Missing the required parameter 'model_send' when calling SendApi.send_post"
  end
  allowable_values = ["None", "Apply", "Force", "Auto"]
  if @api_client.config.client_side_validation && opts[:'signature'] && !allowable_values.include?(opts[:'signature'])
    fail ArgumentError, "invalid value for \"signature\", must be one of #{allowable_values}"
  end
  if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'].to_s.length > 255
    fail ArgumentError, 'invalid value for "opts[:"idempotency_key"]" when calling SendApi.send_post, the character length must be smaller than or equal to 255.'
  end

  # resource path
  local_var_path = '/send'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'validate'] = opts[:'validate'] if !opts[:'validate'].nil?
  query_params[:'signature'] = opts[:'signature'] if !opts[:'signature'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end
  header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(model_send)

  # return_type
  return_type = opts[:debug_return_type] || 'ModelSend'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Basic']

  new_options = opts.merge(
    :operation => :"SendApi.send_post",
    :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: SendApi#send_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#send_validate_file_post(file, opts = {}) ⇒ nil

Validate an invoice file Validate an invoice file without sending it to SDI. Supported formats are XML (FatturaPA) and P7M (signed). Use this to check for errors before actual submission. Returns validation results with any errors found. Send invoices are outbound sales invoices transmitted to customers through Italy's SDI (Sistema di Interscambio). Preserved for two years in the live environment and 15 days in the Sandbox.

Parameters:

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

    the optional parameters

Returns:

  • (nil)


596
597
598
599
# File 'lib/invoicetronic_sdk/api/send_api.rb', line 596

def send_validate_file_post(file, opts = {})
  send_validate_file_post_with_http_info(file, opts)
  nil
end

#send_validate_file_post_with_http_info(file, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Validate an invoice file Validate an invoice file without sending it to SDI. Supported formats are XML (FatturaPA) and P7M (signed). Use this to check for errors before actual submission. Returns validation results with any errors found. Send invoices are outbound sales invoices transmitted to customers through Italy's SDI (Sistema di Interscambio). Preserved for two years in the live environment and 15 days in the Sandbox.

Parameters:

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
# File 'lib/invoicetronic_sdk/api/send_api.rb', line 606

def send_validate_file_post_with_http_info(file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SendApi.send_validate_file_post ...'
  end
  # verify the required parameter 'file' is set
  if @api_client.config.client_side_validation && file.nil?
    fail ArgumentError, "Missing the required parameter 'file' when calling SendApi.send_validate_file_post"
  end
  # resource path
  local_var_path = '/send/validate/file'

  # 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']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['multipart/form-data'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}
  form_params['file'] = file

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Basic']

  new_options = opts.merge(
    :operation => :"SendApi.send_validate_file_post",
    :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: SendApi#send_validate_file_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#send_validate_json_post(body, opts = {}) ⇒ nil

Validate an invoice by json Validate a FatturaPA JSON invoice without sending it to SDI. Property names mirror the FatturaPA XML schema (PascalCase, e.g. FatturaElettronicaHeader). Use this to check for errors before actual submission. Returns validation results with any errors found. Send invoices are outbound sales invoices transmitted to customers through Italy's SDI (Sistema di Interscambio). Preserved for two years in the live environment and 15 days in the Sandbox.

Parameters:

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

    the optional parameters

Returns:

  • (nil)


665
666
667
668
# File 'lib/invoicetronic_sdk/api/send_api.rb', line 665

def send_validate_json_post(body, opts = {})
  send_validate_json_post_with_http_info(body, opts)
  nil
end

#send_validate_json_post_with_http_info(body, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Validate an invoice by json Validate a FatturaPA JSON invoice without sending it to SDI. Property names mirror the FatturaPA XML schema (PascalCase, e.g. `FatturaElettronicaHeader`). Use this to check for errors before actual submission. Returns validation results with any errors found. Send invoices are outbound sales invoices transmitted to customers through Italy's SDI (Sistema di Interscambio). Preserved for two years in the live environment and 15 days in the Sandbox.

Parameters:

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
# File 'lib/invoicetronic_sdk/api/send_api.rb', line 675

def send_validate_json_post_with_http_info(body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SendApi.send_validate_json_post ...'
  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 SendApi.send_validate_json_post"
  end
  # resource path
  local_var_path = '/send/validate/json'

  # 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']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(body)

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Basic']

  new_options = opts.merge(
    :operation => :"SendApi.send_validate_json_post",
    :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: SendApi#send_validate_json_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#send_validate_post(model_send, opts = {}) ⇒ nil

Validate an invoice Validate an invoice without sending it to SDI. Use this to check for errors before actual submission. Returns validation results with any errors found. Send invoices are outbound sales invoices transmitted to customers through Italy's SDI (Sistema di Interscambio). Preserved for two years in the live environment and 15 days in the Sandbox.

Parameters:

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

    the optional parameters

Returns:

  • (nil)


733
734
735
736
# File 'lib/invoicetronic_sdk/api/send_api.rb', line 733

def send_validate_post(model_send, opts = {})
  send_validate_post_with_http_info(model_send, opts)
  nil
end

#send_validate_post_with_http_info(model_send, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Validate an invoice Validate an invoice without sending it to SDI. Use this to check for errors before actual submission. Returns validation results with any errors found. Send invoices are outbound sales invoices transmitted to customers through Italy's SDI (Sistema di Interscambio). Preserved for two years in the live environment and 15 days in the Sandbox.

Parameters:

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
# File 'lib/invoicetronic_sdk/api/send_api.rb', line 743

def send_validate_post_with_http_info(model_send, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SendApi.send_validate_post ...'
  end
  # verify the required parameter 'model_send' is set
  if @api_client.config.client_side_validation && model_send.nil?
    fail ArgumentError, "Missing the required parameter 'model_send' when calling SendApi.send_validate_post"
  end
  # resource path
  local_var_path = '/send/validate'

  # 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']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(model_send)

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Basic']

  new_options = opts.merge(
    :operation => :"SendApi.send_validate_post",
    :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: SendApi#send_validate_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#send_validate_xml_post(body, opts = {}) ⇒ nil

Validate an invoice by xml Validate an XML invoice document without sending it to SDI. Use this to check for errors before actual submission. Returns validation results with any errors found. Send invoices are outbound sales invoices transmitted to customers through Italy's SDI (Sistema di Interscambio). Preserved for two years in the live environment and 15 days in the Sandbox.

Parameters:

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

    the optional parameters

Returns:

  • (nil)


801
802
803
804
# File 'lib/invoicetronic_sdk/api/send_api.rb', line 801

def send_validate_xml_post(body, opts = {})
  send_validate_xml_post_with_http_info(body, opts)
  nil
end

#send_validate_xml_post_with_http_info(body, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Validate an invoice by xml Validate an XML invoice document without sending it to SDI. Use this to check for errors before actual submission. Returns validation results with any errors found. Send invoices are outbound sales invoices transmitted to customers through Italy's SDI (Sistema di Interscambio). Preserved for two years in the live environment and 15 days in the Sandbox.

Parameters:

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
# File 'lib/invoicetronic_sdk/api/send_api.rb', line 811

def send_validate_xml_post_with_http_info(body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SendApi.send_validate_xml_post ...'
  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 SendApi.send_validate_xml_post"
  end
  # resource path
  local_var_path = '/send/validate/xml'

  # 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']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/xml'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(body)

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Basic']

  new_options = opts.merge(
    :operation => :"SendApi.send_validate_xml_post",
    :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: SendApi#send_validate_xml_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#send_xml_post(body, opts = {}) ⇒ ModelSend

Add an invoice by xml Add a new invoice using a raw XML document in FatturaPA format. The invoice will be signed (if requested), validated (if requested), and queued for delivery to SDI. Status updates from SDI will be available in the update endpoint. Send invoices are outbound sales invoices transmitted to customers through Italy's SDI (Sistema di Interscambio). Preserved for two years in the live environment and 15 days in the Sandbox. You can also upload invoices via the Dashboard. ### Idempotency To protect against duplicate submissions caused by network retries, you can send an optional Idempotency-Key header with any unique, client-generated value (up to 255 characters). - The first request with a given key is processed normally, and its response (status, body and Location) is stored for 24 hours. - Any subsequent request that reuses the same key within that window replays the original response instead of sending a second invoice to SDI. - If a request with the same key is still being processed, the retry receives 409 Conflict. - If the same key is reused with a different invoice payload, the request is rejected with 422 Unprocessable Entity: a given key must always map to the same request. Keys are scoped per account, so different accounts can use the same key value without interfering. If the idempotency store is temporarily unavailable, the request is processed normally without idempotency protection.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :validate (Boolean)

    Validate the document first, and reject it on failure. (default to false)

  • :signature (String)

    Whether to digitally sign the document. (default to 'Auto')

  • :idempotency_key (String)

    Optional client-generated key that makes the submission idempotent. Retrying the same request with the same key within 24 hours returns the original response instead of creating a duplicate invoice.

Returns:



872
873
874
875
# File 'lib/invoicetronic_sdk/api/send_api.rb', line 872

def send_xml_post(body, opts = {})
  data, _status_code, _headers = send_xml_post_with_http_info(body, opts)
  data
end

#send_xml_post_with_http_info(body, opts = {}) ⇒ Array<(ModelSend, Integer, Hash)>

Add an invoice by xml Add a new invoice using a raw XML document in FatturaPA format. The invoice will be signed (if requested), validated (if requested), and queued for delivery to SDI. Status updates from SDI will be available in the `update` endpoint. Send invoices are outbound sales invoices transmitted to customers through Italy's SDI (Sistema di Interscambio). Preserved for two years in the live environment and 15 days in the Sandbox. You can also upload invoices via the Dashboard. ### Idempotency To protect against duplicate submissions caused by network retries, you can send an optional `Idempotency-Key` header with any unique, client-generated value (up to 255 characters). - The first request with a given key is processed normally, and its response (status, body and `Location`) is stored for 24 hours. - Any subsequent request that reuses the same key within that window replays the original response instead of sending a second invoice to SDI. - If a request with the same key is still being processed, the retry receives `409 Conflict`. - If the same key is reused with a different invoice payload, the request is rejected with `422 Unprocessable Entity`: a given key must always map to the same request. Keys are scoped per account, so different accounts can use the same key value without interfering. If the idempotency store is temporarily unavailable, the request is processed normally without idempotency protection.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :validate (Boolean)

    Validate the document first, and reject it on failure. (default to false)

  • :signature (String)

    Whether to digitally sign the document. (default to 'Auto')

  • :idempotency_key (String)

    Optional client-generated key that makes the submission idempotent. Retrying the same request with the same key within 24 hours returns the original response instead of creating a duplicate invoice.

Returns:

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

    ModelSend data, response status code and response headers



885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
# File 'lib/invoicetronic_sdk/api/send_api.rb', line 885

def send_xml_post_with_http_info(body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SendApi.send_xml_post ...'
  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 SendApi.send_xml_post"
  end
  allowable_values = ["None", "Apply", "Force", "Auto"]
  if @api_client.config.client_side_validation && opts[:'signature'] && !allowable_values.include?(opts[:'signature'])
    fail ArgumentError, "invalid value for \"signature\", must be one of #{allowable_values}"
  end
  if @api_client.config.client_side_validation && !opts[:'idempotency_key'].nil? && opts[:'idempotency_key'].to_s.length > 255
    fail ArgumentError, 'invalid value for "opts[:"idempotency_key"]" when calling SendApi.send_xml_post, the character length must be smaller than or equal to 255.'
  end

  # resource path
  local_var_path = '/send/xml'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'validate'] = opts[:'validate'] if !opts[:'validate'].nil?
  query_params[:'signature'] = opts[:'signature'] if !opts[:'signature'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/xml'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end
  header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(body)

  # return_type
  return_type = opts[:debug_return_type] || 'ModelSend'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['Basic']

  new_options = opts.merge(
    :operation => :"SendApi.send_xml_post",
    :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: SendApi#send_xml_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end