Agrega ejemplos para nómina y complemento de impuestos locales por re…#1
Hidden character warning
Conversation
…ferencia. Actualiza package.json con nueva versión de SDK
📝 WalkthroughWalkthroughUpdated Changes
Sequence Diagram(s)sequenceDiagram
participant Client as Client
participant Server as Server\n(API Route → Controller)
participant Fiscal as fiscalapi\n(External API)
Client->>Server: POST /api/invoices/create/... (payroll/local-taxes payload)
Server->>Server: Route -> Controller\nController builds invoice payload\n(includes payroll or localTaxes complement)
Server->>Fiscal: fiscalapi.invoices.create(payload)
Fiscal-->>Server: 200 OK / error
Server-->>Client: 200 / 500 response
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Fix all issues with AI agents
In `@package.json`:
- Line 41: Confirm that all usages of the old FiscalAPI invoices.create are
migrated to the unified POST /api/v4/invoices endpoint: search for calls to
invoices.create (and any wrapper functions like createInvoice,
InvoiceService.create, or apiClient.invoices.create) and update request URLs to
/api/v4/invoices; for invoice types "payment", "payroll", and "local-taxes"
update their request payloads to the new v4 schema (field names/structure per v4
docs), leaving income invoices and credit notes with only the endpoint URL
change; run and update unit/integration tests that exercise
InvoiceService/createInvoice and apiClient.invoices.create to validate the new
payload shapes and responses before releasing the package.json bump to fiscalapi
^4.0.360.
In `@src/controllers/invoiceController.ts`:
- Around line 1029-1155: The createPayrollByReferences handler builds
payrollInvoice but omits required payroll fields; add issuer.employerData and
recipient.employeeData (including employeeData.curp and
employeeData.satContractTypeId) to the payrollInvoice object before calling
fiscalapi.invoices.create(); update the payrollInvoice.issuer to include
employerData with the required employer identifiers and payroll settings, and
update payrollInvoice.recipient to include employeeData with curp and
satContractTypeId (and any other schema-required employee fields) so FiscalAPI
v4.0.360 validation succeeds.
- Around line 1158-1208: In createLocalTaxesInvoiceByReference update the
complement.localTaxes.taxes entries so taxRate and taxAmount are numeric types
(numbers/decimals) instead of strings; locate the tax objects inside the
localTaxes complement (in the createLocalTaxesInvoiceByReference function) and
change taxRate: "3.00"/"8.00" to taxRate: 3.00/8.00 and taxAmount:
"6.00"/"16.00" to taxAmount: 6.00/16.00 so the FiscalAPI v4.0.360 SDK accepts
the payload.
In `@src/routes/invoiceRoutes.ts`:
- Around line 480-507: The route path for the local-taxes endpoint is
inconsistent with other reference-based endpoints: change the POST path string
'/create/local-taxes/by-reference' to '/create/local-taxes/by-references' in the
router.post call and update the corresponding Swagger block comment above it so
both the documented path and the actual route match; locate the router.post that
registers createLocalTaxesInvoiceByReference and the Swagger comment block for
this endpoint and make the two use '/by-references' to align with
createPayrollByReferences.
There was a problem hiding this comment.
Amigo, los ejemplos existentes de complemento de pago y el readme requieren cambios, Hay discusiones pendientes con Rabbit, ninguna aplica? yo leí al menos una que sí, hiciste dev DevTesting? porque puedo asegurarte de que los ejemplos de complementos de pago no funcionarán después del update de sdk, levanta los ejemplos y verifica que lo que estás haciendo no solo funciona, si no que lo que existe no está roto.
mendozagit
left a comment
There was a problem hiding this comment.
Amigo, los ejemplos existentes de complemento de pago y el readme requieren cambios, Hay discusiones pendientes con Rabbit, ninguna aplica? yo leí al menos una que sí, hiciste dev DevTesting? porque puedo asegurarte de que los ejemplos de complementos de pago no funcionarán después del update de sdk, levanta los ejemplos y verifica que lo que estás haciendo no solo funciona, si no que lo que existe no está roto.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
Verify each finding against the current code and only fix it if needed.
In `@src/routes/invoiceRoutes.ts`:
- Around line 233-245: The OpenAPI model LocalTax declares taxRate and taxAmount
as number but sample payloads in invoiceController.ts use string values like
"3.00"/"6.00", so standardize them: either change LocalTax.taxRate and
LocalTax.taxAmount types to string in the Swagger schema (LocalTax) to match the
samples, or update the sample payloads in invoiceController.ts (the sample
requests/fixtures around the invoice controller) to use numeric values (3.00,
6.00) and adjust any DTOs/validation that expect strings; update all occurrences
to keep schema, samples, and any validation/DTOs consistent (refer to LocalTax,
taxRate, taxAmount and the sample payloads in invoiceController.ts).
| * LocalTax: | ||
| * type: object | ||
| * properties: | ||
| * taxName: | ||
| * type: string | ||
| * description: Nombre del impuesto local | ||
| * taxRate: | ||
| * type: number | ||
| * description: Tasa del impuesto local (2 decimales) | ||
| * taxAmount: | ||
| * type: number | ||
| * description: Monto del impuesto local (2 decimales) | ||
| * taxFlagCode: |
There was a problem hiding this comment.
Align LocalTax.taxRate/taxAmount types with sample payloads.
In src/controllers/invoiceController.ts (lines 1161–1289 and 1421–1471), the sample payloads use string values like "3.00" and "6.00", but the Swagger schema here declares number. This mismatch can mislead SDK users and validation tooling. Consider standardizing either the schema (string) or the sample payloads (numbers).
🔧 Possible doc fix (if strings are intended)
- * taxRate:
- * type: number
+ * taxRate:
+ * type: string
@@
- * taxAmount:
- * type: number
+ * taxAmount:
+ * type: string📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| * LocalTax: | |
| * type: object | |
| * properties: | |
| * taxName: | |
| * type: string | |
| * description: Nombre del impuesto local | |
| * taxRate: | |
| * type: number | |
| * description: Tasa del impuesto local (2 decimales) | |
| * taxAmount: | |
| * type: number | |
| * description: Monto del impuesto local (2 decimales) | |
| * taxFlagCode: | |
| * LocalTax: | |
| * type: object | |
| * properties: | |
| * taxName: | |
| * type: string | |
| * description: Nombre del impuesto local | |
| * taxRate: | |
| * type: string | |
| * description: Tasa del impuesto local (2 decimales) | |
| * taxAmount: | |
| * type: string | |
| * description: Monto del impuesto local (2 decimales) | |
| * taxFlagCode: |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/routes/invoiceRoutes.ts` around lines 233 - 245, The OpenAPI model
LocalTax declares taxRate and taxAmount as number but sample payloads in
invoiceController.ts use string values like "3.00"/"6.00", so standardize them:
either change LocalTax.taxRate and LocalTax.taxAmount types to string in the
Swagger schema (LocalTax) to match the samples, or update the sample payloads in
invoiceController.ts (the sample requests/fixtures around the invoice
controller) to use numeric values (3.00, 6.00) and adjust any DTOs/validation
that expect strings; update all occurrences to keep schema, samples, and any
validation/DTOs consistent (refer to LocalTax, taxRate, taxAmount and the sample
payloads in invoiceController.ts).
…ferencia. Actualiza package.json con nueva versión de SDK
Summary by CodeRabbit