openubl 0.1.3__tar.gz

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.
Files changed (227) hide show
  1. openubl-0.1.3/.github/workflows/ci.yml +37 -0
  2. openubl-0.1.3/.github/workflows/deploy.yml +49 -0
  3. openubl-0.1.3/.github/workflows/publish.yml +94 -0
  4. openubl-0.1.3/.gitignore +33 -0
  5. openubl-0.1.3/.python-version +1 -0
  6. openubl-0.1.3/AGENTS.md +137 -0
  7. openubl-0.1.3/CHANGELOG.md +15 -0
  8. openubl-0.1.3/PKG-INFO +137 -0
  9. openubl-0.1.3/README.md +122 -0
  10. openubl-0.1.3/cliff.toml +108 -0
  11. openubl-0.1.3/docs/.gitignore +21 -0
  12. openubl-0.1.3/docs/.vscode/extensions.json +4 -0
  13. openubl-0.1.3/docs/.vscode/launch.json +11 -0
  14. openubl-0.1.3/docs/README.md +49 -0
  15. openubl-0.1.3/docs/astro.config.mjs +127 -0
  16. openubl-0.1.3/docs/package-lock.json +6292 -0
  17. openubl-0.1.3/docs/package.json +17 -0
  18. openubl-0.1.3/docs/public/favicon.svg +5 -0
  19. openubl-0.1.3/docs/src/assets/houston.webp +0 -0
  20. openubl-0.1.3/docs/src/assets/logo.svg +6 -0
  21. openubl-0.1.3/docs/src/content/docs/api/openapi.mdx +123 -0
  22. openubl-0.1.3/docs/src/content/docs/api/referencia.mdx +205 -0
  23. openubl-0.1.3/docs/src/content/docs/catalogs/catalogo-01.mdx +63 -0
  24. openubl-0.1.3/docs/src/content/docs/catalogs/catalogo-02.mdx +56 -0
  25. openubl-0.1.3/docs/src/content/docs/catalogs/catalogo-05.mdx +60 -0
  26. openubl-0.1.3/docs/src/content/docs/catalogs/catalogo-06.mdx +56 -0
  27. openubl-0.1.3/docs/src/content/docs/catalogs/catalogo-07.mdx +62 -0
  28. openubl-0.1.3/docs/src/content/docs/catalogs/catalogo-16.mdx +48 -0
  29. openubl-0.1.3/docs/src/content/docs/catalogs/catalogo-19.mdx +64 -0
  30. openubl-0.1.3/docs/src/content/docs/catalogs/catalogo-20.mdx +50 -0
  31. openubl-0.1.3/docs/src/content/docs/catalogs/catalogo-22.mdx +67 -0
  32. openubl-0.1.3/docs/src/content/docs/catalogs/catalogo-23.mdx +66 -0
  33. openubl-0.1.3/docs/src/content/docs/engine/empaquetado.mdx +100 -0
  34. openubl-0.1.3/docs/src/content/docs/engine/enriquecimiento.mdx +193 -0
  35. openubl-0.1.3/docs/src/content/docs/examples/curl.mdx +105 -0
  36. openubl-0.1.3/docs/src/content/docs/examples/python.mdx +118 -0
  37. openubl-0.1.3/docs/src/content/docs/examples/typescript.mdx +144 -0
  38. openubl-0.1.3/docs/src/content/docs/faq.mdx +234 -0
  39. openubl-0.1.3/docs/src/content/docs/getting-started/conceptos-sunat.mdx +110 -0
  40. openubl-0.1.3/docs/src/content/docs/getting-started/instalacion.mdx +44 -0
  41. openubl-0.1.3/docs/src/content/docs/getting-started/introduccion.mdx +28 -0
  42. openubl-0.1.3/docs/src/content/docs/getting-started/primer-documento.mdx +145 -0
  43. openubl-0.1.3/docs/src/content/docs/guides/comunicacion-baja.mdx +139 -0
  44. openubl-0.1.3/docs/src/content/docs/guides/factura.mdx +300 -0
  45. openubl-0.1.3/docs/src/content/docs/guides/firma-digital.mdx +95 -0
  46. openubl-0.1.3/docs/src/content/docs/guides/nota-credito.mdx +173 -0
  47. openubl-0.1.3/docs/src/content/docs/guides/nota-debito.mdx +173 -0
  48. openubl-0.1.3/docs/src/content/docs/guides/percepcion.mdx +167 -0
  49. openubl-0.1.3/docs/src/content/docs/guides/resumen-diario.mdx +155 -0
  50. openubl-0.1.3/docs/src/content/docs/guides/retencion.mdx +167 -0
  51. openubl-0.1.3/docs/src/content/docs/guides/validacion.mdx +98 -0
  52. openubl-0.1.3/docs/src/content/docs/index.mdx +71 -0
  53. openubl-0.1.3/docs/src/content/docs/sdk/csharp.mdx +79 -0
  54. openubl-0.1.3/docs/src/content/docs/sdk/go.mdx +82 -0
  55. openubl-0.1.3/docs/src/content/docs/sdk/java.mdx +79 -0
  56. openubl-0.1.3/docs/src/content/docs/sdk/python.mdx +117 -0
  57. openubl-0.1.3/docs/src/content/docs/sdk/typescript.mdx +85 -0
  58. openubl-0.1.3/docs/src/content/docs/testing.mdx +50 -0
  59. openubl-0.1.3/docs/src/content.config.ts +7 -0
  60. openubl-0.1.3/docs/src/styles/custom.css +248 -0
  61. openubl-0.1.3/docs/tsconfig.json +5 -0
  62. openubl-0.1.3/main.py +6 -0
  63. openubl-0.1.3/openapi.json +1574 -0
  64. openubl-0.1.3/package.json +11 -0
  65. openubl-0.1.3/pyproject.toml +35 -0
  66. openubl-0.1.3/pytest.ini +3 -0
  67. openubl-0.1.3/scripts/__init__.py +0 -0
  68. openubl-0.1.3/scripts/bump_version.py +124 -0
  69. openubl-0.1.3/scripts/check_sdk_sync.py +114 -0
  70. openubl-0.1.3/scripts/export_openapi.py +25 -0
  71. openubl-0.1.3/scripts/release.py +311 -0
  72. openubl-0.1.3/sdk/README.md +130 -0
  73. openubl-0.1.3/sdk/generate.py +89 -0
  74. openubl-0.1.3/sdk/typescript/README.md +79 -0
  75. openubl-0.1.3/sdk/typescript/package-lock.json +1816 -0
  76. openubl-0.1.3/sdk/typescript/package.json +29 -0
  77. openubl-0.1.3/sdk/typescript/src/client.ts +4 -0
  78. openubl-0.1.3/sdk/typescript/src/index.ts +22 -0
  79. openubl-0.1.3/sdk/typescript/src/version.ts +12 -0
  80. openubl-0.1.3/sdk/typescript/test/client.test.ts +99 -0
  81. openubl-0.1.3/sdk/typescript/tsconfig.json +18 -0
  82. openubl-0.1.3/src/openubl/__init__.py +3 -0
  83. openubl-0.1.3/src/openubl/api/__init__.py +1 -0
  84. openubl-0.1.3/src/openubl/api/router.py +186 -0
  85. openubl-0.1.3/src/openubl/enricher.py +68 -0
  86. openubl-0.1.3/src/openubl/main.py +8 -0
  87. openubl-0.1.3/src/openubl/models/__init__.py +61 -0
  88. openubl-0.1.3/src/openubl/models/catalog.py +93 -0
  89. openubl-0.1.3/src/openubl/models/common.py +46 -0
  90. openubl-0.1.3/src/openubl/models/credit_note.py +35 -0
  91. openubl-0.1.3/src/openubl/models/debit_note.py +35 -0
  92. openubl-0.1.3/src/openubl/models/defaults.py +25 -0
  93. openubl-0.1.3/src/openubl/models/invoice.py +53 -0
  94. openubl-0.1.3/src/openubl/models/perception.py +48 -0
  95. openubl-0.1.3/src/openubl/models/retention.py +29 -0
  96. openubl-0.1.3/src/openubl/models/summary.py +66 -0
  97. openubl-0.1.3/src/openubl/models/voided.py +36 -0
  98. openubl-0.1.3/src/openubl/packager.py +62 -0
  99. openubl-0.1.3/src/openubl/renderer.py +52 -0
  100. openubl-0.1.3/src/openubl/signer.py +78 -0
  101. openubl-0.1.3/src/openubl/templates/credit_note.xml.j2 +120 -0
  102. openubl-0.1.3/src/openubl/templates/debit_note.xml.j2 +118 -0
  103. openubl-0.1.3/src/openubl/templates/invoice.xml.j2 +110 -0
  104. openubl-0.1.3/src/openubl/templates/perception.xml.j2 +68 -0
  105. openubl-0.1.3/src/openubl/templates/retention.xml.j2 +68 -0
  106. openubl-0.1.3/src/openubl/templates/summary_documents.xml.j2 +82 -0
  107. openubl-0.1.3/src/openubl/templates/voided_documents.xml.j2 +53 -0
  108. openubl-0.1.3/src/openubl/validator.py +218 -0
  109. openubl-0.1.3/src/openubl/version.py +19 -0
  110. openubl-0.1.3/sunat_schemas/xsd_2.1/2.0/common/CCTS_CCT_SchemaModule-2.0.xsd +731 -0
  111. openubl-0.1.3/sunat_schemas/xsd_2.1/2.0/common/CodeList_CurrencyCode_ISO_7_04.xsd +1378 -0
  112. openubl-0.1.3/sunat_schemas/xsd_2.1/2.0/common/CodeList_LanguageCode_ISO_7_04.xsd +2250 -0
  113. openubl-0.1.3/sunat_schemas/xsd_2.1/2.0/common/CodeList_MIMEMediaTypeCode_IANA_7_04.xsd +658 -0
  114. openubl-0.1.3/sunat_schemas/xsd_2.1/2.0/common/CodeList_UnitCode_UNECE_7_04.xsd +8803 -0
  115. openubl-0.1.3/sunat_schemas/xsd_2.1/2.0/common/UBL-CommonAggregateComponents-2.0.xsd +17444 -0
  116. openubl-0.1.3/sunat_schemas/xsd_2.1/2.0/common/UBL-CommonBasicComponents-2.0.xsd +2922 -0
  117. openubl-0.1.3/sunat_schemas/xsd_2.1/2.0/common/UBL-CommonExtensionComponents-2.0.xsd +240 -0
  118. openubl-0.1.3/sunat_schemas/xsd_2.1/2.0/common/UBL-CoreComponentParameters-2.0.xsd +64 -0
  119. openubl-0.1.3/sunat_schemas/xsd_2.1/2.0/common/UBL-ExtensionContentDatatype-2.0.xsd +73 -0
  120. openubl-0.1.3/sunat_schemas/xsd_2.1/2.0/common/UBL-QualifiedDatatypes-2.0.xsd +1955 -0
  121. openubl-0.1.3/sunat_schemas/xsd_2.1/2.0/common/UBLPE-SunatAggregateComponents-1.0.xsd +1199 -0
  122. openubl-0.1.3/sunat_schemas/xsd_2.1/2.0/common/UBLPE-SunatAggregateComponents-1.1.xsd +1188 -0
  123. openubl-0.1.3/sunat_schemas/xsd_2.1/2.0/common/UnqualifiedDataTypeSchemaModule-2.0.xsd +1138 -0
  124. openubl-0.1.3/sunat_schemas/xsd_2.1/2.0/common/xmldsig-core-schema.xsd +255 -0
  125. openubl-0.1.3/sunat_schemas/xsd_2.1/2.0/maindoc/UBLPE-ApplicationResponse-1.0.xsd +334 -0
  126. openubl-0.1.3/sunat_schemas/xsd_2.1/2.0/maindoc/UBLPE-CreditNote-1.0.xsd +719 -0
  127. openubl-0.1.3/sunat_schemas/xsd_2.1/2.0/maindoc/UBLPE-DebitNote-1.0.xsd +720 -0
  128. openubl-0.1.3/sunat_schemas/xsd_2.1/2.0/maindoc/UBLPE-Invoice-1.0.xsd +848 -0
  129. openubl-0.1.3/sunat_schemas/xsd_2.1/2.0/maindoc/UBLPE-Perception-1.0.xsd +98 -0
  130. openubl-0.1.3/sunat_schemas/xsd_2.1/2.0/maindoc/UBLPE-Retention-1.0.xsd +95 -0
  131. openubl-0.1.3/sunat_schemas/xsd_2.1/2.0/maindoc/UBLPE-SummaryDocuments-1.0.xsd +176 -0
  132. openubl-0.1.3/sunat_schemas/xsd_2.1/2.0/maindoc/UBLPE-VoidedDocuments-1.0.xsd +177 -0
  133. openubl-0.1.3/sunat_schemas/xsd_2.1/2.0/message.xml +12 -0
  134. openubl-0.1.3/sunat_schemas/xsd_2.1/2.0/message.xsl +12 -0
  135. openubl-0.1.3/sunat_schemas/xsd_2.1/2.0/validateAdditionalInformationSchema-beta.xsl +41 -0
  136. openubl-0.1.3/sunat_schemas/xsd_2.1/2.0/validateAdditionalInformationSchema.xsl +43 -0
  137. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/common/CCTS_CCT_SchemaModule-2.1.xsd +731 -0
  138. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/common/UBL-CommonAggregateComponents-2.1.xsd +39799 -0
  139. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/common/UBL-CommonBasicComponents-2.1.xsd +5389 -0
  140. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/common/UBL-CommonExtensionComponents-2.1.xsd +223 -0
  141. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/common/UBL-CommonSignatureComponents-2.1.xsd +101 -0
  142. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/common/UBL-CoreComponentParameters-2.1.xsd +63 -0
  143. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/common/UBL-ExtensionContentDataType-2.1.xsd +89 -0
  144. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/common/UBL-QualifiedDataTypes-2.1.xsd +69 -0
  145. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/common/UBL-SignatureAggregateComponents-2.1.xsd +138 -0
  146. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/common/UBL-SignatureBasicComponents-2.1.xsd +78 -0
  147. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/common/UBL-UnqualifiedDataTypes-2.1.xsd +553 -0
  148. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/common/UBL-XAdESv132-2.1.xsd +476 -0
  149. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/common/UBL-XAdESv141-2.1.xsd +25 -0
  150. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/common/UBL-xmldsig-core-schema-2.1.xsd +330 -0
  151. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-ApplicationResponse-2.1.xsd +362 -0
  152. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-AttachedDocument-2.1.xsd +416 -0
  153. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-AwardedNotification-2.1.xsd +418 -0
  154. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-BillOfLading-2.1.xsd +540 -0
  155. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-CallForTenders-2.1.xsd +513 -0
  156. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-Catalogue-2.1.xsd +565 -0
  157. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-CatalogueDeletion-2.1.xsd +465 -0
  158. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-CatalogueItemSpecificationUpdate-2.1.xsd +533 -0
  159. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-CataloguePricingUpdate-2.1.xsd +532 -0
  160. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-CatalogueRequest-2.1.xsd +571 -0
  161. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-CertificateOfOrigin-2.1.xsd +417 -0
  162. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-ContractAwardNotice-2.1.xsd +493 -0
  163. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-ContractNotice-2.1.xsd +459 -0
  164. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-CreditNote-2.1.xsd +951 -0
  165. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-DebitNote-2.1.xsd +916 -0
  166. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-DespatchAdvice-2.1.xsd +482 -0
  167. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-DocumentStatus-2.1.xsd +350 -0
  168. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-DocumentStatusRequest-2.1.xsd +348 -0
  169. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-ExceptionCriteria-2.1.xsd +417 -0
  170. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-ExceptionNotification-2.1.xsd +403 -0
  171. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-Forecast-2.1.xsd +454 -0
  172. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-ForecastRevision-2.1.xsd +453 -0
  173. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-ForwardingInstructions-2.1.xsd +517 -0
  174. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-FreightInvoice-2.1.xsd +867 -0
  175. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-FulfilmentCancellation-2.1.xsd +471 -0
  176. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-GoodsItemItinerary-2.1.xsd +431 -0
  177. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-GuaranteeCertificate-2.1.xsd +481 -0
  178. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-InstructionForReturns-2.1.xsd +383 -0
  179. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-InventoryReport-2.1.xsd +401 -0
  180. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-Invoice-2.1.xsd +1002 -0
  181. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-ItemInformationRequest-2.1.xsd +402 -0
  182. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-Order-2.1.xsd +891 -0
  183. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-OrderCancellation-2.1.xsd +416 -0
  184. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-OrderChange-2.1.xsd +869 -0
  185. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-OrderResponse-2.1.xsd +956 -0
  186. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-OrderResponseSimple-2.1.xsd +486 -0
  187. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-PackingList-2.1.xsd +432 -0
  188. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-PriorInformationNotice-2.1.xsd +441 -0
  189. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-ProductActivity-2.1.xsd +387 -0
  190. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-Quotation-2.1.xsd +583 -0
  191. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-ReceiptAdvice-2.1.xsd +485 -0
  192. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-Reminder-2.1.xsd +759 -0
  193. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-RemittanceAdvice-2.1.xsd +567 -0
  194. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-RequestForQuotation-2.1.xsd +519 -0
  195. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-RetailEvent-2.1.xsd +515 -0
  196. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-SelfBilledCreditNote-2.1.xsd +918 -0
  197. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-SelfBilledInvoice-2.1.xsd +933 -0
  198. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-Statement-2.1.xsd +600 -0
  199. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-StockAvailabilityReport-2.1.xsd +403 -0
  200. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-Tender-2.1.xsd +464 -0
  201. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-TenderReceipt-2.1.xsd +398 -0
  202. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-TendererQualification-2.1.xsd +401 -0
  203. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-TradeItemLocationProfile-2.1.xsd +415 -0
  204. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-TransportExecutionPlan-2.1.xsd +769 -0
  205. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-TransportExecutionPlanRequest-2.1.xsd +696 -0
  206. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-TransportProgressStatus-2.1.xsd +396 -0
  207. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-TransportProgressStatusRequest-2.1.xsd +345 -0
  208. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-TransportServiceDescription-2.1.xsd +430 -0
  209. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-TransportServiceDescriptionRequest-2.1.xsd +363 -0
  210. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-TransportationStatus-2.1.xsd +566 -0
  211. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-TransportationStatusRequest-2.1.xsd +484 -0
  212. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-UnawardedNotification-2.1.xsd +415 -0
  213. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-UtilityStatement-2.1.xsd +490 -0
  214. openubl-0.1.3/sunat_schemas/xsd_2.1/2.1/maindoc/UBL-Waybill-2.1.xsd +501 -0
  215. openubl-0.1.3/tests/__init__.py +0 -0
  216. openubl-0.1.3/tests/sunat_client.py +102 -0
  217. openubl-0.1.3/tests/test_api.py +134 -0
  218. openubl-0.1.3/tests/test_e2e_sunat_beta.py +150 -0
  219. openubl-0.1.3/tests/test_enricher.py +75 -0
  220. openubl-0.1.3/tests/test_models.py +192 -0
  221. openubl-0.1.3/tests/test_render.py +183 -0
  222. openubl-0.1.3/tests/test_sdk_types.py +49 -0
  223. openubl-0.1.3/tests/test_sign.py +92 -0
  224. openubl-0.1.3/tests/test_validator.py +245 -0
  225. openubl-0.1.3/tests/test_version_check.py +35 -0
  226. openubl-0.1.3/tests/test_version_sync.py +8 -0
  227. openubl-0.1.3/uv.lock +960 -0
@@ -0,0 +1,37 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ branches: [main]
6
+
7
+ jobs:
8
+ python:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v4
12
+ - uses: astral-sh/setup-uv@v3
13
+ - name: Sync dependencies
14
+ run: uv sync
15
+ - name: Run Python tests
16
+ run: uv run pytest -m "not e2e"
17
+ - name: Run static sync check
18
+ run: uv run python scripts/check_sdk_sync.py
19
+ - name: Build wheel
20
+ run: uv build
21
+
22
+ typescript:
23
+ runs-on: ubuntu-latest
24
+ steps:
25
+ - uses: actions/checkout@v4
26
+ - uses: actions/setup-node@v4
27
+ with:
28
+ node-version: 22
29
+ - name: Install & generate
30
+ run: |
31
+ cd sdk/typescript
32
+ npm ci
33
+ npm run generate
34
+ - name: Build
35
+ run: cd sdk/typescript && npm run build
36
+ - name: Test
37
+ run: cd sdk/typescript && npm test
@@ -0,0 +1,49 @@
1
+ name: Deploy Docs to GitHub Pages
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ contents: read
10
+ pages: write
11
+ id-token: write
12
+
13
+ concurrency:
14
+ group: pages
15
+ cancel-in-progress: false
16
+
17
+ jobs:
18
+ build:
19
+ runs-on: ubuntu-latest
20
+ steps:
21
+ - name: Checkout
22
+ uses: actions/checkout@v4
23
+ - name: Setup Node
24
+ uses: actions/setup-node@v4
25
+ with:
26
+ node-version: 22
27
+ cache: npm
28
+ cache-dependency-path: docs/package-lock.json
29
+ - name: Setup Pages
30
+ uses: actions/configure-pages@v5
31
+ - name: Install dependencies
32
+ run: cd docs && npm ci
33
+ - name: Build
34
+ run: cd docs && npm run build
35
+ - name: Upload artifact
36
+ uses: actions/upload-pages-artifact@v3
37
+ with:
38
+ path: docs/dist
39
+
40
+ deploy:
41
+ needs: build
42
+ runs-on: ubuntu-latest
43
+ environment:
44
+ name: github-pages
45
+ url: ${{ steps.deployment.outputs.page_url }}
46
+ steps:
47
+ - name: Deploy to GitHub Pages
48
+ id: deployment
49
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,94 @@
1
+ name: Publish Release
2
+
3
+ on:
4
+ push:
5
+ tags: ["v*"]
6
+
7
+ jobs:
8
+ build-and-test:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v4
12
+ - uses: astral-sh/setup-uv@v3
13
+ - uses: actions/setup-node@v4
14
+ with:
15
+ node-version: 22
16
+ registry-url: "https://registry.npmjs.org"
17
+ - run: uv sync
18
+ - run: uv run pytest -m "not e2e"
19
+ - run: uv run python scripts/check_sdk_sync.py
20
+ - run: cd sdk/typescript && npm ci && npm run generate && npm run build && npm test
21
+ - run: uv build
22
+
23
+ publish-pypi:
24
+ needs: build-and-test
25
+ runs-on: ubuntu-latest
26
+ steps:
27
+ - uses: actions/checkout@v4
28
+ - uses: astral-sh/setup-uv@v3
29
+ - run: uv sync
30
+ - run: uv build
31
+ - uses: pypa/gh-action-pypi-publish@release/v1
32
+ with:
33
+ password: ${{ secrets.PYPI_API_TOKEN }}
34
+
35
+ publish-npm:
36
+ needs: build-and-test
37
+ runs-on: ubuntu-latest
38
+ steps:
39
+ - uses: actions/checkout@v4
40
+ - uses: actions/setup-node@v4
41
+ with:
42
+ node-version: 22
43
+ registry-url: "https://registry.npmjs.org"
44
+ - run: cd sdk/typescript && npm ci && npm run generate && npm run build
45
+ - run: cd sdk/typescript && npm publish --access public
46
+ env:
47
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
48
+
49
+ release-notes:
50
+ needs: [publish-pypi, publish-npm]
51
+ runs-on: ubuntu-latest
52
+ permissions:
53
+ contents: write
54
+ steps:
55
+ - uses: actions/checkout@v4
56
+ with:
57
+ fetch-depth: 0
58
+ - name: Generate changelog
59
+ id: git-cliff
60
+ uses: orhun/git-cliff-action@v4
61
+ with:
62
+ config: cliff.toml
63
+ args: --latest --strip header
64
+ env:
65
+ OUTPUT: CHANGES.md
66
+ GITHUB_REPO: ${{ github.repository }}
67
+ - name: Build release body
68
+ run: |
69
+ VERSION="${GITHUB_REF_NAME#v}"
70
+ {
71
+ echo "📦 **PyPI**: [openubl ${VERSION}](https://pypi.org/project/openubl/${VERSION}/)"
72
+ echo ""
73
+ echo '```bash'
74
+ echo "pip install openubl==${VERSION}"
75
+ echo '```'
76
+ echo ""
77
+ echo "📦 **npm**: [@openubl/sdk ${VERSION}](https://www.npmjs.com/package/@openubl/sdk/v/${VERSION})"
78
+ echo ""
79
+ echo '```bash'
80
+ echo "npm install @openubl/sdk@${VERSION}"
81
+ echo '```'
82
+ echo ""
83
+ echo "---"
84
+ echo ""
85
+ cat CHANGES.md
86
+ } > RELEASE_BODY.md
87
+ - name: Create GitHub Release
88
+ run: |
89
+ BODY=$(cat RELEASE_BODY.md)
90
+ gh release create "$GITHUB_REF_NAME" \
91
+ --title "Release $GITHUB_REF_NAME" \
92
+ --notes "$BODY"
93
+ env:
94
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,33 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+
9
+ # Virtual environments
10
+ .venv
11
+
12
+ # pytest
13
+ .pytest_cache/
14
+
15
+ # Node.js
16
+ node_modules/
17
+
18
+ # OpenAPI Generator metadata
19
+ openapitools.json
20
+
21
+ # Generated SDK files
22
+ sdk/java/
23
+ sdk/go/
24
+ sdk/python/
25
+ sdk/csharp/
26
+ sdk/typescript/src/openubl-types.ts
27
+
28
+ # Documentation build output
29
+ docs/dist/
30
+ docs/.astro/
31
+
32
+ # Local tools (e.g. downloaded binaries)
33
+ .tools/
@@ -0,0 +1 @@
1
+ 3.11
@@ -0,0 +1,137 @@
1
+ # openUBL — Contexto para Agentes de IA
2
+
3
+ ## Qué es este proyecto
4
+
5
+ openUBL es una biblioteca Python para generar, firmar y validar documentos electrónicos UBL 2.1 para SUNAT (Perú). Expone una API REST FastAPI y SDKs generados a partir de OpenAPI.
6
+
7
+ ## Estructura clave
8
+
9
+ ```
10
+ openubl/
11
+ ├── src/openubl/ # Biblioteca core Python
12
+ │ ├── models/ # Pydantic models (Invoice, CreditNote, etc.)
13
+ │ ├── api/router.py # Endpoints FastAPI
14
+ │ ├── main.py # App FastAPI
15
+ │ ├── renderer.py # Renderizado Jinja2 → XML UBL
16
+ │ ├── signer.py # Firma digital XAdES-EPES
17
+ │ ├── validator.py # Validación SUNAT sobre XML
18
+ │ ├── enricher.py # Enriquecimiento automático de campos
19
+ │ └── version.py # check_api_version() para sincronización runtime
20
+ ├── sdk/typescript/ # SDK TypeScript (@openubl/sdk)
21
+ │ ├── src/ # Código fuente (client.ts, version.ts, openubl-types.ts)
22
+ │ ├── test/ # Tests Vitest
23
+ │ └── dist/ # Emitido por tsc
24
+ ├── scripts/
25
+ │ ├── export_openapi.py # Exporta openapi.json desde FastAPI
26
+ │ ├── check_sdk_sync.py # Valida sincronización de versiones + openapi.json
27
+ │ ├── bump_version.py # Bump atómico de versión en todas las fuentes
28
+ │ └── release.py # Script único de release (bump, commit, tag, push, rollback)
29
+ ├── .github/workflows/
30
+ │ ├── ci.yml # Tests y build en PR
31
+ │ └── publish.yml # Publica en PyPI + npm y crea GitHub Release
32
+ ├── tests/ # Suite pytest
33
+ ├── openapi.json # Esquema OpenAPI 3.1.0 (single source of truth)
34
+ ├── pyproject.toml # Config Python (openubl)
35
+ └── package.json # Config root (scripts/docs)
36
+ ```
37
+
38
+ ## Convenciones de código
39
+
40
+ - **Idioma**: Código en inglés, documentación y mensajes de usuario en español.
41
+ - **Python**: `snake_case`, tipado estricto (mypy-friendly), docstrings en español para FastAPI OpenAPI.
42
+ - **TypeScript**: `camelCase`, ES modules (`"type": "module"`), tipos exportados desde `openubl-types.ts`.
43
+ - **Versionado**: SemVer. La versión debe ser idéntica en los 7 archivos. Nunca editar a mano; usar `scripts/bump_version.py`.
44
+
45
+ ## Cómo ejecutar tests
46
+
47
+ ```bash
48
+ # Python (todos excepto E2E)
49
+ uv run pytest -m "not e2e"
50
+
51
+ # TypeScript SDK
52
+ cd sdk/typescript && npm test
53
+
54
+ # Sincronización
55
+ uv run python scripts/check_sdk_sync.py
56
+ ```
57
+
58
+ ## Cómo crear un release
59
+
60
+ Cuando un PR se mergea a `main` con un label `release:patch`, `release:minor` o `release:major`:
61
+
62
+ | Label | Color HEX | Resultado |
63
+ |-------|-----------|-----------|
64
+ | `release:patch` | `#22c55e` | Bugfix → `0.1.0` → `0.1.1` |
65
+ | `release:minor` | `#f59e0b` | Feature → `0.1.0` → `0.2.0` |
66
+ | `release:major` | `#ef4444` | Breaking → `0.1.0` → `1.0.0` |
67
+
68
+ 1. Ejecuta localmente (detecta el label automáticamente):
69
+ ```bash
70
+ uv run python scripts/release.py --from-label --push
71
+ ```
72
+ > Requiere la CLI `gh` instalada y autenticada.
73
+
74
+ 2. El workflow `.github/workflows/publish.yml` se disparará automáticamente en GitHub Actions por el tag `v*`.
75
+
76
+ ### Flujo manual (fallback)
77
+
78
+ ```bash
79
+ # Bump por tipo
80
+ uv run python scripts/release.py --type minor --push
81
+
82
+ # O versión exacta
83
+ uv run python scripts/release.py 0.2.0 --push
84
+ ```
85
+
86
+ ### Rollback
87
+
88
+ Si algo sale mal después de crear el release localmente:
89
+
90
+ ```bash
91
+ uv run python scripts/release.py --rollback
92
+ ```
93
+
94
+ Esto elimina el tag local y hace `git reset --hard HEAD~1`.
95
+
96
+ ## Reglas de dominio (no inventar)
97
+
98
+ ### Fuente de verdad obligatoria
99
+
100
+ Antes de implementar o modificar cualquier regla de validación, formato, catálogo o estructura XML relacionada con SUNAT, **debes consultar primero** la documentación oficial en:
101
+
102
+ **https://cpe.sunat.gob.pe/guias-y-manuales**
103
+
104
+ Esta es la fuente autorizada de SUNAT para:
105
+ - Guías de emisión electrónica (factura, boleta, notas de crédito/débito, etc.)
106
+ - Especificaciones técnicas de XML UBL 2.1
107
+ - Catálogos de códigos (tipo de documento, tipo de operación, moneda, etc.)
108
+ - Reglas de validación y rechazo
109
+ - Formatos de firma digital y envío
110
+
111
+ **Nunca asumas, inventes ni "alucines" reglas SUNAT.** Si la información no está clara en el código existente, busca en la URL oficial antes de escribir código nuevo.
112
+
113
+ ### Reglas del código existente
114
+
115
+ - Los documentos SUNAT usan catálogos fijos (tipo de documento, moneda, etc.). Están en `src/openubl/models/catalog.py`.
116
+ - La firma digital requiere certificado PEM y clave privada PEM. No inventar formatos.
117
+ - El XML UBL 2.1 generado debe pasar validación SUNAT (`validator.py`) antes del envío.
118
+ - El ambiente beta de SUNAT requiere credenciales reales (`SUNAT_BETA_RUC`); los tests E2E están marcados con `pytest.mark.e2e`.
119
+
120
+ ## Qué NO hacer
121
+
122
+ - No editar versiones a mano en `__init__.py`, `pyproject.toml`, `package.json`, etc. Usar `bump_version.py`.
123
+ - No modificar `openapi.json` manualmente. Usar `export_openapi.py`.
124
+ - No romper la sincronización entre API y SDKs. Siempre ejecutar `check_sdk_sync.py` antes de un release.
125
+ - No agregar dependencias runtime innecesarias. `urllib.request` ya cubre HTTP simple en Python.
126
+
127
+ ## Endpoints principales (FastAPI)
128
+
129
+ - `POST /api/v1/invoice/create` → Genera XML de factura/boleta
130
+ - `POST /api/v1/credit-note/create` → Nota de crédito
131
+ - `POST /api/v1/debit-note/create` → Nota de débito
132
+ - `POST /api/v1/voided-documents/create` → Comunicación de baja (RA)
133
+ - `POST /api/v1/summary-documents/create` → Resumen diario (RC)
134
+ - `POST /api/v1/perception/create` → Percepción
135
+ ## Contacto / autor
136
+
137
+ Consulta el repositorio en GitHub para información del mantenedor.
@@ -0,0 +1,15 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.1.1] - 2026-06-11
9
+
10
+ ### Features
11
+
12
+ - *(core)* Initial openUBL project with SUNAT electronic invoicing - ([9eeae61](https://github.com/darvin2c/openUBL/commit/9eeae610527ddf49af5307013c66dded77e50e0d))
13
+ - *(docs)* Astro Starlight documentation site - ([f1ad39b](https://github.com/darvin2c/openUBL/commit/f1ad39b670944f3cc8105d994d76b8dd9ca6cebe))
14
+ - *(sdk)* Multi-language SDK generation from OpenAPI - ([3e02820](https://github.com/darvin2c/openUBL/commit/3e02820f513848da9a3061c328793c168c506474))
15
+ <!-- generated by git-cliff -->
openubl-0.1.3/PKG-INFO ADDED
@@ -0,0 +1,137 @@
1
+ Metadata-Version: 2.4
2
+ Name: openubl
3
+ Version: 0.1.3
4
+ Summary: openUBL - Peruvian SUNAT Electronic Documents Library
5
+ Requires-Python: >=3.11
6
+ Requires-Dist: fastapi>=0.136.3
7
+ Requires-Dist: jinja2>=3.1.6
8
+ Requires-Dist: lxml>=6.1.1
9
+ Requires-Dist: pydantic>=2.13.4
10
+ Requires-Dist: python-multipart>=0.0.32
11
+ Requires-Dist: signxml>=4.4.0
12
+ Requires-Dist: uvicorn>=0.49.0
13
+ Requires-Dist: zeep>=4.3.2
14
+ Description-Content-Type: text/markdown
15
+
16
+ # openUBL
17
+
18
+ [![PyPI](https://img.shields.io/pypi/v/openubl)](https://pypi.org/project/openubl/)
19
+ [![npm](https://img.shields.io/npm/v/@openubl/sdk)](https://www.npmjs.com/package/@openubl/sdk)
20
+
21
+ **Genera, firma y valida documentos electrónicos UBL 2.1 para SUNAT (Perú) — sin complicaciones.**
22
+
23
+ openUBL es una biblioteca Python con API REST incluida. Genera XML válido para facturas, notas de crédito, notas de débito, comunicaciones de baja, resúmenes diarios, percepciones y retenciones. Firma digitalmente con certificados XAdES-EPES y valida contra las reglas SUNAT antes de enviar.
24
+
25
+ ## ¿Por qué openUBL?
26
+
27
+ - **Sin dependencias externas** — todo en Python. No necesitas servicios de terceros para generar XML.
28
+ - **API REST lista para usar** — levantas FastAPI y generas documentos vía HTTP.
29
+ - **SDK TypeScript** — tipos generados desde OpenAPI, con autocompletado completo.
30
+ - **Firma digital integrada** — firma con certificado PEM sin herramientas externas.
31
+ - **Validación SUNAT** — detecta errores antes del envío, no después.
32
+ - **Documentación completa** — guías paso a paso en [https://darvin2c.github.io/openUBL](https://darvin2c.github.io/openUBL)
33
+
34
+ ## Instalación rápida
35
+
36
+ ### Python
37
+
38
+ ```bash
39
+ pip install openubl
40
+ ```
41
+
42
+ ```python
43
+ from openubl.models import Invoice, Proveedor, Cliente, DocumentoVentaDetalle
44
+
45
+ invoice = Invoice(
46
+ serie="F001",
47
+ numero=1,
48
+ proveedor=Proveedor(ruc="20100066603", razonSocial="Softgreen S.A.C."),
49
+ cliente=Cliente(nombre="Carlos", numeroDocumentoIdentidad="12121212121", tipoDocumentoIdentidad="6"),
50
+ detalles=[DocumentoVentaDetalle(descripcion="Item", cantidad=10, precio=100)],
51
+ )
52
+
53
+ xml = invoice.to_xml()
54
+ print(xml) # XML UBL 2.1 listo para firmar
55
+ ```
56
+
57
+ ### TypeScript / JavaScript
58
+
59
+ ```bash
60
+ npm install @openubl/sdk
61
+ ```
62
+
63
+ ```typescript
64
+ import { client, type Invoice } from "@openubl/sdk";
65
+
66
+ const invoice: Invoice = {
67
+ serie: "F001",
68
+ numero: 1,
69
+ proveedor: { ruc: "20100066603", razonSocial: "Softgreen S.A.C." },
70
+ cliente: { nombre: "Carlos", numeroDocumentoIdentidad: "12121212121", tipoDocumentoIdentidad: "6" },
71
+ detalles: [{ descripcion: "Item", cantidad: 10, precio: 100 }],
72
+ };
73
+
74
+ const { data } = await client.POST("/api/v1/invoice/create", { body: invoice });
75
+ console.log(data?.xml); // XML UBL 2.1 generado
76
+ ```
77
+
78
+ ## Levantar la API REST
79
+
80
+ ```bash
81
+ uv run uvicorn openubl.main:app --reload
82
+ ```
83
+
84
+ Abre [http://localhost:8000/docs](http://localhost:8000/docs) para Swagger UI interactivo.
85
+
86
+ ## Documentos soportados
87
+
88
+ | Tipo | Código SUNAT | Endpoint |
89
+ |------|-------------|----------|
90
+ | Factura | 01 | `POST /api/v1/invoice/create` |
91
+ | Boleta | 03 | `POST /api/v1/invoice/create` |
92
+ | Nota de Crédito | 07 | `POST /api/v1/credit-note/create` |
93
+ | Nota de Débito | 08 | `POST /api/v1/debit-note/create` |
94
+ | Comunicación de Baja | RA | `POST /api/v1/voided-documents/create` |
95
+ | Resumen Diario | RC | `POST /api/v1/summary-documents/create` |
96
+ | Percepción | 40 | `POST /api/v1/perception/create` |
97
+ | Retención | 20 | `POST /api/v1/retention/create` |
98
+
99
+ ## Validación de versión
100
+
101
+ Verifica que tu SDK y la API compartan la misma versión:
102
+
103
+ ```python
104
+ from openubl.version import check_api_version
105
+
106
+ result = check_api_version("http://localhost:8000")
107
+ assert result["ok"], f"Desfase: SDK {result['sdk_version']} vs API {result['api_version']}"
108
+ ```
109
+
110
+ ```typescript
111
+ import { checkApiVersion } from "@openubl/sdk";
112
+
113
+ const result = await checkApiVersion("http://localhost:8000");
114
+ if (!result.ok) throw new Error(`Desfase: SDK ${result.sdkVersion} vs API ${result.apiVersion}`);
115
+ ```
116
+
117
+ ## Documentación
118
+
119
+ - [Documentación completa](https://darvin2c.github.io/openUBL)
120
+ - [Guía de Python SDK](https://darvin2c.github.io/openUBL/sdk/python)
121
+ - [Guía de TypeScript SDK](https://darvin2c.github.io/openUBL/sdk/typescript)
122
+ - [Referencia de API](https://darvin2c.github.io/openUBL/api/referencia)
123
+
124
+ ## Contribuir
125
+
126
+ Consulta `AGENTS.md` para el contexto técnico completo del proyecto.
127
+
128
+ ## Licencia
129
+
130
+ MIT © openUBL
131
+ # Test release flow v2
132
+
133
+
134
+
135
+
136
+
137
+
@@ -0,0 +1,122 @@
1
+ # openUBL
2
+
3
+ [![PyPI](https://img.shields.io/pypi/v/openubl)](https://pypi.org/project/openubl/)
4
+ [![npm](https://img.shields.io/npm/v/@openubl/sdk)](https://www.npmjs.com/package/@openubl/sdk)
5
+
6
+ **Genera, firma y valida documentos electrónicos UBL 2.1 para SUNAT (Perú) — sin complicaciones.**
7
+
8
+ openUBL es una biblioteca Python con API REST incluida. Genera XML válido para facturas, notas de crédito, notas de débito, comunicaciones de baja, resúmenes diarios, percepciones y retenciones. Firma digitalmente con certificados XAdES-EPES y valida contra las reglas SUNAT antes de enviar.
9
+
10
+ ## ¿Por qué openUBL?
11
+
12
+ - **Sin dependencias externas** — todo en Python. No necesitas servicios de terceros para generar XML.
13
+ - **API REST lista para usar** — levantas FastAPI y generas documentos vía HTTP.
14
+ - **SDK TypeScript** — tipos generados desde OpenAPI, con autocompletado completo.
15
+ - **Firma digital integrada** — firma con certificado PEM sin herramientas externas.
16
+ - **Validación SUNAT** — detecta errores antes del envío, no después.
17
+ - **Documentación completa** — guías paso a paso en [https://darvin2c.github.io/openUBL](https://darvin2c.github.io/openUBL)
18
+
19
+ ## Instalación rápida
20
+
21
+ ### Python
22
+
23
+ ```bash
24
+ pip install openubl
25
+ ```
26
+
27
+ ```python
28
+ from openubl.models import Invoice, Proveedor, Cliente, DocumentoVentaDetalle
29
+
30
+ invoice = Invoice(
31
+ serie="F001",
32
+ numero=1,
33
+ proveedor=Proveedor(ruc="20100066603", razonSocial="Softgreen S.A.C."),
34
+ cliente=Cliente(nombre="Carlos", numeroDocumentoIdentidad="12121212121", tipoDocumentoIdentidad="6"),
35
+ detalles=[DocumentoVentaDetalle(descripcion="Item", cantidad=10, precio=100)],
36
+ )
37
+
38
+ xml = invoice.to_xml()
39
+ print(xml) # XML UBL 2.1 listo para firmar
40
+ ```
41
+
42
+ ### TypeScript / JavaScript
43
+
44
+ ```bash
45
+ npm install @openubl/sdk
46
+ ```
47
+
48
+ ```typescript
49
+ import { client, type Invoice } from "@openubl/sdk";
50
+
51
+ const invoice: Invoice = {
52
+ serie: "F001",
53
+ numero: 1,
54
+ proveedor: { ruc: "20100066603", razonSocial: "Softgreen S.A.C." },
55
+ cliente: { nombre: "Carlos", numeroDocumentoIdentidad: "12121212121", tipoDocumentoIdentidad: "6" },
56
+ detalles: [{ descripcion: "Item", cantidad: 10, precio: 100 }],
57
+ };
58
+
59
+ const { data } = await client.POST("/api/v1/invoice/create", { body: invoice });
60
+ console.log(data?.xml); // XML UBL 2.1 generado
61
+ ```
62
+
63
+ ## Levantar la API REST
64
+
65
+ ```bash
66
+ uv run uvicorn openubl.main:app --reload
67
+ ```
68
+
69
+ Abre [http://localhost:8000/docs](http://localhost:8000/docs) para Swagger UI interactivo.
70
+
71
+ ## Documentos soportados
72
+
73
+ | Tipo | Código SUNAT | Endpoint |
74
+ |------|-------------|----------|
75
+ | Factura | 01 | `POST /api/v1/invoice/create` |
76
+ | Boleta | 03 | `POST /api/v1/invoice/create` |
77
+ | Nota de Crédito | 07 | `POST /api/v1/credit-note/create` |
78
+ | Nota de Débito | 08 | `POST /api/v1/debit-note/create` |
79
+ | Comunicación de Baja | RA | `POST /api/v1/voided-documents/create` |
80
+ | Resumen Diario | RC | `POST /api/v1/summary-documents/create` |
81
+ | Percepción | 40 | `POST /api/v1/perception/create` |
82
+ | Retención | 20 | `POST /api/v1/retention/create` |
83
+
84
+ ## Validación de versión
85
+
86
+ Verifica que tu SDK y la API compartan la misma versión:
87
+
88
+ ```python
89
+ from openubl.version import check_api_version
90
+
91
+ result = check_api_version("http://localhost:8000")
92
+ assert result["ok"], f"Desfase: SDK {result['sdk_version']} vs API {result['api_version']}"
93
+ ```
94
+
95
+ ```typescript
96
+ import { checkApiVersion } from "@openubl/sdk";
97
+
98
+ const result = await checkApiVersion("http://localhost:8000");
99
+ if (!result.ok) throw new Error(`Desfase: SDK ${result.sdkVersion} vs API ${result.apiVersion}`);
100
+ ```
101
+
102
+ ## Documentación
103
+
104
+ - [Documentación completa](https://darvin2c.github.io/openUBL)
105
+ - [Guía de Python SDK](https://darvin2c.github.io/openUBL/sdk/python)
106
+ - [Guía de TypeScript SDK](https://darvin2c.github.io/openUBL/sdk/typescript)
107
+ - [Referencia de API](https://darvin2c.github.io/openUBL/api/referencia)
108
+
109
+ ## Contribuir
110
+
111
+ Consulta `AGENTS.md` para el contexto técnico completo del proyecto.
112
+
113
+ ## Licencia
114
+
115
+ MIT © openUBL
116
+ # Test release flow v2
117
+
118
+
119
+
120
+
121
+
122
+