Class: FactPulse::PDFXMLVerificationApi

Inherits:
Object
  • Object
show all
Defined in:
lib/factpulse/api/pdfxml_verification_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ PDFXMLVerificationApi

Returns a new instance of PDFXMLVerificationApi.



19
20
21
# File 'lib/factpulse/api/pdfxml_verification_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/factpulse/api/pdfxml_verification_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#get_verification_status_api_v1_verification_verify_async_task_id_status_get(task_id, opts = {}) ⇒ AsyncTaskStatus

Get status of an asynchronous verification Retrieves the status and result of an asynchronous verification task. **Possible statuses:** - ‘PENDING`: Task waiting in queue - `STARTED`: Task currently running - `SUCCESS`: Task completed successfully (see `result`) - `FAILURE`: System error (unhandled exception) Note: The `result.status` field can be "SUCCESS" or "ERROR" independently of Celery status (which will always be SUCCESS if the task ran).

Parameters:

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

    the optional parameters

Returns:



27
28
29
30
# File 'lib/factpulse/api/pdfxml_verification_api.rb', line 27

def get_verification_status_api_v1_verification_verify_async_task_id_status_get(task_id, opts = {})
  data, _status_code, _headers = get_verification_status_api_v1_verification_verify_async_task_id_status_get_with_http_info(task_id, opts)
  data
end

#get_verification_status_api_v1_verification_verify_async_task_id_status_get_0(task_id, opts = {}) ⇒ AsyncTaskStatus

Get status of an asynchronous verification Retrieves the status and result of an asynchronous verification task. **Possible statuses:** - ‘PENDING`: Task waiting in queue - `STARTED`: Task currently running - `SUCCESS`: Task completed successfully (see `result`) - `FAILURE`: System error (unhandled exception) Note: The `result.status` field can be "SUCCESS" or "ERROR" independently of Celery status (which will always be SUCCESS if the task ran).

Parameters:

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

    the optional parameters

Returns:



90
91
92
93
# File 'lib/factpulse/api/pdfxml_verification_api.rb', line 90

def get_verification_status_api_v1_verification_verify_async_task_id_status_get_0(task_id, opts = {})
  data, _status_code, _headers = get_verification_status_api_v1_verification_verify_async_task_id_status_get_0_with_http_info(task_id, opts)
  data
end

#get_verification_status_api_v1_verification_verify_async_task_id_status_get_0_with_http_info(task_id, opts = {}) ⇒ Array<(AsyncTaskStatus, Integer, Hash)>

Get status of an asynchronous verification Retrieves the status and result of an asynchronous verification task. **Possible statuses:** - &#x60;PENDING&#x60;: Task waiting in queue - &#x60;STARTED&#x60;: Task currently running - &#x60;SUCCESS&#x60;: Task completed successfully (see &#x60;result&#x60;) - &#x60;FAILURE&#x60;: System error (unhandled exception) Note: The &#x60;result.status&#x60; field can be &quot;SUCCESS&quot; or &quot;ERROR&quot; independently of Celery status (which will always be SUCCESS if the task ran).

Parameters:

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

    the optional parameters

Returns:

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

    AsyncTaskStatus data, response status code and response headers



100
101
102
103
104
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
# File 'lib/factpulse/api/pdfxml_verification_api.rb', line 100

def get_verification_status_api_v1_verification_verify_async_task_id_status_get_0_with_http_info(task_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PDFXMLVerificationApi.get_verification_status_api_v1_verification_verify_async_task_id_status_get_0 ...'
  end
  # verify the required parameter 'task_id' is set
  if @api_client.config.client_side_validation && task_id.nil?
    fail ArgumentError, "Missing the required parameter 'task_id' when calling PDFXMLVerificationApi.get_verification_status_api_v1_verification_verify_async_task_id_status_get_0"
  end
  # resource path
  local_var_path = '/api/v1/verification/verify-async/{task_id}/status'.sub('{' + 'task_id' + '}', CGI.escape(task_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']) 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] || 'AsyncTaskStatus'

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

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

#get_verification_status_api_v1_verification_verify_async_task_id_status_get_with_http_info(task_id, opts = {}) ⇒ Array<(AsyncTaskStatus, Integer, Hash)>

Get status of an asynchronous verification Retrieves the status and result of an asynchronous verification task. **Possible statuses:** - &#x60;PENDING&#x60;: Task waiting in queue - &#x60;STARTED&#x60;: Task currently running - &#x60;SUCCESS&#x60;: Task completed successfully (see &#x60;result&#x60;) - &#x60;FAILURE&#x60;: System error (unhandled exception) Note: The &#x60;result.status&#x60; field can be &quot;SUCCESS&quot; or &quot;ERROR&quot; independently of Celery status (which will always be SUCCESS if the task ran).

Parameters:

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

    the optional parameters

Returns:

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

    AsyncTaskStatus data, response status code and response headers



37
38
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
# File 'lib/factpulse/api/pdfxml_verification_api.rb', line 37

def get_verification_status_api_v1_verification_verify_async_task_id_status_get_with_http_info(task_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PDFXMLVerificationApi.get_verification_status_api_v1_verification_verify_async_task_id_status_get ...'
  end
  # verify the required parameter 'task_id' is set
  if @api_client.config.client_side_validation && task_id.nil?
    fail ArgumentError, "Missing the required parameter 'task_id' when calling PDFXMLVerificationApi.get_verification_status_api_v1_verification_verify_async_task_id_status_get"
  end
  # resource path
  local_var_path = '/api/v1/verification/verify-async/{task_id}/status'.sub('{' + 'task_id' + '}', CGI.escape(task_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']) 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] || 'AsyncTaskStatus'

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

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

#verify_pdf_async_api_v1_verification_verify_async_post(pdf_file, opts = {}) ⇒ TaskResponse

Verify PDF/XML Factur-X compliance (asynchronous) Verifies PDF/XML Factur-X compliance asynchronously. IMPORTANT: Only Factur-X PDFs (with embedded XML) are accepted. PDFs without Factur-X XML will return a ‘NOT_FACTURX` error in the result. This version uses a Celery task and can call the OCR service if the PDF is an image or if `force_ocr=true`. **Returns immediately** a task ID. Use `/verify-async/task_id/status` to retrieve the result. **Verification principle (Factur-X 1.08):** - Principle #2: XML can only contain info present in the PDF - Principle #4: All XML info must be present and compliant in the PDF **Verified fields:** - Identification: BT-1 (invoice #), BT-2 (date), BT-3 (type), BT-5 (currency), BT-23 (framework) - Seller: BT-27 (name), BT-29 (SIRET), BT-30 (SIREN), BT-31 (VAT) - Buyer: BT-44 (name), BT-46 (SIRET), BT-47 (SIREN), BT-48 (VAT) - Amounts: BT-109 (excl. tax), BT-110 (VAT), BT-112 (incl. tax), BT-115 (amount due) - VAT breakdown: BT-116, BT-117, BT-118, BT-119 - Invoice lines: BT-153, BT-129, BT-146, BT-131 - Mandatory notes: PMT, PMD, AAB - Rule BR-FR-09: SIRET/SIREN consistency **Advantages over synchronous version:** - OCR support for image PDFs (via DocTR service) - Longer timeout for large documents - Doesn’t block the server

Parameters:

  • pdf_file (File)

    Factur-X PDF file to verify

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

    the optional parameters

Options Hash (opts):

  • :force_ocr (Boolean)

    Force OCR usage even if PDF contains native text (default to false)

Returns:



154
155
156
157
# File 'lib/factpulse/api/pdfxml_verification_api.rb', line 154

def verify_pdf_async_api_v1_verification_verify_async_post(pdf_file, opts = {})
  data, _status_code, _headers = verify_pdf_async_api_v1_verification_verify_async_post_with_http_info(pdf_file, opts)
  data
end

#verify_pdf_async_api_v1_verification_verify_async_post_0(pdf_file, opts = {}) ⇒ TaskResponse

Verify PDF/XML Factur-X compliance (asynchronous) Verifies PDF/XML Factur-X compliance asynchronously. IMPORTANT: Only Factur-X PDFs (with embedded XML) are accepted. PDFs without Factur-X XML will return a ‘NOT_FACTURX` error in the result. This version uses a Celery task and can call the OCR service if the PDF is an image or if `force_ocr=true`. **Returns immediately** a task ID. Use `/verify-async/task_id/status` to retrieve the result. **Verification principle (Factur-X 1.08):** - Principle #2: XML can only contain info present in the PDF - Principle #4: All XML info must be present and compliant in the PDF **Verified fields:** - Identification: BT-1 (invoice #), BT-2 (date), BT-3 (type), BT-5 (currency), BT-23 (framework) - Seller: BT-27 (name), BT-29 (SIRET), BT-30 (SIREN), BT-31 (VAT) - Buyer: BT-44 (name), BT-46 (SIRET), BT-47 (SIREN), BT-48 (VAT) - Amounts: BT-109 (excl. tax), BT-110 (VAT), BT-112 (incl. tax), BT-115 (amount due) - VAT breakdown: BT-116, BT-117, BT-118, BT-119 - Invoice lines: BT-153, BT-129, BT-146, BT-131 - Mandatory notes: PMT, PMD, AAB - Rule BR-FR-09: SIRET/SIREN consistency **Advantages over synchronous version:** - OCR support for image PDFs (via DocTR service) - Longer timeout for large documents - Doesn’t block the server

Parameters:

  • pdf_file (File)

    Factur-X PDF file to verify

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

    the optional parameters

Options Hash (opts):

  • :force_ocr (Boolean)

    Force OCR usage even if PDF contains native text (default to false)

Returns:



226
227
228
229
# File 'lib/factpulse/api/pdfxml_verification_api.rb', line 226

def verify_pdf_async_api_v1_verification_verify_async_post_0(pdf_file, opts = {})
  data, _status_code, _headers = verify_pdf_async_api_v1_verification_verify_async_post_0_with_http_info(pdf_file, opts)
  data
end

#verify_pdf_async_api_v1_verification_verify_async_post_0_with_http_info(pdf_file, opts = {}) ⇒ Array<(TaskResponse, Integer, Hash)>

Verify PDF/XML Factur-X compliance (asynchronous) Verifies PDF/XML Factur-X compliance asynchronously. IMPORTANT: Only Factur-X PDFs (with embedded XML) are accepted. PDFs without Factur-X XML will return a &#x60;NOT_FACTURX&#x60; error in the result. This version uses a Celery task and can call the OCR service if the PDF is an image or if &#x60;force_ocr&#x3D;true&#x60;. **Returns immediately** a task ID. Use &#x60;/verify-async/task_id/status&#x60; to retrieve the result. **Verification principle (Factur-X 1.08):** - Principle #2: XML can only contain info present in the PDF - Principle #4: All XML info must be present and compliant in the PDF **Verified fields:** - Identification: BT-1 (invoice #), BT-2 (date), BT-3 (type), BT-5 (currency), BT-23 (framework) - Seller: BT-27 (name), BT-29 (SIRET), BT-30 (SIREN), BT-31 (VAT) - Buyer: BT-44 (name), BT-46 (SIRET), BT-47 (SIREN), BT-48 (VAT) - Amounts: BT-109 (excl. tax), BT-110 (VAT), BT-112 (incl. tax), BT-115 (amount due) - VAT breakdown: BT-116, BT-117, BT-118, BT-119 - Invoice lines: BT-153, BT-129, BT-146, BT-131 - Mandatory notes: PMT, PMD, AAB - Rule BR-FR-09: SIRET/SIREN consistency **Advantages over synchronous version:** - OCR support for image PDFs (via DocTR service) - Longer timeout for large documents - Doesn&#39;t block the server

Parameters:

  • pdf_file (File)

    Factur-X PDF file to verify

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

    the optional parameters

Options Hash (opts):

  • :force_ocr (Boolean)

    Force OCR usage even if PDF contains native text (default to false)

Returns:

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

    TaskResponse data, response status code and response headers



237
238
239
240
241
242
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/factpulse/api/pdfxml_verification_api.rb', line 237

def verify_pdf_async_api_v1_verification_verify_async_post_0_with_http_info(pdf_file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PDFXMLVerificationApi.verify_pdf_async_api_v1_verification_verify_async_post_0 ...'
  end
  # verify the required parameter 'pdf_file' is set
  if @api_client.config.client_side_validation && pdf_file.nil?
    fail ArgumentError, "Missing the required parameter 'pdf_file' when calling PDFXMLVerificationApi.verify_pdf_async_api_v1_verification_verify_async_post_0"
  end
  # resource path
  local_var_path = '/api/v1/verification/verify-async'

  # 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['pdf_file'] = pdf_file
  form_params['force_ocr'] = opts[:'force_ocr'] if !opts[:'force_ocr'].nil?

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

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

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

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

#verify_pdf_async_api_v1_verification_verify_async_post_with_http_info(pdf_file, opts = {}) ⇒ Array<(TaskResponse, Integer, Hash)>

Verify PDF/XML Factur-X compliance (asynchronous) Verifies PDF/XML Factur-X compliance asynchronously. IMPORTANT: Only Factur-X PDFs (with embedded XML) are accepted. PDFs without Factur-X XML will return a &#x60;NOT_FACTURX&#x60; error in the result. This version uses a Celery task and can call the OCR service if the PDF is an image or if &#x60;force_ocr&#x3D;true&#x60;. **Returns immediately** a task ID. Use &#x60;/verify-async/task_id/status&#x60; to retrieve the result. **Verification principle (Factur-X 1.08):** - Principle #2: XML can only contain info present in the PDF - Principle #4: All XML info must be present and compliant in the PDF **Verified fields:** - Identification: BT-1 (invoice #), BT-2 (date), BT-3 (type), BT-5 (currency), BT-23 (framework) - Seller: BT-27 (name), BT-29 (SIRET), BT-30 (SIREN), BT-31 (VAT) - Buyer: BT-44 (name), BT-46 (SIRET), BT-47 (SIREN), BT-48 (VAT) - Amounts: BT-109 (excl. tax), BT-110 (VAT), BT-112 (incl. tax), BT-115 (amount due) - VAT breakdown: BT-116, BT-117, BT-118, BT-119 - Invoice lines: BT-153, BT-129, BT-146, BT-131 - Mandatory notes: PMT, PMD, AAB - Rule BR-FR-09: SIRET/SIREN consistency **Advantages over synchronous version:** - OCR support for image PDFs (via DocTR service) - Longer timeout for large documents - Doesn&#39;t block the server

Parameters:

  • pdf_file (File)

    Factur-X PDF file to verify

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

    the optional parameters

Options Hash (opts):

  • :force_ocr (Boolean)

    Force OCR usage even if PDF contains native text (default to false)

Returns:

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

    TaskResponse data, response status code and response headers



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
# File 'lib/factpulse/api/pdfxml_verification_api.rb', line 165

def verify_pdf_async_api_v1_verification_verify_async_post_with_http_info(pdf_file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PDFXMLVerificationApi.verify_pdf_async_api_v1_verification_verify_async_post ...'
  end
  # verify the required parameter 'pdf_file' is set
  if @api_client.config.client_side_validation && pdf_file.nil?
    fail ArgumentError, "Missing the required parameter 'pdf_file' when calling PDFXMLVerificationApi.verify_pdf_async_api_v1_verification_verify_async_post"
  end
  # resource path
  local_var_path = '/api/v1/verification/verify-async'

  # 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['pdf_file'] = pdf_file
  form_params['force_ocr'] = opts[:'force_ocr'] if !opts[:'force_ocr'].nil?

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

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

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

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

#verify_pdf_sync_api_v1_verification_verify_post(pdf_file, opts = {}) ⇒ VerificationSuccessResponse

Verify PDF/XML Factur-X compliance (synchronous) Verifies compliance between the PDF and its embedded Factur-X XML. IMPORTANT: Only Factur-X PDFs (with embedded XML) are accepted. PDFs without Factur-X XML will be rejected with a 400 error. This synchronous version uses only native PDF extraction (pdfplumber). For image PDFs requiring OCR, use the ‘/verify-async` endpoint. **Verification principle (Factur-X 1.08):** - Principle #2: XML can only contain info present in the PDF - Principle #4: All XML info must be present and compliant in the PDF **Verified fields:** - Identification: BT-1 (invoice #), BT-2 (date), BT-3 (type), BT-5 (currency), BT-23 (framework) - Seller: BT-27 (name), BT-29 (SIRET), BT-30 (SIREN), BT-31 (VAT) - Buyer: BT-44 (name), BT-46 (SIRET), BT-47 (SIREN), BT-48 (VAT) - Amounts: BT-109 (excl. tax), BT-110 (VAT), BT-112 (incl. tax), BT-115 (amount due) - VAT breakdown: BT-116, BT-117, BT-118, BT-119 - Invoice lines: BT-153, BT-129, BT-146, BT-131 - Mandatory notes: PMT, PMD, AAB - Rule BR-FR-09: SIRET/SIREN consistency

Parameters:

  • pdf_file (File)

    Factur-X PDF file to verify

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

    the optional parameters

Returns:



297
298
299
300
# File 'lib/factpulse/api/pdfxml_verification_api.rb', line 297

def verify_pdf_sync_api_v1_verification_verify_post(pdf_file, opts = {})
  data, _status_code, _headers = verify_pdf_sync_api_v1_verification_verify_post_with_http_info(pdf_file, opts)
  data
end

#verify_pdf_sync_api_v1_verification_verify_post_0(pdf_file, opts = {}) ⇒ VerificationSuccessResponse

Verify PDF/XML Factur-X compliance (synchronous) Verifies compliance between the PDF and its embedded Factur-X XML. IMPORTANT: Only Factur-X PDFs (with embedded XML) are accepted. PDFs without Factur-X XML will be rejected with a 400 error. This synchronous version uses only native PDF extraction (pdfplumber). For image PDFs requiring OCR, use the ‘/verify-async` endpoint. **Verification principle (Factur-X 1.08):** - Principle #2: XML can only contain info present in the PDF - Principle #4: All XML info must be present and compliant in the PDF **Verified fields:** - Identification: BT-1 (invoice #), BT-2 (date), BT-3 (type), BT-5 (currency), BT-23 (framework) - Seller: BT-27 (name), BT-29 (SIRET), BT-30 (SIREN), BT-31 (VAT) - Buyer: BT-44 (name), BT-46 (SIRET), BT-47 (SIREN), BT-48 (VAT) - Amounts: BT-109 (excl. tax), BT-110 (VAT), BT-112 (incl. tax), BT-115 (amount due) - VAT breakdown: BT-116, BT-117, BT-118, BT-119 - Invoice lines: BT-153, BT-129, BT-146, BT-131 - Mandatory notes: PMT, PMD, AAB - Rule BR-FR-09: SIRET/SIREN consistency

Parameters:

  • pdf_file (File)

    Factur-X PDF file to verify

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

    the optional parameters

Returns:



366
367
368
369
# File 'lib/factpulse/api/pdfxml_verification_api.rb', line 366

def verify_pdf_sync_api_v1_verification_verify_post_0(pdf_file, opts = {})
  data, _status_code, _headers = verify_pdf_sync_api_v1_verification_verify_post_0_with_http_info(pdf_file, opts)
  data
end

#verify_pdf_sync_api_v1_verification_verify_post_0_with_http_info(pdf_file, opts = {}) ⇒ Array<(VerificationSuccessResponse, Integer, Hash)>

Verify PDF/XML Factur-X compliance (synchronous) Verifies compliance between the PDF and its embedded Factur-X XML. IMPORTANT: Only Factur-X PDFs (with embedded XML) are accepted. PDFs without Factur-X XML will be rejected with a 400 error. This synchronous version uses only native PDF extraction (pdfplumber). For image PDFs requiring OCR, use the &#x60;/verify-async&#x60; endpoint. **Verification principle (Factur-X 1.08):** - Principle #2: XML can only contain info present in the PDF - Principle #4: All XML info must be present and compliant in the PDF **Verified fields:** - Identification: BT-1 (invoice #), BT-2 (date), BT-3 (type), BT-5 (currency), BT-23 (framework) - Seller: BT-27 (name), BT-29 (SIRET), BT-30 (SIREN), BT-31 (VAT) - Buyer: BT-44 (name), BT-46 (SIRET), BT-47 (SIREN), BT-48 (VAT) - Amounts: BT-109 (excl. tax), BT-110 (VAT), BT-112 (incl. tax), BT-115 (amount due) - VAT breakdown: BT-116, BT-117, BT-118, BT-119 - Invoice lines: BT-153, BT-129, BT-146, BT-131 - Mandatory notes: PMT, PMD, AAB - Rule BR-FR-09: SIRET/SIREN consistency

Parameters:

  • pdf_file (File)

    Factur-X PDF file to verify

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

    the optional parameters

Returns:

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

    VerificationSuccessResponse data, response status code and response headers



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
420
421
422
423
424
425
426
427
428
# File 'lib/factpulse/api/pdfxml_verification_api.rb', line 376

def verify_pdf_sync_api_v1_verification_verify_post_0_with_http_info(pdf_file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PDFXMLVerificationApi.verify_pdf_sync_api_v1_verification_verify_post_0 ...'
  end
  # verify the required parameter 'pdf_file' is set
  if @api_client.config.client_side_validation && pdf_file.nil?
    fail ArgumentError, "Missing the required parameter 'pdf_file' when calling PDFXMLVerificationApi.verify_pdf_sync_api_v1_verification_verify_post_0"
  end
  # resource path
  local_var_path = '/api/v1/verification/verify'

  # 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['pdf_file'] = pdf_file

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

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

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

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

#verify_pdf_sync_api_v1_verification_verify_post_with_http_info(pdf_file, opts = {}) ⇒ Array<(VerificationSuccessResponse, Integer, Hash)>

Verify PDF/XML Factur-X compliance (synchronous) Verifies compliance between the PDF and its embedded Factur-X XML. IMPORTANT: Only Factur-X PDFs (with embedded XML) are accepted. PDFs without Factur-X XML will be rejected with a 400 error. This synchronous version uses only native PDF extraction (pdfplumber). For image PDFs requiring OCR, use the &#x60;/verify-async&#x60; endpoint. **Verification principle (Factur-X 1.08):** - Principle #2: XML can only contain info present in the PDF - Principle #4: All XML info must be present and compliant in the PDF **Verified fields:** - Identification: BT-1 (invoice #), BT-2 (date), BT-3 (type), BT-5 (currency), BT-23 (framework) - Seller: BT-27 (name), BT-29 (SIRET), BT-30 (SIREN), BT-31 (VAT) - Buyer: BT-44 (name), BT-46 (SIRET), BT-47 (SIREN), BT-48 (VAT) - Amounts: BT-109 (excl. tax), BT-110 (VAT), BT-112 (incl. tax), BT-115 (amount due) - VAT breakdown: BT-116, BT-117, BT-118, BT-119 - Invoice lines: BT-153, BT-129, BT-146, BT-131 - Mandatory notes: PMT, PMD, AAB - Rule BR-FR-09: SIRET/SIREN consistency

Parameters:

  • pdf_file (File)

    Factur-X PDF file to verify

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

    the optional parameters

Returns:

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

    VerificationSuccessResponse data, 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
354
355
356
357
358
359
# File 'lib/factpulse/api/pdfxml_verification_api.rb', line 307

def verify_pdf_sync_api_v1_verification_verify_post_with_http_info(pdf_file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PDFXMLVerificationApi.verify_pdf_sync_api_v1_verification_verify_post ...'
  end
  # verify the required parameter 'pdf_file' is set
  if @api_client.config.client_side_validation && pdf_file.nil?
    fail ArgumentError, "Missing the required parameter 'pdf_file' when calling PDFXMLVerificationApi.verify_pdf_sync_api_v1_verification_verify_post"
  end
  # resource path
  local_var_path = '/api/v1/verification/verify'

  # 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['pdf_file'] = pdf_file

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

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

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

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