trevol 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +15 -0
- data/GENERADO.md +14 -0
- data/LICENSE +21 -0
- data/README.md +173 -0
- data/lib/trevol/client.rb +94 -0
- data/lib/trevol/errors.rb +152 -0
- data/lib/trevol/llave.rb +21 -0
- data/lib/trevol/paginacion.rb +41 -0
- data/lib/trevol/transporte.rb +173 -0
- data/lib/trevol/webhook.rb +100 -0
- data/lib/trevol.rb +18 -0
- data/lib/trevol_generado/api/balance_api.rb +220 -0
- data/lib/trevol_generado/api/credit_notes_api.rb +671 -0
- data/lib/trevol_generado/api/debit_notes_api.rb +671 -0
- data/lib/trevol_generado/api/equivalent_document_adjustments_api.rb +691 -0
- data/lib/trevol_generado/api/equivalent_documents_api.rb +698 -0
- data/lib/trevol_generado/api/events_api.rb +231 -0
- data/lib/trevol_generado/api/general_api.rb +201 -0
- data/lib/trevol_generado/api/invoices_api.rb +736 -0
- data/lib/trevol_generado/api/payroll_adjustments_api.rb +637 -0
- data/lib/trevol_generado/api/payrolls_api.rb +637 -0
- data/lib/trevol_generado/api/radian_events_api.rb +431 -0
- data/lib/trevol_generado/api/requests_api.rb +97 -0
- data/lib/trevol_generado/api/support_document_adjustments_api.rb +565 -0
- data/lib/trevol_generado/api/support_documents_api.rb +565 -0
- data/lib/trevol_generado/api/webhook_endpoints_api.rb +556 -0
- data/lib/trevol_generado/api_client.rb +441 -0
- data/lib/trevol_generado/api_error.rb +58 -0
- data/lib/trevol_generado/api_model_base.rb +88 -0
- data/lib/trevol_generado/configuration.rb +392 -0
- data/lib/trevol_generado/models/acquirer.rb +209 -0
- data/lib/trevol_generado/models/air_collection.rb +205 -0
- data/lib/trevol_generado/models/air_extension.rb +216 -0
- data/lib/trevol_generado/models/allowance_charge.rb +250 -0
- data/lib/trevol_generado/models/alternative_currency.rb +180 -0
- data/lib/trevol_generado/models/balance.rb +244 -0
- data/lib/trevol_generado/models/balance_event_data.rb +172 -0
- data/lib/trevol_generado/models/balance_transaction.rb +265 -0
- data/lib/trevol_generado/models/balance_transaction_company.rb +172 -0
- data/lib/trevol_generado/models/balance_transaction_document.rb +173 -0
- data/lib/trevol_generado/models/balance_transaction_list.rb +191 -0
- data/lib/trevol_generado/models/carrier.rb +219 -0
- data/lib/trevol_generado/models/certificate_event_data.rb +180 -0
- data/lib/trevol_generado/models/cinema_extension.rb +214 -0
- data/lib/trevol_generado/models/cinema_screening.rb +256 -0
- data/lib/trevol_generado/models/company.rb +267 -0
- data/lib/trevol_generado/models/company_key.rb +182 -0
- data/lib/trevol_generado/models/company_numbering.rb +201 -0
- data/lib/trevol_generado/models/consumption.rb +246 -0
- data/lib/trevol_generado/models/consumption_adjustment.rb +204 -0
- data/lib/trevol_generado/models/contingency.rb +160 -0
- data/lib/trevol_generado/models/credit_note_list.rb +191 -0
- data/lib/trevol_generado/models/currency.rb +241 -0
- data/lib/trevol_generado/models/customer.rb +360 -0
- data/lib/trevol_generado/models/debit_note_list.rb +191 -0
- data/lib/trevol_generado/models/deleted_object.rb +178 -0
- data/lib/trevol_generado/models/delivery.rb +200 -0
- data/lib/trevol_generado/models/delivery_email.rb +181 -0
- data/lib/trevol_generado/models/delivery_terms.rb +169 -0
- data/lib/trevol_generado/models/dian_result.rb +182 -0
- data/lib/trevol_generado/models/dian_rule.rb +216 -0
- data/lib/trevol_generado/models/document.rb +432 -0
- data/lib/trevol_generado/models/document_event_data.rb +315 -0
- data/lib/trevol_generado/models/document_reference.rb +169 -0
- data/lib/trevol_generado/models/document_totals.rb +299 -0
- data/lib/trevol_generado/models/document_totals_currency.rb +197 -0
- data/lib/trevol_generado/models/document_totals_item.rb +196 -0
- data/lib/trevol_generado/models/document_totals_tax.rb +197 -0
- data/lib/trevol_generado/models/document_totals_withholding.rb +206 -0
- data/lib/trevol_generado/models/equivalent_adjustment_item.rb +374 -0
- data/lib/trevol_generado/models/equivalent_document.rb +470 -0
- data/lib/trevol_generado/models/equivalent_document_adjustment.rb +440 -0
- data/lib/trevol_generado/models/equivalent_document_adjustment_input.rb +388 -0
- data/lib/trevol_generado/models/equivalent_document_adjustment_list.rb +191 -0
- data/lib/trevol_generado/models/equivalent_document_contingency.rb +181 -0
- data/lib/trevol_generado/models/equivalent_document_contingency_backup.rb +171 -0
- data/lib/trevol_generado/models/equivalent_document_event_data.rb +313 -0
- data/lib/trevol_generado/models/equivalent_document_input.rb +365 -0
- data/lib/trevol_generado/models/equivalent_document_list.rb +191 -0
- data/lib/trevol_generado/models/equivalent_document_reference.rb +241 -0
- data/lib/trevol_generado/models/equivalent_item.rb +387 -0
- data/lib/trevol_generado/models/event.rb +223 -0
- data/lib/trevol_generado/models/event_claim.rb +170 -0
- data/lib/trevol_generado/models/event_delivery.rb +178 -0
- data/lib/trevol_generado/models/event_delivery_email.rb +161 -0
- data/lib/trevol_generado/models/event_dian_result.rb +173 -0
- data/lib/trevol_generado/models/event_dian_rule.rb +170 -0
- data/lib/trevol_generado/models/event_document_error.rb +170 -0
- data/lib/trevol_generado/models/event_equivalent_document_ref.rb +161 -0
- data/lib/trevol_generado/models/event_error.rb +170 -0
- data/lib/trevol_generado/models/event_invoice_ref.rb +161 -0
- data/lib/trevol_generado/models/event_list.rb +191 -0
- data/lib/trevol_generado/models/event_payroll_ref.rb +160 -0
- data/lib/trevol_generado/models/event_radian_invoice_ref.rb +181 -0
- data/lib/trevol_generado/models/event_resend_input.rb +177 -0
- data/lib/trevol_generado/models/event_support_document_ref.rb +161 -0
- data/lib/trevol_generado/models/extension.rb +215 -0
- data/lib/trevol_generado/models/foreign_address.rb +218 -0
- data/lib/trevol_generado/models/free_of_charge.rb +170 -0
- data/lib/trevol_generado/models/game.rb +203 -0
- data/lib/trevol_generado/models/game_credit.rb +204 -0
- data/lib/trevol_generado/models/games_extension.rb +216 -0
- data/lib/trevol_generado/models/games_venue.rb +204 -0
- data/lib/trevol_generado/models/interoperability.rb +205 -0
- data/lib/trevol_generado/models/interoperability_collection.rb +171 -0
- data/lib/trevol_generado/models/interoperability_data.rb +186 -0
- data/lib/trevol_generado/models/invoice_input.rb +364 -0
- data/lib/trevol_generado/models/invoice_list.rb +191 -0
- data/lib/trevol_generado/models/invoice_reference.rb +198 -0
- data/lib/trevol_generado/models/item.rb +439 -0
- data/lib/trevol_generado/models/item_allowance.rb +190 -0
- data/lib/trevol_generado/models/item_consignment.rb +286 -0
- data/lib/trevol_generado/models/item_mandator.rb +231 -0
- data/lib/trevol_generado/models/item_notary.rb +204 -0
- data/lib/trevol_generado/models/item_property.rb +223 -0
- data/lib/trevol_generado/models/item_tax.rb +246 -0
- data/lib/trevol_generado/models/item_withholding.rb +214 -0
- data/lib/trevol_generado/models/meter.rb +233 -0
- data/lib/trevol_generado/models/note_input.rb +329 -0
- data/lib/trevol_generado/models/numbering.rb +178 -0
- data/lib/trevol_generado/models/numbering_expiring_event_data.rb +209 -0
- data/lib/trevol_generado/models/numbering_low_event_data.rb +209 -0
- data/lib/trevol_generado/models/origin_note.rb +230 -0
- data/lib/trevol_generado/models/payment.rb +232 -0
- data/lib/trevol_generado/models/payment_method.rb +187 -0
- data/lib/trevol_generado/models/payroll.rb +455 -0
- data/lib/trevol_generado/models/payroll_adjustment.rb +467 -0
- data/lib/trevol_generado/models/payroll_adjustment_input.rb +362 -0
- data/lib/trevol_generado/models/payroll_adjustment_list.rb +191 -0
- data/lib/trevol_generado/models/payroll_basic.rb +204 -0
- data/lib/trevol_generado/models/payroll_compensated_vacation.rb +204 -0
- data/lib/trevol_generado/models/payroll_compensation.rb +205 -0
- data/lib/trevol_generado/models/payroll_deductions.rb +370 -0
- data/lib/trevol_generado/models/payroll_disability.rb +249 -0
- data/lib/trevol_generado/models/payroll_earnings.rb +406 -0
- data/lib/trevol_generado/models/payroll_employee.rb +437 -0
- data/lib/trevol_generado/models/payroll_employer.rb +238 -0
- data/lib/trevol_generado/models/payroll_epctv_bonus.rb +191 -0
- data/lib/trevol_generado/models/payroll_event_data.rb +303 -0
- data/lib/trevol_generado/models/payroll_files.rb +179 -0
- data/lib/trevol_generado/models/payroll_input.rb +420 -0
- data/lib/trevol_generado/models/payroll_leaves.rb +184 -0
- data/lib/trevol_generado/models/payroll_list.rb +191 -0
- data/lib/trevol_generado/models/payroll_loan.rb +204 -0
- data/lib/trevol_generado/models/payroll_novelty.rb +177 -0
- data/lib/trevol_generado/models/payroll_other_concept.rb +197 -0
- data/lib/trevol_generado/models/payroll_overtime.rb +262 -0
- data/lib/trevol_generado/models/payroll_paid_period.rb +222 -0
- data/lib/trevol_generado/models/payroll_payment.rb +215 -0
- data/lib/trevol_generado/models/payroll_percent_amount.rb +205 -0
- data/lib/trevol_generado/models/payroll_period.rb +247 -0
- data/lib/trevol_generado/models/payroll_place.rb +179 -0
- data/lib/trevol_generado/models/payroll_reference.rb +188 -0
- data/lib/trevol_generado/models/payroll_salary_amounts.rb +171 -0
- data/lib/trevol_generado/models/payroll_sanction.rb +205 -0
- data/lib/trevol_generado/models/payroll_service_bonus.rb +214 -0
- data/lib/trevol_generado/models/payroll_severance.rb +232 -0
- data/lib/trevol_generado/models/payroll_solidarity_fund.rb +191 -0
- data/lib/trevol_generado/models/payroll_totals.rb +188 -0
- data/lib/trevol_generado/models/payroll_transport.rb +181 -0
- data/lib/trevol_generado/models/payroll_unpaid_period.rb +195 -0
- data/lib/trevol_generado/models/payroll_vacation.rb +173 -0
- data/lib/trevol_generado/models/payroll_workplace.rb +188 -0
- data/lib/trevol_generado/models/period.rb +169 -0
- data/lib/trevol_generado/models/physical_document.rb +179 -0
- data/lib/trevol_generado/models/pos.rb +186 -0
- data/lib/trevol_generado/models/pos_buyer.rb +181 -0
- data/lib/trevol_generado/models/pos_register.rb +269 -0
- data/lib/trevol_generado/models/prepayment.rb +248 -0
- data/lib/trevol_generado/models/preview.rb +195 -0
- data/lib/trevol_generado/models/problem.rb +329 -0
- data/lib/trevol_generado/models/problem_error.rb +178 -0
- data/lib/trevol_generado/models/public_services_extension.rb +385 -0
- data/lib/trevol_generado/models/radian_event.rb +359 -0
- data/lib/trevol_generado/models/radian_event_data.rb +289 -0
- data/lib/trevol_generado/models/radian_event_input.rb +284 -0
- data/lib/trevol_generado/models/radian_event_invoice.rb +208 -0
- data/lib/trevol_generado/models/radian_event_list.rb +191 -0
- data/lib/trevol_generado/models/received_invoice.rb +200 -0
- data/lib/trevol_generado/models/received_invoice_issuer.rb +190 -0
- data/lib/trevol_generado/models/references.rb +182 -0
- data/lib/trevol_generado/models/request_list.rb +191 -0
- data/lib/trevol_generado/models/request_log.rb +275 -0
- data/lib/trevol_generado/models/seller.rb +385 -0
- data/lib/trevol_generado/models/shipment.rb +178 -0
- data/lib/trevol_generado/models/show_event.rb +276 -0
- data/lib/trevol_generado/models/show_extension.rb +203 -0
- data/lib/trevol_generado/models/show_producer.rb +212 -0
- data/lib/trevol_generado/models/standard_code.rb +169 -0
- data/lib/trevol_generado/models/stock_exchange_extension.rb +320 -0
- data/lib/trevol_generado/models/stock_exchange_prices.rb +169 -0
- data/lib/trevol_generado/models/support_adjustment_item.rb +295 -0
- data/lib/trevol_generado/models/support_adjustment_reference.rb +188 -0
- data/lib/trevol_generado/models/support_currency.rb +231 -0
- data/lib/trevol_generado/models/support_document.rb +401 -0
- data/lib/trevol_generado/models/support_document_adjustment.rb +409 -0
- data/lib/trevol_generado/models/support_document_adjustment_input.rb +331 -0
- data/lib/trevol_generado/models/support_document_adjustment_list.rb +191 -0
- data/lib/trevol_generado/models/support_document_delivery.rb +199 -0
- data/lib/trevol_generado/models/support_document_event_data.rb +305 -0
- data/lib/trevol_generado/models/support_document_input.rb +331 -0
- data/lib/trevol_generado/models/support_document_list.rb +191 -0
- data/lib/trevol_generado/models/support_document_reference.rb +198 -0
- data/lib/trevol_generado/models/support_item.rb +317 -0
- data/lib/trevol_generado/models/support_item_charge.rb +180 -0
- data/lib/trevol_generado/models/support_item_tax.rb +197 -0
- data/lib/trevol_generado/models/support_item_withholding.rb +205 -0
- data/lib/trevol_generado/models/tacit_acceptance.rb +224 -0
- data/lib/trevol_generado/models/tacit_acceptance_rule.rb +226 -0
- data/lib/trevol_generado/models/test_event_data.rb +171 -0
- data/lib/trevol_generado/models/third_party_charge.rb +277 -0
- data/lib/trevol_generado/models/third_party_company.rb +203 -0
- data/lib/trevol_generado/models/top_up.rb +199 -0
- data/lib/trevol_generado/models/top_up_buyer.rb +352 -0
- data/lib/trevol_generado/models/top_up_input.rb +187 -0
- data/lib/trevol_generado/models/top_up_wompi.rb +209 -0
- data/lib/trevol_generado/models/transport_extension.rb +281 -0
- data/lib/trevol_generado/models/webhook_delivery.rb +267 -0
- data/lib/trevol_generado/models/webhook_delivery_attempt.rb +192 -0
- data/lib/trevol_generado/models/webhook_delivery_list.rb +191 -0
- data/lib/trevol_generado/models/webhook_endpoint.rb +317 -0
- data/lib/trevol_generado/models/webhook_endpoint_input.rb +229 -0
- data/lib/trevol_generado/models/webhook_endpoint_list.rb +191 -0
- data/lib/trevol_generado/models/webhook_endpoint_rotate_input.rb +160 -0
- data/lib/trevol_generado/models/webhook_endpoint_update.rb +227 -0
- data/lib/trevol_generado/models/withholding.rb +224 -0
- data/lib/trevol_generado/tablas.rb +243 -0
- data/lib/trevol_generado/version.rb +15 -0
- data/lib/trevol_generado.rb +251 -0
- metadata +386 -0
|
@@ -0,0 +1,736 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#API de Trevol
|
|
3
|
+
|
|
4
|
+
#Trevol API. Documentación: https://platform.trevol.si/docs
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 2026-10-22
|
|
7
|
+
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.26.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'cgi'
|
|
14
|
+
|
|
15
|
+
module TrevolGenerado
|
|
16
|
+
class InvoicesApi
|
|
17
|
+
attr_accessor :api_client
|
|
18
|
+
|
|
19
|
+
def initialize(api_client = ApiClient.default)
|
|
20
|
+
@api_client = api_client
|
|
21
|
+
end
|
|
22
|
+
# Corregir una factura rechazada (mismo número) y reenviarla
|
|
23
|
+
# @param id [String]
|
|
24
|
+
# @param invoice_input [InvoiceInput]
|
|
25
|
+
# @param [Hash] opts the optional parameters
|
|
26
|
+
# @option opts [String] :idempotency_key Obligatoria: 1 a 255 caracteres ASCII visibles, única por pedido (7 días).
|
|
27
|
+
# @return [Document]
|
|
28
|
+
def correct_invoice(id, invoice_input, opts = {})
|
|
29
|
+
data, _status_code, _headers = correct_invoice_with_http_info(id, invoice_input, opts)
|
|
30
|
+
data
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Corregir una factura rechazada (mismo número) y reenviarla
|
|
34
|
+
# @param id [String]
|
|
35
|
+
# @param invoice_input [InvoiceInput]
|
|
36
|
+
# @param [Hash] opts the optional parameters
|
|
37
|
+
# @option opts [String] :idempotency_key Obligatoria: 1 a 255 caracteres ASCII visibles, única por pedido (7 días).
|
|
38
|
+
# @return [Array<(Document, Integer, Hash)>] Document data, response status code and response headers
|
|
39
|
+
def correct_invoice_with_http_info(id, invoice_input, opts = {})
|
|
40
|
+
if @api_client.config.debugging
|
|
41
|
+
@api_client.config.logger.debug 'Calling API: InvoicesApi.correct_invoice ...'
|
|
42
|
+
end
|
|
43
|
+
# verify the required parameter 'id' is set
|
|
44
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
45
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling InvoicesApi.correct_invoice"
|
|
46
|
+
end
|
|
47
|
+
# verify the required parameter 'invoice_input' is set
|
|
48
|
+
if @api_client.config.client_side_validation && invoice_input.nil?
|
|
49
|
+
fail ArgumentError, "Missing the required parameter 'invoice_input' when calling InvoicesApi.correct_invoice"
|
|
50
|
+
end
|
|
51
|
+
# resource path
|
|
52
|
+
local_var_path = '/invoices/{id}'.sub('{id}', CGI.escape(id.to_s))
|
|
53
|
+
|
|
54
|
+
# query parameters
|
|
55
|
+
query_params = opts[:query_params] || {}
|
|
56
|
+
|
|
57
|
+
# header parameters
|
|
58
|
+
header_params = opts[:header_params] || {}
|
|
59
|
+
# HTTP header 'Accept' (if needed)
|
|
60
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/problem+json']) unless header_params['Accept']
|
|
61
|
+
# HTTP header 'Content-Type'
|
|
62
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
63
|
+
if !content_type.nil?
|
|
64
|
+
header_params['Content-Type'] = content_type
|
|
65
|
+
end
|
|
66
|
+
header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
|
|
67
|
+
|
|
68
|
+
# form parameters
|
|
69
|
+
form_params = opts[:form_params] || {}
|
|
70
|
+
|
|
71
|
+
# http body (model)
|
|
72
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(invoice_input)
|
|
73
|
+
|
|
74
|
+
# return_type
|
|
75
|
+
return_type = opts[:debug_return_type] || 'Document'
|
|
76
|
+
|
|
77
|
+
# auth_names
|
|
78
|
+
auth_names = opts[:debug_auth_names] || ['llave']
|
|
79
|
+
|
|
80
|
+
new_options = opts.merge(
|
|
81
|
+
:operation => :"InvoicesApi.correct_invoice",
|
|
82
|
+
:header_params => header_params,
|
|
83
|
+
:query_params => query_params,
|
|
84
|
+
:form_params => form_params,
|
|
85
|
+
:body => post_body,
|
|
86
|
+
:auth_names => auth_names,
|
|
87
|
+
:return_type => return_type
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
|
|
91
|
+
if @api_client.config.debugging
|
|
92
|
+
@api_client.config.logger.debug "API called: InvoicesApi#correct_invoice\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
93
|
+
end
|
|
94
|
+
return data, status_code, headers
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# Emitir una factura
|
|
98
|
+
# Valida, numera, firma y envía una factura a la DIAN. Además de la factura nacional acepta la exportación (`document_type: \"02\"`), la moneda extranjera (`currency`), los términos de entrega (`delivery_terms`), el AIU, los mandatos, el transporte de carga, los notarios, las divisas y el sector salud (`operation_type`). El envío físico de la mercancía va en `shipment` (no en `delivery`: ese es el estado del PDF, el ZIP y el correo en la respuesta). Las notas crédito y débito no admiten estos campos. **Respuestas.** `201` la DIAN lo validó (`status: accepted`). `202` solo en la versión 2026-10-22: la DIAN no contestó (`processing`), otra petición lo está enviando (`sending`) o, en habilitación, el set de pruebas todavía lo valida (`validating`, en las dos versiones); trae `Location` y `Retry-After`, y el resultado llega por GET y por webhook: **no crees otro documento para la misma operación**. `422` `validation_error` (se revisó a fondo ANTES de reservar: no se gastó el número, y `errors[]` dice el campo), `dian_rejected` (con `document` y las reglas traducidas; corrige con `PUT` y el mismo número), `company_not_enabled` o `numbering_unavailable` (con `reason`). `402` `insufficient_balance` (producción sin saldo: queda `pending` con su número). `409` `external_id_in_use` o `duplicate_document` (con `existing_id`). `503` `dian_unavailable` en la 2026-10-21. Pide `Idempotency-Key`: repetir la misma devuelve lo mismo sin enviar nada.
|
|
99
|
+
# @param invoice_input [InvoiceInput]
|
|
100
|
+
# @param [Hash] opts the optional parameters
|
|
101
|
+
# @option opts [String] :idempotency_key Obligatoria: 1 a 255 caracteres ASCII visibles, única por pedido (7 días).
|
|
102
|
+
# @return [Document]
|
|
103
|
+
def create_invoice(invoice_input, opts = {})
|
|
104
|
+
data, _status_code, _headers = create_invoice_with_http_info(invoice_input, opts)
|
|
105
|
+
data
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# Emitir una factura
|
|
109
|
+
# Valida, numera, firma y envía una factura a la DIAN. Además de la factura nacional acepta la exportación (`document_type: \"02\"`), la moneda extranjera (`currency`), los términos de entrega (`delivery_terms`), el AIU, los mandatos, el transporte de carga, los notarios, las divisas y el sector salud (`operation_type`). El envío físico de la mercancía va en `shipment` (no en `delivery`: ese es el estado del PDF, el ZIP y el correo en la respuesta). Las notas crédito y débito no admiten estos campos. **Respuestas.** `201` la DIAN lo validó (`status: accepted`). `202` solo en la versión 2026-10-22: la DIAN no contestó (`processing`), otra petición lo está enviando (`sending`) o, en habilitación, el set de pruebas todavía lo valida (`validating`, en las dos versiones); trae `Location` y `Retry-After`, y el resultado llega por GET y por webhook: **no crees otro documento para la misma operación**. `422` `validation_error` (se revisó a fondo ANTES de reservar: no se gastó el número, y `errors[]` dice el campo), `dian_rejected` (con `document` y las reglas traducidas; corrige con `PUT` y el mismo número), `company_not_enabled` o `numbering_unavailable` (con `reason`). `402` `insufficient_balance` (producción sin saldo: queda `pending` con su número). `409` `external_id_in_use` o `duplicate_document` (con `existing_id`). `503` `dian_unavailable` en la 2026-10-21. Pide `Idempotency-Key`: repetir la misma devuelve lo mismo sin enviar nada.
|
|
110
|
+
# @param invoice_input [InvoiceInput]
|
|
111
|
+
# @param [Hash] opts the optional parameters
|
|
112
|
+
# @option opts [String] :idempotency_key Obligatoria: 1 a 255 caracteres ASCII visibles, única por pedido (7 días).
|
|
113
|
+
# @return [Array<(Document, Integer, Hash)>] Document data, response status code and response headers
|
|
114
|
+
def create_invoice_with_http_info(invoice_input, opts = {})
|
|
115
|
+
if @api_client.config.debugging
|
|
116
|
+
@api_client.config.logger.debug 'Calling API: InvoicesApi.create_invoice ...'
|
|
117
|
+
end
|
|
118
|
+
# verify the required parameter 'invoice_input' is set
|
|
119
|
+
if @api_client.config.client_side_validation && invoice_input.nil?
|
|
120
|
+
fail ArgumentError, "Missing the required parameter 'invoice_input' when calling InvoicesApi.create_invoice"
|
|
121
|
+
end
|
|
122
|
+
# resource path
|
|
123
|
+
local_var_path = '/invoices'
|
|
124
|
+
|
|
125
|
+
# query parameters
|
|
126
|
+
query_params = opts[:query_params] || {}
|
|
127
|
+
|
|
128
|
+
# header parameters
|
|
129
|
+
header_params = opts[:header_params] || {}
|
|
130
|
+
# HTTP header 'Accept' (if needed)
|
|
131
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/problem+json']) unless header_params['Accept']
|
|
132
|
+
# HTTP header 'Content-Type'
|
|
133
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
134
|
+
if !content_type.nil?
|
|
135
|
+
header_params['Content-Type'] = content_type
|
|
136
|
+
end
|
|
137
|
+
header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
|
|
138
|
+
|
|
139
|
+
# form parameters
|
|
140
|
+
form_params = opts[:form_params] || {}
|
|
141
|
+
|
|
142
|
+
# http body (model)
|
|
143
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(invoice_input)
|
|
144
|
+
|
|
145
|
+
# return_type
|
|
146
|
+
return_type = opts[:debug_return_type] || 'Document'
|
|
147
|
+
|
|
148
|
+
# auth_names
|
|
149
|
+
auth_names = opts[:debug_auth_names] || ['llave']
|
|
150
|
+
|
|
151
|
+
new_options = opts.merge(
|
|
152
|
+
:operation => :"InvoicesApi.create_invoice",
|
|
153
|
+
:header_params => header_params,
|
|
154
|
+
:query_params => query_params,
|
|
155
|
+
:form_params => form_params,
|
|
156
|
+
:body => post_body,
|
|
157
|
+
:auth_names => auth_names,
|
|
158
|
+
:return_type => return_type
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
162
|
+
if @api_client.config.debugging
|
|
163
|
+
@api_client.config.logger.debug "API called: InvoicesApi#create_invoice\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
164
|
+
end
|
|
165
|
+
return data, status_code, headers
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
# Archivo dian_response
|
|
169
|
+
# @param id [String]
|
|
170
|
+
# @param [Hash] opts the optional parameters
|
|
171
|
+
# @return [File]
|
|
172
|
+
def download_invoice_dian_response(id, opts = {})
|
|
173
|
+
data, _status_code, _headers = download_invoice_dian_response_with_http_info(id, opts)
|
|
174
|
+
data
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
# Archivo dian_response
|
|
178
|
+
# @param id [String]
|
|
179
|
+
# @param [Hash] opts the optional parameters
|
|
180
|
+
# @return [Array<(File, Integer, Hash)>] File data, response status code and response headers
|
|
181
|
+
def download_invoice_dian_response_with_http_info(id, opts = {})
|
|
182
|
+
if @api_client.config.debugging
|
|
183
|
+
@api_client.config.logger.debug 'Calling API: InvoicesApi.download_invoice_dian_response ...'
|
|
184
|
+
end
|
|
185
|
+
# verify the required parameter 'id' is set
|
|
186
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
187
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling InvoicesApi.download_invoice_dian_response"
|
|
188
|
+
end
|
|
189
|
+
# resource path
|
|
190
|
+
local_var_path = '/invoices/{id}/dian_response'.sub('{id}', CGI.escape(id.to_s))
|
|
191
|
+
|
|
192
|
+
# query parameters
|
|
193
|
+
query_params = opts[:query_params] || {}
|
|
194
|
+
|
|
195
|
+
# header parameters
|
|
196
|
+
header_params = opts[:header_params] || {}
|
|
197
|
+
# HTTP header 'Accept' (if needed)
|
|
198
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/problem+json']) unless header_params['Accept']
|
|
199
|
+
|
|
200
|
+
# form parameters
|
|
201
|
+
form_params = opts[:form_params] || {}
|
|
202
|
+
|
|
203
|
+
# http body (model)
|
|
204
|
+
post_body = opts[:debug_body]
|
|
205
|
+
|
|
206
|
+
# return_type
|
|
207
|
+
return_type = opts[:debug_return_type] || 'File'
|
|
208
|
+
|
|
209
|
+
# auth_names
|
|
210
|
+
auth_names = opts[:debug_auth_names] || ['llave']
|
|
211
|
+
|
|
212
|
+
new_options = opts.merge(
|
|
213
|
+
:operation => :"InvoicesApi.download_invoice_dian_response",
|
|
214
|
+
:header_params => header_params,
|
|
215
|
+
:query_params => query_params,
|
|
216
|
+
:form_params => form_params,
|
|
217
|
+
:body => post_body,
|
|
218
|
+
:auth_names => auth_names,
|
|
219
|
+
:return_type => return_type
|
|
220
|
+
)
|
|
221
|
+
|
|
222
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
223
|
+
if @api_client.config.debugging
|
|
224
|
+
@api_client.config.logger.debug "API called: InvoicesApi#download_invoice_dian_response\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
225
|
+
end
|
|
226
|
+
return data, status_code, headers
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
# Archivo pdf
|
|
230
|
+
# @param id [String]
|
|
231
|
+
# @param [Hash] opts the optional parameters
|
|
232
|
+
# @return [File]
|
|
233
|
+
def download_invoice_pdf(id, opts = {})
|
|
234
|
+
data, _status_code, _headers = download_invoice_pdf_with_http_info(id, opts)
|
|
235
|
+
data
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
# Archivo pdf
|
|
239
|
+
# @param id [String]
|
|
240
|
+
# @param [Hash] opts the optional parameters
|
|
241
|
+
# @return [Array<(File, Integer, Hash)>] File data, response status code and response headers
|
|
242
|
+
def download_invoice_pdf_with_http_info(id, opts = {})
|
|
243
|
+
if @api_client.config.debugging
|
|
244
|
+
@api_client.config.logger.debug 'Calling API: InvoicesApi.download_invoice_pdf ...'
|
|
245
|
+
end
|
|
246
|
+
# verify the required parameter 'id' is set
|
|
247
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
248
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling InvoicesApi.download_invoice_pdf"
|
|
249
|
+
end
|
|
250
|
+
# resource path
|
|
251
|
+
local_var_path = '/invoices/{id}/pdf'.sub('{id}', CGI.escape(id.to_s))
|
|
252
|
+
|
|
253
|
+
# query parameters
|
|
254
|
+
query_params = opts[:query_params] || {}
|
|
255
|
+
|
|
256
|
+
# header parameters
|
|
257
|
+
header_params = opts[:header_params] || {}
|
|
258
|
+
# HTTP header 'Accept' (if needed)
|
|
259
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/pdf', 'application/problem+json']) unless header_params['Accept']
|
|
260
|
+
|
|
261
|
+
# form parameters
|
|
262
|
+
form_params = opts[:form_params] || {}
|
|
263
|
+
|
|
264
|
+
# http body (model)
|
|
265
|
+
post_body = opts[:debug_body]
|
|
266
|
+
|
|
267
|
+
# return_type
|
|
268
|
+
return_type = opts[:debug_return_type] || 'File'
|
|
269
|
+
|
|
270
|
+
# auth_names
|
|
271
|
+
auth_names = opts[:debug_auth_names] || ['llave']
|
|
272
|
+
|
|
273
|
+
new_options = opts.merge(
|
|
274
|
+
:operation => :"InvoicesApi.download_invoice_pdf",
|
|
275
|
+
:header_params => header_params,
|
|
276
|
+
:query_params => query_params,
|
|
277
|
+
:form_params => form_params,
|
|
278
|
+
:body => post_body,
|
|
279
|
+
:auth_names => auth_names,
|
|
280
|
+
:return_type => return_type
|
|
281
|
+
)
|
|
282
|
+
|
|
283
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
284
|
+
if @api_client.config.debugging
|
|
285
|
+
@api_client.config.logger.debug "API called: InvoicesApi#download_invoice_pdf\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
286
|
+
end
|
|
287
|
+
return data, status_code, headers
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
# Archivo xml
|
|
291
|
+
# @param id [String]
|
|
292
|
+
# @param [Hash] opts the optional parameters
|
|
293
|
+
# @return [File]
|
|
294
|
+
def download_invoice_xml(id, opts = {})
|
|
295
|
+
data, _status_code, _headers = download_invoice_xml_with_http_info(id, opts)
|
|
296
|
+
data
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
# Archivo xml
|
|
300
|
+
# @param id [String]
|
|
301
|
+
# @param [Hash] opts the optional parameters
|
|
302
|
+
# @return [Array<(File, Integer, Hash)>] File data, response status code and response headers
|
|
303
|
+
def download_invoice_xml_with_http_info(id, opts = {})
|
|
304
|
+
if @api_client.config.debugging
|
|
305
|
+
@api_client.config.logger.debug 'Calling API: InvoicesApi.download_invoice_xml ...'
|
|
306
|
+
end
|
|
307
|
+
# verify the required parameter 'id' is set
|
|
308
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
309
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling InvoicesApi.download_invoice_xml"
|
|
310
|
+
end
|
|
311
|
+
# resource path
|
|
312
|
+
local_var_path = '/invoices/{id}/xml'.sub('{id}', CGI.escape(id.to_s))
|
|
313
|
+
|
|
314
|
+
# query parameters
|
|
315
|
+
query_params = opts[:query_params] || {}
|
|
316
|
+
|
|
317
|
+
# header parameters
|
|
318
|
+
header_params = opts[:header_params] || {}
|
|
319
|
+
# HTTP header 'Accept' (if needed)
|
|
320
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/problem+json']) unless header_params['Accept']
|
|
321
|
+
|
|
322
|
+
# form parameters
|
|
323
|
+
form_params = opts[:form_params] || {}
|
|
324
|
+
|
|
325
|
+
# http body (model)
|
|
326
|
+
post_body = opts[:debug_body]
|
|
327
|
+
|
|
328
|
+
# return_type
|
|
329
|
+
return_type = opts[:debug_return_type] || 'File'
|
|
330
|
+
|
|
331
|
+
# auth_names
|
|
332
|
+
auth_names = opts[:debug_auth_names] || ['llave']
|
|
333
|
+
|
|
334
|
+
new_options = opts.merge(
|
|
335
|
+
:operation => :"InvoicesApi.download_invoice_xml",
|
|
336
|
+
:header_params => header_params,
|
|
337
|
+
:query_params => query_params,
|
|
338
|
+
:form_params => form_params,
|
|
339
|
+
:body => post_body,
|
|
340
|
+
:auth_names => auth_names,
|
|
341
|
+
:return_type => return_type
|
|
342
|
+
)
|
|
343
|
+
|
|
344
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
345
|
+
if @api_client.config.debugging
|
|
346
|
+
@api_client.config.logger.debug "API called: InvoicesApi#download_invoice_xml\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
347
|
+
end
|
|
348
|
+
return data, status_code, headers
|
|
349
|
+
end
|
|
350
|
+
|
|
351
|
+
# Archivo zip
|
|
352
|
+
# @param id [String]
|
|
353
|
+
# @param [Hash] opts the optional parameters
|
|
354
|
+
# @return [File]
|
|
355
|
+
def download_invoice_zip(id, opts = {})
|
|
356
|
+
data, _status_code, _headers = download_invoice_zip_with_http_info(id, opts)
|
|
357
|
+
data
|
|
358
|
+
end
|
|
359
|
+
|
|
360
|
+
# Archivo zip
|
|
361
|
+
# @param id [String]
|
|
362
|
+
# @param [Hash] opts the optional parameters
|
|
363
|
+
# @return [Array<(File, Integer, Hash)>] File data, response status code and response headers
|
|
364
|
+
def download_invoice_zip_with_http_info(id, opts = {})
|
|
365
|
+
if @api_client.config.debugging
|
|
366
|
+
@api_client.config.logger.debug 'Calling API: InvoicesApi.download_invoice_zip ...'
|
|
367
|
+
end
|
|
368
|
+
# verify the required parameter 'id' is set
|
|
369
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
370
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling InvoicesApi.download_invoice_zip"
|
|
371
|
+
end
|
|
372
|
+
# resource path
|
|
373
|
+
local_var_path = '/invoices/{id}/zip'.sub('{id}', CGI.escape(id.to_s))
|
|
374
|
+
|
|
375
|
+
# query parameters
|
|
376
|
+
query_params = opts[:query_params] || {}
|
|
377
|
+
|
|
378
|
+
# header parameters
|
|
379
|
+
header_params = opts[:header_params] || {}
|
|
380
|
+
# HTTP header 'Accept' (if needed)
|
|
381
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/zip', 'application/problem+json']) unless header_params['Accept']
|
|
382
|
+
|
|
383
|
+
# form parameters
|
|
384
|
+
form_params = opts[:form_params] || {}
|
|
385
|
+
|
|
386
|
+
# http body (model)
|
|
387
|
+
post_body = opts[:debug_body]
|
|
388
|
+
|
|
389
|
+
# return_type
|
|
390
|
+
return_type = opts[:debug_return_type] || 'File'
|
|
391
|
+
|
|
392
|
+
# auth_names
|
|
393
|
+
auth_names = opts[:debug_auth_names] || ['llave']
|
|
394
|
+
|
|
395
|
+
new_options = opts.merge(
|
|
396
|
+
:operation => :"InvoicesApi.download_invoice_zip",
|
|
397
|
+
:header_params => header_params,
|
|
398
|
+
:query_params => query_params,
|
|
399
|
+
:form_params => form_params,
|
|
400
|
+
:body => post_body,
|
|
401
|
+
:auth_names => auth_names,
|
|
402
|
+
:return_type => return_type
|
|
403
|
+
)
|
|
404
|
+
|
|
405
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
406
|
+
if @api_client.config.debugging
|
|
407
|
+
@api_client.config.logger.debug "API called: InvoicesApi#download_invoice_zip\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
408
|
+
end
|
|
409
|
+
return data, status_code, headers
|
|
410
|
+
end
|
|
411
|
+
|
|
412
|
+
# Listar (factura)
|
|
413
|
+
# @param [Hash] opts the optional parameters
|
|
414
|
+
# @option opts [Integer] :limit
|
|
415
|
+
# @option opts [String] :starting_after
|
|
416
|
+
# @option opts [String] :status
|
|
417
|
+
# @option opts [String] :external_id
|
|
418
|
+
# @option opts [String] :created_from
|
|
419
|
+
# @option opts [String] :created_to
|
|
420
|
+
# @return [InvoiceList]
|
|
421
|
+
def list_invoices(opts = {})
|
|
422
|
+
data, _status_code, _headers = list_invoices_with_http_info(opts)
|
|
423
|
+
data
|
|
424
|
+
end
|
|
425
|
+
|
|
426
|
+
# Listar (factura)
|
|
427
|
+
# @param [Hash] opts the optional parameters
|
|
428
|
+
# @option opts [Integer] :limit
|
|
429
|
+
# @option opts [String] :starting_after
|
|
430
|
+
# @option opts [String] :status
|
|
431
|
+
# @option opts [String] :external_id
|
|
432
|
+
# @option opts [String] :created_from
|
|
433
|
+
# @option opts [String] :created_to
|
|
434
|
+
# @return [Array<(InvoiceList, Integer, Hash)>] InvoiceList data, response status code and response headers
|
|
435
|
+
def list_invoices_with_http_info(opts = {})
|
|
436
|
+
if @api_client.config.debugging
|
|
437
|
+
@api_client.config.logger.debug 'Calling API: InvoicesApi.list_invoices ...'
|
|
438
|
+
end
|
|
439
|
+
# resource path
|
|
440
|
+
local_var_path = '/invoices'
|
|
441
|
+
|
|
442
|
+
# query parameters
|
|
443
|
+
query_params = opts[:query_params] || {}
|
|
444
|
+
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
|
|
445
|
+
query_params[:'starting_after'] = opts[:'starting_after'] if !opts[:'starting_after'].nil?
|
|
446
|
+
query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
|
|
447
|
+
query_params[:'external_id'] = opts[:'external_id'] if !opts[:'external_id'].nil?
|
|
448
|
+
query_params[:'created_from'] = opts[:'created_from'] if !opts[:'created_from'].nil?
|
|
449
|
+
query_params[:'created_to'] = opts[:'created_to'] if !opts[:'created_to'].nil?
|
|
450
|
+
|
|
451
|
+
# header parameters
|
|
452
|
+
header_params = opts[:header_params] || {}
|
|
453
|
+
# HTTP header 'Accept' (if needed)
|
|
454
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/problem+json']) unless header_params['Accept']
|
|
455
|
+
|
|
456
|
+
# form parameters
|
|
457
|
+
form_params = opts[:form_params] || {}
|
|
458
|
+
|
|
459
|
+
# http body (model)
|
|
460
|
+
post_body = opts[:debug_body]
|
|
461
|
+
|
|
462
|
+
# return_type
|
|
463
|
+
return_type = opts[:debug_return_type] || 'InvoiceList'
|
|
464
|
+
|
|
465
|
+
# auth_names
|
|
466
|
+
auth_names = opts[:debug_auth_names] || ['llave']
|
|
467
|
+
|
|
468
|
+
new_options = opts.merge(
|
|
469
|
+
:operation => :"InvoicesApi.list_invoices",
|
|
470
|
+
:header_params => header_params,
|
|
471
|
+
:query_params => query_params,
|
|
472
|
+
:form_params => form_params,
|
|
473
|
+
:body => post_body,
|
|
474
|
+
:auth_names => auth_names,
|
|
475
|
+
:return_type => return_type
|
|
476
|
+
)
|
|
477
|
+
|
|
478
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
479
|
+
if @api_client.config.debugging
|
|
480
|
+
@api_client.config.logger.debug "API called: InvoicesApi#list_invoices\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
481
|
+
end
|
|
482
|
+
return data, status_code, headers
|
|
483
|
+
end
|
|
484
|
+
|
|
485
|
+
# Calcular una factura sin emitirla
|
|
486
|
+
# @param invoice_input [InvoiceInput]
|
|
487
|
+
# @param [Hash] opts the optional parameters
|
|
488
|
+
# @return [Preview]
|
|
489
|
+
def preview_invoice(invoice_input, opts = {})
|
|
490
|
+
data, _status_code, _headers = preview_invoice_with_http_info(invoice_input, opts)
|
|
491
|
+
data
|
|
492
|
+
end
|
|
493
|
+
|
|
494
|
+
# Calcular una factura sin emitirla
|
|
495
|
+
# @param invoice_input [InvoiceInput]
|
|
496
|
+
# @param [Hash] opts the optional parameters
|
|
497
|
+
# @return [Array<(Preview, Integer, Hash)>] Preview data, response status code and response headers
|
|
498
|
+
def preview_invoice_with_http_info(invoice_input, opts = {})
|
|
499
|
+
if @api_client.config.debugging
|
|
500
|
+
@api_client.config.logger.debug 'Calling API: InvoicesApi.preview_invoice ...'
|
|
501
|
+
end
|
|
502
|
+
# verify the required parameter 'invoice_input' is set
|
|
503
|
+
if @api_client.config.client_side_validation && invoice_input.nil?
|
|
504
|
+
fail ArgumentError, "Missing the required parameter 'invoice_input' when calling InvoicesApi.preview_invoice"
|
|
505
|
+
end
|
|
506
|
+
# resource path
|
|
507
|
+
local_var_path = '/invoices/preview'
|
|
508
|
+
|
|
509
|
+
# query parameters
|
|
510
|
+
query_params = opts[:query_params] || {}
|
|
511
|
+
|
|
512
|
+
# header parameters
|
|
513
|
+
header_params = opts[:header_params] || {}
|
|
514
|
+
# HTTP header 'Accept' (if needed)
|
|
515
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/problem+json']) unless header_params['Accept']
|
|
516
|
+
# HTTP header 'Content-Type'
|
|
517
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
518
|
+
if !content_type.nil?
|
|
519
|
+
header_params['Content-Type'] = content_type
|
|
520
|
+
end
|
|
521
|
+
|
|
522
|
+
# form parameters
|
|
523
|
+
form_params = opts[:form_params] || {}
|
|
524
|
+
|
|
525
|
+
# http body (model)
|
|
526
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(invoice_input)
|
|
527
|
+
|
|
528
|
+
# return_type
|
|
529
|
+
return_type = opts[:debug_return_type] || 'Preview'
|
|
530
|
+
|
|
531
|
+
# auth_names
|
|
532
|
+
auth_names = opts[:debug_auth_names] || ['llave']
|
|
533
|
+
|
|
534
|
+
new_options = opts.merge(
|
|
535
|
+
:operation => :"InvoicesApi.preview_invoice",
|
|
536
|
+
:header_params => header_params,
|
|
537
|
+
:query_params => query_params,
|
|
538
|
+
:form_params => form_params,
|
|
539
|
+
:body => post_body,
|
|
540
|
+
:auth_names => auth_names,
|
|
541
|
+
:return_type => return_type
|
|
542
|
+
)
|
|
543
|
+
|
|
544
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
545
|
+
if @api_client.config.debugging
|
|
546
|
+
@api_client.config.logger.debug "API called: InvoicesApi#preview_invoice\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
547
|
+
end
|
|
548
|
+
return data, status_code, headers
|
|
549
|
+
end
|
|
550
|
+
|
|
551
|
+
# Una factura
|
|
552
|
+
# @param id [String]
|
|
553
|
+
# @param [Hash] opts the optional parameters
|
|
554
|
+
# @return [Document]
|
|
555
|
+
def retrieve_invoice(id, opts = {})
|
|
556
|
+
data, _status_code, _headers = retrieve_invoice_with_http_info(id, opts)
|
|
557
|
+
data
|
|
558
|
+
end
|
|
559
|
+
|
|
560
|
+
# Una factura
|
|
561
|
+
# @param id [String]
|
|
562
|
+
# @param [Hash] opts the optional parameters
|
|
563
|
+
# @return [Array<(Document, Integer, Hash)>] Document data, response status code and response headers
|
|
564
|
+
def retrieve_invoice_with_http_info(id, opts = {})
|
|
565
|
+
if @api_client.config.debugging
|
|
566
|
+
@api_client.config.logger.debug 'Calling API: InvoicesApi.retrieve_invoice ...'
|
|
567
|
+
end
|
|
568
|
+
# verify the required parameter 'id' is set
|
|
569
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
570
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling InvoicesApi.retrieve_invoice"
|
|
571
|
+
end
|
|
572
|
+
# resource path
|
|
573
|
+
local_var_path = '/invoices/{id}'.sub('{id}', CGI.escape(id.to_s))
|
|
574
|
+
|
|
575
|
+
# query parameters
|
|
576
|
+
query_params = opts[:query_params] || {}
|
|
577
|
+
|
|
578
|
+
# header parameters
|
|
579
|
+
header_params = opts[:header_params] || {}
|
|
580
|
+
# HTTP header 'Accept' (if needed)
|
|
581
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/problem+json']) unless header_params['Accept']
|
|
582
|
+
|
|
583
|
+
# form parameters
|
|
584
|
+
form_params = opts[:form_params] || {}
|
|
585
|
+
|
|
586
|
+
# http body (model)
|
|
587
|
+
post_body = opts[:debug_body]
|
|
588
|
+
|
|
589
|
+
# return_type
|
|
590
|
+
return_type = opts[:debug_return_type] || 'Document'
|
|
591
|
+
|
|
592
|
+
# auth_names
|
|
593
|
+
auth_names = opts[:debug_auth_names] || ['llave']
|
|
594
|
+
|
|
595
|
+
new_options = opts.merge(
|
|
596
|
+
:operation => :"InvoicesApi.retrieve_invoice",
|
|
597
|
+
:header_params => header_params,
|
|
598
|
+
:query_params => query_params,
|
|
599
|
+
:form_params => form_params,
|
|
600
|
+
:body => post_body,
|
|
601
|
+
:auth_names => auth_names,
|
|
602
|
+
:return_type => return_type
|
|
603
|
+
)
|
|
604
|
+
|
|
605
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
606
|
+
if @api_client.config.debugging
|
|
607
|
+
@api_client.config.logger.debug "API called: InvoicesApi#retrieve_invoice\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
608
|
+
end
|
|
609
|
+
return data, status_code, headers
|
|
610
|
+
end
|
|
611
|
+
|
|
612
|
+
# ¿Procede ya la aceptación tácita (034) de esta factura?
|
|
613
|
+
# Consulta GetStatusEvent (con el certificado de la empresa) y aplica la regla de los 3 días hábiles; no envía nada. Usa el mismo historial que el envío del 034 (`POST /v1/radian_events`), así que la consulta y el envío no se contradicen. 404 si la factura no es de la empresa y el ambiente de la llave; 422 si no está validada, no es a crédito o es de consumidor final; 429 con más de 30 consultas por minuto por llave; 503 si la DIAN no contesta (reintentable).
|
|
614
|
+
# @param id [String]
|
|
615
|
+
# @param [Hash] opts the optional parameters
|
|
616
|
+
# @return [TacitAcceptance]
|
|
617
|
+
def retrieve_invoice_tacit_acceptance(id, opts = {})
|
|
618
|
+
data, _status_code, _headers = retrieve_invoice_tacit_acceptance_with_http_info(id, opts)
|
|
619
|
+
data
|
|
620
|
+
end
|
|
621
|
+
|
|
622
|
+
# ¿Procede ya la aceptación tácita (034) de esta factura?
|
|
623
|
+
# Consulta GetStatusEvent (con el certificado de la empresa) y aplica la regla de los 3 días hábiles; no envía nada. Usa el mismo historial que el envío del 034 (`POST /v1/radian_events`), así que la consulta y el envío no se contradicen. 404 si la factura no es de la empresa y el ambiente de la llave; 422 si no está validada, no es a crédito o es de consumidor final; 429 con más de 30 consultas por minuto por llave; 503 si la DIAN no contesta (reintentable).
|
|
624
|
+
# @param id [String]
|
|
625
|
+
# @param [Hash] opts the optional parameters
|
|
626
|
+
# @return [Array<(TacitAcceptance, Integer, Hash)>] TacitAcceptance data, response status code and response headers
|
|
627
|
+
def retrieve_invoice_tacit_acceptance_with_http_info(id, opts = {})
|
|
628
|
+
if @api_client.config.debugging
|
|
629
|
+
@api_client.config.logger.debug 'Calling API: InvoicesApi.retrieve_invoice_tacit_acceptance ...'
|
|
630
|
+
end
|
|
631
|
+
# verify the required parameter 'id' is set
|
|
632
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
633
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling InvoicesApi.retrieve_invoice_tacit_acceptance"
|
|
634
|
+
end
|
|
635
|
+
# resource path
|
|
636
|
+
local_var_path = '/invoices/{id}/tacit_acceptance'.sub('{id}', CGI.escape(id.to_s))
|
|
637
|
+
|
|
638
|
+
# query parameters
|
|
639
|
+
query_params = opts[:query_params] || {}
|
|
640
|
+
|
|
641
|
+
# header parameters
|
|
642
|
+
header_params = opts[:header_params] || {}
|
|
643
|
+
# HTTP header 'Accept' (if needed)
|
|
644
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/problem+json']) unless header_params['Accept']
|
|
645
|
+
|
|
646
|
+
# form parameters
|
|
647
|
+
form_params = opts[:form_params] || {}
|
|
648
|
+
|
|
649
|
+
# http body (model)
|
|
650
|
+
post_body = opts[:debug_body]
|
|
651
|
+
|
|
652
|
+
# return_type
|
|
653
|
+
return_type = opts[:debug_return_type] || 'TacitAcceptance'
|
|
654
|
+
|
|
655
|
+
# auth_names
|
|
656
|
+
auth_names = opts[:debug_auth_names] || ['llave']
|
|
657
|
+
|
|
658
|
+
new_options = opts.merge(
|
|
659
|
+
:operation => :"InvoicesApi.retrieve_invoice_tacit_acceptance",
|
|
660
|
+
:header_params => header_params,
|
|
661
|
+
:query_params => query_params,
|
|
662
|
+
:form_params => form_params,
|
|
663
|
+
:body => post_body,
|
|
664
|
+
:auth_names => auth_names,
|
|
665
|
+
:return_type => return_type
|
|
666
|
+
)
|
|
667
|
+
|
|
668
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
669
|
+
if @api_client.config.debugging
|
|
670
|
+
@api_client.config.logger.debug "API called: InvoicesApi#retrieve_invoice_tacit_acceptance\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
671
|
+
end
|
|
672
|
+
return data, status_code, headers
|
|
673
|
+
end
|
|
674
|
+
|
|
675
|
+
# Reenviar una pendiente o en error
|
|
676
|
+
# @param id [String]
|
|
677
|
+
# @param [Hash] opts the optional parameters
|
|
678
|
+
# @return [Document]
|
|
679
|
+
def send_invoice(id, opts = {})
|
|
680
|
+
data, _status_code, _headers = send_invoice_with_http_info(id, opts)
|
|
681
|
+
data
|
|
682
|
+
end
|
|
683
|
+
|
|
684
|
+
# Reenviar una pendiente o en error
|
|
685
|
+
# @param id [String]
|
|
686
|
+
# @param [Hash] opts the optional parameters
|
|
687
|
+
# @return [Array<(Document, Integer, Hash)>] Document data, response status code and response headers
|
|
688
|
+
def send_invoice_with_http_info(id, opts = {})
|
|
689
|
+
if @api_client.config.debugging
|
|
690
|
+
@api_client.config.logger.debug 'Calling API: InvoicesApi.send_invoice ...'
|
|
691
|
+
end
|
|
692
|
+
# verify the required parameter 'id' is set
|
|
693
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
694
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling InvoicesApi.send_invoice"
|
|
695
|
+
end
|
|
696
|
+
# resource path
|
|
697
|
+
local_var_path = '/invoices/{id}/send'.sub('{id}', CGI.escape(id.to_s))
|
|
698
|
+
|
|
699
|
+
# query parameters
|
|
700
|
+
query_params = opts[:query_params] || {}
|
|
701
|
+
|
|
702
|
+
# header parameters
|
|
703
|
+
header_params = opts[:header_params] || {}
|
|
704
|
+
# HTTP header 'Accept' (if needed)
|
|
705
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/problem+json']) unless header_params['Accept']
|
|
706
|
+
|
|
707
|
+
# form parameters
|
|
708
|
+
form_params = opts[:form_params] || {}
|
|
709
|
+
|
|
710
|
+
# http body (model)
|
|
711
|
+
post_body = opts[:debug_body]
|
|
712
|
+
|
|
713
|
+
# return_type
|
|
714
|
+
return_type = opts[:debug_return_type] || 'Document'
|
|
715
|
+
|
|
716
|
+
# auth_names
|
|
717
|
+
auth_names = opts[:debug_auth_names] || ['llave']
|
|
718
|
+
|
|
719
|
+
new_options = opts.merge(
|
|
720
|
+
:operation => :"InvoicesApi.send_invoice",
|
|
721
|
+
:header_params => header_params,
|
|
722
|
+
:query_params => query_params,
|
|
723
|
+
:form_params => form_params,
|
|
724
|
+
:body => post_body,
|
|
725
|
+
:auth_names => auth_names,
|
|
726
|
+
:return_type => return_type
|
|
727
|
+
)
|
|
728
|
+
|
|
729
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
730
|
+
if @api_client.config.debugging
|
|
731
|
+
@api_client.config.logger.debug "API called: InvoicesApi#send_invoice\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
732
|
+
end
|
|
733
|
+
return data, status_code, headers
|
|
734
|
+
end
|
|
735
|
+
end
|
|
736
|
+
end
|