-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: crea ejemplo json de movimientos
- Loading branch information
1 parent
00679b1
commit 45a9731
Showing
4 changed files
with
136 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
{ | ||
"id": 0, | ||
"producto": { | ||
"id": 0, | ||
"codigo": "PROD001", | ||
"nombre": "", | ||
"tipo": "Producto", | ||
"claveSat": "", | ||
"datosExtra": {} | ||
}, | ||
"almacen": { | ||
"id": 0, | ||
"codigo": "ALMACENPRUEBA", | ||
"nombre": "", | ||
"datosExtra": {} | ||
}, | ||
"unidades": 1, | ||
"precio": 100, | ||
"subtotal": 0, | ||
"descuentos": { | ||
"descuento1": { | ||
"tasa": 10, | ||
"importe": 0 | ||
}, | ||
"descuento2": { | ||
"tasa": 0, | ||
"importe": 0 | ||
}, | ||
"descuento3": { | ||
"tasa": 0, | ||
"importe": 0 | ||
}, | ||
"descuento4": { | ||
"tasa": 0, | ||
"importe": 0 | ||
}, | ||
"descuento5": { | ||
"tasa": 0, | ||
"importe": 0 | ||
} | ||
}, | ||
"impuestos": { | ||
"impuesto1": { | ||
"tasa": 16, | ||
"importe": 0 | ||
}, | ||
"impuesto2": { | ||
"tasa": 0, | ||
"importe": 0 | ||
}, | ||
"impuesto3": { | ||
"tasa": 0, | ||
"importe": 0 | ||
} | ||
}, | ||
"retenciones": { | ||
"retencion1": { | ||
"tasa": 0, | ||
"importe": 0 | ||
}, | ||
"retencion2": { | ||
"tasa": 0, | ||
"importe": 0 | ||
} | ||
}, | ||
"total": 0, | ||
"referencia": "Referencia mov", | ||
"observaciones": "Observaciones del movimiento", | ||
"seriesCapas": [ | ||
{ | ||
"unidades": 0, | ||
"tipoCambio": 0, | ||
"series": "", | ||
"pedimento": "", | ||
"agencia": "", | ||
"fechaPedimento": null, | ||
"numeroLote": "", | ||
"fechaFabricacion": null, | ||
"fechaCaducidad": null | ||
} | ||
], | ||
"datosExtra": { | ||
"CTEXTOEXTRA1": "Texto extra 1", | ||
"CTEXTOEXTRA2": "Texto extra 2", | ||
"CTEXTOEXTRA3": "Texto extra 3" | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
samples/Api.Sdk.ConsoleApp/JsonFactories/MovimientoFactory.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using System.Text.Json; | ||
using ARSoftware.Contpaqi.Comercial.Sdk.Abstractions.Models; | ||
using ARSoftware.Contpaqi.Comercial.Sdk.Abstractions.ValueObjects; | ||
using ARSoftware.Contpaqi.Comercial.Sql.Models.Empresa; | ||
|
||
namespace Api.Sdk.ConsoleApp.JsonFactories; | ||
|
||
public class MovimientoFactory | ||
{ | ||
public static Movimiento GetModeloPrueba() | ||
{ | ||
return new Movimiento | ||
{ | ||
Producto = new Producto { Codigo = ProductoFactory.CodigoPrueba }, | ||
Almacen = new Almacen { Codigo = AlmacenFactory.CodigoPrueba }, | ||
Unidades = 1, | ||
Precio = 100, | ||
Impuestos = new ImpuestosMovimiento { Impuesto1 = new Impuesto { Tasa = 16 } }, | ||
Descuentos = new DescuentosMovimiento { Descuento1 = new Descuento { Tasa = 10 } }, | ||
Retenciones = new RetencionesMovimiento { Retencion1 = new Retencion(), Retencion2 = new Retencion() }, | ||
Referencia = "Referencia mov", | ||
Observaciones = "Observaciones del movimiento", | ||
SeriesCapas = new List<SeriesCapas> { new() }, | ||
DatosExtra = GetDatosExtraPrueba() | ||
}; | ||
} | ||
|
||
public static Dictionary<string, string> GetDatosExtraPrueba() | ||
{ | ||
return new Dictionary<string, string> | ||
{ | ||
{ nameof(admMovimientos.CTEXTOEXTRA1), "Texto extra 1" }, | ||
{ nameof(admMovimientos.CTEXTOEXTRA2), "Texto extra 2" }, | ||
{ nameof(admMovimientos.CTEXTOEXTRA3), "Texto extra 3" } | ||
}; | ||
} | ||
|
||
public static void CearJson(string directory) | ||
{ | ||
Directory.CreateDirectory(directory); | ||
|
||
JsonSerializerOptions options = FactoryExtensions.GetJsonSerializerOptions(); | ||
|
||
File.WriteAllText(Path.Combine(directory, $"{nameof(Movimiento)}.json"), JsonSerializer.Serialize(GetModeloPrueba(), options)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters