@@ -492,51 +492,51 @@ async function main() : Promise<void> {
492492
493493
494494 // Crear factura global por referencias (Node.js)
495- const globalInvoiceByReferences : Invoice = {
496- versionCode : "4.0" ,
497- series : "F" ,
498- exportCode : "01" ,
499- date : DateTime . now ( ) . toFormat ( "yyyy-MM-dd'T'HH:mm:ss" ) ,
500- paymentFormCode : "01" ,
501- paymentMethodCode : "PUE" ,
502- currencyCode : "MXN" ,
503- typeCode : "I" ,
504- expeditionZipCode : "01160" ,
505- exchangeRate : 1 ,
506- globalInformation : {
507- periodicityCode : "01" ,
508- monthCode : "05" ,
509- year : 2025
510- } ,
511- issuer : {
512- id : "78d380fd-1b69-4e3c-8bc0-4f57737f7d5f"
513- } ,
514- recipient : {
515- id : "4e7ba2d7-2302-42f1-9fe4-6b75069f0fc9"
516- } ,
517- items : [
518- {
519- itemCode : "01010101" ,
520- quantity : 1 ,
521- unitOfMeasurementCode : "ACT" ,
522- description : "Venta" ,
523- unitPrice : 1230.00 ,
524- taxObjectCode : "02" ,
525- itemSku : "venta0001" ,
526- itemTaxes : [
527- {
528- taxCode : "002" , // IVA
529- taxTypeCode : "Tasa" ,
530- taxRate : "0.160000" , // 16%
531- taxFlagCode : "T" // Traslado
532- }
533- ]
534- }
535- ]
536- } ;
537-
538- const apiResponse = await client . invoices . create ( globalInvoiceByReferences ) ;
539- console . log ( 'apiResponse:' , apiResponse ) ;
495+ // const globalInvoiceByReferences: Invoice = {
496+ // versionCode: "4.0",
497+ // series: "F",
498+ // exportCode: "01",
499+ // date: DateTime.now().toFormat("yyyy-MM-dd'T'HH:mm:ss"),
500+ // paymentFormCode: "01",
501+ // paymentMethodCode: "PUE",
502+ // currencyCode: "MXN",
503+ // typeCode: "I",
504+ // expeditionZipCode: "01160",
505+ // exchangeRate: 1,
506+ // globalInformation: {
507+ // periodicityCode: "01",
508+ // monthCode: "05",
509+ // year: 2025
510+ // },
511+ // issuer: {
512+ // id: "78d380fd-1b69-4e3c-8bc0-4f57737f7d5f"
513+ // },
514+ // recipient: {
515+ // id: "4e7ba2d7-2302-42f1-9fe4-6b75069f0fc9"
516+ // },
517+ // items: [
518+ // {
519+ // itemCode: "01010101",
520+ // quantity: 1,
521+ // unitOfMeasurementCode: "ACT",
522+ // description: "Venta",
523+ // unitPrice: 1230.00,
524+ // taxObjectCode: "02",
525+ // itemSku: "venta0001",
526+ // itemTaxes: [
527+ // {
528+ // taxCode: "002", // IVA
529+ // taxTypeCode: "Tasa",
530+ // taxRate: "0.160000", // 16%
531+ // taxFlagCode: "T" // Traslado
532+ // }
533+ // ]
534+ // }
535+ // ]
536+ // };
537+
538+ // const apiResponse = await client.invoices.create(globalInvoiceByReferences);
539+ // console.log('apiResponse:', apiResponse);
540540
541541
542542
@@ -576,6 +576,38 @@ async function main() : Promise<void> {
576576 // const apiResponse = await client.invoices.create(invoiceByReferences);
577577 // console.log('apiResponse:', apiResponse);
578578
579+ // Crear factura de ingreso con precios dinamicos
580+ // const invoiceByReferences: Invoice = {
581+ // versionCode: "4.0",
582+ // series: "F",
583+ // date: DateTime.now().toFormat("yyyy-MM-dd'T'HH:mm:ss"),
584+ // paymentFormCode: "01",
585+ // currencyCode: "MXN",
586+ // typeCode: "I",
587+ // expeditionZipCode: "42501",
588+ // paymentMethodCode: "PUE",
589+ // exchangeRate: 1,
590+ // exportCode: "01",
591+ // issuer: {
592+ // id: "3f3478b4-60fd-459e-8bfc-f8239fc96257"
593+ // // No es necesario incluir otros datos del emisor al usar el ID
594+ // },
595+ // recipient: {
596+ // id: "96b46762-d246-4a67-a562-510a25dbafa9"
597+ // // No es necesario incluir otros datos del receptor al usar el ID
598+ // },
599+ // items: [
600+ // {
601+ // id: "114a4be5-fb65-40b2-a762-ff0c55c6ebfa", // ID del producto/servicio
602+ // quantity: 1, // Solo es necesario especificar la cantidad
603+ // unitPrice: 200, // precio dinámico
604+ // }
605+ // ]
606+ // };
607+
608+ // const apiResponse = await client.invoices.create(invoiceByReferences);
609+ // console.log('apiResponse:', apiResponse);
610+
579611
580612 // Crear nota de crédito por valores
581613 // const creditNote: Invoice = {
@@ -686,6 +718,45 @@ async function main() : Promise<void> {
686718
687719
688720
721+ // Crear nota de crédito por referencias con precios dinamicos
722+ // const creditNoteByReferences: Invoice = {
723+ // versionCode: "4.0",
724+ // series: "CN",
725+ // date: DateTime.now().toFormat("yyyy-MM-dd'T'HH:mm:ss"),
726+ // paymentFormCode: "03",
727+ // currencyCode: "MXN",
728+ // typeCode: "E", // Tipo E para notas de crédito (Egreso)
729+ // expeditionZipCode: "01160",
730+ // paymentMethodCode: "PUE",
731+ // exchangeRate: 1,
732+ // exportCode: "01",
733+ // issuer: {
734+ // id: "3f3478b4-60fd-459e-8bfc-f8239fc96257" // Solo se necesita el ID del emisor
735+ // },
736+ // recipient: {
737+ // id: "96b46762-d246-4a67-a562-510a25dbafa9" // Solo se necesita el ID del receptor
738+ // },
739+ // // Importante: Las facturas relacionadas siempre son necesarias para notas de crédito
740+ // relatedInvoices: [
741+ // {
742+ // uuid: "5FB2822E-396D-4725-8521-CDC4BDD20CCF",
743+ // relationshipTypeCode: "01" // 01 - Nota de crédito de los documentos relacionados
744+ // }
745+ // ],
746+ // items: [
747+ // {
748+ // id: "114a4be5-fb65-40b2-a762-ff0c55c6ebfa", // ID del producto/servicio
749+ // quantity: 0.5, // La cantidad que se está acreditando/devolviendo
750+ // unitPrice: 250, // precio dinámico
751+ // }
752+ // ]
753+ // };
754+
755+ // const apiResponse = await client.invoices.create(creditNoteByReferences);
756+ // console.log('apiResponse:', apiResponse);
757+
758+
759+
689760 // Crear un complemento de pago por valores
690761 // const invoice = {
691762 // versionCode: "4.0",
0 commit comments