diff --git a/FiscalApi.Samples.NetFramework/BillOfLadingReferenceForm.Designer.cs b/FiscalApi.Samples.NetFramework/BillOfLadingReferenceForm.Designer.cs new file mode 100644 index 0000000..a0e1bdf --- /dev/null +++ b/FiscalApi.Samples.NetFramework/BillOfLadingReferenceForm.Designer.cs @@ -0,0 +1,416 @@ +namespace FiscalApi.Samples.NetFramework +{ + partial class BillOfLadingReferenceForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.button3 = new System.Windows.Forms.Button(); + this.button4 = new System.Windows.Forms.Button(); + this.button5 = new System.Windows.Forms.Button(); + this.button6 = new System.Windows.Forms.Button(); + this.button7 = new System.Windows.Forms.Button(); + this.button8 = new System.Windows.Forms.Button(); + this.button9 = new System.Windows.Forms.Button(); + this.button10 = new System.Windows.Forms.Button(); + this.button11 = new System.Windows.Forms.Button(); + this.button12 = new System.Windows.Forms.Button(); + this.button13 = new System.Windows.Forms.Button(); + this.button14 = new System.Windows.Forms.Button(); + this.button15 = new System.Windows.Forms.Button(); + this.button16 = new System.Windows.Forms.Button(); + this.button17 = new System.Windows.Forms.Button(); + this.button18 = new System.Windows.Forms.Button(); + this.button19 = new System.Windows.Forms.Button(); + this.button20 = new System.Windows.Forms.Button(); + this.button21 = new System.Windows.Forms.Button(); + this.button22 = new System.Windows.Forms.Button(); + this.button23 = new System.Windows.Forms.Button(); + this.button24 = new System.Windows.Forms.Button(); + this.button25 = new System.Windows.Forms.Button(); + this.groupBox1.SuspendLayout(); + this.SuspendLayout(); + // + // groupBox1 + // + this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox1.Controls.Add(this.button1); + this.groupBox1.Controls.Add(this.button2); + this.groupBox1.Controls.Add(this.button3); + this.groupBox1.Controls.Add(this.button4); + this.groupBox1.Controls.Add(this.button5); + this.groupBox1.Controls.Add(this.button6); + this.groupBox1.Controls.Add(this.button7); + this.groupBox1.Controls.Add(this.button8); + this.groupBox1.Controls.Add(this.button9); + this.groupBox1.Controls.Add(this.button10); + this.groupBox1.Controls.Add(this.button11); + this.groupBox1.Controls.Add(this.button12); + this.groupBox1.Controls.Add(this.button13); + this.groupBox1.Controls.Add(this.button14); + this.groupBox1.Controls.Add(this.button15); + this.groupBox1.Controls.Add(this.button16); + this.groupBox1.Controls.Add(this.button17); + this.groupBox1.Controls.Add(this.button18); + this.groupBox1.Controls.Add(this.button19); + this.groupBox1.Controls.Add(this.button20); + this.groupBox1.Controls.Add(this.button21); + this.groupBox1.Controls.Add(this.button22); + this.groupBox1.Controls.Add(this.button23); + this.groupBox1.Controls.Add(this.button24); + this.groupBox1.Controls.Add(this.button25); + this.groupBox1.Location = new System.Drawing.Point(12, 12); + this.groupBox1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.groupBox1.Size = new System.Drawing.Size(995, 430); + this.groupBox1.TabIndex = 0; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Carta Porte"; + // + // button1 - Factura ingreso autotransporte nacional + // + this.button1.Location = new System.Drawing.Point(5, 21); + this.button1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(189, 60); + this.button1.TabIndex = 1; + this.button1.Text = "Factura ingreso autotransporte nacional"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // button2 - Factura ingreso autotransporte nacional con impuestos + // + this.button2.Location = new System.Drawing.Point(203, 21); + this.button2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(189, 60); + this.button2.TabIndex = 2; + this.button2.Text = "Factura ingreso autotransporte nacional con impuestos"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // button3 - Factura ingreso autotransporte extranjero + // + this.button3.Location = new System.Drawing.Point(401, 21); + this.button3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(189, 60); + this.button3.TabIndex = 3; + this.button3.Text = "Factura ingreso autotransporte extranjero"; + this.button3.UseVisualStyleBackColor = true; + this.button3.Click += new System.EventHandler(this.button3_Click); + // + // button4 - Factura ingreso autotransporte internacional aduanero + // + this.button4.Location = new System.Drawing.Point(599, 21); + this.button4.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button4.Name = "button4"; + this.button4.Size = new System.Drawing.Size(189, 60); + this.button4.TabIndex = 4; + this.button4.Text = "Factura ingreso autotransporte internacional aduanero"; + this.button4.UseVisualStyleBackColor = true; + this.button4.Click += new System.EventHandler(this.button4_Click); + // + // button5 - Factura ingreso transporte ferroviario nacional + // + this.button5.Location = new System.Drawing.Point(797, 21); + this.button5.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button5.Name = "button5"; + this.button5.Size = new System.Drawing.Size(189, 60); + this.button5.TabIndex = 5; + this.button5.Text = "Factura ingreso transporte ferroviario nacional"; + this.button5.UseVisualStyleBackColor = true; + this.button5.Click += new System.EventHandler(this.button5_Click); + // + // button6 - Factura ingreso transporte ferroviario extranjero + // + this.button6.Location = new System.Drawing.Point(5, 89); + this.button6.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button6.Name = "button6"; + this.button6.Size = new System.Drawing.Size(189, 60); + this.button6.TabIndex = 6; + this.button6.Text = "Factura ingreso transporte ferroviario extranjero"; + this.button6.UseVisualStyleBackColor = true; + this.button6.Click += new System.EventHandler(this.button6_Click); + // + // button7 - Factura ingreso transporte ferroviario internacional aduanero + // + this.button7.Location = new System.Drawing.Point(203, 89); + this.button7.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button7.Name = "button7"; + this.button7.Size = new System.Drawing.Size(189, 60); + this.button7.TabIndex = 7; + this.button7.Text = "Factura ingreso transporte ferroviario internacional aduanero"; + this.button7.UseVisualStyleBackColor = true; + this.button7.Click += new System.EventHandler(this.button7_Click); + // + // button8 - Factura ingreso transporte aereo nacional + // + this.button8.Location = new System.Drawing.Point(401, 89); + this.button8.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button8.Name = "button8"; + this.button8.Size = new System.Drawing.Size(189, 60); + this.button8.TabIndex = 8; + this.button8.Text = "Factura ingreso transporte aereo nacional"; + this.button8.UseVisualStyleBackColor = true; + this.button8.Click += new System.EventHandler(this.button8_Click); + // + // button9 - Factura ingreso transporte aereo extranjero + // + this.button9.Location = new System.Drawing.Point(599, 89); + this.button9.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button9.Name = "button9"; + this.button9.Size = new System.Drawing.Size(189, 60); + this.button9.TabIndex = 9; + this.button9.Text = "Factura ingreso transporte aereo extranjero"; + this.button9.UseVisualStyleBackColor = true; + this.button9.Click += new System.EventHandler(this.button9_Click); + // + // button10 - Factura ingreso transporte aereo internacional aduanero + // + this.button10.Location = new System.Drawing.Point(797, 89); + this.button10.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button10.Name = "button10"; + this.button10.Size = new System.Drawing.Size(189, 60); + this.button10.TabIndex = 10; + this.button10.Text = "Factura ingreso transporte aereo internacional aduanero"; + this.button10.UseVisualStyleBackColor = true; + this.button10.Click += new System.EventHandler(this.button10_Click); + // + // button11 - Factura ingreso transporte maritimo nacional + // + this.button11.Location = new System.Drawing.Point(5, 157); + this.button11.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button11.Name = "button11"; + this.button11.Size = new System.Drawing.Size(189, 60); + this.button11.TabIndex = 11; + this.button11.Text = "Factura ingreso transporte maritimo nacional"; + this.button11.UseVisualStyleBackColor = true; + this.button11.Click += new System.EventHandler(this.button11_Click); + // + // button12 - Factura ingreso transporte maritimo extranjero + // + this.button12.Location = new System.Drawing.Point(203, 157); + this.button12.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button12.Name = "button12"; + this.button12.Size = new System.Drawing.Size(189, 60); + this.button12.TabIndex = 12; + this.button12.Text = "Factura ingreso transporte maritimo extranjero"; + this.button12.UseVisualStyleBackColor = true; + this.button12.Click += new System.EventHandler(this.button12_Click); + // + // button13 - Factura ingreso transporte maritimo internacional aduanero + // + this.button13.Location = new System.Drawing.Point(401, 157); + this.button13.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button13.Name = "button13"; + this.button13.Size = new System.Drawing.Size(189, 60); + this.button13.TabIndex = 13; + this.button13.Text = "Factura ingreso transporte maritimo internacional aduanero"; + this.button13.UseVisualStyleBackColor = true; + this.button13.Click += new System.EventHandler(this.button13_Click); + // + // button14 - Factura traslado autotransporte nacional + // + this.button14.Location = new System.Drawing.Point(599, 157); + this.button14.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button14.Name = "button14"; + this.button14.Size = new System.Drawing.Size(189, 60); + this.button14.TabIndex = 14; + this.button14.Text = "Factura traslado autotransporte nacional"; + this.button14.UseVisualStyleBackColor = true; + this.button14.Click += new System.EventHandler(this.button14_Click); + // + // button15 - Factura traslado autotransporte extranjero + // + this.button15.Location = new System.Drawing.Point(797, 157); + this.button15.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button15.Name = "button15"; + this.button15.Size = new System.Drawing.Size(189, 60); + this.button15.TabIndex = 15; + this.button15.Text = "Factura traslado autotransporte extranjero"; + this.button15.UseVisualStyleBackColor = true; + this.button15.Click += new System.EventHandler(this.button15_Click); + // + // button16 - Factura traslado autotransporte internacional aduanero + // + this.button16.Location = new System.Drawing.Point(5, 225); + this.button16.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button16.Name = "button16"; + this.button16.Size = new System.Drawing.Size(189, 60); + this.button16.TabIndex = 16; + this.button16.Text = "Factura traslado autotransporte internacional aduanero"; + this.button16.UseVisualStyleBackColor = true; + this.button16.Click += new System.EventHandler(this.button16_Click); + // + // button17 - Factura traslado transporte ferroviario nacional + // + this.button17.Location = new System.Drawing.Point(203, 225); + this.button17.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button17.Name = "button17"; + this.button17.Size = new System.Drawing.Size(189, 60); + this.button17.TabIndex = 17; + this.button17.Text = "Factura traslado transporte ferroviario nacional"; + this.button17.UseVisualStyleBackColor = true; + this.button17.Click += new System.EventHandler(this.button17_Click); + // + // button18 - Factura traslado transporte ferroviario extranjero + // + this.button18.Location = new System.Drawing.Point(401, 225); + this.button18.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button18.Name = "button18"; + this.button18.Size = new System.Drawing.Size(189, 60); + this.button18.TabIndex = 18; + this.button18.Text = "Factura traslado transporte ferroviario extranjero"; + this.button18.UseVisualStyleBackColor = true; + this.button18.Click += new System.EventHandler(this.button18_Click); + // + // button19 - Factura traslado transporte ferroviario internacional aduanero + // + this.button19.Location = new System.Drawing.Point(599, 225); + this.button19.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button19.Name = "button19"; + this.button19.Size = new System.Drawing.Size(189, 60); + this.button19.TabIndex = 19; + this.button19.Text = "Factura traslado transporte ferroviario inernacional aduanero"; + this.button19.UseVisualStyleBackColor = true; + this.button19.Click += new System.EventHandler(this.button19_Click); + // + // button20 - Factura traslado transporte aereo nacional + // + this.button20.Location = new System.Drawing.Point(797, 225); + this.button20.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button20.Name = "button20"; + this.button20.Size = new System.Drawing.Size(189, 60); + this.button20.TabIndex = 20; + this.button20.Text = "Factura traslado transporte aereo nacional"; + this.button20.UseVisualStyleBackColor = true; + this.button20.Click += new System.EventHandler(this.button20_Click); + // + // button21 - Factura traslado transporte aereo extranjero + // + this.button21.Location = new System.Drawing.Point(5, 293); + this.button21.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button21.Name = "button21"; + this.button21.Size = new System.Drawing.Size(189, 60); + this.button21.TabIndex = 21; + this.button21.Text = "Factura traslado transporte aereo extranjero"; + this.button21.UseVisualStyleBackColor = true; + this.button21.Click += new System.EventHandler(this.button21_Click); + // + // button22 - Factura traslado transporte aereo internacional aduanero + // + this.button22.Location = new System.Drawing.Point(203, 293); + this.button22.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button22.Name = "button22"; + this.button22.Size = new System.Drawing.Size(189, 60); + this.button22.TabIndex = 22; + this.button22.Text = "Factura traslado transporte aereo internacional aduanero"; + this.button22.UseVisualStyleBackColor = true; + this.button22.Click += new System.EventHandler(this.button22_Click); + // + // button23 - Factura traslado transporte maritimo nacional + // + this.button23.Location = new System.Drawing.Point(401, 293); + this.button23.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button23.Name = "button23"; + this.button23.Size = new System.Drawing.Size(189, 60); + this.button23.TabIndex = 23; + this.button23.Text = "Factura traslado transporte maritimo nacional"; + this.button23.UseVisualStyleBackColor = true; + this.button23.Click += new System.EventHandler(this.button23_Click); + // + // button24 - Factura traslado transporte maritimo extranjero + // + this.button24.Location = new System.Drawing.Point(599, 293); + this.button24.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button24.Name = "button24"; + this.button24.Size = new System.Drawing.Size(189, 60); + this.button24.TabIndex = 24; + this.button24.Text = "Factura traslado transporte maritimo extranjero"; + this.button24.UseVisualStyleBackColor = true; + this.button24.Click += new System.EventHandler(this.button24_Click); + // + // button25 - Factura traslado transporte maritimo internacional aduanero + // + this.button25.Location = new System.Drawing.Point(797, 293); + this.button25.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button25.Name = "button25"; + this.button25.Size = new System.Drawing.Size(189, 60); + this.button25.TabIndex = 25; + this.button25.Text = "Factura traslado transporte maritimo internacional aduanero"; + this.button25.UseVisualStyleBackColor = true; + this.button25.Click += new System.EventHandler(this.button25_Click); + // + // BillOfLadingReferenceForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1019, 454); + this.Controls.Add(this.groupBox1); + this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.Name = "BillOfLadingReferenceForm"; + this.Text = "BillOfLadingReferenceForm"; + this.groupBox1.ResumeLayout(false); + this.ResumeLayout(false); + } + + #endregion + + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.Button button3; + private System.Windows.Forms.Button button4; + private System.Windows.Forms.Button button5; + private System.Windows.Forms.Button button6; + private System.Windows.Forms.Button button7; + private System.Windows.Forms.Button button8; + private System.Windows.Forms.Button button9; + private System.Windows.Forms.Button button10; + private System.Windows.Forms.Button button11; + private System.Windows.Forms.Button button12; + private System.Windows.Forms.Button button13; + private System.Windows.Forms.Button button14; + private System.Windows.Forms.Button button15; + private System.Windows.Forms.Button button16; + private System.Windows.Forms.Button button17; + private System.Windows.Forms.Button button18; + private System.Windows.Forms.Button button19; + private System.Windows.Forms.Button button20; + private System.Windows.Forms.Button button21; + private System.Windows.Forms.Button button22; + private System.Windows.Forms.Button button23; + private System.Windows.Forms.Button button24; + private System.Windows.Forms.Button button25; + } +} \ No newline at end of file diff --git a/FiscalApi.Samples.NetFramework/BillOfLadingReferenceForm.cs b/FiscalApi.Samples.NetFramework/BillOfLadingReferenceForm.cs new file mode 100644 index 0000000..c5a8347 --- /dev/null +++ b/FiscalApi.Samples.NetFramework/BillOfLadingReferenceForm.cs @@ -0,0 +1,3029 @@ +using Fiscalapi.Common; +using Fiscalapi.Models; +using Fiscalapi.Models.BillOfLading; +using Fiscalapi.Services; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace FiscalApi.Samples.NetFramework +{ + public partial class BillOfLadingReferenceForm : Form + { + private FiscalapiSettings _settings; + public BillOfLadingReferenceForm(FiscalapiSettings settings) + { + InitializeComponent(); + _settings = settings; + } + + private string _certEscuelaKemper = "MIIFsDCCA5igAwIBAgIUMzAwMDEwMDAwMDA1MDAwMDM0MTYwDQYJKoZIhvcNAQELBQAwggErMQ8wDQYDVQQDDAZBQyBVQVQxLjAsBgNVBAoMJVNFUlZJQ0lPIERFIEFETUlOSVNUUkFDSU9OIFRSSUJVVEFSSUExGjAYBgNVBAsMEVNBVC1JRVMgQXV0aG9yaXR5MSgwJgYJKoZIhvcNAQkBFhlvc2Nhci5tYXJ0aW5lekBzYXQuZ29iLm14MR0wGwYDVQQJDBQzcmEgY2VycmFkYSBkZSBjYWxpejEOMAwGA1UEEQwFMDYzNzAxCzAJBgNVBAYTAk1YMRkwFwYDVQQIDBBDSVVEQUQgREUgTUVYSUNPMREwDwYDVQQHDAhDT1lPQUNBTjERMA8GA1UELRMIMi41LjQuNDUxJTAjBgkqhkiG9w0BCQITFnJlc3BvbnNhYmxlOiBBQ0RNQS1TQVQwHhcNMjMwNTE4MTE0MzUxWhcNMjcwNTE4MTE0MzUxWjCB1zEnMCUGA1UEAxMeRVNDVUVMQSBLRU1QRVIgVVJHQVRFIFNBIERFIENWMScwJQYDVQQpEx5FU0NVRUxBIEtFTVBFUiBVUkdBVEUgU0EgREUgQ1YxJzAlBgNVBAoTHkVTQ1VFTEEgS0VNUEVSIFVSR0FURSBTQSBERSBDVjElMCMGA1UELRMcRUtVOTAwMzE3M0M5IC8gVkFEQTgwMDkyN0RKMzEeMBwGA1UEBRMVIC8gVkFEQTgwMDkyN0hTUlNSTDA1MRMwEQYDVQQLEwpTdWN1cnNhbCAxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtmecO6n2GS0zL025gbHGQVxznPDICoXzR2uUngz4DqxVUC/w9cE6FxSiXm2ap8Gcjg7wmcZfm85EBaxCx/0J2u5CqnhzIoGCdhBPuhWQnIh5TLgj/X6uNquwZkKChbNe9aeFirU/JbyN7Egia9oKH9KZUsodiM/pWAH00PCtoKJ9OBcSHMq8Rqa3KKoBcfkg1ZrgueffwRLws9yOcRWLb02sDOPzGIm/jEFicVYt2Hw1qdRE5xmTZ7AGG0UHs+unkGjpCVeJ+BEBn0JPLWVvDKHZAQMj6s5Bku35+d/MyATkpOPsGT/VTnsouxekDfikJD1f7A1ZpJbqDpkJnss3vQIDAQABox0wGzAMBgNVHRMBAf8EAjAAMAsGA1UdDwQEAwIGwDANBgkqhkiG9w0BAQsFAAOCAgEAFaUgj5PqgvJigNMgtrdXZnbPfVBbukAbW4OGnUhNrA7SRAAfv2BSGk16PI0nBOr7qF2mItmBnjgEwk+DTv8Zr7w5qp7vleC6dIsZFNJoa6ZndrE/f7KO1CYruLXr5gwEkIyGfJ9NwyIagvHHMszzyHiSZIA850fWtbqtythpAliJ2jF35M5pNS+YTkRB+T6L/c6m00ymN3q9lT1rB03YywxrLreRSFZOSrbwWfg34EJbHfbFXpCSVYdJRfiVdvHnewN0r5fUlPtR9stQHyuqewzdkyb5jTTw02D2cUfL57vlPStBj7SEi3uOWvLrsiDnnCIxRMYJ2UA2ktDKHk+zWnsDmaeleSzonv2CHW42yXYPCvWi88oE1DJNYLNkIjua7MxAnkNZbScNw01A6zbLsZ3y8G6eEYnxSTRfwjd8EP4kdiHNJftm7Z4iRU7HOVh79/lRWB+gd171s3d/mI9kte3MRy6V8MMEMCAnMboGpaooYwgAmwclI2XZCczNWXfhaWe0ZS5PmytD/GDpXzkX0oEgY9K/uYo5V77NdZbGAjmyi8cE2B2ogvyaN2XfIInrZPgEffJ4AB7kFA2mwesdLOCh0BLD9itmCve3A1FGR4+stO2ANUoiI3w3Tv2yQSg4bjeDlJ08lXaaFCLW2peEXMXjQUk7fmpb5MNuOUTW6BE="; + private string _keyEscuelaKemper = "MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQIAgEAAoIBAQACAggAMBQGCCqGSIb3DQMHBAgwggS/AgEAMASCBMh4EHl7aNSCaMDA1VlRoXCZ5UUmqErAbucoZQObOaLUEm+I+QZ7Y8Giupo+F1XWkLvAsdk/uZlJcTfKLJyJbJwsQYbSpLOCLataZ4O5MVnnmMbfG//NKJn9kSMvJQZhSwAwoGLYDm1ESGezrvZabgFJnoQv8Si1nAhVGTk9FkFBesxRzq07dmZYwFCnFSX4xt2fDHs1PMpQbeq83aL/PzLCce3kxbYSB5kQlzGtUYayiYXcu0cVRu228VwBLCD+2wTDDoCmRXtPesgrLKUR4WWWb5N2AqAU1mNDC+UEYsENAerOFXWnmwrcTAu5qyZ7GsBMTpipW4Dbou2yqQ0lpA/aB06n1kz1aL6mNqGPaJ+OqoFuc8Ugdhadd+MmjHfFzoI20SZ3b2geCsUMNCsAd6oXMsZdWm8lzjqCGWHFeol0ik/xHMQvuQkkeCsQ28PBxdnUgf7ZGer+TN+2ZLd2kvTBOk6pIVgy5yC6cZ+o1Tloql9hYGa6rT3xcMbXlW+9e5jM2MWXZliVW3ZhaPjptJFDbIfWxJPjz4QvKyJk0zok4muv13Iiwj2bCyefUTRz6psqI4cGaYm9JpscKO2RCJN8UluYGbbWmYQU+Int6LtZj/lv8p6xnVjWxYI+rBPdtkpfFYRp+MJiXjgPw5B6UGuoruv7+vHjOLHOotRo+RdjZt7NqL9dAJnl1Qb2jfW6+d7NYQSI/bAwxO0sk4taQIT6Gsu/8kfZOPC2xk9rphGqCSS/4q3Os0MMjA1bcJLyoWLp13pqhK6bmiiHw0BBXH4fbEp4xjSbpPx4tHXzbdn8oDsHKZkWh3pPC2J/nVl0k/yF1KDVowVtMDXE47k6TGVcBoqe8PDXCG9+vjRpzIidqNo5qebaUZu6riWMWzldz8x3Z/jLWXuDiM7/Yscn0Z2GIlfoeyz+GwP2eTdOw9EUedHjEQuJY32bq8LICimJ4Ht+zMJKUyhwVQyAER8byzQBwTYmYP5U0wdsyIFitphw+/IH8+v08Ia1iBLPQAeAvRfTTIFLCs8foyUrj5Zv2B/wTYIZy6ioUM+qADeXyo45uBLLqkN90Rf6kiTqDld78NxwsfyR5MxtJLVDFkmf2IMMJHTqSfhbi+7QJaC11OOUJTD0v9wo0X/oO5GvZhe0ZaGHnm9zqTopALuFEAxcaQlc4R81wjC4wrIrqWnbcl2dxiBtD73KW+wcC9ymsLf4I8BEmiN25lx/OUc1IHNyXZJYSFkEfaxCEZWKcnbiyf5sqFSSlEqZLc4lUPJFAoP6s1FHVcyO0odWqdadhRZLZC9RCzQgPlMRtji/OXy5phh7diOBZv5UYp5nb+MZ2NAB/eFXm2JLguxjvEstuvTDmZDUb6Uqv++RdhO5gvKf/AcwU38ifaHQ9uvRuDocYwVxZS2nr9rOwZ8nAh+P2o4e0tEXjxFKQGhxXYkn75H3hhfnFYjik/2qunHBBZfcdG148MaNP6DjX33M238T9Zw/GyGx00JMogr2pdP4JAErv9a5yt4YR41KGf8guSOUbOXVARw6+ybh7+meb7w4BeTlj3aZkv8tVGdfIt3lrwVnlbzhLjeQY6PplKp3/a5Kr5yM0T4wJoKQQ6v3vSNmrhpbuAtKxpMILe8CQoo="; + + private List CreateTaxCredentials() + { + return new List + { + new TaxCredential + { + Base64File = _certEscuelaKemper, + FileType = FileType.CertificateCsd, + Password = "12345678a" + }, + new TaxCredential + { + Base64File = _keyEscuelaKemper, + FileType = FileType.PrivateKeyCsd, + Password = "12345678a" + } + }; + } + + private InvoiceIssuer CreateIssuer() + { + return new InvoiceIssuer { Id = "0e82a655-5f0c-4e07-abab-8f322e4123ef" }; + } + + private Autotransporte CreateAutotransporte() + { + return new Autotransporte + { + PermSCTId = "TPAF01", + NumPermisoSCT = "NumPermisoSCT1", + ConfigVehicularId = "VL", + PesoBrutoVehicular = 1, + PlacaVM = "plac892", + AnioModeloVM = 2020, + AseguraRespCivil = "AseguraRespCivil", + PolizaRespCivil = "123456789", + Remolques = new List + { + new Remolque { SubTipoRemId = "CTR004", Placa = "VL45K98" } + } + }; + } + + private Mercancia CreateMercancia(bool includeDocumentacionAduanera = false) + { + var mercancia = new Mercancia + { + BienesTranspId = "11121900", + Descripcion = "Accesorios de equipo de telefonía", + Cantidad = 1.0m, + ClaveUnidadId = "XBX", + MaterialPeligrosoId = "No", + DenominacionGenericaProd = "DenominacionGenericaProd1", + DenominacionDistintivaProd = "DenominacionDistintivaProd1", + Fabricante = "Fabricante1", + FechaCaducidad = DateTime.Parse("2003-04-02T00:00:00"), + LoteMedicamento = "LoteMedic1", + FormaFarmaceuticaId = "01", + CondicionesEspTranspId = "01", + RegistroSanitarioFolioAutorizacion = "RegistroSanita1", + PesoEnKg = 1, + FraccionArancelariaId = "6309000100", + CantidadTransporta = new List + { + new CantidadTransporta { Cantidad = 1, IdOrigen = "OR101010", IdDestino = "DE202020" } + } + }; + + if (includeDocumentacionAduanera) + { + mercancia.TipoMateriaId = "05"; + mercancia.DescripcionMateria = "otramateria"; + mercancia.DocumentacionAduanera = new List + { + new DocumentoAduanero + { + TipoDocumentoId = "01", + NumPedimento = "23 43 0472 8000448", + RfcImpo = "EKU9003173C9" + } + }; + } + + return mercancia; + } + + private Invoice CreateBaseInvoice(string taxObjectCode = "01", List itemTaxes = null) + { + return new Invoice + { + VersionCode = "4.0", + PaymentFormCode = "01", + PaymentMethodCode = "PUE", + CurrencyCode = "MXN", + TypeCode = "I", + ExpeditionZipCode = "42501", + Series = "SerieCCP31", + Date = DateTime.Now, + ExchangeRate = 1, + ExportCode = "01", + Issuer = CreateIssuer(), + Items = new List + { + new InvoiceItem + { + ItemCode = "78101800", + ItemSku = "UT421511", + Quantity = 1, + UnitOfMeasurementCode = "H87", + Description = "Transporte de carga por carretera", + UnitPrice = 100.00m, + Discount = 0, + TaxObjectCode = taxObjectCode, + ItemTaxes = itemTaxes ?? new List() + } + } + }; + } + + // button1: Factura ingreso autotransporte nacional + private async void button1_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseInvoice(); + invoice.Recipient = new InvoiceRecipient { Id = "37f7c342-d9a6-4881-9620-0da769b50ce5" }; + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "No", + TotalDistRec = 1.0m, + RegistroISTMOId = "Sí", + UbicacionPoloOrigenId = "01", + UbicacionPoloDestinoId = "01", + UnidadPesoId = "XBX", + LogisticaInversaRecoleccionDevolucionId = "Sí", + Ubicaciones = new List + { + new Ubicacion + { + TipoUbicacion = "Origen", + IdUbicacion = "OR101010", + RfcRemitenteDestinatario = "URE180429TM6", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario1", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:00"), + Domicilio = new Domicilio + { + Calle = "Calle1", NumeroExterior = "211", NumeroInterior = "212", + ColoniaId = "1957", LocalidadId = "13", Referencia = "casa blanca", + MunicipioId = "011", EstadoId = "CMX", PaisId = "MEX", CodigoPostalId = "13250" + } + }, + new Ubicacion + { + TipoUbicacion = "Destino", + IdUbicacion = "DE202020", + RfcRemitenteDestinatario = "URE180429TM6", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario2", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + DistanciaRecorrida = 1, + Domicilio = new Domicilio + { + Calle = "Calle2", NumeroExterior = "214", NumeroInterior = "215", + ColoniaId = "0347", LocalidadId = "23", Referencia = "casa negra", + MunicipioId = "004", EstadoId = "COA", PaisId = "MEX", CodigoPostalId = "25350" + } + } + }, + Mercancias = new List { CreateMercancia() }, + Autotransporte = CreateAutotransporte(), + TiposFigura = new List + { + new TipoFigura + { + TipoFiguraId = "01", + RfcFigura = "URE180429TM6", + NumLicencia = "NumLicencia1", + NombreFigura = "NombreFigura1", + Domicilio = new Domicilio + { + Calle = "Calle1", NumeroExterior = "NumeroExterior1", NumeroInterior = "NumeroInterior1", + ColoniaId = "Colonia1", LocalidadId = "Localidad1", Referencia = "Referencia1", + MunicipioId = "Municipio1", EstadoId = "Estado1", PaisId = "AFG", CodigoPostalId = "CodigoPosta1" + } + } + } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button2: Factura ingreso autotransporte nacional con impuestos + private async void button2_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var itemTaxes = new List + { + new InvoiceItemTax { TaxCode = "002", TaxTypeCode = "Tasa", TaxRate = 0.160000m, TaxFlagCode = "T" }, + new InvoiceItemTax { TaxCode = "002", TaxTypeCode = "Tasa", TaxRate = 0.040000m, TaxFlagCode = "R" } + }; + + var invoice = CreateBaseInvoice("02", itemTaxes); + invoice.Items[0].UnitPrice = 26232.75m; + invoice.Recipient = new InvoiceRecipient { Id = "37f7c342-d9a6-4881-9620-0da769b50ce5" }; + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "No", + TotalDistRec = 1, + RegistroISTMOId = "Sí", + UbicacionPoloOrigenId = "01", + UbicacionPoloDestinoId = "01", + UnidadPesoId = "XBX", + LogisticaInversaRecoleccionDevolucionId = "Sí", + Ubicaciones = new List + { + new Ubicacion + { + TipoUbicacion = "Origen", + IdUbicacion = "OR101010", + RfcRemitenteDestinatario = "URE180429TM6", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario1", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:00"), + Domicilio = new Domicilio + { + Calle = "Calle1", NumeroExterior = "211", NumeroInterior = "212", + ColoniaId = "1957", LocalidadId = "13", Referencia = "casa blanca", + MunicipioId = "011", EstadoId = "CMX", PaisId = "MEX", CodigoPostalId = "13250" + } + }, + new Ubicacion + { + TipoUbicacion = "Destino", + IdUbicacion = "DE202020", + RfcRemitenteDestinatario = "URE180429TM6", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario2", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + DistanciaRecorrida = 1, + Domicilio = new Domicilio + { + Calle = "Calle2", NumeroExterior = "214", NumeroInterior = "215", + ColoniaId = "0347", LocalidadId = "23", Referencia = "casa negra", + MunicipioId = "004", EstadoId = "COA", PaisId = "MEX", CodigoPostalId = "25350" + } + } + }, + Mercancias = new List { CreateMercancia() }, + Autotransporte = CreateAutotransporte(), + TiposFigura = new List + { + new TipoFigura + { + TipoFiguraId = "01", + RfcFigura = "URE180429TM6", + NumLicencia = "NumLicencia1", + NombreFigura = "NombreFigura1", + Domicilio = new Domicilio + { + Calle = "Calle1", NumeroExterior = "NumeroExterior1", NumeroInterior = "NumeroInterior1", + ColoniaId = "Colonia1", LocalidadId = "Localidad1", Referencia = "Referencia1", + MunicipioId = "Municipio1", EstadoId = "Estado1", PaisId = "AFG", CodigoPostalId = "CodigoPosta1" + } + } + } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button3: Factura ingreso autotransporte extranjero + private async void button3_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseInvoice(); + invoice.Recipient = new InvoiceRecipient { Id = "37f7c342-d9a6-4881-9620-0da769b50ce5" }; + + var domicilioUSA = new Domicilio + { + Calle = "ST", NumeroExterior = "214", ColoniaId = "N/A", + Referencia = "WHITE HOUSE", MunicipioId = "N/A", EstadoId = "TX", + PaisId = "USA", CodigoPostalId = "N/A" + }; + + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "Sí", + EntradaSalidaMercId = "Salida", + PaisOrigenDestinoId = "USA", + ViaEntradaSalidaId = "01", + TotalDistRec = 1, + RegistroISTMOId = "Sí", + UbicacionPoloOrigenId = "01", + UbicacionPoloDestinoId = "01", + UnidadPesoId = "XBX", + LogisticaInversaRecoleccionDevolucionId = "Sí", + RegimenAduaneros = new List + { + new RegimenAduanero { RegimenAduaneroId = "EXD" } + }, + Ubicaciones = new List + { + new Ubicacion + { + TipoUbicacion = "Origen", + IdUbicacion = "OR101010", + RfcRemitenteDestinatario = "XEXX010101000", + NumRegIdTrib = "01010101", + ResidenciaFiscalId = "USA", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + Domicilio = domicilioUSA + }, + new Ubicacion + { + TipoUbicacion = "Destino", + IdUbicacion = "DE202020", + RfcRemitenteDestinatario = "XEXX010101000", + NumRegIdTrib = "01010101", + ResidenciaFiscalId = "USA", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + DistanciaRecorrida = 1, + Domicilio = domicilioUSA + } + }, + Mercancias = new List + { + new Mercancia + { + BienesTranspId = "11121900", + Descripcion = "Accesorios de equipo de telefonía", + Cantidad = 1.0m, + ClaveUnidadId = "XBX", + MaterialPeligrosoId = "No", + DenominacionGenericaProd = "DenominacionGenericaProd1", + DenominacionDistintivaProd = "DenominacionDistintivaProd1", + Fabricante = "Fabricante1", + FechaCaducidad = DateTime.Parse("2003-04-02T00:00:00"), + LoteMedicamento = "LoteMedic1", + FormaFarmaceuticaId = "01", + CondicionesEspTranspId = "01", + RegistroSanitarioFolioAutorizacion = "RegistroSanita1", + PesoEnKg = 1, + FraccionArancelariaId = "6309000100", + TipoMateriaId = "05", + DescripcionMateria = "otramateria", + CantidadTransporta = new List + { + new CantidadTransporta { Cantidad = 1, IdOrigen = "OR101010", IdDestino = "DE202020" } + } + } + }, + Autotransporte = CreateAutotransporte(), + TiposFigura = new List + { + new TipoFigura + { + TipoFiguraId = "01", + RfcFigura = "EKU9003173C9", + NumLicencia = "NumLicencia1", + NombreFigura = "NombreFigura1", + Domicilio = domicilioUSA + } + } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button4: Factura ingreso autotransporte internacional aduanero + private async void button4_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseInvoice(); + invoice.Recipient = new InvoiceRecipient { Id = "37f7c342-d9a6-4881-9620-0da769b50ce5" }; + + var domicilioUSA = new Domicilio + { + Calle = "ST", NumeroExterior = "214", ColoniaId = "N/A", + Referencia = "WHITE HOUSE", MunicipioId = "N/A", EstadoId = "TX", + PaisId = "USA", CodigoPostalId = "N/A" + }; + + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "Sí", + EntradaSalidaMercId = "Entrada", + PaisOrigenDestinoId = "USA", + ViaEntradaSalidaId = "01", + TotalDistRec = 1, + RegistroISTMOId = "Sí", + UbicacionPoloOrigenId = "01", + UbicacionPoloDestinoId = "01", + UnidadPesoId = "XBX", + LogisticaInversaRecoleccionDevolucionId = "Sí", + RegimenAduaneros = new List + { + new RegimenAduanero { RegimenAduaneroId = "IMD" } + }, + Ubicaciones = new List + { + new Ubicacion + { + TipoUbicacion = "Origen", + IdUbicacion = "OR101010", + RfcRemitenteDestinatario = "XEXX010101000", + NumRegIdTrib = "01010101", + ResidenciaFiscalId = "USA", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + Domicilio = domicilioUSA + }, + new Ubicacion + { + TipoUbicacion = "Destino", + IdUbicacion = "DE202020", + RfcRemitenteDestinatario = "XEXX010101000", + NumRegIdTrib = "01010101", + ResidenciaFiscalId = "USA", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + DistanciaRecorrida = 1, + Domicilio = domicilioUSA + } + }, + Mercancias = new List { CreateMercancia(includeDocumentacionAduanera: true) }, + Autotransporte = CreateAutotransporte(), + TiposFigura = new List + { + new TipoFigura + { + TipoFiguraId = "01", + RfcFigura = "EKU9003173C9", + NumLicencia = "NumLicencia1", + NombreFigura = "NombreFigura1", + Domicilio = domicilioUSA + } + } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button5: Factura ingreso transporte ferroviario nacional + private async void button5_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseInvoiceFerroviario(); + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "No", + TotalDistRec = 500, + PesoNetoTotal = 10, + RegistroISTMOId = "Sí", + UbicacionPoloOrigenId = "01", + UbicacionPoloDestinoId = "01", + UnidadPesoId = "XBX", + Ubicaciones = CreateUbicacionesFerroviarioNacional(), + Mercancias = new List { CreateMercanciaFerroviario() }, + TransporteFerroviario = CreateTransporteFerroviario(), + TiposFigura = new List { CreateTipoFiguraFerroviario() } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button6: Factura ingreso transporte ferroviario extranjero + private async void button6_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseInvoiceFerroviario(); + + var ubicaciones = CreateUbicacionesFerroviarioNacional(); + // Replace last destination with a foreign one + ubicaciones[ubicaciones.Count - 1] = new Ubicacion + { + TipoUbicacion = "Destino", IdUbicacion = "DE202025", + RfcRemitenteDestinatario = "XEXX010101000", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario2", + NumRegIdTrib = "01010101", ResidenciaFiscalId = "USA", + NumEstacionId = "EF0001", NombreEstacion = "NombreEstacion", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T05:00:01"), + DistanciaRecorrida = 100.00m, + Domicilio = new Domicilio + { + Calle = "ST", NumeroExterior = "1234", ColoniaId = "1234", + Referencia = "WHITE HOUSE", MunicipioId = "1234", + EstadoId = "TX", PaisId = "USA", CodigoPostalId = "12345" + } + }; + + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "Sí", + EntradaSalidaMercId = "Salida", + PaisOrigenDestinoId = "USA", + ViaEntradaSalidaId = "04", + TotalDistRec = 500, + PesoNetoTotal = 10, + RegistroISTMOId = "Sí", + UbicacionPoloOrigenId = "01", + UbicacionPoloDestinoId = "01", + UnidadPesoId = "XBX", + RegimenAduaneros = new List + { + new RegimenAduanero { RegimenAduaneroId = "EXD" } + }, + Ubicaciones = ubicaciones, + Mercancias = new List { CreateMercanciaFerroviario(includeTipoMateria: true) }, + TransporteFerroviario = CreateTransporteFerroviario(), + TiposFigura = new List { CreateTipoFiguraFerroviario() } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button7: Factura ingresdo transporte ferrovirario internacional aduanero + private async void button7_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseInvoiceFerroviario(); + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "Sí", + EntradaSalidaMercId = "Entrada", + PaisOrigenDestinoId = "AFG", + ViaEntradaSalidaId = "04", + TotalDistRec = 500, + PesoNetoTotal = 10, + RegistroISTMOId = "Sí", + UbicacionPoloOrigenId = "01", + UbicacionPoloDestinoId = "01", + UnidadPesoId = "XBX", + RegimenAduaneros = new List + { + new RegimenAduanero { RegimenAduaneroId = "IMD" } + }, + Ubicaciones = CreateUbicacionesFerroviarioNacional(), + Mercancias = new List { CreateMercanciaFerroviario(includeDocumentacionAduanera: true) }, + TransporteFerroviario = CreateTransporteFerroviario(), + TiposFigura = new List { CreateTipoFiguraFerroviario() } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button8: Factura ingreso transporte aereo nacional + private async void button8_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseInvoice(); + invoice.Series = "Serie"; + invoice.Recipient = new InvoiceRecipient { Id = "37f7c342-d9a6-4881-9620-0da769b50ce5" }; + + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "No", + UnidadPesoId = "XBX", + PesoNetoTotal = 10, + Ubicaciones = new List + { + new Ubicacion + { + TipoUbicacion = "Origen", IdUbicacion = "OR101010", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario1", + NumEstacionId = "EA0417", NombreEstacion = "Loreto", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:00"), + TipoEstacionId = "01", + Domicilio = new Domicilio + { + Calle = "Calle1", NumeroExterior = "211", NumeroInterior = "212", + ColoniaId = "1957", LocalidadId = "13", Referencia = "casa blanca", + MunicipioId = "011", EstadoId = "CMX", PaisId = "MEX", CodigoPostalId = "13250" + } + }, + new Ubicacion + { + TipoUbicacion = "Destino", IdUbicacion = "DE202020", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario2", + NumEstacionId = "EA0418", NombreEstacion = "Los Cabos", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + TipoEstacionId = "03", + Domicilio = new Domicilio + { + Calle = "Calle2", NumeroExterior = "214", NumeroInterior = "215", + ColoniaId = "0347", LocalidadId = "23", Referencia = "casa negra", + MunicipioId = "004", EstadoId = "COA", PaisId = "MEX", CodigoPostalId = "25350" + } + } + }, + Mercancias = new List + { + new Mercancia + { + BienesTranspId = "11121900", + Descripcion = "Accesorios de equipo de telefonía", + Cantidad = 1.0m, + ClaveUnidadId = "XBX", + MaterialPeligrosoId = "No", + DenominacionGenericaProd = "DenominacionGenericaProd1", + DenominacionDistintivaProd = "DenominacionDistintivaProd1", + Fabricante = "Fabricante1", + FechaCaducidad = DateTime.Parse("2028-01-01T00:00:00"), + LoteMedicamento = "LoteMedic1", + RegistroSanitarioFolioAutorizacion = "RegistroSanita1", + PesoEnKg = 1, + ValorMercancia = 100, + MonedaId = "MXN", + CantidadTransporta = new List + { + new CantidadTransporta { Cantidad = 1, IdOrigen = "OR101010", IdDestino = "DE202020" } + } + } + }, + TransporteAereo = new TransporteAereo + { + PermSCTId = "TPAF01", + NumPermisoSCT = "Demo", + MatriculaAeronave = "61E5-WZ", + NombreAseg = "NombreAseg", + NumPolizaSeguro = "NumPolizaSeguro", + NumeroGuia = "acUbYlBVTmlzx", + LugarContrato = "LugarContrato", + CodigoTransportistaId = "CA001", + RfcEmbarcador = "EKU9003173C9", + NombreEmbarcador = "Embarcador" + }, + TiposFigura = new List + { + new TipoFigura + { + TipoFiguraId = "01", + RfcFigura = "EKU9003173C9", + NumLicencia = "a234567890", + NombreFigura = "NombreFigura" + } + } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button9: Factura ingreso transporte aereo extranjero + private async void button9_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseInvoice(); + invoice.Series = "Serie"; + invoice.Recipient = new InvoiceRecipient { Id = "37f7c342-d9a6-4881-9620-0da769b50ce5" }; + + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "Sí", + EntradaSalidaMercId = "Salida", + PaisOrigenDestinoId = "USA", + ViaEntradaSalidaId = "03", + UnidadPesoId = "XBX", + PesoNetoTotal = 10, + RegimenAduaneros = new List + { + new RegimenAduanero { RegimenAduaneroId = "EXD" } + }, + Ubicaciones = new List + { + new Ubicacion + { + TipoUbicacion = "Origen", IdUbicacion = "OR101010", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario1", + NumEstacionId = "EA0417", NombreEstacion = "Loreto", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:00"), + TipoEstacionId = "01", + Domicilio = new Domicilio + { + Calle = "Calle2", NumeroExterior = "214", NumeroInterior = "215", + ColoniaId = "0347", LocalidadId = "23", Referencia = "casa negra", + MunicipioId = "004", EstadoId = "COA", PaisId = "MEX", CodigoPostalId = "25350" + } + }, + new Ubicacion + { + TipoUbicacion = "Destino", IdUbicacion = "DE202020", + RfcRemitenteDestinatario = "XEXX010101000", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario", + NumRegIdTrib = "01010101", ResidenciaFiscalId = "USA", + NumEstacionId = "EA0143", NombreEstacion = "Phoenix-Mesa Gateway", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + Domicilio = new Domicilio + { + Calle = "ST", NumeroExterior = "12344", ColoniaId = "N/A", + Referencia = "WHITE HOUSE", MunicipioId = "N/A", + EstadoId = "TX", PaisId = "USA", CodigoPostalId = "12345" + } + } + }, + Mercancias = new List + { + new Mercancia + { + BienesTranspId = "11121900", + Descripcion = "Accesorios de equipo de telefonía", + Cantidad = 1.0m, + ClaveUnidadId = "XBX", + MaterialPeligrosoId = "No", + DenominacionGenericaProd = "DenominacionGenericaProd1", + DenominacionDistintivaProd = "DenominacionDistintivaProd1", + Fabricante = "Fabricante1", + FechaCaducidad = DateTime.Parse("2028-01-01T00:00:00"), + LoteMedicamento = "LoteMedic1", + RegistroSanitarioFolioAutorizacion = "RegistroSanita1", + PesoEnKg = 1, + ValorMercancia = 100, + MonedaId = "MXN", + TipoMateriaId = "05", + DescripcionMateria = "otramateria", + CantidadTransporta = new List + { + new CantidadTransporta { Cantidad = 1, IdOrigen = "OR101010", IdDestino = "DE202020" } + } + } + }, + TransporteAereo = new TransporteAereo + { + PermSCTId = "TPAF01", + NumPermisoSCT = "Demo", + MatriculaAeronave = "61E5-WZ", + NombreAseg = "NombreAseg", + NumPolizaSeguro = "NumPolizaSeguro", + NumeroGuia = "acUbYlBVTmlzx", + LugarContrato = "LugarContrato", + CodigoTransportistaId = "CA001", + RfcEmbarcador = "EKU9003173C9", + NombreEmbarcador = "Embarcador" + }, + TiposFigura = new List + { + new TipoFigura + { + TipoFiguraId = "01", + RfcFigura = "EKU9003173C9", + NumLicencia = "a234567890", + NombreFigura = "NombreFigura" + } + } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button10: Factura ingreso transporte aereo internacional aduanero + private async void button10_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseInvoice(); + invoice.Series = "Serie"; + invoice.Recipient = new InvoiceRecipient { Id = "37f7c342-d9a6-4881-9620-0da769b50ce5" }; + + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "Sí", + EntradaSalidaMercId = "Entrada", + PaisOrigenDestinoId = "AFG", + ViaEntradaSalidaId = "03", + UnidadPesoId = "XBX", + PesoNetoTotal = 10, + RegimenAduaneros = new List + { + new RegimenAduanero { RegimenAduaneroId = "IMD" } + }, + Ubicaciones = new List + { + new Ubicacion + { + TipoUbicacion = "Origen", + IdUbicacion = "OR101010", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario1", + NumEstacionId = "EA0417", NombreEstacion = "Loreto", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:00"), + TipoEstacionId = "01", + Domicilio = new Domicilio + { + Calle = "Calle1", NumeroExterior = "211", NumeroInterior = "212", + ColoniaId = "1957", LocalidadId = "13", Referencia = "casa blanca", + MunicipioId = "011", EstadoId = "CMX", PaisId = "MEX", CodigoPostalId = "13250" + } + }, + new Ubicacion + { + TipoUbicacion = "Destino", + IdUbicacion = "DE202020", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario2", + NumEstacionId = "EA0418", NombreEstacion = "Los Cabos", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + TipoEstacionId = "03", + Domicilio = new Domicilio + { + Calle = "Calle2", NumeroExterior = "214", NumeroInterior = "215", + ColoniaId = "0347", LocalidadId = "23", Referencia = "casa negra", + MunicipioId = "004", EstadoId = "COA", PaisId = "MEX", CodigoPostalId = "25350" + } + } + }, + Mercancias = new List + { + new Mercancia + { + BienesTranspId = "11121900", + Descripcion = "Accesorios de equipo de telefonía", + Cantidad = 1.0m, + ClaveUnidadId = "XBX", + MaterialPeligrosoId = "No", + DenominacionGenericaProd = "DenominacionGenericaProd1", + DenominacionDistintivaProd = "DenominacionDistintivaProd1", + Fabricante = "Fabricante1", + FechaCaducidad = DateTime.Parse("2028-01-01T00:00:00"), + LoteMedicamento = "LoteMedic1", + RegistroSanitarioFolioAutorizacion = "RegistroSanita1", + PesoEnKg = 1, + ValorMercancia = 100, + MonedaId = "MXN", + TipoMateriaId = "05", + DescripcionMateria = "otramateria", + DocumentacionAduanera = new List + { + new DocumentoAduanero { TipoDocumentoId = "01", NumPedimento = "23 43 0472 8000448", RfcImpo = "EKU9003173C9" } + }, + CantidadTransporta = new List + { + new CantidadTransporta { Cantidad = 1, IdOrigen = "OR101010", IdDestino = "DE202020" } + } + } + }, + TransporteAereo = new TransporteAereo + { + PermSCTId = "TPAF01", + NumPermisoSCT = "Demo", + MatriculaAeronave = "61E5-WZ", + NombreAseg = "NombreAseg", + NumPolizaSeguro = "NumPolizaSeguro", + NumeroGuia = "acUbYlBVTmlzx", + LugarContrato = "LugarContrato", + CodigoTransportistaId = "CA001", + RfcEmbarcador = "EKU9003173C9", + NombreEmbarcador = "Embarcador" + }, + TiposFigura = new List + { + new TipoFigura + { + TipoFiguraId = "01", + RfcFigura = "EKU9003173C9", + NumLicencia = "a234567890", + NombreFigura = "NombreFigura" + } + } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button11: Factura ingreso transporte maritimo nacional + private async void button11_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseInvoice(); + invoice.Series = "Serie"; + invoice.Recipient = new InvoiceRecipient { Id = "37f7c342-d9a6-4881-9620-0da769b50ce5" }; + + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "No", + UnidadPesoId = "XBX", + PesoNetoTotal = 1, + Ubicaciones = new List + { + new Ubicacion + { + TipoUbicacion = "Origen", IdUbicacion = "OR101010", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario1", + NumEstacionId = "PM001", NombreEstacion = "Rosarito", + NavegacionTraficoId = "Altura", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:00"), + TipoEstacionId = "01", + Domicilio = new Domicilio + { + Calle = "Calle1", NumeroExterior = "211", NumeroInterior = "212", + ColoniaId = "1957", LocalidadId = "13", Referencia = "casa blanca", + MunicipioId = "011", EstadoId = "CMX", PaisId = "MEX", CodigoPostalId = "13250" + } + }, + new Ubicacion + { + TipoUbicacion = "Destino", IdUbicacion = "DE202020", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario2", + NumEstacionId = "PM001", NombreEstacion = "Rosarito", + NavegacionTraficoId = "Altura", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + TipoEstacionId = "03", + Domicilio = new Domicilio + { + Calle = "Calle2", NumeroExterior = "214", NumeroInterior = "215", + ColoniaId = "0347", LocalidadId = "23", Referencia = "casa negra", + MunicipioId = "004", EstadoId = "COA", PaisId = "MEX", CodigoPostalId = "25350" + } + } + }, + Mercancias = new List + { + new Mercancia + { + BienesTranspId = "11121900", + Descripcion = "Accesorios de equipo de telefonía", + Cantidad = 1.0m, + ClaveUnidadId = "XBX", + MaterialPeligrosoId = "No", + DenominacionGenericaProd = "DenominacionGenericaProd1", + DenominacionDistintivaProd = "DenominacionDistintivaProd1", + Fabricante = "Fabricante1", + FechaCaducidad = DateTime.Parse("2028-01-01T00:00:00"), + LoteMedicamento = "LoteMedic1", + RegistroSanitarioFolioAutorizacion = "RegistroSanita1", + PesoEnKg = 1, + CantidadTransporta = new List + { + new CantidadTransporta { Cantidad = 1, IdOrigen = "OR101010", IdDestino = "DE202020" } + }, + DetalleMercancia = new DetalleMercancia + { + UnidadPesoMercId = "Tu", + PesoBruto = 1, + PesoNeto = 1, + PesoTara = 0.001m, + NumPiezas = 1 + } + } + }, + TransporteMaritimo = new TransporteMaritimo + { + PermSCTId = "TPAF01", + NumPermisoSCT = "NumPermisoSCT1", + NombreAseg = "NombreAseg1", + NumPolizaSeguro = "NumPolizaSeguro1", + TipoEmbarcacionId = "B01", + Matricula = "Matricula1", + NumeroOMI = "IMO1234567", + AnioEmbarcacion = 2003, + NombreEmbarc = "NombreEmbarc1", + NacionalidadEmbarcId = "AFG", + UnidadesDeArqBruto = 0.001m, + TipoCargaId = "CGS", + Eslora = 0.01m, + Manga = 0.01m, + Calado = 0.01m, + Puntal = 0.01m, + LineaNaviera = "LineaNaviera1", + NombreAgenteNaviero = "NombreAgenteNaviero1", + NumAutorizacionNavieroId = "ANC001/2022", + NumViaje = "NumViaje1", + NumConocEmbarc = "NumConocEmbarc1", + PermisoTempNavegacion = "PermisoTempNavegac1", + Contenedores = new List + { + new ContenedorMaritimo + { + TipoContenedorId = "CM011", + IdCCPRelacionado = "CCCBCD94-870A-4332-A52A-A52AA52AA52A", + PlacaVMCCP = "JNG7683", + FechaCertificacionCCP = "2024-06-20T11:11:00", + RemolquesCCP = new List + { + new RemolqueCCP { SubTipoRemCCPId = "CTR001", PlacaCCP = "JNG7636" } + } + } + } + }, + TiposFigura = new List + { + new TipoFigura + { + TipoFiguraId = "02", + RfcFigura = "EKU9003173C9", + NombreFigura = "NombreFigura", + PartesTransporte = new List + { + new ParteTransporte { ParteTransporteId = "PT02" } + }, + Domicilio = new Domicilio + { + Calle = "calle", NumeroExterior = "211", ColoniaId = "0814", + LocalidadId = "01", Referencia = "casa blanca", + MunicipioId = "010", EstadoId = "ZAC", PaisId = "MEX", CodigoPostalId = "99080" + } + } + } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button12: Factura ingreso transporte maritimo extranjero + private async void button12_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseInvoice(); + invoice.Series = "Serie"; + invoice.Recipient = new InvoiceRecipient { Id = "37f7c342-d9a6-4881-9620-0da769b50ce5" }; + + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "Sí", + EntradaSalidaMercId = "Salida", + PaisOrigenDestinoId = "USA", + ViaEntradaSalidaId = "02", + UnidadPesoId = "XBX", + PesoNetoTotal = 1, + RegimenAduaneros = new List + { + new RegimenAduanero { RegimenAduaneroId = "EXD" } + }, + Ubicaciones = new List + { + new Ubicacion + { + TipoUbicacion = "Origen", IdUbicacion = "OR101010", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario1", + NumEstacionId = "PM001", NombreEstacion = "Rosarito", + NavegacionTraficoId = "Altura", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:00"), + TipoEstacionId = "01", + Domicilio = new Domicilio + { + Calle = "Calle1", NumeroExterior = "211", NumeroInterior = "212", + ColoniaId = "1957", LocalidadId = "13", Referencia = "casa blanca", + MunicipioId = "011", EstadoId = "CMX", PaisId = "MEX", CodigoPostalId = "13250" + } + }, + new Ubicacion + { + TipoUbicacion = "Destino", IdUbicacion = "DE202020", + RfcRemitenteDestinatario = "XEXX010101000", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario", + NumRegIdTrib = "01010101", ResidenciaFiscalId = "USA", + NumEstacionId = "PM120", NombreEstacion = "NombreEstacion", + NavegacionTraficoId = "Altura", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + Domicilio = new Domicilio + { + Calle = "ST", NumeroExterior = "12345", ColoniaId = "N/A", + Referencia = "N/A", MunicipioId = "N/A", + EstadoId = "TX", PaisId = "USA", CodigoPostalId = "12345" + } + } + }, + Mercancias = new List + { + new Mercancia + { + BienesTranspId = "11121900", + Descripcion = "Accesorios de equipo de telefonía", + Cantidad = 1.0m, + ClaveUnidadId = "XBX", + MaterialPeligrosoId = "No", + DenominacionGenericaProd = "DenominacionGenericaProd1", + DenominacionDistintivaProd = "DenominacionDistintivaProd1", + Fabricante = "Fabricante1", + FechaCaducidad = DateTime.Parse("2028-01-01T00:00:00"), + LoteMedicamento = "LoteMedic1", + RegistroSanitarioFolioAutorizacion = "RegistroSanita1", + PesoEnKg = 1, + ValorMercancia = 100, + MonedaId = "MXN", + TipoMateriaId = "05", + DescripcionMateria = "otramateria", + CantidadTransporta = new List + { + new CantidadTransporta { Cantidad = 1, IdOrigen = "OR101010", IdDestino = "DE202020" } + }, + DetalleMercancia = new DetalleMercancia + { + UnidadPesoMercId = "Tu", + PesoBruto = 1, + PesoNeto = 1, + PesoTara = 0.001m, + NumPiezas = 1 + } + } + }, + TransporteMaritimo = new TransporteMaritimo + { + PermSCTId = "TPAF01", + NumPermisoSCT = "NumPermisoSCT1", + NombreAseg = "NombreAseg1", + NumPolizaSeguro = "NumPolizaSeguro1", + TipoEmbarcacionId = "B01", + Matricula = "Matricula1", + NumeroOMI = "IMO1234567", + AnioEmbarcacion = 2003, + NombreEmbarc = "NombreEmbarc1", + NacionalidadEmbarcId = "AFG", + UnidadesDeArqBruto = 0.001m, + TipoCargaId = "CGS", + Eslora = 0.01m, + Manga = 0.01m, + Calado = 0.01m, + Puntal = 0.01m, + LineaNaviera = "LineaNaviera1", + NombreAgenteNaviero = "NombreAgenteNaviero1", + NumAutorizacionNavieroId = "ANC001/2022", + NumViaje = "NumViaje1", + NumConocEmbarc = "NumConocEmbarc1", + PermisoTempNavegacion = "PermisoTempNavegac1", + Contenedores = new List + { + new ContenedorMaritimo + { + TipoContenedorId = "CM011", + IdCCPRelacionado = "CCCBCD94-870A-4332-A52A-A52AA52AA52A", + PlacaVMCCP = "JNG7683", + FechaCertificacionCCP = "2024-06-20T11:11:00", + RemolquesCCP = new List + { + new RemolqueCCP { SubTipoRemCCPId = "CTR001", PlacaCCP = "JNG7636" } + } + } + } + }, + TiposFigura = new List + { + new TipoFigura + { + TipoFiguraId = "02", + RfcFigura = "EKU9003173C9", + NombreFigura = "NombreFigura", + PartesTransporte = new List + { + new ParteTransporte { ParteTransporteId = "PT02" } + }, + Domicilio = new Domicilio + { + Calle = "calle", NumeroExterior = "211", ColoniaId = "0814", + LocalidadId = "01", Referencia = "casa blanca", + MunicipioId = "010", EstadoId = "ZAC", PaisId = "MEX", CodigoPostalId = "99080" + } + } + } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button13: Factura ingreso transporte maritimo internacional aduanero + private async void button13_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseInvoice(); + invoice.Series = "CP3.1"; + invoice.Recipient = new InvoiceRecipient { Id = "37f7c342-d9a6-4881-9620-0da769b50ce5" }; + + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "Sí", + EntradaSalidaMercId = "Entrada", + PaisOrigenDestinoId = "AFG", + ViaEntradaSalidaId = "01", + RegistroISTMOId = "Sí", + UbicacionPoloOrigenId = "01", + UbicacionPoloDestinoId = "01", + UnidadPesoId = "XBX", + PesoNetoTotal = 1, + RegimenAduaneros = new List + { + new RegimenAduanero { RegimenAduaneroId = "IMD" }, + new RegimenAduanero { RegimenAduaneroId = "IMD" } + }, + Ubicaciones = new List + { + new Ubicacion + { + TipoUbicacion = "Origen", + IdUbicacion = "OR101010", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario1", + NumEstacionId = "EA0417", + NombreEstacion = "Loreto", + NavegacionTraficoId = "Altura", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:00"), + TipoEstacionId = "01", + Domicilio = new Domicilio + { + Calle = "Calle1", NumeroExterior = "211", NumeroInterior = "212", + ColoniaId = "1957", LocalidadId = "13", Referencia = "casa blanca", + MunicipioId = "011", EstadoId = "CMX", PaisId = "MEX", CodigoPostalId = "13250" + } + }, + new Ubicacion + { + TipoUbicacion = "Destino", + IdUbicacion = "DE202020", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario2", + NumEstacionId = "PM001", + NombreEstacion = "Rosarito", + NavegacionTraficoId = "Altura", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T04:00:01"), + TipoEstacionId = "02", + Domicilio = new Domicilio + { + Calle = "Calle2", NumeroExterior = "214", NumeroInterior = "215", + ColoniaId = "0347", LocalidadId = "23", Referencia = "casa negra", + MunicipioId = "004", EstadoId = "COA", PaisId = "MEX", CodigoPostalId = "25350" + } + } + }, + Mercancias = new List + { + new Mercancia + { + BienesTranspId = "11121900", + Descripcion = "Accesorios de equipo de telefonía", + Cantidad = 1.0m, + ClaveUnidadId = "XBX", + MaterialPeligrosoId = "No", + DenominacionGenericaProd = "DenominacionGenericaProd1", + DenominacionDistintivaProd = "DenominacionDistintivaProd1", + Fabricante = "Fabricante1", + FechaCaducidad = DateTime.Parse("2003-04-02T00:00:00"), + LoteMedicamento = "LoteMedic1", + FormaFarmaceuticaId = "01", + CondicionesEspTranspId = "01", + RegistroSanitarioFolioAutorizacion = "RegistroSanita1", + PesoEnKg = 1.50m, + ValorMercancia = 100, + MonedaId = "MXN", + FraccionArancelariaId = "6309000100", + TipoMateriaId = "05", + DescripcionMateria = "otramateria", + DocumentacionAduanera = new List + { + new DocumentoAduanero + { + TipoDocumentoId = "01", + NumPedimento = "23 43 0472 8000448", + RfcImpo = "EKU9003173C9" + } + }, + CantidadTransporta = new List + { + new CantidadTransporta { Cantidad = 1, IdOrigen = "OR101010", IdDestino = "DE202020", CvesTransporteId = "02" } + }, + DetalleMercancia = new DetalleMercancia + { + UnidadPesoMercId = "X1A", + PesoBruto = 1.50m, + PesoNeto = 1.00m, + PesoTara = 0.50m + } + } + }, + TransporteMaritimo = new TransporteMaritimo + { + PermSCTId = "TPAF01", + NumPermisoSCT = "NumPermisoSCT1", + NombreAseg = "NombreAseg1", + NumPolizaSeguro = "NumPolizaSeguro1", + TipoEmbarcacionId = "B01", + Matricula = "Matricula1", + NumeroOMI = "IMO1234567", + AnioEmbarcacion = 2003, + NombreEmbarc = "NombreEmbarc1", + NacionalidadEmbarcId = "AFG", + UnidadesDeArqBruto = 0.001m, + TipoCargaId = "CGS", + Eslora = 0.01m, + Manga = 0.01m, + Calado = 0.01m, + Puntal = 0.01m, + LineaNaviera = "LineaNaviera1", + NombreAgenteNaviero = "NombreAgenteNaviero1", + NumAutorizacionNavieroId = "ANC001/2022", + NumViaje = "NumViaje1", + NumConocEmbarc = "NumConocEmbarc1", + PermisoTempNavegacion = "PermisoTempNavegac1", + Contenedores = new List + { + new ContenedorMaritimo + { + TipoContenedorId = "CM011", + IdCCPRelacionado = "CCCBCD94-870A-4332-A52A-A52AA52AA52A", + PlacaVMCCP = "JNG7683", + FechaCertificacionCCP = "2024-06-20T11:11:00", + RemolquesCCP = new List + { + new RemolqueCCP { SubTipoRemCCPId = "CTR001", PlacaCCP = "JNG7636" } + } + } + } + }, + TransporteAereo = new TransporteAereo + { + PermSCTId = "TPAF01", + NumPermisoSCT = "Demo", + MatriculaAeronave = "61E5-WZ", + NombreAseg = "NombreAseg", + NumPolizaSeguro = "NumPolizaSeguro", + NumeroGuia = "acUbYlBVTmlzx", + LugarContrato = "LugarContrato", + CodigoTransportistaId = "CA001", + RfcEmbarcador = "EKU9003173C9", + NombreEmbarcador = "Embarcador" + }, + TiposFigura = new List + { + new TipoFigura + { + TipoFiguraId = "01", + RfcFigura = "EKU9003173C9", + NumLicencia = "NumLicencia1", + NombreFigura = "NombreFigura1", + Domicilio = new Domicilio + { + Calle = "Calle1", NumeroExterior = "NumeroExterior1", NumeroInterior = "NumeroInterior1", + ColoniaId = "Colonia1", LocalidadId = "Localidad1", Referencia = "Referencia1", + MunicipioId = "Municipio1", EstadoId = "Estado1", PaisId = "AFG", CodigoPostalId = "CodigoPosta1" + } + } + } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button14: Factura traslado autotransporte nacional + private async void button14_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseTraslado(); + invoice.Series = "Serie"; + + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "No", + TotalDistRec = 1, + RegistroISTMOId = "Sí", + UbicacionPoloOrigenId = "01", + UbicacionPoloDestinoId = "01", + UnidadPesoId = "XBX", + LogisticaInversaRecoleccionDevolucionId = "Sí", + Ubicaciones = new List + { + new Ubicacion + { + TipoUbicacion = "Origen", + IdUbicacion = "OR101010", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario1", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:00"), + Domicilio = new Domicilio + { + Calle = "Calle1", NumeroExterior = "211", NumeroInterior = "212", + ColoniaId = "1957", LocalidadId = "13", Referencia = "casa blanca", + MunicipioId = "011", EstadoId = "CMX", PaisId = "MEX", CodigoPostalId = "13250" + } + }, + new Ubicacion + { + TipoUbicacion = "Destino", + IdUbicacion = "DE202020", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario2", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + DistanciaRecorrida = 1, + Domicilio = new Domicilio + { + Calle = "Calle2", NumeroExterior = "214", NumeroInterior = "215", + ColoniaId = "0347", LocalidadId = "23", Referencia = "casa negra", + MunicipioId = "004", EstadoId = "COA", PaisId = "MEX", CodigoPostalId = "25350" + } + } + }, + Mercancias = new List + { + new Mercancia + { + BienesTranspId = "11121900", + Descripcion = "Accesorios de equipo de telefonía", + Cantidad = 1.0m, + ClaveUnidadId = "XBX", + MaterialPeligrosoId = "No", + DenominacionGenericaProd = "DenominacionGenericaProd1", + DenominacionDistintivaProd = "DenominacionDistintivaProd1", + Fabricante = "Fabricante1", + FechaCaducidad = DateTime.Parse("2028-01-01T00:00:00"), + LoteMedicamento = "LoteMedic1", + RegistroSanitarioFolioAutorizacion = "RegistroSanita1", + PesoEnKg = 1, + CantidadTransporta = new List + { + new CantidadTransporta { Cantidad = 1, IdOrigen = "OR101010", IdDestino = "DE202020" } + } + } + }, + Autotransporte = CreateAutotransporte(), + TiposFigura = new List + { + new TipoFigura + { + TipoFiguraId = "01", + RfcFigura = "EKU9003173C9", + NumLicencia = "a234567890", + NombreFigura = "NombreFigura" + } + } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button15: Factura traslado autotransporte extranjero + private async void button15_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseTraslado(); + invoice.Series = "SerieCCP31"; + + var domicilioUSA = new Domicilio + { + Calle = "ST", NumeroExterior = "214", ColoniaId = "N/A", + Referencia = "WHITE HOUSE", MunicipioId = "N/A", EstadoId = "TX", + PaisId = "USA", CodigoPostalId = "N/A" + }; + + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "Sí", + EntradaSalidaMercId = "Salida", + PaisOrigenDestinoId = "USA", + ViaEntradaSalidaId = "01", + TotalDistRec = 1, + RegistroISTMOId = "Sí", + UbicacionPoloOrigenId = "01", + UbicacionPoloDestinoId = "01", + UnidadPesoId = "XBX", + LogisticaInversaRecoleccionDevolucionId = "Sí", + RegimenAduaneros = new List + { + new RegimenAduanero { RegimenAduaneroId = "EXD" } + }, + Ubicaciones = new List + { + new Ubicacion + { + TipoUbicacion = "Origen", + IdUbicacion = "OR101010", + RfcRemitenteDestinatario = "XEXX010101000", + NumRegIdTrib = "01010101", + ResidenciaFiscalId = "USA", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + Domicilio = domicilioUSA + }, + new Ubicacion + { + TipoUbicacion = "Destino", + IdUbicacion = "DE202020", + RfcRemitenteDestinatario = "XEXX010101000", + NumRegIdTrib = "01010101", + ResidenciaFiscalId = "USA", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + DistanciaRecorrida = 1, + Domicilio = domicilioUSA + } + }, + Mercancias = new List + { + new Mercancia + { + BienesTranspId = "11121900", + Descripcion = "Accesorios de equipo de telefonía", + Cantidad = 1.0m, + ClaveUnidadId = "XBX", + MaterialPeligrosoId = "No", + DenominacionGenericaProd = "DenominacionGenericaProd1", + DenominacionDistintivaProd = "DenominacionDistintivaProd1", + Fabricante = "Fabricante1", + FechaCaducidad = DateTime.Parse("2003-04-02T00:00:00"), + LoteMedicamento = "LoteMedic1", + FormaFarmaceuticaId = "01", + CondicionesEspTranspId = "01", + RegistroSanitarioFolioAutorizacion = "RegistroSanita1", + PesoEnKg = 1, + FraccionArancelariaId = "6309000100", + TipoMateriaId = "05", + DescripcionMateria = "otramateria", + CantidadTransporta = new List + { + new CantidadTransporta { Cantidad = 1, IdOrigen = "OR101010", IdDestino = "DE202020" } + } + } + }, + Autotransporte = CreateAutotransporte(), + TiposFigura = new List + { + new TipoFigura + { + TipoFiguraId = "01", + RfcFigura = "EKU9003173C9", + NumLicencia = "NumLicencia1", + NombreFigura = "NombreFigura1", + Domicilio = domicilioUSA + } + } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button16: Factura traslado autotransporte internacional aduanero + private async void button16_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseTraslado(); + invoice.Series = "SerieCCP31"; + + var domicilioUSA = new Domicilio + { + Calle = "ST", NumeroExterior = "214", ColoniaId = "N/A", + Referencia = "WHITE HOUSE", MunicipioId = "N/A", EstadoId = "TX", + PaisId = "USA", CodigoPostalId = "N/A" + }; + + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "Sí", + EntradaSalidaMercId = "Entrada", + PaisOrigenDestinoId = "USA", + ViaEntradaSalidaId = "01", + TotalDistRec = 1, + RegistroISTMOId = "Sí", + UbicacionPoloOrigenId = "01", + UbicacionPoloDestinoId = "01", + UnidadPesoId = "XBX", + LogisticaInversaRecoleccionDevolucionId = "Sí", + RegimenAduaneros = new List + { + new RegimenAduanero { RegimenAduaneroId = "IMD" } + }, + Ubicaciones = new List + { + new Ubicacion + { + TipoUbicacion = "Origen", + IdUbicacion = "OR101010", + RfcRemitenteDestinatario = "XEXX010101000", + NumRegIdTrib = "01010101", + ResidenciaFiscalId = "USA", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + Domicilio = domicilioUSA + }, + new Ubicacion + { + TipoUbicacion = "Destino", + IdUbicacion = "DE202020", + RfcRemitenteDestinatario = "XEXX010101000", + NumRegIdTrib = "01010101", + ResidenciaFiscalId = "USA", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + DistanciaRecorrida = 1, + Domicilio = domicilioUSA + } + }, + Mercancias = new List + { + new Mercancia + { + BienesTranspId = "11121900", + Descripcion = "Accesorios de equipo de telefonía", + Cantidad = 1.0m, + ClaveUnidadId = "XBX", + MaterialPeligrosoId = "No", + DenominacionGenericaProd = "DenominacionGenericaProd1", + DenominacionDistintivaProd = "DenominacionDistintivaProd1", + Fabricante = "Fabricante1", + FechaCaducidad = DateTime.Parse("2003-04-02T00:00:00"), + LoteMedicamento = "LoteMedic1", + FormaFarmaceuticaId = "01", + CondicionesEspTranspId = "01", + RegistroSanitarioFolioAutorizacion = "RegistroSanita1", + PesoEnKg = 1, + FraccionArancelariaId = "6309000100", + TipoMateriaId = "05", + DescripcionMateria = "otramateria", + DocumentacionAduanera = new List + { + new DocumentoAduanero + { + TipoDocumentoId = "01", + NumPedimento = "23 43 0472 8000448", + RfcImpo = "EKU9003173C9" + } + }, + CantidadTransporta = new List + { + new CantidadTransporta { Cantidad = 1, IdOrigen = "OR101010", IdDestino = "DE202020" } + } + } + }, + Autotransporte = CreateAutotransporte(), + TiposFigura = new List + { + new TipoFigura + { + TipoFiguraId = "01", + RfcFigura = "EKU9003173C9", + NumLicencia = "NumLicencia1", + NombreFigura = "NombreFigura1", + Domicilio = domicilioUSA + } + } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button17: Factura traslado transporte ferroviario nacional + private async void button17_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseTraslado(); + invoice.Series = "Serie"; + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "No", + TotalDistRec = 500, + PesoNetoTotal = 10, + RegistroISTMOId = "Sí", + UbicacionPoloOrigenId = "01", + UbicacionPoloDestinoId = "01", + UnidadPesoId = "XBX", + Ubicaciones = CreateUbicacionesFerroviarioNacional(), + Mercancias = new List { CreateMercanciaFerroviario() }, + TransporteFerroviario = CreateTransporteFerroviario(), + TiposFigura = new List { CreateTipoFiguraFerroviario() } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button18: Factura traslado transporte ferroviario extranjero + private async void button18_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseTraslado(); + invoice.Series = "Serie"; + + var ubicaciones = CreateUbicacionesFerroviarioNacional(); + // Replace last destination with a foreign one + ubicaciones[ubicaciones.Count - 1] = new Ubicacion + { + TipoUbicacion = "Destino", IdUbicacion = "DE202025", + RfcRemitenteDestinatario = "XEXX010101000", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario2", + NumRegIdTrib = "01010101", ResidenciaFiscalId = "USA", + NumEstacionId = "EF0001", NombreEstacion = "NombreEstacion", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T05:00:01"), + DistanciaRecorrida = 100.00m, + Domicilio = new Domicilio + { + Calle = "ST", NumeroExterior = "1234", ColoniaId = "1234", + Referencia = "WHITE HOUSE", MunicipioId = "1234", + EstadoId = "TX", PaisId = "USA", CodigoPostalId = "12345" + } + }; + + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "Sí", + EntradaSalidaMercId = "Salida", + PaisOrigenDestinoId = "USA", + ViaEntradaSalidaId = "04", + TotalDistRec = 500, + PesoNetoTotal = 10, + RegistroISTMOId = "Sí", + UbicacionPoloOrigenId = "01", + UbicacionPoloDestinoId = "01", + UnidadPesoId = "XBX", + RegimenAduaneros = new List + { + new RegimenAduanero { RegimenAduaneroId = "EXD" } + }, + Ubicaciones = ubicaciones, + Mercancias = new List { CreateMercanciaFerroviario(includeTipoMateria: true) }, + TransporteFerroviario = CreateTransporteFerroviario(), + TiposFigura = new List { CreateTipoFiguraFerroviario() } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button19: Factura traslado transporte ferroviario inernacional aduanero + private async void button19_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseTraslado(); + invoice.Series = "Serie"; + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "Sí", + EntradaSalidaMercId = "Entrada", + PaisOrigenDestinoId = "AFG", + ViaEntradaSalidaId = "04", + TotalDistRec = 500, + PesoNetoTotal = 10, + RegistroISTMOId = "Sí", + UbicacionPoloOrigenId = "01", + UbicacionPoloDestinoId = "01", + UnidadPesoId = "XBX", + RegimenAduaneros = new List + { + new RegimenAduanero { RegimenAduaneroId = "IMD" } + }, + Ubicaciones = CreateUbicacionesFerroviarioNacional(), + Mercancias = new List { CreateMercanciaFerroviario(includeDocumentacionAduanera: true) }, + TransporteFerroviario = CreateTransporteFerroviario(), + TiposFigura = new List { CreateTipoFiguraFerroviario() } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button20: Factura traslado transporte aereo nacional + private async void button20_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseTraslado(); + invoice.Series = "Serie"; + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "No", + UnidadPesoId = "XBX", + PesoNetoTotal = 10, + Ubicaciones = new List + { + new Ubicacion + { + TipoUbicacion = "Origen", IdUbicacion = "OR101010", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario1", + NumEstacionId = "EA0417", NombreEstacion = "Loreto", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:00"), + TipoEstacionId = "01", + Domicilio = new Domicilio + { + Calle = "Calle1", NumeroExterior = "211", NumeroInterior = "212", + ColoniaId = "1957", LocalidadId = "13", Referencia = "casa blanca", + MunicipioId = "011", EstadoId = "CMX", PaisId = "MEX", CodigoPostalId = "13250" + } + }, + new Ubicacion + { + TipoUbicacion = "Destino", IdUbicacion = "DE202020", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario2", + NumEstacionId = "EA0418", NombreEstacion = "Los Cabos", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + TipoEstacionId = "03", + Domicilio = new Domicilio + { + Calle = "Calle2", NumeroExterior = "214", NumeroInterior = "215", + ColoniaId = "0347", LocalidadId = "23", Referencia = "casa negra", + MunicipioId = "004", EstadoId = "COA", PaisId = "MEX", CodigoPostalId = "25350" + } + } + }, + Mercancias = new List + { + new Mercancia + { + BienesTranspId = "11121900", + Descripcion = "Accesorios de equipo de telefonía", + Cantidad = 1.0m, + ClaveUnidadId = "XBX", + MaterialPeligrosoId = "No", + DenominacionGenericaProd = "DenominacionGenericaProd1", + DenominacionDistintivaProd = "DenominacionDistintivaProd1", + Fabricante = "Fabricante1", + FechaCaducidad = DateTime.Parse("2028-01-01T00:00:00"), + LoteMedicamento = "LoteMedic1", + RegistroSanitarioFolioAutorizacion = "RegistroSanita1", + PesoEnKg = 1, + ValorMercancia = 100, + MonedaId = "MXN", + CantidadTransporta = new List + { + new CantidadTransporta { Cantidad = 1, IdOrigen = "OR101010", IdDestino = "DE202020" } + } + } + }, + TransporteAereo = new TransporteAereo + { + PermSCTId = "TPAF01", + NumPermisoSCT = "Demo", + MatriculaAeronave = "61E5-WZ", + NombreAseg = "NombreAseg", + NumPolizaSeguro = "NumPolizaSeguro", + NumeroGuia = "acUbYlBVTmlzx", + LugarContrato = "LugarContrato", + CodigoTransportistaId = "CA001", + RfcEmbarcador = "EKU9003173C9", + NombreEmbarcador = "Embarcador" + }, + TiposFigura = new List + { + new TipoFigura + { + TipoFiguraId = "01", + RfcFigura = "EKU9003173C9", + NumLicencia = "a234567890", + NombreFigura = "NombreFigura" + } + } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button21: Factura traslado transporte aereo extranjero + private async void button21_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseTraslado(); + invoice.Series = "Serie"; + + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "Sí", + EntradaSalidaMercId = "Salida", + PaisOrigenDestinoId = "USA", + ViaEntradaSalidaId = "03", + UnidadPesoId = "XBX", + PesoNetoTotal = 10, + RegimenAduaneros = new List + { + new RegimenAduanero { RegimenAduaneroId = "EXD" } + }, + Ubicaciones = new List + { + new Ubicacion + { + TipoUbicacion = "Origen", IdUbicacion = "OR101010", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario1", + NumEstacionId = "EA0417", NombreEstacion = "Loreto", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:00"), + TipoEstacionId = "01", + Domicilio = new Domicilio + { + Calle = "Calle2", NumeroExterior = "214", NumeroInterior = "215", + ColoniaId = "0347", LocalidadId = "23", Referencia = "casa negra", + MunicipioId = "004", EstadoId = "COA", PaisId = "MEX", CodigoPostalId = "25350" + } + }, + new Ubicacion + { + TipoUbicacion = "Destino", IdUbicacion = "DE202020", + RfcRemitenteDestinatario = "XEXX010101000", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario", + NumRegIdTrib = "01010101", ResidenciaFiscalId = "USA", + NumEstacionId = "EA0143", NombreEstacion = "Phoenix-Mesa Gateway", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + Domicilio = new Domicilio + { + Calle = "ST", NumeroExterior = "12344", ColoniaId = "N/A", + Referencia = "WHITE HOUSE", MunicipioId = "N/A", + EstadoId = "TX", PaisId = "USA", CodigoPostalId = "12345" + } + } + }, + Mercancias = new List + { + new Mercancia + { + BienesTranspId = "11121900", + Descripcion = "Accesorios de equipo de telefonía", + Cantidad = 1.0m, + ClaveUnidadId = "XBX", + MaterialPeligrosoId = "No", + DenominacionGenericaProd = "DenominacionGenericaProd1", + DenominacionDistintivaProd = "DenominacionDistintivaProd1", + Fabricante = "Fabricante1", + FechaCaducidad = DateTime.Parse("2028-01-01T00:00:00"), + LoteMedicamento = "LoteMedic1", + RegistroSanitarioFolioAutorizacion = "RegistroSanita1", + PesoEnKg = 1, + ValorMercancia = 100, + MonedaId = "MXN", + TipoMateriaId = "05", + DescripcionMateria = "otramateria", + CantidadTransporta = new List + { + new CantidadTransporta { Cantidad = 1, IdOrigen = "OR101010", IdDestino = "DE202020" } + } + } + }, + TransporteAereo = new TransporteAereo + { + PermSCTId = "TPAF01", + NumPermisoSCT = "Demo", + MatriculaAeronave = "61E5-WZ", + NombreAseg = "NombreAseg", + NumPolizaSeguro = "NumPolizaSeguro", + NumeroGuia = "acUbYlBVTmlzx", + LugarContrato = "LugarContrato", + CodigoTransportistaId = "CA001", + RfcEmbarcador = "EKU9003173C9", + NombreEmbarcador = "Embarcador" + }, + TiposFigura = new List + { + new TipoFigura + { + TipoFiguraId = "01", + RfcFigura = "EKU9003173C9", + NumLicencia = "a234567890", + NombreFigura = "NombreFigura" + } + } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button22: Factura traslado transporte aereo internacional aduanero + private async void button22_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseTraslado(); + invoice.Series = "Serie"; + + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "Sí", + EntradaSalidaMercId = "Entrada", + PaisOrigenDestinoId = "AFG", + ViaEntradaSalidaId = "03", + UnidadPesoId = "XBX", + PesoNetoTotal = 10, + RegimenAduaneros = new List + { + new RegimenAduanero { RegimenAduaneroId = "IMD" } + }, + Ubicaciones = new List + { + new Ubicacion + { + TipoUbicacion = "Origen", IdUbicacion = "OR101010", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario1", + NumEstacionId = "EA0417", NombreEstacion = "Loreto", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:00"), + TipoEstacionId = "01", + Domicilio = new Domicilio + { + Calle = "Calle1", NumeroExterior = "211", NumeroInterior = "212", + ColoniaId = "1957", LocalidadId = "13", Referencia = "casa blanca", + MunicipioId = "011", EstadoId = "CMX", PaisId = "MEX", CodigoPostalId = "13250" + } + }, + new Ubicacion + { + TipoUbicacion = "Destino", IdUbicacion = "DE202020", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario2", + NumEstacionId = "EA0418", NombreEstacion = "Los Cabos", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + TipoEstacionId = "03", + Domicilio = new Domicilio + { + Calle = "Calle2", NumeroExterior = "214", NumeroInterior = "215", + ColoniaId = "0347", LocalidadId = "23", Referencia = "casa negra", + MunicipioId = "004", EstadoId = "COA", PaisId = "MEX", CodigoPostalId = "25350" + } + } + }, + Mercancias = new List + { + new Mercancia + { + BienesTranspId = "11121900", + Descripcion = "Accesorios de equipo de telefonía", + Cantidad = 1.0m, + ClaveUnidadId = "XBX", + MaterialPeligrosoId = "No", + DenominacionGenericaProd = "DenominacionGenericaProd1", + DenominacionDistintivaProd = "DenominacionDistintivaProd1", + Fabricante = "Fabricante1", + FechaCaducidad = DateTime.Parse("2028-01-01T00:00:00"), + LoteMedicamento = "LoteMedic1", + RegistroSanitarioFolioAutorizacion = "RegistroSanita1", + PesoEnKg = 1, + ValorMercancia = 100, + MonedaId = "MXN", + TipoMateriaId = "05", + DescripcionMateria = "otramateria", + DocumentacionAduanera = new List + { + new DocumentoAduanero + { + TipoDocumentoId = "01", + NumPedimento = "23 43 0472 8000448", + RfcImpo = "EKU9003173C9" + } + }, + CantidadTransporta = new List + { + new CantidadTransporta { Cantidad = 1, IdOrigen = "OR101010", IdDestino = "DE202020" } + } + } + }, + TransporteAereo = new TransporteAereo + { + PermSCTId = "TPAF01", + NumPermisoSCT = "Demo", + MatriculaAeronave = "61E5-WZ", + NombreAseg = "NombreAseg", + NumPolizaSeguro = "NumPolizaSeguro", + NumeroGuia = "acUbYlBVTmlzx", + LugarContrato = "LugarContrato", + CodigoTransportistaId = "CA001", + RfcEmbarcador = "EKU9003173C9", + NombreEmbarcador = "Embarcador" + }, + TiposFigura = new List + { + new TipoFigura + { + TipoFiguraId = "01", + RfcFigura = "EKU9003173C9", + NumLicencia = "a234567890", + NombreFigura = "NombreFigura" + } + } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button23: Factura traslado transporte maritimo nacional + private async void button23_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseTraslado(); + invoice.Series = "Serie"; + + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "No", + UnidadPesoId = "XBX", + PesoNetoTotal = 1, + Ubicaciones = new List + { + new Ubicacion + { + TipoUbicacion = "Origen", IdUbicacion = "OR101010", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario1", + NumEstacionId = "PM001", NombreEstacion = "Rosarito", + NavegacionTraficoId = "Altura", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:00"), + TipoEstacionId = "01", + Domicilio = new Domicilio + { + Calle = "Calle1", NumeroExterior = "211", NumeroInterior = "212", + ColoniaId = "1957", LocalidadId = "13", Referencia = "casa blanca", + MunicipioId = "011", EstadoId = "CMX", PaisId = "MEX", CodigoPostalId = "13250" + } + }, + new Ubicacion + { + TipoUbicacion = "Destino", IdUbicacion = "DE202020", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario2", + NumEstacionId = "PM001", NombreEstacion = "Rosarito", + NavegacionTraficoId = "Altura", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + TipoEstacionId = "03", + Domicilio = new Domicilio + { + Calle = "Calle2", NumeroExterior = "214", NumeroInterior = "215", + ColoniaId = "0347", LocalidadId = "23", Referencia = "casa negra", + MunicipioId = "004", EstadoId = "COA", PaisId = "MEX", CodigoPostalId = "25350" + } + } + }, + Mercancias = new List + { + new Mercancia + { + BienesTranspId = "11121900", + Descripcion = "Accesorios de equipo de telefonía", + Cantidad = 1.0m, + ClaveUnidadId = "XBX", + MaterialPeligrosoId = "No", + DenominacionGenericaProd = "DenominacionGenericaProd1", + DenominacionDistintivaProd = "DenominacionDistintivaProd1", + Fabricante = "Fabricante1", + FechaCaducidad = DateTime.Parse("2028-01-01T00:00:00"), + LoteMedicamento = "LoteMedic1", + RegistroSanitarioFolioAutorizacion = "RegistroSanita1", + PesoEnKg = 1, + ValorMercancia = 100, + MonedaId = "MXN", + CantidadTransporta = new List + { + new CantidadTransporta { Cantidad = 1, IdOrigen = "OR101010", IdDestino = "DE202020" } + }, + DetalleMercancia = new DetalleMercancia + { + UnidadPesoMercId = "Tu", + PesoBruto = 1, + PesoNeto = 1, + PesoTara = 0.001m, + NumPiezas = 1 + } + } + }, + TransporteMaritimo = new TransporteMaritimo + { + PermSCTId = "TPAF01", + NumPermisoSCT = "NumPermisoSCT1", + NombreAseg = "NombreAseg1", + NumPolizaSeguro = "NumPolizaSeguro1", + TipoEmbarcacionId = "B01", + Matricula = "Matricula1", + NumeroOMI = "IMO1234567", + AnioEmbarcacion = 2003, + NombreEmbarc = "NombreEmbarc1", + NacionalidadEmbarcId = "AFG", + UnidadesDeArqBruto = 0.001m, + TipoCargaId = "CGS", + Eslora = 0.01m, + Manga = 0.01m, + Calado = 0.01m, + Puntal = 0.01m, + LineaNaviera = "LineaNaviera1", + NombreAgenteNaviero = "NombreAgenteNaviero1", + NumAutorizacionNavieroId = "ANC001/2022", + NumViaje = "NumViaje1", + NumConocEmbarc = "NumConocEmbarc1", + PermisoTempNavegacion = "PermisoTempNavegac1", + Contenedores = new List + { + new ContenedorMaritimo + { + TipoContenedorId = "CM011", + IdCCPRelacionado = "CCCBCD94-870A-4332-A52A-A52AA52AA52A", + PlacaVMCCP = "JNG7683", + FechaCertificacionCCP = "2024-06-20T11:11:00", + RemolquesCCP = new List + { + new RemolqueCCP { SubTipoRemCCPId = "CTR001", PlacaCCP = "JNG7636" } + } + } + } + }, + TiposFigura = new List + { + new TipoFigura + { + TipoFiguraId = "02", + RfcFigura = "EKU9003173C9", + NombreFigura = "NombreFigura", + PartesTransporte = new List + { + new ParteTransporte { ParteTransporteId = "PT02" } + }, + Domicilio = new Domicilio + { + Calle = "calle", NumeroExterior = "211", ColoniaId = "0814", + LocalidadId = "01", Referencia = "casa blanca", + MunicipioId = "010", EstadoId = "ZAC", PaisId = "MEX", CodigoPostalId = "99080" + } + } + } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button24: Factura traslado transporte maritimo extranjero + private async void button24_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseTraslado(); + invoice.Series = "Serie"; + + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "Sí", + EntradaSalidaMercId = "Salida", + PaisOrigenDestinoId = "USA", + ViaEntradaSalidaId = "02", + UnidadPesoId = "XBX", + PesoNetoTotal = 1, + RegimenAduaneros = new List + { + new RegimenAduanero { RegimenAduaneroId = "EXD" } + }, + Ubicaciones = new List + { + new Ubicacion + { + TipoUbicacion = "Origen", IdUbicacion = "OR101010", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario1", + NumEstacionId = "PM001", NombreEstacion = "Rosarito", + NavegacionTraficoId = "Altura", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:00"), + TipoEstacionId = "01", + Domicilio = new Domicilio + { + Calle = "Calle1", NumeroExterior = "211", NumeroInterior = "212", + ColoniaId = "1957", LocalidadId = "13", Referencia = "casa blanca", + MunicipioId = "011", EstadoId = "CMX", PaisId = "MEX", CodigoPostalId = "13250" + } + }, + new Ubicacion + { + TipoUbicacion = "Destino", IdUbicacion = "DE202020", + RfcRemitenteDestinatario = "XEXX010101000", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario2", + NumRegIdTrib = "01010101", ResidenciaFiscalId = "USA", + NumEstacionId = "PM120", NombreEstacion = "NombreEstacion", + NavegacionTraficoId = "Altura", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + Domicilio = new Domicilio + { + Calle = "ST", NumeroExterior = "12345", ColoniaId = "N/A", + Referencia = "N/A", MunicipioId = "N/A", + EstadoId = "TX", PaisId = "USA", CodigoPostalId = "12345" + } + } + }, + Mercancias = new List + { + new Mercancia + { + BienesTranspId = "11121900", + Descripcion = "Accesorios de equipo de telefonía", + Cantidad = 1.0m, + ClaveUnidadId = "XBX", + MaterialPeligrosoId = "No", + DenominacionGenericaProd = "DenominacionGenericaProd1", + DenominacionDistintivaProd = "DenominacionDistintivaProd1", + Fabricante = "Fabricante1", + FechaCaducidad = DateTime.Parse("2028-01-01T00:00:00"), + LoteMedicamento = "LoteMedic1", + RegistroSanitarioFolioAutorizacion = "RegistroSanita1", + PesoEnKg = 1, + ValorMercancia = 100, + MonedaId = "MXN", + TipoMateriaId = "05", + DescripcionMateria = "otramateria", + CantidadTransporta = new List + { + new CantidadTransporta { Cantidad = 1, IdOrigen = "OR101010", IdDestino = "DE202020" } + }, + DetalleMercancia = new DetalleMercancia + { + UnidadPesoMercId = "Tu", + PesoBruto = 1, + PesoNeto = 1, + PesoTara = 0.001m, + NumPiezas = 1 + } + } + }, + TransporteMaritimo = new TransporteMaritimo + { + PermSCTId = "TPAF01", + NumPermisoSCT = "NumPermisoSCT1", + NombreAseg = "NombreAseg1", + NumPolizaSeguro = "NumPolizaSeguro1", + TipoEmbarcacionId = "B01", + Matricula = "Matricula1", + NumeroOMI = "IMO1234567", + AnioEmbarcacion = 2003, + NombreEmbarc = "NombreEmbarc1", + NacionalidadEmbarcId = "AFG", + UnidadesDeArqBruto = 0.001m, + TipoCargaId = "CGS", + Eslora = 0.01m, + Manga = 0.01m, + Calado = 0.01m, + Puntal = 0.01m, + LineaNaviera = "LineaNaviera1", + NombreAgenteNaviero = "NombreAgenteNaviero1", + NumAutorizacionNavieroId = "ANC001/2022", + NumViaje = "NumViaje1", + NumConocEmbarc = "NumConocEmbarc1", + PermisoTempNavegacion = "PermisoTempNavegac1", + Contenedores = new List + { + new ContenedorMaritimo + { + TipoContenedorId = "CM011", + IdCCPRelacionado = "CCCBCD94-870A-4332-A52A-A52AA52AA52A", + PlacaVMCCP = "JNG7683", + FechaCertificacionCCP = "2024-06-20T11:11:00", + RemolquesCCP = new List + { + new RemolqueCCP { SubTipoRemCCPId = "CTR001", PlacaCCP = "JNG7636" } + } + } + } + }, + TiposFigura = new List + { + new TipoFigura + { + TipoFiguraId = "02", + RfcFigura = "EKU9003173C9", + NombreFigura = "NombreFigura", + PartesTransporte = new List + { + new ParteTransporte { ParteTransporteId = "PT02" } + }, + Domicilio = new Domicilio + { + Calle = "calle", NumeroExterior = "211", ColoniaId = "0814", + LocalidadId = "01", Referencia = "casa blanca", + MunicipioId = "010", EstadoId = "ZAC", PaisId = "MEX", CodigoPostalId = "99080" + } + } + } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button25: Factura traslado transporte maritimo internacional aduanero + private async void button25_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseTraslado(); + invoice.Series = "Serie"; + + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "Sí", + EntradaSalidaMercId = "Entrada", + PaisOrigenDestinoId = "AFG", + ViaEntradaSalidaId = "02", + UnidadPesoId = "XBX", + PesoNetoTotal = 1, + RegimenAduaneros = new List + { + new RegimenAduanero { RegimenAduaneroId = "IMD" }, + new RegimenAduanero { RegimenAduaneroId = "IMD" } + }, + Ubicaciones = new List + { + new Ubicacion + { + TipoUbicacion = "Origen", IdUbicacion = "OR101010", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario1", + NumEstacionId = "PM001", NombreEstacion = "Rosarito", + NavegacionTraficoId = "Altura", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:00"), + TipoEstacionId = "01", + Domicilio = new Domicilio + { + Calle = "Calle1", NumeroExterior = "211", NumeroInterior = "212", + ColoniaId = "1957", LocalidadId = "13", Referencia = "casa blanca", + MunicipioId = "011", EstadoId = "CMX", PaisId = "MEX", CodigoPostalId = "13250" + } + }, + new Ubicacion + { + TipoUbicacion = "Destino", IdUbicacion = "DE202020", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario2", + NumEstacionId = "PM001", NombreEstacion = "Rosarito", + NavegacionTraficoId = "Altura", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + TipoEstacionId = "03", + Domicilio = new Domicilio + { + Calle = "Calle2", NumeroExterior = "214", NumeroInterior = "215", + ColoniaId = "0347", LocalidadId = "23", Referencia = "casa negra", + MunicipioId = "004", EstadoId = "COA", PaisId = "MEX", CodigoPostalId = "25350" + } + } + }, + Mercancias = new List + { + new Mercancia + { + BienesTranspId = "11121900", + Descripcion = "Accesorios de equipo de telefonía", + Cantidad = 1.0m, + ClaveUnidadId = "XBX", + MaterialPeligrosoId = "No", + DenominacionGenericaProd = "DenominacionGenericaProd1", + DenominacionDistintivaProd = "DenominacionDistintivaProd1", + Fabricante = "Fabricante1", + FechaCaducidad = DateTime.Parse("2028-01-01T00:00:00"), + LoteMedicamento = "LoteMedic1", + RegistroSanitarioFolioAutorizacion = "RegistroSanita1", + PesoEnKg = 1, + ValorMercancia = 100, + MonedaId = "MXN", + TipoMateriaId = "05", + DescripcionMateria = "otramateria", + DocumentacionAduanera = new List + { + new DocumentoAduanero + { + TipoDocumentoId = "01", + NumPedimento = "23 43 0472 8000448", + RfcImpo = "EKU9003173C9" + } + }, + CantidadTransporta = new List + { + new CantidadTransporta { Cantidad = 1, IdOrigen = "OR101010", IdDestino = "DE202020" } + }, + DetalleMercancia = new DetalleMercancia + { + UnidadPesoMercId = "Tu", + PesoBruto = 1, + PesoNeto = 1, + PesoTara = 0.001m, + NumPiezas = 1 + } + } + }, + TransporteMaritimo = new TransporteMaritimo + { + PermSCTId = "TPAF01", + NumPermisoSCT = "NumPermisoSCT1", + NombreAseg = "NombreAseg1", + NumPolizaSeguro = "NumPolizaSeguro1", + TipoEmbarcacionId = "B01", + Matricula = "Matricula1", + NumeroOMI = "IMO1234567", + AnioEmbarcacion = 2003, + NombreEmbarc = "NombreEmbarc1", + NacionalidadEmbarcId = "AFG", + UnidadesDeArqBruto = 0.001m, + TipoCargaId = "CGS", + Eslora = 0.01m, + Manga = 0.01m, + Calado = 0.01m, + Puntal = 0.01m, + LineaNaviera = "LineaNaviera1", + NombreAgenteNaviero = "NombreAgenteNaviero1", + NumAutorizacionNavieroId = "ANC001/2022", + NumViaje = "NumViaje1", + NumConocEmbarc = "NumConocEmbarc1", + PermisoTempNavegacion = "PermisoTempNavegac1", + Contenedores = new List + { + new ContenedorMaritimo + { + TipoContenedorId = "CM011", + IdCCPRelacionado = "CCCBCD94-870A-4332-A52A-A52AA52AA52A", + PlacaVMCCP = "JNG7683", + FechaCertificacionCCP = "2024-06-20T11:11:00", + RemolquesCCP = new List + { + new RemolqueCCP { SubTipoRemCCPId = "CTR001", PlacaCCP = "JNG7636" } + } + } + } + }, + TiposFigura = new List + { + new TipoFigura + { + TipoFiguraId = "02", + RfcFigura = "EKU9003173C9", + NombreFigura = "NombreFigura", + PartesTransporte = new List + { + new ParteTransporte { ParteTransporteId = "PT02" } + }, + Domicilio = new Domicilio + { + Calle = "calle", NumeroExterior = "211", ColoniaId = "0814", + LocalidadId = "01", Referencia = "casa blanca", + MunicipioId = "010", EstadoId = "ZAC", PaisId = "MEX", CodigoPostalId = "99080" + } + } + } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + private TransporteFerroviario CreateTransporteFerroviario() + { + return new TransporteFerroviario + { + TipoDeServicioId = "TS01", + TipoDeTraficoId = "TT01", + DerechosDePaso = new List + { + new DerechoDePaso { TipoDerechoDePasoId = "CDP114", KilometrajePagado = 100 } + }, + Carros = new List + { + new Carro + { + TipoCarroId = "TC08", + MatriculaCarro = "A00012", + GuiaCarro = "123ASD", + ToneladasNetasCarro = 10 + } + } + }; + } + + private TipoFigura CreateTipoFiguraFerroviario() + { + return new TipoFigura + { + TipoFiguraId = "02", + RfcFigura = "EKU9003173C9", + NombreFigura = "NombreFigura", + PartesTransporte = new List + { + new ParteTransporte { ParteTransporteId = "PT02" } + }, + Domicilio = new Domicilio + { + Calle = "calle", NumeroExterior = "211", ColoniaId = "0814", + LocalidadId = "01", Referencia = "casa blanca", + MunicipioId = "010", EstadoId = "ZAC", PaisId = "MEX", CodigoPostalId = "99080" + } + }; + } + + private List CreateUbicacionesFerroviarioNacional() + { + return new List + { + new Ubicacion + { + TipoUbicacion = "Origen", IdUbicacion = "OR101010", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario1", + NumEstacionId = "Q0736", NombreEstacion = "SANTO NINO", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:00"), + TipoEstacionId = "01", + Domicilio = new Domicilio + { + Calle = "Calle1", NumeroExterior = "211", NumeroInterior = "212", + ColoniaId = "1957", LocalidadId = "13", Referencia = "casa blanca", + MunicipioId = "011", EstadoId = "CMX", PaisId = "MEX", CodigoPostalId = "13250" + } + }, + new Ubicacion + { + TipoUbicacion = "Destino", IdUbicacion = "DE202021", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario2", + NumEstacionId = "SC283", NombreEstacion = "HUAXTITLA", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T01:00:01"), + TipoEstacionId = "02", DistanciaRecorrida = 100.00m + }, + new Ubicacion + { + TipoUbicacion = "Destino", IdUbicacion = "DE202022", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario2", + NumEstacionId = "TG0", NombreEstacion = "NAVOJOA", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T02:00:01"), + TipoEstacionId = "02", DistanciaRecorrida = 100.00m + }, + new Ubicacion + { + TipoUbicacion = "Destino", IdUbicacion = "DE202023", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario2", + NumEstacionId = "E0029", NombreEstacion = "TRES JAGUEYES", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T03:00:01"), + TipoEstacionId = "02", DistanciaRecorrida = 100.00m + }, + new Ubicacion + { + TipoUbicacion = "Destino", IdUbicacion = "DE202024", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario2", + NumEstacionId = "TI032", NombreEstacion = "NAVOLATO", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T04:00:01"), + TipoEstacionId = "02", DistanciaRecorrida = 100.00m + }, + new Ubicacion + { + TipoUbicacion = "Destino", IdUbicacion = "DE202025", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario2", + NumEstacionId = "JM047", NombreEstacion = "HUEHUETOCA", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T05:00:01"), + TipoEstacionId = "03", DistanciaRecorrida = 100.00m, + Domicilio = new Domicilio + { + Calle = "Calle2", NumeroExterior = "214", NumeroInterior = "215", + ColoniaId = "0347", LocalidadId = "23", Referencia = "casa negra", + MunicipioId = "004", EstadoId = "COA", PaisId = "MEX", CodigoPostalId = "25350" + } + } + }; + } + + private Mercancia CreateMercanciaFerroviario(bool includeTipoMateria = false, bool includeDocumentacionAduanera = false) + { + var m = new Mercancia + { + BienesTranspId = "11121900", + Descripcion = "Accesorios de equipo de telefonía", + Cantidad = 1.0m, + ClaveUnidadId = "XBX", + MaterialPeligrosoId = "No", + DenominacionGenericaProd = "DenominacionGenericaProd1", + DenominacionDistintivaProd = "DenominacionDistintivaProd1", + Fabricante = "Fabricante1", + FechaCaducidad = DateTime.Parse("2028-01-01T00:00:00"), + LoteMedicamento = "LoteMedic1", + RegistroSanitarioFolioAutorizacion = "RegistroSanita1", + PesoEnKg = 1, + CantidadTransporta = new List + { + new CantidadTransporta { Cantidad = 1, IdOrigen = "OR101010", IdDestino = "DE202025" } + } + }; + + if (includeTipoMateria || includeDocumentacionAduanera) + { + m.TipoMateriaId = "05"; + m.DescripcionMateria = "otramateria"; + } + + if (includeDocumentacionAduanera) + { + m.DocumentacionAduanera = new List + { + new DocumentoAduanero + { + TipoDocumentoId = "01", + NumPedimento = "23 43 0472 8000448", + RfcImpo = "EKU9003173C9" + } + }; + } + + return m; + } + + private Invoice CreateBaseInvoiceFerroviario() + { + var invoice = CreateBaseInvoice(); + invoice.Series = "Serie"; + invoice.Recipient = new InvoiceRecipient { Id = "37f7c342-d9a6-4881-9620-0da769b50ce5" }; + return invoice; + } + + private Invoice CreateBaseTraslado() + { + return new Invoice + { + VersionCode = "4.0", + CurrencyCode = "XXX", + TypeCode = "T", + ExpeditionZipCode = "42501", + PaymentMethodCode = "", + Date = DateTime.Now, + ExchangeRate = 1, + ExportCode = "01", + Issuer = CreateIssuer(), + Recipient = new InvoiceRecipient { Id = "0e82a655-5f0c-4e07-abab-8f322e4123ef" }, + Items = new List + { + new InvoiceItem + { + ItemCode = "78101800", + ItemSku = "UT421511", + Quantity = 1, + UnitOfMeasurementCode = "H87", + Description = "Transporte de carga por carretera", + UnitPrice = 100.00m, + Discount = 0, + TaxObjectCode = "01", + ItemTaxes = new List() + } + } + }; + } + } +} diff --git a/FiscalApi.Samples.NetFramework/BillOfLadingValueForm.Designer.cs b/FiscalApi.Samples.NetFramework/BillOfLadingValueForm.Designer.cs new file mode 100644 index 0000000..682e7fb --- /dev/null +++ b/FiscalApi.Samples.NetFramework/BillOfLadingValueForm.Designer.cs @@ -0,0 +1,416 @@ +namespace FiscalApi.Samples.NetFramework +{ + partial class BillOfLadingValueForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.button3 = new System.Windows.Forms.Button(); + this.button4 = new System.Windows.Forms.Button(); + this.button5 = new System.Windows.Forms.Button(); + this.button6 = new System.Windows.Forms.Button(); + this.button7 = new System.Windows.Forms.Button(); + this.button8 = new System.Windows.Forms.Button(); + this.button9 = new System.Windows.Forms.Button(); + this.button10 = new System.Windows.Forms.Button(); + this.button11 = new System.Windows.Forms.Button(); + this.button12 = new System.Windows.Forms.Button(); + this.button13 = new System.Windows.Forms.Button(); + this.button14 = new System.Windows.Forms.Button(); + this.button15 = new System.Windows.Forms.Button(); + this.button16 = new System.Windows.Forms.Button(); + this.button17 = new System.Windows.Forms.Button(); + this.button18 = new System.Windows.Forms.Button(); + this.button19 = new System.Windows.Forms.Button(); + this.button20 = new System.Windows.Forms.Button(); + this.button21 = new System.Windows.Forms.Button(); + this.button22 = new System.Windows.Forms.Button(); + this.button23 = new System.Windows.Forms.Button(); + this.button24 = new System.Windows.Forms.Button(); + this.button25 = new System.Windows.Forms.Button(); + this.groupBox1.SuspendLayout(); + this.SuspendLayout(); + // + // groupBox1 + // + this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox1.Controls.Add(this.button1); + this.groupBox1.Controls.Add(this.button2); + this.groupBox1.Controls.Add(this.button3); + this.groupBox1.Controls.Add(this.button4); + this.groupBox1.Controls.Add(this.button5); + this.groupBox1.Controls.Add(this.button6); + this.groupBox1.Controls.Add(this.button7); + this.groupBox1.Controls.Add(this.button8); + this.groupBox1.Controls.Add(this.button9); + this.groupBox1.Controls.Add(this.button10); + this.groupBox1.Controls.Add(this.button11); + this.groupBox1.Controls.Add(this.button12); + this.groupBox1.Controls.Add(this.button13); + this.groupBox1.Controls.Add(this.button14); + this.groupBox1.Controls.Add(this.button15); + this.groupBox1.Controls.Add(this.button16); + this.groupBox1.Controls.Add(this.button17); + this.groupBox1.Controls.Add(this.button18); + this.groupBox1.Controls.Add(this.button19); + this.groupBox1.Controls.Add(this.button20); + this.groupBox1.Controls.Add(this.button21); + this.groupBox1.Controls.Add(this.button22); + this.groupBox1.Controls.Add(this.button23); + this.groupBox1.Controls.Add(this.button24); + this.groupBox1.Controls.Add(this.button25); + this.groupBox1.Location = new System.Drawing.Point(12, 12); + this.groupBox1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.groupBox1.Size = new System.Drawing.Size(995, 430); + this.groupBox1.TabIndex = 0; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Carta Porte"; + // + // button1 - Factura ingreso autotransporte nacional + // + this.button1.Location = new System.Drawing.Point(5, 21); + this.button1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(189, 60); + this.button1.TabIndex = 1; + this.button1.Text = "Factura ingreso autotransporte nacional"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // button2 - Factura ingreso autotransporte nacional con impuestos + // + this.button2.Location = new System.Drawing.Point(203, 21); + this.button2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(189, 60); + this.button2.TabIndex = 2; + this.button2.Text = "Factura ingreso autotransporte nacional con impuestos"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // button3 - Factura ingreso autotransporte extranjero + // + this.button3.Location = new System.Drawing.Point(401, 21); + this.button3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(189, 60); + this.button3.TabIndex = 3; + this.button3.Text = "Factura ingreso autotransporte extranjero"; + this.button3.UseVisualStyleBackColor = true; + this.button3.Click += new System.EventHandler(this.button3_Click); + // + // button4 - Factura ingreso autotransporte internacional aduanero + // + this.button4.Location = new System.Drawing.Point(599, 21); + this.button4.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button4.Name = "button4"; + this.button4.Size = new System.Drawing.Size(189, 60); + this.button4.TabIndex = 4; + this.button4.Text = "Factura ingreso autotransporte internacional aduanero"; + this.button4.UseVisualStyleBackColor = true; + this.button4.Click += new System.EventHandler(this.button4_Click); + // + // button5 - Factura ingreso transporte ferroviario nacional + // + this.button5.Location = new System.Drawing.Point(797, 21); + this.button5.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button5.Name = "button5"; + this.button5.Size = new System.Drawing.Size(189, 60); + this.button5.TabIndex = 5; + this.button5.Text = "Factura ingreso transporte ferroviario nacional"; + this.button5.UseVisualStyleBackColor = true; + this.button5.Click += new System.EventHandler(this.button5_Click); + // + // button6 - Factura ingreso transporte ferroviario extranjero + // + this.button6.Location = new System.Drawing.Point(5, 89); + this.button6.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button6.Name = "button6"; + this.button6.Size = new System.Drawing.Size(189, 60); + this.button6.TabIndex = 6; + this.button6.Text = "Factura ingreso transporte ferroviario extranjero"; + this.button6.UseVisualStyleBackColor = true; + this.button6.Click += new System.EventHandler(this.button6_Click); + // + // button7 - Factura ingreso transporte ferroviario internacional aduanero + // + this.button7.Location = new System.Drawing.Point(203, 89); + this.button7.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button7.Name = "button7"; + this.button7.Size = new System.Drawing.Size(189, 60); + this.button7.TabIndex = 7; + this.button7.Text = "Factura ingreso transporte ferroviario internacional aduanero"; + this.button7.UseVisualStyleBackColor = true; + this.button7.Click += new System.EventHandler(this.button7_Click); + // + // button8 - Factura ingreso transporte aereo nacional + // + this.button8.Location = new System.Drawing.Point(401, 89); + this.button8.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button8.Name = "button8"; + this.button8.Size = new System.Drawing.Size(189, 60); + this.button8.TabIndex = 8; + this.button8.Text = "Factura ingreso transporte aereo nacional"; + this.button8.UseVisualStyleBackColor = true; + this.button8.Click += new System.EventHandler(this.button8_Click); + // + // button9 - Factura ingreso transporte aereo extranjero + // + this.button9.Location = new System.Drawing.Point(599, 89); + this.button9.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button9.Name = "button9"; + this.button9.Size = new System.Drawing.Size(189, 60); + this.button9.TabIndex = 9; + this.button9.Text = "Factura ingreso transporte aereo extranjero"; + this.button9.UseVisualStyleBackColor = true; + this.button9.Click += new System.EventHandler(this.button9_Click); + // + // button10 - Factura ingreso transporte aereo internacional aduanero + // + this.button10.Location = new System.Drawing.Point(797, 89); + this.button10.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button10.Name = "button10"; + this.button10.Size = new System.Drawing.Size(189, 60); + this.button10.TabIndex = 10; + this.button10.Text = "Factura ingreso transporte aereo internacional aduanero"; + this.button10.UseVisualStyleBackColor = true; + this.button10.Click += new System.EventHandler(this.button10_Click); + // + // button11 - Factura ingreso transporte maritimo nacional + // + this.button11.Location = new System.Drawing.Point(5, 157); + this.button11.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button11.Name = "button11"; + this.button11.Size = new System.Drawing.Size(189, 60); + this.button11.TabIndex = 11; + this.button11.Text = "Factura ingreso transporte maritimo nacional"; + this.button11.UseVisualStyleBackColor = true; + this.button11.Click += new System.EventHandler(this.button11_Click); + // + // button12 - Factura ingreso transporte maritimo extranjero + // + this.button12.Location = new System.Drawing.Point(203, 157); + this.button12.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button12.Name = "button12"; + this.button12.Size = new System.Drawing.Size(189, 60); + this.button12.TabIndex = 12; + this.button12.Text = "Factura ingreso transporte maritimo extranjero"; + this.button12.UseVisualStyleBackColor = true; + this.button12.Click += new System.EventHandler(this.button12_Click); + // + // button13 - Factura ingreso transporte maritimo internacional aduanero + // + this.button13.Location = new System.Drawing.Point(401, 157); + this.button13.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button13.Name = "button13"; + this.button13.Size = new System.Drawing.Size(189, 60); + this.button13.TabIndex = 13; + this.button13.Text = "Factura ingreso transporte maritimo internacional aduanero"; + this.button13.UseVisualStyleBackColor = true; + this.button13.Click += new System.EventHandler(this.button13_Click); + // + // button14 - Factura traslado autotransporte nacional + // + this.button14.Location = new System.Drawing.Point(599, 157); + this.button14.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button14.Name = "button14"; + this.button14.Size = new System.Drawing.Size(189, 60); + this.button14.TabIndex = 14; + this.button14.Text = "Factura traslado autotransporte nacional"; + this.button14.UseVisualStyleBackColor = true; + this.button14.Click += new System.EventHandler(this.button14_Click); + // + // button15 - Factura traslado autotransporte extranjero + // + this.button15.Location = new System.Drawing.Point(797, 157); + this.button15.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button15.Name = "button15"; + this.button15.Size = new System.Drawing.Size(189, 60); + this.button15.TabIndex = 15; + this.button15.Text = "Factura traslado autotransporte extranjero"; + this.button15.UseVisualStyleBackColor = true; + this.button15.Click += new System.EventHandler(this.button15_Click); + // + // button16 - Factura traslado autotransporte internacional aduanero + // + this.button16.Location = new System.Drawing.Point(5, 225); + this.button16.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button16.Name = "button16"; + this.button16.Size = new System.Drawing.Size(189, 60); + this.button16.TabIndex = 16; + this.button16.Text = "Factura traslado autotransporte internacional aduanero"; + this.button16.UseVisualStyleBackColor = true; + this.button16.Click += new System.EventHandler(this.button16_Click); + // + // button17 - Factura traslado transporte ferroviario nacional + // + this.button17.Location = new System.Drawing.Point(203, 225); + this.button17.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button17.Name = "button17"; + this.button17.Size = new System.Drawing.Size(189, 60); + this.button17.TabIndex = 17; + this.button17.Text = "Factura traslado transporte ferroviario nacional"; + this.button17.UseVisualStyleBackColor = true; + this.button17.Click += new System.EventHandler(this.button17_Click); + // + // button18 - Factura traslado transporte ferroviario extranjero + // + this.button18.Location = new System.Drawing.Point(401, 225); + this.button18.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button18.Name = "button18"; + this.button18.Size = new System.Drawing.Size(189, 60); + this.button18.TabIndex = 18; + this.button18.Text = "Factura traslado transporte ferroviario extranjero"; + this.button18.UseVisualStyleBackColor = true; + this.button18.Click += new System.EventHandler(this.button18_Click); + // + // button19 - Factura traslado transporte ferroviario internacional aduanero + // + this.button19.Location = new System.Drawing.Point(599, 225); + this.button19.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button19.Name = "button19"; + this.button19.Size = new System.Drawing.Size(189, 60); + this.button19.TabIndex = 19; + this.button19.Text = "Factura traslado transporte ferroviario inernacional aduanero"; + this.button19.UseVisualStyleBackColor = true; + this.button19.Click += new System.EventHandler(this.button19_Click); + // + // button20 - Factura traslado transporte aereo nacional + // + this.button20.Location = new System.Drawing.Point(797, 225); + this.button20.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button20.Name = "button20"; + this.button20.Size = new System.Drawing.Size(189, 60); + this.button20.TabIndex = 20; + this.button20.Text = "Factura traslado transporte aereo nacional"; + this.button20.UseVisualStyleBackColor = true; + this.button20.Click += new System.EventHandler(this.button20_Click); + // + // button21 - Factura traslado transporte aereo extranjero + // + this.button21.Location = new System.Drawing.Point(5, 293); + this.button21.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button21.Name = "button21"; + this.button21.Size = new System.Drawing.Size(189, 60); + this.button21.TabIndex = 21; + this.button21.Text = "Factura traslado transporte aereo extranjero"; + this.button21.UseVisualStyleBackColor = true; + this.button21.Click += new System.EventHandler(this.button21_Click); + // + // button22 - Factura traslado transporte aereo internacional aduanero + // + this.button22.Location = new System.Drawing.Point(203, 293); + this.button22.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button22.Name = "button22"; + this.button22.Size = new System.Drawing.Size(189, 60); + this.button22.TabIndex = 22; + this.button22.Text = "Factura traslado transporte aereo internacional aduanero"; + this.button22.UseVisualStyleBackColor = true; + this.button22.Click += new System.EventHandler(this.button22_Click); + // + // button23 - Factura traslado transporte maritimo nacional + // + this.button23.Location = new System.Drawing.Point(401, 293); + this.button23.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button23.Name = "button23"; + this.button23.Size = new System.Drawing.Size(189, 60); + this.button23.TabIndex = 23; + this.button23.Text = "Factura traslado transporte maritimo nacional"; + this.button23.UseVisualStyleBackColor = true; + this.button23.Click += new System.EventHandler(this.button23_Click); + // + // button24 - Factura traslado transporte maritimo extranjero + // + this.button24.Location = new System.Drawing.Point(599, 293); + this.button24.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button24.Name = "button24"; + this.button24.Size = new System.Drawing.Size(189, 60); + this.button24.TabIndex = 24; + this.button24.Text = "Factura traslado transporte maritimo extranjero"; + this.button24.UseVisualStyleBackColor = true; + this.button24.Click += new System.EventHandler(this.button24_Click); + // + // button25 - Factura traslado transporte maritimo internacional aduanero + // + this.button25.Location = new System.Drawing.Point(797, 293); + this.button25.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button25.Name = "button25"; + this.button25.Size = new System.Drawing.Size(189, 60); + this.button25.TabIndex = 25; + this.button25.Text = "Factura traslado transporte maritimo internacional aduanero"; + this.button25.UseVisualStyleBackColor = true; + this.button25.Click += new System.EventHandler(this.button25_Click); + // + // BillOfLadingValueForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1019, 454); + this.Controls.Add(this.groupBox1); + this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.Name = "BillOfLadingValueForm"; + this.Text = "BillOfLadingValueForm"; + this.groupBox1.ResumeLayout(false); + this.ResumeLayout(false); + } + + #endregion + + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.Button button3; + private System.Windows.Forms.Button button4; + private System.Windows.Forms.Button button5; + private System.Windows.Forms.Button button6; + private System.Windows.Forms.Button button7; + private System.Windows.Forms.Button button8; + private System.Windows.Forms.Button button9; + private System.Windows.Forms.Button button10; + private System.Windows.Forms.Button button11; + private System.Windows.Forms.Button button12; + private System.Windows.Forms.Button button13; + private System.Windows.Forms.Button button14; + private System.Windows.Forms.Button button15; + private System.Windows.Forms.Button button16; + private System.Windows.Forms.Button button17; + private System.Windows.Forms.Button button18; + private System.Windows.Forms.Button button19; + private System.Windows.Forms.Button button20; + private System.Windows.Forms.Button button21; + private System.Windows.Forms.Button button22; + private System.Windows.Forms.Button button23; + private System.Windows.Forms.Button button24; + private System.Windows.Forms.Button button25; + } +} \ No newline at end of file diff --git a/FiscalApi.Samples.NetFramework/BillOfLadingValueForm.cs b/FiscalApi.Samples.NetFramework/BillOfLadingValueForm.cs new file mode 100644 index 0000000..2ac7c1b --- /dev/null +++ b/FiscalApi.Samples.NetFramework/BillOfLadingValueForm.cs @@ -0,0 +1,3119 @@ +using Fiscalapi.Common; +using Fiscalapi.Models; +using Fiscalapi.Models.BillOfLading; +using Fiscalapi.Services; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace FiscalApi.Samples.NetFramework +{ + public partial class BillOfLadingValueForm : Form + { + private FiscalapiSettings _settings; + public BillOfLadingValueForm(FiscalapiSettings settings) + { + InitializeComponent(); + _settings = settings; + } + + private string _certEscuelaKemper = "MIIFsDCCA5igAwIBAgIUMzAwMDEwMDAwMDA1MDAwMDM0MTYwDQYJKoZIhvcNAQELBQAwggErMQ8wDQYDVQQDDAZBQyBVQVQxLjAsBgNVBAoMJVNFUlZJQ0lPIERFIEFETUlOSVNUUkFDSU9OIFRSSUJVVEFSSUExGjAYBgNVBAsMEVNBVC1JRVMgQXV0aG9yaXR5MSgwJgYJKoZIhvcNAQkBFhlvc2Nhci5tYXJ0aW5lekBzYXQuZ29iLm14MR0wGwYDVQQJDBQzcmEgY2VycmFkYSBkZSBjYWxpejEOMAwGA1UEEQwFMDYzNzAxCzAJBgNVBAYTAk1YMRkwFwYDVQQIDBBDSVVEQUQgREUgTUVYSUNPMREwDwYDVQQHDAhDT1lPQUNBTjERMA8GA1UELRMIMi41LjQuNDUxJTAjBgkqhkiG9w0BCQITFnJlc3BvbnNhYmxlOiBBQ0RNQS1TQVQwHhcNMjMwNTE4MTE0MzUxWhcNMjcwNTE4MTE0MzUxWjCB1zEnMCUGA1UEAxMeRVNDVUVMQSBLRU1QRVIgVVJHQVRFIFNBIERFIENWMScwJQYDVQQpEx5FU0NVRUxBIEtFTVBFUiBVUkdBVEUgU0EgREUgQ1YxJzAlBgNVBAoTHkVTQ1VFTEEgS0VNUEVSIFVSR0FURSBTQSBERSBDVjElMCMGA1UELRMcRUtVOTAwMzE3M0M5IC8gVkFEQTgwMDkyN0RKMzEeMBwGA1UEBRMVIC8gVkFEQTgwMDkyN0hTUlNSTDA1MRMwEQYDVQQLEwpTdWN1cnNhbCAxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtmecO6n2GS0zL025gbHGQVxznPDICoXzR2uUngz4DqxVUC/w9cE6FxSiXm2ap8Gcjg7wmcZfm85EBaxCx/0J2u5CqnhzIoGCdhBPuhWQnIh5TLgj/X6uNquwZkKChbNe9aeFirU/JbyN7Egia9oKH9KZUsodiM/pWAH00PCtoKJ9OBcSHMq8Rqa3KKoBcfkg1ZrgueffwRLws9yOcRWLb02sDOPzGIm/jEFicVYt2Hw1qdRE5xmTZ7AGG0UHs+unkGjpCVeJ+BEBn0JPLWVvDKHZAQMj6s5Bku35+d/MyATkpOPsGT/VTnsouxekDfikJD1f7A1ZpJbqDpkJnss3vQIDAQABox0wGzAMBgNVHRMBAf8EAjAAMAsGA1UdDwQEAwIGwDANBgkqhkiG9w0BAQsFAAOCAgEAFaUgj5PqgvJigNMgtrdXZnbPfVBbukAbW4OGnUhNrA7SRAAfv2BSGk16PI0nBOr7qF2mItmBnjgEwk+DTv8Zr7w5qp7vleC6dIsZFNJoa6ZndrE/f7KO1CYruLXr5gwEkIyGfJ9NwyIagvHHMszzyHiSZIA850fWtbqtythpAliJ2jF35M5pNS+YTkRB+T6L/c6m00ymN3q9lT1rB03YywxrLreRSFZOSrbwWfg34EJbHfbFXpCSVYdJRfiVdvHnewN0r5fUlPtR9stQHyuqewzdkyb5jTTw02D2cUfL57vlPStBj7SEi3uOWvLrsiDnnCIxRMYJ2UA2ktDKHk+zWnsDmaeleSzonv2CHW42yXYPCvWi88oE1DJNYLNkIjua7MxAnkNZbScNw01A6zbLsZ3y8G6eEYnxSTRfwjd8EP4kdiHNJftm7Z4iRU7HOVh79/lRWB+gd171s3d/mI9kte3MRy6V8MMEMCAnMboGpaooYwgAmwclI2XZCczNWXfhaWe0ZS5PmytD/GDpXzkX0oEgY9K/uYo5V77NdZbGAjmyi8cE2B2ogvyaN2XfIInrZPgEffJ4AB7kFA2mwesdLOCh0BLD9itmCve3A1FGR4+stO2ANUoiI3w3Tv2yQSg4bjeDlJ08lXaaFCLW2peEXMXjQUk7fmpb5MNuOUTW6BE="; + private string _keyEscuelaKemper = "MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQIAgEAAoIBAQACAggAMBQGCCqGSIb3DQMHBAgwggS/AgEAMASCBMh4EHl7aNSCaMDA1VlRoXCZ5UUmqErAbucoZQObOaLUEm+I+QZ7Y8Giupo+F1XWkLvAsdk/uZlJcTfKLJyJbJwsQYbSpLOCLataZ4O5MVnnmMbfG//NKJn9kSMvJQZhSwAwoGLYDm1ESGezrvZabgFJnoQv8Si1nAhVGTk9FkFBesxRzq07dmZYwFCnFSX4xt2fDHs1PMpQbeq83aL/PzLCce3kxbYSB5kQlzGtUYayiYXcu0cVRu228VwBLCD+2wTDDoCmRXtPesgrLKUR4WWWb5N2AqAU1mNDC+UEYsENAerOFXWnmwrcTAu5qyZ7GsBMTpipW4Dbou2yqQ0lpA/aB06n1kz1aL6mNqGPaJ+OqoFuc8Ugdhadd+MmjHfFzoI20SZ3b2geCsUMNCsAd6oXMsZdWm8lzjqCGWHFeol0ik/xHMQvuQkkeCsQ28PBxdnUgf7ZGer+TN+2ZLd2kvTBOk6pIVgy5yC6cZ+o1Tloql9hYGa6rT3xcMbXlW+9e5jM2MWXZliVW3ZhaPjptJFDbIfWxJPjz4QvKyJk0zok4muv13Iiwj2bCyefUTRz6psqI4cGaYm9JpscKO2RCJN8UluYGbbWmYQU+Int6LtZj/lv8p6xnVjWxYI+rBPdtkpfFYRp+MJiXjgPw5B6UGuoruv7+vHjOLHOotRo+RdjZt7NqL9dAJnl1Qb2jfW6+d7NYQSI/bAwxO0sk4taQIT6Gsu/8kfZOPC2xk9rphGqCSS/4q3Os0MMjA1bcJLyoWLp13pqhK6bmiiHw0BBXH4fbEp4xjSbpPx4tHXzbdn8oDsHKZkWh3pPC2J/nVl0k/yF1KDVowVtMDXE47k6TGVcBoqe8PDXCG9+vjRpzIidqNo5qebaUZu6riWMWzldz8x3Z/jLWXuDiM7/Yscn0Z2GIlfoeyz+GwP2eTdOw9EUedHjEQuJY32bq8LICimJ4Ht+zMJKUyhwVQyAER8byzQBwTYmYP5U0wdsyIFitphw+/IH8+v08Ia1iBLPQAeAvRfTTIFLCs8foyUrj5Zv2B/wTYIZy6ioUM+qADeXyo45uBLLqkN90Rf6kiTqDld78NxwsfyR5MxtJLVDFkmf2IMMJHTqSfhbi+7QJaC11OOUJTD0v9wo0X/oO5GvZhe0ZaGHnm9zqTopALuFEAxcaQlc4R81wjC4wrIrqWnbcl2dxiBtD73KW+wcC9ymsLf4I8BEmiN25lx/OUc1IHNyXZJYSFkEfaxCEZWKcnbiyf5sqFSSlEqZLc4lUPJFAoP6s1FHVcyO0odWqdadhRZLZC9RCzQgPlMRtji/OXy5phh7diOBZv5UYp5nb+MZ2NAB/eFXm2JLguxjvEstuvTDmZDUb6Uqv++RdhO5gvKf/AcwU38ifaHQ9uvRuDocYwVxZS2nr9rOwZ8nAh+P2o4e0tEXjxFKQGhxXYkn75H3hhfnFYjik/2qunHBBZfcdG148MaNP6DjX33M238T9Zw/GyGx00JMogr2pdP4JAErv9a5yt4YR41KGf8guSOUbOXVARw6+ybh7+meb7w4BeTlj3aZkv8tVGdfIt3lrwVnlbzhLjeQY6PplKp3/a5Kr5yM0T4wJoKQQ6v3vSNmrhpbuAtKxpMILe8CQoo="; + + private List CreateTaxCredentials() + { + return new List + { + new TaxCredential + { + Base64File = _certEscuelaKemper, + FileType = FileType.CertificateCsd, + Password = "12345678a" + }, + new TaxCredential + { + Base64File = _keyEscuelaKemper, + FileType = FileType.PrivateKeyCsd, + Password = "12345678a" + } + }; + } + + private InvoiceIssuer CreateIssuer() + { + return new InvoiceIssuer + { + Tin = "EKU9003173C9", + LegalName = "ESCUELA KEMPER URGATE", + TaxRegimeCode = "601", + TaxCredentials = CreateTaxCredentials() + }; + } + + private Autotransporte CreateAutotransporte() + { + return new Autotransporte + { + PermSCTId = "TPAF01", + NumPermisoSCT = "NumPermisoSCT1", + ConfigVehicularId = "VL", + PesoBrutoVehicular = 1, + PlacaVM = "plac892", + AnioModeloVM = 2020, + AseguraRespCivil = "AseguraRespCivil", + PolizaRespCivil = "123456789", + Remolques = new List + { + new Remolque { SubTipoRemId = "CTR004", Placa = "VL45K98" } + } + }; + } + + private Mercancia CreateMercancia(bool includeDocumentacionAduanera = false) + { + var mercancia = new Mercancia + { + BienesTranspId = "11121900", + Descripcion = "Accesorios de equipo de telefonía", + Cantidad = 1.0m, + ClaveUnidadId = "XBX", + MaterialPeligrosoId = "No", + DenominacionGenericaProd = "DenominacionGenericaProd1", + DenominacionDistintivaProd = "DenominacionDistintivaProd1", + Fabricante = "Fabricante1", + FechaCaducidad = DateTime.Parse("2003-04-02T00:00:00"), + LoteMedicamento = "LoteMedic1", + FormaFarmaceuticaId = "01", + CondicionesEspTranspId = "01", + RegistroSanitarioFolioAutorizacion = "RegistroSanita1", + PesoEnKg = 1, + FraccionArancelariaId = "6309000100", + CantidadTransporta = new List + { + new CantidadTransporta { Cantidad = 1, IdOrigen = "OR101010", IdDestino = "DE202020" } + } + }; + + if (includeDocumentacionAduanera) + { + mercancia.TipoMateriaId = "05"; + mercancia.DescripcionMateria = "otramateria"; + mercancia.DocumentacionAduanera = new List + { + new DocumentoAduanero + { + TipoDocumentoId = "01", + NumPedimento = "23 43 0472 8000448", + RfcImpo = "EKU9003173C9" + } + }; + } + + return mercancia; + } + + private Invoice CreateBaseInvoice(string taxObjectCode = "01", List itemTaxes = null) + { + return new Invoice + { + VersionCode = "4.0", + PaymentFormCode = "01", + PaymentMethodCode = "PUE", + CurrencyCode = "MXN", + TypeCode = "I", + ExpeditionZipCode = "42501", + Series = "SerieCCP31", + Date = DateTime.Now, + ExchangeRate = 1, + ExportCode = "01", + Issuer = CreateIssuer(), + Items = new List + { + new InvoiceItem + { + ItemCode = "78101800", + ItemSku = "UT421511", + Quantity = 1, + UnitOfMeasurementCode = "H87", + Description = "Transporte de carga por carretera", + UnitPrice = 100.00m, + Discount = 0, + TaxObjectCode = taxObjectCode, + ItemTaxes = itemTaxes ?? new List() + } + } + }; + } + + // button1: Factura ingreso autotransporte nacional + private async void button1_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseInvoice(); + invoice.Recipient = new InvoiceRecipient + { + Tin = "URE180429TM6", + LegalName = "UNIVERSIDAD ROBOTICA ESPAÑOLA", + ZipCode = "86991", + TaxRegimeCode = "601", + CfdiUseCode = "S01" + }; + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "No", + TotalDistRec = 1.0m, + RegistroISTMOId = "Sí", + UbicacionPoloOrigenId = "01", + UbicacionPoloDestinoId = "01", + UnidadPesoId = "XBX", + LogisticaInversaRecoleccionDevolucionId = "Sí", + Ubicaciones = new List + { + new Ubicacion + { + TipoUbicacion = "Origen", + IdUbicacion = "OR101010", + RfcRemitenteDestinatario = "URE180429TM6", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario1", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:00"), + Domicilio = new Domicilio + { + Calle = "Calle1", NumeroExterior = "211", NumeroInterior = "212", + ColoniaId = "1957", LocalidadId = "13", Referencia = "casa blanca", + MunicipioId = "011", EstadoId = "CMX", PaisId = "MEX", CodigoPostalId = "13250" + } + }, + new Ubicacion + { + TipoUbicacion = "Destino", + IdUbicacion = "DE202020", + RfcRemitenteDestinatario = "URE180429TM6", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario2", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + DistanciaRecorrida = 1, + Domicilio = new Domicilio + { + Calle = "Calle2", NumeroExterior = "214", NumeroInterior = "215", + ColoniaId = "0347", LocalidadId = "23", Referencia = "casa negra", + MunicipioId = "004", EstadoId = "COA", PaisId = "MEX", CodigoPostalId = "25350" + } + } + }, + Mercancias = new List { CreateMercancia() }, + Autotransporte = CreateAutotransporte(), + TiposFigura = new List + { + new TipoFigura + { + TipoFiguraId = "01", + RfcFigura = "URE180429TM6", + NumLicencia = "NumLicencia1", + NombreFigura = "NombreFigura1", + Domicilio = new Domicilio + { + Calle = "Calle1", NumeroExterior = "NumeroExterior1", NumeroInterior = "NumeroInterior1", + ColoniaId = "Colonia1", LocalidadId = "Localidad1", Referencia = "Referencia1", + MunicipioId = "Municipio1", EstadoId = "Estado1", PaisId = "AFG", CodigoPostalId = "CodigoPosta1" + } + } + } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button2: Factura ingreso autotransporte nacional con impuestos + private async void button2_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var itemTaxes = new List + { + new InvoiceItemTax { TaxCode = "002", TaxTypeCode = "Tasa", TaxRate = 0.160000m, TaxFlagCode = "T" }, + new InvoiceItemTax { TaxCode = "002", TaxTypeCode = "Tasa", TaxRate = 0.040000m, TaxFlagCode = "R" } + }; + + var invoice = CreateBaseInvoice("02", itemTaxes); + invoice.Items[0].UnitPrice = 26232.75m; + invoice.Recipient = new InvoiceRecipient + { + Tin = "URE180429TM6", + LegalName = "UNIVERSIDAD ROBOTICA ESPAÑOLA", + ZipCode = "86991", + TaxRegimeCode = "601", + CfdiUseCode = "S01" + }; + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "No", + TotalDistRec = 1, + RegistroISTMOId = "Sí", + UbicacionPoloOrigenId = "01", + UbicacionPoloDestinoId = "01", + UnidadPesoId = "XBX", + LogisticaInversaRecoleccionDevolucionId = "Sí", + Ubicaciones = new List + { + new Ubicacion + { + TipoUbicacion = "Origen", + IdUbicacion = "OR101010", + RfcRemitenteDestinatario = "URE180429TM6", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario1", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:00"), + Domicilio = new Domicilio + { + Calle = "Calle1", NumeroExterior = "211", NumeroInterior = "212", + ColoniaId = "1957", LocalidadId = "13", Referencia = "casa blanca", + MunicipioId = "011", EstadoId = "CMX", PaisId = "MEX", CodigoPostalId = "13250" + } + }, + new Ubicacion + { + TipoUbicacion = "Destino", + IdUbicacion = "DE202020", + RfcRemitenteDestinatario = "URE180429TM6", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario2", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + DistanciaRecorrida = 1, + Domicilio = new Domicilio + { + Calle = "Calle2", NumeroExterior = "214", NumeroInterior = "215", + ColoniaId = "0347", LocalidadId = "23", Referencia = "casa negra", + MunicipioId = "004", EstadoId = "COA", PaisId = "MEX", CodigoPostalId = "25350" + } + } + }, + Mercancias = new List { CreateMercancia() }, + Autotransporte = CreateAutotransporte(), + TiposFigura = new List + { + new TipoFigura + { + TipoFiguraId = "01", + RfcFigura = "URE180429TM6", + NumLicencia = "NumLicencia1", + NombreFigura = "NombreFigura1", + Domicilio = new Domicilio + { + Calle = "Calle1", NumeroExterior = "NumeroExterior1", NumeroInterior = "NumeroInterior1", + ColoniaId = "Colonia1", LocalidadId = "Localidad1", Referencia = "Referencia1", + MunicipioId = "Municipio1", EstadoId = "Estado1", PaisId = "AFG", CodigoPostalId = "CodigoPosta1" + } + } + } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button3: Factura ingreso autotransporte extranjero + private async void button3_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseInvoice(); + invoice.Recipient = new InvoiceRecipient + { + Tin = "EKU9003173C9", + LegalName = "ESCUELA KEMPER URGATE", + ZipCode = "42501", + TaxRegimeCode = "601", + CfdiUseCode = "S01" + }; + + var domicilioUSA = new Domicilio + { + Calle = "ST", NumeroExterior = "214", ColoniaId = "N/A", + Referencia = "WHITE HOUSE", MunicipioId = "N/A", EstadoId = "TX", + PaisId = "USA", CodigoPostalId = "N/A" + }; + + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "Sí", + EntradaSalidaMercId = "Salida", + PaisOrigenDestinoId = "USA", + ViaEntradaSalidaId = "01", + TotalDistRec = 1, + RegistroISTMOId = "Sí", + UbicacionPoloOrigenId = "01", + UbicacionPoloDestinoId = "01", + UnidadPesoId = "XBX", + LogisticaInversaRecoleccionDevolucionId = "Sí", + RegimenAduaneros = new List + { + new RegimenAduanero { RegimenAduaneroId = "EXD" } + }, + Ubicaciones = new List + { + new Ubicacion + { + TipoUbicacion = "Origen", + IdUbicacion = "OR101010", + RfcRemitenteDestinatario = "XEXX010101000", + NumRegIdTrib = "01010101", + ResidenciaFiscalId = "USA", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + Domicilio = domicilioUSA + }, + new Ubicacion + { + TipoUbicacion = "Destino", + IdUbicacion = "DE202020", + RfcRemitenteDestinatario = "XEXX010101000", + NumRegIdTrib = "01010101", + ResidenciaFiscalId = "USA", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + DistanciaRecorrida = 1, + Domicilio = domicilioUSA + } + }, + Mercancias = new List + { + new Mercancia + { + BienesTranspId = "11121900", + Descripcion = "Accesorios de equipo de telefonía", + Cantidad = 1.0m, + ClaveUnidadId = "XBX", + MaterialPeligrosoId = "No", + DenominacionGenericaProd = "DenominacionGenericaProd1", + DenominacionDistintivaProd = "DenominacionDistintivaProd1", + Fabricante = "Fabricante1", + FechaCaducidad = DateTime.Parse("2003-04-02T00:00:00"), + LoteMedicamento = "LoteMedic1", + FormaFarmaceuticaId = "01", + CondicionesEspTranspId = "01", + RegistroSanitarioFolioAutorizacion = "RegistroSanita1", + PesoEnKg = 1, + FraccionArancelariaId = "6309000100", + TipoMateriaId = "05", + DescripcionMateria = "otramateria", + CantidadTransporta = new List + { + new CantidadTransporta { Cantidad = 1, IdOrigen = "OR101010", IdDestino = "DE202020" } + } + } + }, + Autotransporte = CreateAutotransporte(), + TiposFigura = new List + { + new TipoFigura + { + TipoFiguraId = "01", + RfcFigura = "EKU9003173C9", + NumLicencia = "NumLicencia1", + NombreFigura = "NombreFigura1", + Domicilio = domicilioUSA + } + } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button4: Factura ingreso autotransporte internacional aduanero + private async void button4_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseInvoice(); + invoice.Recipient = new InvoiceRecipient + { + Tin = "EKU9003173C9", + LegalName = "ESCUELA KEMPER URGATE", + ZipCode = "42501", + TaxRegimeCode = "601", + CfdiUseCode = "S01" + }; + + var domicilioUSA = new Domicilio + { + Calle = "ST", NumeroExterior = "214", ColoniaId = "N/A", + Referencia = "WHITE HOUSE", MunicipioId = "N/A", EstadoId = "TX", + PaisId = "USA", CodigoPostalId = "N/A" + }; + + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "Sí", + EntradaSalidaMercId = "Entrada", + PaisOrigenDestinoId = "USA", + ViaEntradaSalidaId = "01", + TotalDistRec = 1, + RegistroISTMOId = "Sí", + UbicacionPoloOrigenId = "01", + UbicacionPoloDestinoId = "01", + UnidadPesoId = "XBX", + LogisticaInversaRecoleccionDevolucionId = "Sí", + RegimenAduaneros = new List + { + new RegimenAduanero { RegimenAduaneroId = "IMD" } + }, + Ubicaciones = new List + { + new Ubicacion + { + TipoUbicacion = "Origen", + IdUbicacion = "OR101010", + RfcRemitenteDestinatario = "XEXX010101000", + NumRegIdTrib = "01010101", + ResidenciaFiscalId = "USA", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + Domicilio = domicilioUSA + }, + new Ubicacion + { + TipoUbicacion = "Destino", + IdUbicacion = "DE202020", + RfcRemitenteDestinatario = "XEXX010101000", + NumRegIdTrib = "01010101", + ResidenciaFiscalId = "USA", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + DistanciaRecorrida = 1, + Domicilio = domicilioUSA + } + }, + Mercancias = new List { CreateMercancia(includeDocumentacionAduanera: true) }, + Autotransporte = CreateAutotransporte(), + TiposFigura = new List + { + new TipoFigura + { + TipoFiguraId = "01", + RfcFigura = "EKU9003173C9", + NumLicencia = "NumLicencia1", + NombreFigura = "NombreFigura1", + Domicilio = domicilioUSA + } + } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button5: Factura ingreso transporte ferroviario nacional + private async void button5_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseInvoiceFerroviario(); + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "No", + TotalDistRec = 500, + PesoNetoTotal = 10, + RegistroISTMOId = "Sí", + UbicacionPoloOrigenId = "01", + UbicacionPoloDestinoId = "01", + UnidadPesoId = "XBX", + Ubicaciones = CreateUbicacionesFerroviarioNacional(), + Mercancias = new List { CreateMercanciaFerroviario() }, + TransporteFerroviario = CreateTransporteFerroviario(), + TiposFigura = new List { CreateTipoFiguraFerroviario() } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button6: Factura ingreso transporte ferroviario extranjero + private async void button6_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseInvoiceFerroviario(); + + var ubicaciones = CreateUbicacionesFerroviarioNacional(); + // Replace last destination with a foreign one + ubicaciones[ubicaciones.Count - 1] = new Ubicacion + { + TipoUbicacion = "Destino", IdUbicacion = "DE202025", + RfcRemitenteDestinatario = "XEXX010101000", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario2", + NumRegIdTrib = "01010101", ResidenciaFiscalId = "USA", + NumEstacionId = "EF0001", NombreEstacion = "NombreEstacion", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T05:00:01"), + DistanciaRecorrida = 100.00m, + Domicilio = new Domicilio + { + Calle = "ST", NumeroExterior = "1234", ColoniaId = "1234", + Referencia = "WHITE HOUSE", MunicipioId = "1234", + EstadoId = "TX", PaisId = "USA", CodigoPostalId = "12345" + } + }; + + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "Sí", + EntradaSalidaMercId = "Salida", + PaisOrigenDestinoId = "USA", + ViaEntradaSalidaId = "04", + TotalDistRec = 500, + PesoNetoTotal = 10, + RegistroISTMOId = "Sí", + UbicacionPoloOrigenId = "01", + UbicacionPoloDestinoId = "01", + UnidadPesoId = "XBX", + RegimenAduaneros = new List + { + new RegimenAduanero { RegimenAduaneroId = "EXD" } + }, + Ubicaciones = ubicaciones, + Mercancias = new List { CreateMercanciaFerroviario(includeTipoMateria: true) }, + TransporteFerroviario = CreateTransporteFerroviario(), + TiposFigura = new List { CreateTipoFiguraFerroviario() } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button7: Factura ingresdo transporte ferrovirario internacional aduanero + private async void button7_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseInvoiceFerroviario(); + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "Sí", + EntradaSalidaMercId = "Entrada", + PaisOrigenDestinoId = "AFG", + ViaEntradaSalidaId = "04", + TotalDistRec = 500, + PesoNetoTotal = 10, + RegistroISTMOId = "Sí", + UbicacionPoloOrigenId = "01", + UbicacionPoloDestinoId = "01", + UnidadPesoId = "XBX", + RegimenAduaneros = new List + { + new RegimenAduanero { RegimenAduaneroId = "IMD" } + }, + Ubicaciones = CreateUbicacionesFerroviarioNacional(), + Mercancias = new List { CreateMercanciaFerroviario(includeDocumentacionAduanera: true) }, + TransporteFerroviario = CreateTransporteFerroviario(), + TiposFigura = new List { CreateTipoFiguraFerroviario() } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button8: Factura ingreso transporte aereo nacional + private async void button8_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseInvoice(); + invoice.Series = "Serie"; + invoice.Recipient = new InvoiceRecipient + { + Tin = "EKU9003173C9", + LegalName = "ESCUELA KEMPER URGATE", + ZipCode = "42501", + TaxRegimeCode = "601", + CfdiUseCode = "S01" + }; + + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "No", + UnidadPesoId = "XBX", + PesoNetoTotal = 10, + Ubicaciones = new List + { + new Ubicacion + { + TipoUbicacion = "Origen", IdUbicacion = "OR101010", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario1", + NumEstacionId = "EA0417", NombreEstacion = "Loreto", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:00"), + TipoEstacionId = "01", + Domicilio = new Domicilio + { + Calle = "Calle1", NumeroExterior = "211", NumeroInterior = "212", + ColoniaId = "1957", LocalidadId = "13", Referencia = "casa blanca", + MunicipioId = "011", EstadoId = "CMX", PaisId = "MEX", CodigoPostalId = "13250" + } + }, + new Ubicacion + { + TipoUbicacion = "Destino", IdUbicacion = "DE202020", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario2", + NumEstacionId = "EA0418", NombreEstacion = "Los Cabos", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + TipoEstacionId = "03", + Domicilio = new Domicilio + { + Calle = "Calle2", NumeroExterior = "214", NumeroInterior = "215", + ColoniaId = "0347", LocalidadId = "23", Referencia = "casa negra", + MunicipioId = "004", EstadoId = "COA", PaisId = "MEX", CodigoPostalId = "25350" + } + } + }, + Mercancias = new List + { + new Mercancia + { + BienesTranspId = "11121900", + Descripcion = "Accesorios de equipo de telefonía", + Cantidad = 1.0m, + ClaveUnidadId = "XBX", + MaterialPeligrosoId = "No", + DenominacionGenericaProd = "DenominacionGenericaProd1", + DenominacionDistintivaProd = "DenominacionDistintivaProd1", + Fabricante = "Fabricante1", + FechaCaducidad = DateTime.Parse("2028-01-01T00:00:00"), + LoteMedicamento = "LoteMedic1", + RegistroSanitarioFolioAutorizacion = "RegistroSanita1", + PesoEnKg = 1, + ValorMercancia = 100, + MonedaId = "MXN", + CantidadTransporta = new List + { + new CantidadTransporta { Cantidad = 1, IdOrigen = "OR101010", IdDestino = "DE202020" } + } + } + }, + TransporteAereo = new TransporteAereo + { + PermSCTId = "TPAF01", + NumPermisoSCT = "Demo", + MatriculaAeronave = "61E5-WZ", + NombreAseg = "NombreAseg", + NumPolizaSeguro = "NumPolizaSeguro", + NumeroGuia = "acUbYlBVTmlzx", + LugarContrato = "LugarContrato", + CodigoTransportistaId = "CA001", + RfcEmbarcador = "EKU9003173C9", + NombreEmbarcador = "Embarcador" + }, + TiposFigura = new List + { + new TipoFigura + { + TipoFiguraId = "01", + RfcFigura = "EKU9003173C9", + NumLicencia = "a234567890", + NombreFigura = "NombreFigura" + } + } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button9: Factura ingreso transporte aereo extranjero + private async void button9_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseInvoice(); + invoice.Series = "Serie"; + invoice.Recipient = new InvoiceRecipient + { + Tin = "EKU9003173C9", + LegalName = "ESCUELA KEMPER URGATE", + ZipCode = "42501", + TaxRegimeCode = "601", + CfdiUseCode = "S01" + }; + + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "Sí", + EntradaSalidaMercId = "Salida", + PaisOrigenDestinoId = "USA", + ViaEntradaSalidaId = "03", + UnidadPesoId = "XBX", + PesoNetoTotal = 10, + RegimenAduaneros = new List + { + new RegimenAduanero { RegimenAduaneroId = "EXD" } + }, + Ubicaciones = new List + { + new Ubicacion + { + TipoUbicacion = "Origen", IdUbicacion = "OR101010", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario1", + NumEstacionId = "EA0417", NombreEstacion = "Loreto", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:00"), + TipoEstacionId = "01", + Domicilio = new Domicilio + { + Calle = "Calle2", NumeroExterior = "214", NumeroInterior = "215", + ColoniaId = "0347", LocalidadId = "23", Referencia = "casa negra", + MunicipioId = "004", EstadoId = "COA", PaisId = "MEX", CodigoPostalId = "25350" + } + }, + new Ubicacion + { + TipoUbicacion = "Destino", IdUbicacion = "DE202020", + RfcRemitenteDestinatario = "XEXX010101000", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario", + NumRegIdTrib = "01010101", ResidenciaFiscalId = "USA", + NumEstacionId = "EA0143", NombreEstacion = "Phoenix-Mesa Gateway", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + Domicilio = new Domicilio + { + Calle = "ST", NumeroExterior = "12344", ColoniaId = "N/A", + Referencia = "WHITE HOUSE", MunicipioId = "N/A", + EstadoId = "TX", PaisId = "USA", CodigoPostalId = "12345" + } + } + }, + Mercancias = new List + { + new Mercancia + { + BienesTranspId = "11121900", + Descripcion = "Accesorios de equipo de telefonía", + Cantidad = 1.0m, + ClaveUnidadId = "XBX", + MaterialPeligrosoId = "No", + DenominacionGenericaProd = "DenominacionGenericaProd1", + DenominacionDistintivaProd = "DenominacionDistintivaProd1", + Fabricante = "Fabricante1", + FechaCaducidad = DateTime.Parse("2028-01-01T00:00:00"), + LoteMedicamento = "LoteMedic1", + RegistroSanitarioFolioAutorizacion = "RegistroSanita1", + PesoEnKg = 1, + ValorMercancia = 100, + MonedaId = "MXN", + TipoMateriaId = "05", + DescripcionMateria = "otramateria", + CantidadTransporta = new List + { + new CantidadTransporta { Cantidad = 1, IdOrigen = "OR101010", IdDestino = "DE202020" } + } + } + }, + TransporteAereo = new TransporteAereo + { + PermSCTId = "TPAF01", + NumPermisoSCT = "Demo", + MatriculaAeronave = "61E5-WZ", + NombreAseg = "NombreAseg", + NumPolizaSeguro = "NumPolizaSeguro", + NumeroGuia = "acUbYlBVTmlzx", + LugarContrato = "LugarContrato", + CodigoTransportistaId = "CA001", + RfcEmbarcador = "EKU9003173C9", + NombreEmbarcador = "Embarcador" + }, + TiposFigura = new List + { + new TipoFigura + { + TipoFiguraId = "01", + RfcFigura = "EKU9003173C9", + NumLicencia = "a234567890", + NombreFigura = "NombreFigura" + } + } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button10: Factura ingreso transporte aereo internacional aduanero + private async void button10_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseInvoice(); + invoice.Series = "Serie"; + invoice.Recipient = new InvoiceRecipient + { + Tin = "EKU9003173C9", + LegalName = "ESCUELA KEMPER URGATE", + ZipCode = "42501", + TaxRegimeCode = "601", + CfdiUseCode = "S01" + }; + + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "Sí", + EntradaSalidaMercId = "Entrada", + PaisOrigenDestinoId = "AFG", + ViaEntradaSalidaId = "03", + UnidadPesoId = "XBX", + PesoNetoTotal = 10, + RegimenAduaneros = new List + { + new RegimenAduanero { RegimenAduaneroId = "IMD" } + }, + Ubicaciones = new List + { + new Ubicacion + { + TipoUbicacion = "Origen", + IdUbicacion = "OR101010", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario1", + NumEstacionId = "EA0417", NombreEstacion = "Loreto", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:00"), + TipoEstacionId = "01", + Domicilio = new Domicilio + { + Calle = "Calle1", NumeroExterior = "211", NumeroInterior = "212", + ColoniaId = "1957", LocalidadId = "13", Referencia = "casa blanca", + MunicipioId = "011", EstadoId = "CMX", PaisId = "MEX", CodigoPostalId = "13250" + } + }, + new Ubicacion + { + TipoUbicacion = "Destino", + IdUbicacion = "DE202020", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario2", + NumEstacionId = "EA0418", NombreEstacion = "Los Cabos", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + TipoEstacionId = "03", + Domicilio = new Domicilio + { + Calle = "Calle2", NumeroExterior = "214", NumeroInterior = "215", + ColoniaId = "0347", LocalidadId = "23", Referencia = "casa negra", + MunicipioId = "004", EstadoId = "COA", PaisId = "MEX", CodigoPostalId = "25350" + } + } + }, + Mercancias = new List + { + new Mercancia + { + BienesTranspId = "11121900", + Descripcion = "Accesorios de equipo de telefonía", + Cantidad = 1.0m, + ClaveUnidadId = "XBX", + MaterialPeligrosoId = "No", + DenominacionGenericaProd = "DenominacionGenericaProd1", + DenominacionDistintivaProd = "DenominacionDistintivaProd1", + Fabricante = "Fabricante1", + FechaCaducidad = DateTime.Parse("2028-01-01T00:00:00"), + LoteMedicamento = "LoteMedic1", + RegistroSanitarioFolioAutorizacion = "RegistroSanita1", + PesoEnKg = 1, + ValorMercancia = 100, + MonedaId = "MXN", + TipoMateriaId = "05", + DescripcionMateria = "otramateria", + DocumentacionAduanera = new List + { + new DocumentoAduanero { TipoDocumentoId = "01", NumPedimento = "23 43 0472 8000448", RfcImpo = "EKU9003173C9" } + }, + CantidadTransporta = new List + { + new CantidadTransporta { Cantidad = 1, IdOrigen = "OR101010", IdDestino = "DE202020" } + } + } + }, + TransporteAereo = new TransporteAereo + { + PermSCTId = "TPAF01", + NumPermisoSCT = "Demo", + MatriculaAeronave = "61E5-WZ", + NombreAseg = "NombreAseg", + NumPolizaSeguro = "NumPolizaSeguro", + NumeroGuia = "acUbYlBVTmlzx", + LugarContrato = "LugarContrato", + CodigoTransportistaId = "CA001", + RfcEmbarcador = "EKU9003173C9", + NombreEmbarcador = "Embarcador" + }, + TiposFigura = new List + { + new TipoFigura + { + TipoFiguraId = "01", + RfcFigura = "EKU9003173C9", + NumLicencia = "a234567890", + NombreFigura = "NombreFigura" + } + } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button11: Factura ingreso transporte maritimo nacional + private async void button11_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseInvoice(); + invoice.Series = "Serie"; + invoice.Recipient = new InvoiceRecipient + { + Tin = "EKU9003173C9", + LegalName = "ESCUELA KEMPER URGATE", + ZipCode = "42501", + TaxRegimeCode = "601", + CfdiUseCode = "S01" + }; + + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "No", + UnidadPesoId = "XBX", + PesoNetoTotal = 1, + Ubicaciones = new List + { + new Ubicacion + { + TipoUbicacion = "Origen", IdUbicacion = "OR101010", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario1", + NumEstacionId = "PM001", NombreEstacion = "Rosarito", + NavegacionTraficoId = "Altura", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:00"), + TipoEstacionId = "01", + Domicilio = new Domicilio + { + Calle = "Calle1", NumeroExterior = "211", NumeroInterior = "212", + ColoniaId = "1957", LocalidadId = "13", Referencia = "casa blanca", + MunicipioId = "011", EstadoId = "CMX", PaisId = "MEX", CodigoPostalId = "13250" + } + }, + new Ubicacion + { + TipoUbicacion = "Destino", IdUbicacion = "DE202020", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario2", + NumEstacionId = "PM001", NombreEstacion = "Rosarito", + NavegacionTraficoId = "Altura", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + TipoEstacionId = "03", + Domicilio = new Domicilio + { + Calle = "Calle2", NumeroExterior = "214", NumeroInterior = "215", + ColoniaId = "0347", LocalidadId = "23", Referencia = "casa negra", + MunicipioId = "004", EstadoId = "COA", PaisId = "MEX", CodigoPostalId = "25350" + } + } + }, + Mercancias = new List + { + new Mercancia + { + BienesTranspId = "11121900", + Descripcion = "Accesorios de equipo de telefonía", + Cantidad = 1.0m, + ClaveUnidadId = "XBX", + MaterialPeligrosoId = "No", + DenominacionGenericaProd = "DenominacionGenericaProd1", + DenominacionDistintivaProd = "DenominacionDistintivaProd1", + Fabricante = "Fabricante1", + FechaCaducidad = DateTime.Parse("2028-01-01T00:00:00"), + LoteMedicamento = "LoteMedic1", + RegistroSanitarioFolioAutorizacion = "RegistroSanita1", + PesoEnKg = 1, + CantidadTransporta = new List + { + new CantidadTransporta { Cantidad = 1, IdOrigen = "OR101010", IdDestino = "DE202020" } + }, + DetalleMercancia = new DetalleMercancia + { + UnidadPesoMercId = "Tu", + PesoBruto = 1, + PesoNeto = 1, + PesoTara = 0.001m, + NumPiezas = 1 + } + } + }, + TransporteMaritimo = new TransporteMaritimo + { + PermSCTId = "TPAF01", + NumPermisoSCT = "NumPermisoSCT1", + NombreAseg = "NombreAseg1", + NumPolizaSeguro = "NumPolizaSeguro1", + TipoEmbarcacionId = "B01", + Matricula = "Matricula1", + NumeroOMI = "IMO1234567", + AnioEmbarcacion = 2003, + NombreEmbarc = "NombreEmbarc1", + NacionalidadEmbarcId = "AFG", + UnidadesDeArqBruto = 0.001m, + TipoCargaId = "CGS", + Eslora = 0.01m, + Manga = 0.01m, + Calado = 0.01m, + Puntal = 0.01m, + LineaNaviera = "LineaNaviera1", + NombreAgenteNaviero = "NombreAgenteNaviero1", + NumAutorizacionNavieroId = "ANC001/2022", + NumViaje = "NumViaje1", + NumConocEmbarc = "NumConocEmbarc1", + PermisoTempNavegacion = "PermisoTempNavegac1", + Contenedores = new List + { + new ContenedorMaritimo + { + TipoContenedorId = "CM011", + IdCCPRelacionado = "CCCBCD94-870A-4332-A52A-A52AA52AA52A", + PlacaVMCCP = "JNG7683", + FechaCertificacionCCP = "2024-06-20T11:11:00", + RemolquesCCP = new List + { + new RemolqueCCP { SubTipoRemCCPId = "CTR001", PlacaCCP = "JNG7636" } + } + } + } + }, + TiposFigura = new List + { + new TipoFigura + { + TipoFiguraId = "02", + RfcFigura = "EKU9003173C9", + NombreFigura = "NombreFigura", + PartesTransporte = new List + { + new ParteTransporte { ParteTransporteId = "PT02" } + }, + Domicilio = new Domicilio + { + Calle = "calle", NumeroExterior = "211", ColoniaId = "0814", + LocalidadId = "01", Referencia = "casa blanca", + MunicipioId = "010", EstadoId = "ZAC", PaisId = "MEX", CodigoPostalId = "99080" + } + } + } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button12: Factura ingreso transporte maritimo extranjero + private async void button12_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseInvoice(); + invoice.Series = "Serie"; + invoice.Recipient = new InvoiceRecipient + { + Tin = "EKU9003173C9", + LegalName = "ESCUELA KEMPER URGATE", + ZipCode = "42501", + TaxRegimeCode = "601", + CfdiUseCode = "S01" + }; + + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "Sí", + EntradaSalidaMercId = "Salida", + PaisOrigenDestinoId = "USA", + ViaEntradaSalidaId = "02", + UnidadPesoId = "XBX", + PesoNetoTotal = 1, + RegimenAduaneros = new List + { + new RegimenAduanero { RegimenAduaneroId = "EXD" } + }, + Ubicaciones = new List + { + new Ubicacion + { + TipoUbicacion = "Origen", IdUbicacion = "OR101010", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario1", + NumEstacionId = "PM001", NombreEstacion = "Rosarito", + NavegacionTraficoId = "Altura", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:00"), + TipoEstacionId = "01", + Domicilio = new Domicilio + { + Calle = "Calle1", NumeroExterior = "211", NumeroInterior = "212", + ColoniaId = "1957", LocalidadId = "13", Referencia = "casa blanca", + MunicipioId = "011", EstadoId = "CMX", PaisId = "MEX", CodigoPostalId = "13250" + } + }, + new Ubicacion + { + TipoUbicacion = "Destino", IdUbicacion = "DE202020", + RfcRemitenteDestinatario = "XEXX010101000", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario", + NumRegIdTrib = "01010101", ResidenciaFiscalId = "USA", + NumEstacionId = "PM120", NombreEstacion = "NombreEstacion", + NavegacionTraficoId = "Altura", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + Domicilio = new Domicilio + { + Calle = "ST", NumeroExterior = "12345", ColoniaId = "N/A", + Referencia = "N/A", MunicipioId = "N/A", + EstadoId = "TX", PaisId = "USA", CodigoPostalId = "12345" + } + } + }, + Mercancias = new List + { + new Mercancia + { + BienesTranspId = "11121900", + Descripcion = "Accesorios de equipo de telefonía", + Cantidad = 1.0m, + ClaveUnidadId = "XBX", + MaterialPeligrosoId = "No", + DenominacionGenericaProd = "DenominacionGenericaProd1", + DenominacionDistintivaProd = "DenominacionDistintivaProd1", + Fabricante = "Fabricante1", + FechaCaducidad = DateTime.Parse("2028-01-01T00:00:00"), + LoteMedicamento = "LoteMedic1", + RegistroSanitarioFolioAutorizacion = "RegistroSanita1", + PesoEnKg = 1, + ValorMercancia = 100, + MonedaId = "MXN", + TipoMateriaId = "05", + DescripcionMateria = "otramateria", + CantidadTransporta = new List + { + new CantidadTransporta { Cantidad = 1, IdOrigen = "OR101010", IdDestino = "DE202020" } + }, + DetalleMercancia = new DetalleMercancia + { + UnidadPesoMercId = "Tu", + PesoBruto = 1, + PesoNeto = 1, + PesoTara = 0.001m, + NumPiezas = 1 + } + } + }, + TransporteMaritimo = new TransporteMaritimo + { + PermSCTId = "TPAF01", + NumPermisoSCT = "NumPermisoSCT1", + NombreAseg = "NombreAseg1", + NumPolizaSeguro = "NumPolizaSeguro1", + TipoEmbarcacionId = "B01", + Matricula = "Matricula1", + NumeroOMI = "IMO1234567", + AnioEmbarcacion = 2003, + NombreEmbarc = "NombreEmbarc1", + NacionalidadEmbarcId = "AFG", + UnidadesDeArqBruto = 0.001m, + TipoCargaId = "CGS", + Eslora = 0.01m, + Manga = 0.01m, + Calado = 0.01m, + Puntal = 0.01m, + LineaNaviera = "LineaNaviera1", + NombreAgenteNaviero = "NombreAgenteNaviero1", + NumAutorizacionNavieroId = "ANC001/2022", + NumViaje = "NumViaje1", + NumConocEmbarc = "NumConocEmbarc1", + PermisoTempNavegacion = "PermisoTempNavegac1", + Contenedores = new List + { + new ContenedorMaritimo + { + TipoContenedorId = "CM011", + IdCCPRelacionado = "CCCBCD94-870A-4332-A52A-A52AA52AA52A", + PlacaVMCCP = "JNG7683", + FechaCertificacionCCP = "2024-06-20T11:11:00", + RemolquesCCP = new List + { + new RemolqueCCP { SubTipoRemCCPId = "CTR001", PlacaCCP = "JNG7636" } + } + } + } + }, + TiposFigura = new List + { + new TipoFigura + { + TipoFiguraId = "02", + RfcFigura = "EKU9003173C9", + NombreFigura = "NombreFigura", + PartesTransporte = new List + { + new ParteTransporte { ParteTransporteId = "PT02" } + }, + Domicilio = new Domicilio + { + Calle = "calle", NumeroExterior = "211", ColoniaId = "0814", + LocalidadId = "01", Referencia = "casa blanca", + MunicipioId = "010", EstadoId = "ZAC", PaisId = "MEX", CodigoPostalId = "99080" + } + } + } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button13: Factura ingreso transporte maritimo internacional aduanero + private async void button13_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseInvoice(); + invoice.Series = "CP3.1"; + invoice.Recipient = new InvoiceRecipient + { + Tin = "EKU9003173C9", + LegalName = "ESCUELA KEMPER URGATE", + ZipCode = "42501", + TaxRegimeCode = "601", + CfdiUseCode = "S01" + }; + + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "Sí", + EntradaSalidaMercId = "Entrada", + PaisOrigenDestinoId = "AFG", + ViaEntradaSalidaId = "01", + RegistroISTMOId = "Sí", + UbicacionPoloOrigenId = "01", + UbicacionPoloDestinoId = "01", + UnidadPesoId = "XBX", + PesoNetoTotal = 1, + RegimenAduaneros = new List + { + new RegimenAduanero { RegimenAduaneroId = "IMD" }, + new RegimenAduanero { RegimenAduaneroId = "IMD" } + }, + Ubicaciones = new List + { + new Ubicacion + { + TipoUbicacion = "Origen", + IdUbicacion = "OR101010", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario1", + NumEstacionId = "EA0417", + NombreEstacion = "Loreto", + NavegacionTraficoId = "Altura", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:00"), + TipoEstacionId = "01", + Domicilio = new Domicilio + { + Calle = "Calle1", NumeroExterior = "211", NumeroInterior = "212", + ColoniaId = "1957", LocalidadId = "13", Referencia = "casa blanca", + MunicipioId = "011", EstadoId = "CMX", PaisId = "MEX", CodigoPostalId = "13250" + } + }, + new Ubicacion + { + TipoUbicacion = "Destino", + IdUbicacion = "DE202020", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario2", + NumEstacionId = "PM001", + NombreEstacion = "Rosarito", + NavegacionTraficoId = "Altura", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T04:00:01"), + TipoEstacionId = "02", + Domicilio = new Domicilio + { + Calle = "Calle2", NumeroExterior = "214", NumeroInterior = "215", + ColoniaId = "0347", LocalidadId = "23", Referencia = "casa negra", + MunicipioId = "004", EstadoId = "COA", PaisId = "MEX", CodigoPostalId = "25350" + } + } + }, + Mercancias = new List + { + new Mercancia + { + BienesTranspId = "11121900", + Descripcion = "Accesorios de equipo de telefonía", + Cantidad = 1.0m, + ClaveUnidadId = "XBX", + MaterialPeligrosoId = "No", + DenominacionGenericaProd = "DenominacionGenericaProd1", + DenominacionDistintivaProd = "DenominacionDistintivaProd1", + Fabricante = "Fabricante1", + FechaCaducidad = DateTime.Parse("2003-04-02T00:00:00"), + LoteMedicamento = "LoteMedic1", + FormaFarmaceuticaId = "01", + CondicionesEspTranspId = "01", + RegistroSanitarioFolioAutorizacion = "RegistroSanita1", + PesoEnKg = 1.50m, + ValorMercancia = 100, + MonedaId = "MXN", + FraccionArancelariaId = "6309000100", + TipoMateriaId = "05", + DescripcionMateria = "otramateria", + DocumentacionAduanera = new List + { + new DocumentoAduanero + { + TipoDocumentoId = "01", + NumPedimento = "23 43 0472 8000448", + RfcImpo = "EKU9003173C9" + } + }, + CantidadTransporta = new List + { + new CantidadTransporta { Cantidad = 1, IdOrigen = "OR101010", IdDestino = "DE202020", CvesTransporteId = "02" } + }, + DetalleMercancia = new DetalleMercancia + { + UnidadPesoMercId = "X1A", + PesoBruto = 1.50m, + PesoNeto = 1.00m, + PesoTara = 0.50m + } + } + }, + TransporteMaritimo = new TransporteMaritimo + { + PermSCTId = "TPAF01", + NumPermisoSCT = "NumPermisoSCT1", + NombreAseg = "NombreAseg1", + NumPolizaSeguro = "NumPolizaSeguro1", + TipoEmbarcacionId = "B01", + Matricula = "Matricula1", + NumeroOMI = "IMO1234567", + AnioEmbarcacion = 2003, + NombreEmbarc = "NombreEmbarc1", + NacionalidadEmbarcId = "AFG", + UnidadesDeArqBruto = 0.001m, + TipoCargaId = "CGS", + Eslora = 0.01m, + Manga = 0.01m, + Calado = 0.01m, + Puntal = 0.01m, + LineaNaviera = "LineaNaviera1", + NombreAgenteNaviero = "NombreAgenteNaviero1", + NumAutorizacionNavieroId = "ANC001/2022", + NumViaje = "NumViaje1", + NumConocEmbarc = "NumConocEmbarc1", + PermisoTempNavegacion = "PermisoTempNavegac1", + Contenedores = new List + { + new ContenedorMaritimo + { + TipoContenedorId = "CM011", + IdCCPRelacionado = "CCCBCD94-870A-4332-A52A-A52AA52AA52A", + PlacaVMCCP = "JNG7683", + FechaCertificacionCCP = "2024-06-20T11:11:00", + RemolquesCCP = new List + { + new RemolqueCCP { SubTipoRemCCPId = "CTR001", PlacaCCP = "JNG7636" } + } + } + } + }, + TransporteAereo = new TransporteAereo + { + PermSCTId = "TPAF01", + NumPermisoSCT = "Demo", + MatriculaAeronave = "61E5-WZ", + NombreAseg = "NombreAseg", + NumPolizaSeguro = "NumPolizaSeguro", + NumeroGuia = "acUbYlBVTmlzx", + LugarContrato = "LugarContrato", + CodigoTransportistaId = "CA001", + RfcEmbarcador = "EKU9003173C9", + NombreEmbarcador = "Embarcador" + }, + TiposFigura = new List + { + new TipoFigura + { + TipoFiguraId = "01", + RfcFigura = "EKU9003173C9", + NumLicencia = "NumLicencia1", + NombreFigura = "NombreFigura1", + Domicilio = new Domicilio + { + Calle = "Calle1", NumeroExterior = "NumeroExterior1", NumeroInterior = "NumeroInterior1", + ColoniaId = "Colonia1", LocalidadId = "Localidad1", Referencia = "Referencia1", + MunicipioId = "Municipio1", EstadoId = "Estado1", PaisId = "AFG", CodigoPostalId = "CodigoPosta1" + } + } + } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button14: Factura traslado autotransporte nacional + private async void button14_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseTraslado(); + invoice.Series = "Serie"; + + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "No", + TotalDistRec = 1, + RegistroISTMOId = "Sí", + UbicacionPoloOrigenId = "01", + UbicacionPoloDestinoId = "01", + UnidadPesoId = "XBX", + LogisticaInversaRecoleccionDevolucionId = "Sí", + Ubicaciones = new List + { + new Ubicacion + { + TipoUbicacion = "Origen", + IdUbicacion = "OR101010", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario1", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:00"), + Domicilio = new Domicilio + { + Calle = "Calle1", NumeroExterior = "211", NumeroInterior = "212", + ColoniaId = "1957", LocalidadId = "13", Referencia = "casa blanca", + MunicipioId = "011", EstadoId = "CMX", PaisId = "MEX", CodigoPostalId = "13250" + } + }, + new Ubicacion + { + TipoUbicacion = "Destino", + IdUbicacion = "DE202020", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario2", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + DistanciaRecorrida = 1, + Domicilio = new Domicilio + { + Calle = "Calle2", NumeroExterior = "214", NumeroInterior = "215", + ColoniaId = "0347", LocalidadId = "23", Referencia = "casa negra", + MunicipioId = "004", EstadoId = "COA", PaisId = "MEX", CodigoPostalId = "25350" + } + } + }, + Mercancias = new List + { + new Mercancia + { + BienesTranspId = "11121900", + Descripcion = "Accesorios de equipo de telefonía", + Cantidad = 1.0m, + ClaveUnidadId = "XBX", + MaterialPeligrosoId = "No", + DenominacionGenericaProd = "DenominacionGenericaProd1", + DenominacionDistintivaProd = "DenominacionDistintivaProd1", + Fabricante = "Fabricante1", + FechaCaducidad = DateTime.Parse("2028-01-01T00:00:00"), + LoteMedicamento = "LoteMedic1", + RegistroSanitarioFolioAutorizacion = "RegistroSanita1", + PesoEnKg = 1, + CantidadTransporta = new List + { + new CantidadTransporta { Cantidad = 1, IdOrigen = "OR101010", IdDestino = "DE202020" } + } + } + }, + Autotransporte = CreateAutotransporte(), + TiposFigura = new List + { + new TipoFigura + { + TipoFiguraId = "01", + RfcFigura = "EKU9003173C9", + NumLicencia = "a234567890", + NombreFigura = "NombreFigura" + } + } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button15: Factura traslado autotransporte extranjero + private async void button15_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseTraslado(); + invoice.Series = "SerieCCP31"; + + var domicilioUSA = new Domicilio + { + Calle = "ST", NumeroExterior = "214", ColoniaId = "N/A", + Referencia = "WHITE HOUSE", MunicipioId = "N/A", EstadoId = "TX", + PaisId = "USA", CodigoPostalId = "N/A" + }; + + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "Sí", + EntradaSalidaMercId = "Salida", + PaisOrigenDestinoId = "USA", + ViaEntradaSalidaId = "01", + TotalDistRec = 1, + RegistroISTMOId = "Sí", + UbicacionPoloOrigenId = "01", + UbicacionPoloDestinoId = "01", + UnidadPesoId = "XBX", + LogisticaInversaRecoleccionDevolucionId = "Sí", + RegimenAduaneros = new List + { + new RegimenAduanero { RegimenAduaneroId = "EXD" } + }, + Ubicaciones = new List + { + new Ubicacion + { + TipoUbicacion = "Origen", + IdUbicacion = "OR101010", + RfcRemitenteDestinatario = "XEXX010101000", + NumRegIdTrib = "01010101", + ResidenciaFiscalId = "USA", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + Domicilio = domicilioUSA + }, + new Ubicacion + { + TipoUbicacion = "Destino", + IdUbicacion = "DE202020", + RfcRemitenteDestinatario = "XEXX010101000", + NumRegIdTrib = "01010101", + ResidenciaFiscalId = "USA", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + DistanciaRecorrida = 1, + Domicilio = domicilioUSA + } + }, + Mercancias = new List + { + new Mercancia + { + BienesTranspId = "11121900", + Descripcion = "Accesorios de equipo de telefonía", + Cantidad = 1.0m, + ClaveUnidadId = "XBX", + MaterialPeligrosoId = "No", + DenominacionGenericaProd = "DenominacionGenericaProd1", + DenominacionDistintivaProd = "DenominacionDistintivaProd1", + Fabricante = "Fabricante1", + FechaCaducidad = DateTime.Parse("2003-04-02T00:00:00"), + LoteMedicamento = "LoteMedic1", + FormaFarmaceuticaId = "01", + CondicionesEspTranspId = "01", + RegistroSanitarioFolioAutorizacion = "RegistroSanita1", + PesoEnKg = 1, + FraccionArancelariaId = "6309000100", + TipoMateriaId = "05", + DescripcionMateria = "otramateria", + CantidadTransporta = new List + { + new CantidadTransporta { Cantidad = 1, IdOrigen = "OR101010", IdDestino = "DE202020" } + } + } + }, + Autotransporte = CreateAutotransporte(), + TiposFigura = new List + { + new TipoFigura + { + TipoFiguraId = "01", + RfcFigura = "EKU9003173C9", + NumLicencia = "NumLicencia1", + NombreFigura = "NombreFigura1", + Domicilio = domicilioUSA + } + } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button16: Factura traslado autotransporte internacional aduanero + private async void button16_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseTraslado(); + invoice.Series = "SerieCCP31"; + + var domicilioUSA = new Domicilio + { + Calle = "ST", NumeroExterior = "214", ColoniaId = "N/A", + Referencia = "WHITE HOUSE", MunicipioId = "N/A", EstadoId = "TX", + PaisId = "USA", CodigoPostalId = "N/A" + }; + + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "Sí", + EntradaSalidaMercId = "Entrada", + PaisOrigenDestinoId = "USA", + ViaEntradaSalidaId = "01", + TotalDistRec = 1, + RegistroISTMOId = "Sí", + UbicacionPoloOrigenId = "01", + UbicacionPoloDestinoId = "01", + UnidadPesoId = "XBX", + LogisticaInversaRecoleccionDevolucionId = "Sí", + RegimenAduaneros = new List + { + new RegimenAduanero { RegimenAduaneroId = "IMD" } + }, + Ubicaciones = new List + { + new Ubicacion + { + TipoUbicacion = "Origen", + IdUbicacion = "OR101010", + RfcRemitenteDestinatario = "XEXX010101000", + NumRegIdTrib = "01010101", + ResidenciaFiscalId = "USA", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + Domicilio = domicilioUSA + }, + new Ubicacion + { + TipoUbicacion = "Destino", + IdUbicacion = "DE202020", + RfcRemitenteDestinatario = "XEXX010101000", + NumRegIdTrib = "01010101", + ResidenciaFiscalId = "USA", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + DistanciaRecorrida = 1, + Domicilio = domicilioUSA + } + }, + Mercancias = new List + { + new Mercancia + { + BienesTranspId = "11121900", + Descripcion = "Accesorios de equipo de telefonía", + Cantidad = 1.0m, + ClaveUnidadId = "XBX", + MaterialPeligrosoId = "No", + DenominacionGenericaProd = "DenominacionGenericaProd1", + DenominacionDistintivaProd = "DenominacionDistintivaProd1", + Fabricante = "Fabricante1", + FechaCaducidad = DateTime.Parse("2003-04-02T00:00:00"), + LoteMedicamento = "LoteMedic1", + FormaFarmaceuticaId = "01", + CondicionesEspTranspId = "01", + RegistroSanitarioFolioAutorizacion = "RegistroSanita1", + PesoEnKg = 1, + FraccionArancelariaId = "6309000100", + TipoMateriaId = "05", + DescripcionMateria = "otramateria", + DocumentacionAduanera = new List + { + new DocumentoAduanero + { + TipoDocumentoId = "01", + NumPedimento = "23 43 0472 8000448", + RfcImpo = "EKU9003173C9" + } + }, + CantidadTransporta = new List + { + new CantidadTransporta { Cantidad = 1, IdOrigen = "OR101010", IdDestino = "DE202020" } + } + } + }, + Autotransporte = CreateAutotransporte(), + TiposFigura = new List + { + new TipoFigura + { + TipoFiguraId = "01", + RfcFigura = "EKU9003173C9", + NumLicencia = "NumLicencia1", + NombreFigura = "NombreFigura1", + Domicilio = domicilioUSA + } + } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button17: Factura traslado transporte ferroviario nacional + private async void button17_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseTraslado(); + invoice.Series = "Serie"; + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "No", + TotalDistRec = 500, + PesoNetoTotal = 10, + RegistroISTMOId = "Sí", + UbicacionPoloOrigenId = "01", + UbicacionPoloDestinoId = "01", + UnidadPesoId = "XBX", + Ubicaciones = CreateUbicacionesFerroviarioNacional(), + Mercancias = new List { CreateMercanciaFerroviario() }, + TransporteFerroviario = CreateTransporteFerroviario(), + TiposFigura = new List { CreateTipoFiguraFerroviario() } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button18: Factura traslado transporte ferroviario extranjero + private async void button18_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseTraslado(); + invoice.Series = "Serie"; + + var ubicaciones = CreateUbicacionesFerroviarioNacional(); + // Replace last destination with a foreign one + ubicaciones[ubicaciones.Count - 1] = new Ubicacion + { + TipoUbicacion = "Destino", IdUbicacion = "DE202025", + RfcRemitenteDestinatario = "XEXX010101000", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario2", + NumRegIdTrib = "01010101", ResidenciaFiscalId = "USA", + NumEstacionId = "EF0001", NombreEstacion = "NombreEstacion", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T05:00:01"), + DistanciaRecorrida = 100.00m, + Domicilio = new Domicilio + { + Calle = "ST", NumeroExterior = "1234", ColoniaId = "1234", + Referencia = "WHITE HOUSE", MunicipioId = "1234", + EstadoId = "TX", PaisId = "USA", CodigoPostalId = "12345" + } + }; + + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "Sí", + EntradaSalidaMercId = "Salida", + PaisOrigenDestinoId = "USA", + ViaEntradaSalidaId = "04", + TotalDistRec = 500, + PesoNetoTotal = 10, + RegistroISTMOId = "Sí", + UbicacionPoloOrigenId = "01", + UbicacionPoloDestinoId = "01", + UnidadPesoId = "XBX", + RegimenAduaneros = new List + { + new RegimenAduanero { RegimenAduaneroId = "EXD" } + }, + Ubicaciones = ubicaciones, + Mercancias = new List { CreateMercanciaFerroviario(includeTipoMateria: true) }, + TransporteFerroviario = CreateTransporteFerroviario(), + TiposFigura = new List { CreateTipoFiguraFerroviario() } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button19: Factura traslado transporte ferroviario inernacional aduanero + private async void button19_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseTraslado(); + invoice.Series = "Serie"; + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "Sí", + EntradaSalidaMercId = "Entrada", + PaisOrigenDestinoId = "AFG", + ViaEntradaSalidaId = "04", + TotalDistRec = 500, + PesoNetoTotal = 10, + RegistroISTMOId = "Sí", + UbicacionPoloOrigenId = "01", + UbicacionPoloDestinoId = "01", + UnidadPesoId = "XBX", + RegimenAduaneros = new List + { + new RegimenAduanero { RegimenAduaneroId = "IMD" } + }, + Ubicaciones = CreateUbicacionesFerroviarioNacional(), + Mercancias = new List { CreateMercanciaFerroviario(includeDocumentacionAduanera: true) }, + TransporteFerroviario = CreateTransporteFerroviario(), + TiposFigura = new List { CreateTipoFiguraFerroviario() } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button20: Factura traslado transporte aereo nacional + private async void button20_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseTraslado(); + invoice.Series = "Serie"; + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "No", + UnidadPesoId = "XBX", + PesoNetoTotal = 10, + Ubicaciones = new List + { + new Ubicacion + { + TipoUbicacion = "Origen", IdUbicacion = "OR101010", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario1", + NumEstacionId = "EA0417", NombreEstacion = "Loreto", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:00"), + TipoEstacionId = "01", + Domicilio = new Domicilio + { + Calle = "Calle1", NumeroExterior = "211", NumeroInterior = "212", + ColoniaId = "1957", LocalidadId = "13", Referencia = "casa blanca", + MunicipioId = "011", EstadoId = "CMX", PaisId = "MEX", CodigoPostalId = "13250" + } + }, + new Ubicacion + { + TipoUbicacion = "Destino", IdUbicacion = "DE202020", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario2", + NumEstacionId = "EA0418", NombreEstacion = "Los Cabos", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + TipoEstacionId = "03", + Domicilio = new Domicilio + { + Calle = "Calle2", NumeroExterior = "214", NumeroInterior = "215", + ColoniaId = "0347", LocalidadId = "23", Referencia = "casa negra", + MunicipioId = "004", EstadoId = "COA", PaisId = "MEX", CodigoPostalId = "25350" + } + } + }, + Mercancias = new List + { + new Mercancia + { + BienesTranspId = "11121900", + Descripcion = "Accesorios de equipo de telefonía", + Cantidad = 1.0m, + ClaveUnidadId = "XBX", + MaterialPeligrosoId = "No", + DenominacionGenericaProd = "DenominacionGenericaProd1", + DenominacionDistintivaProd = "DenominacionDistintivaProd1", + Fabricante = "Fabricante1", + FechaCaducidad = DateTime.Parse("2028-01-01T00:00:00"), + LoteMedicamento = "LoteMedic1", + RegistroSanitarioFolioAutorizacion = "RegistroSanita1", + PesoEnKg = 1, + ValorMercancia = 100, + MonedaId = "MXN", + CantidadTransporta = new List + { + new CantidadTransporta { Cantidad = 1, IdOrigen = "OR101010", IdDestino = "DE202020" } + } + } + }, + TransporteAereo = new TransporteAereo + { + PermSCTId = "TPAF01", + NumPermisoSCT = "Demo", + MatriculaAeronave = "61E5-WZ", + NombreAseg = "NombreAseg", + NumPolizaSeguro = "NumPolizaSeguro", + NumeroGuia = "acUbYlBVTmlzx", + LugarContrato = "LugarContrato", + CodigoTransportistaId = "CA001", + RfcEmbarcador = "EKU9003173C9", + NombreEmbarcador = "Embarcador" + }, + TiposFigura = new List + { + new TipoFigura + { + TipoFiguraId = "01", + RfcFigura = "EKU9003173C9", + NumLicencia = "a234567890", + NombreFigura = "NombreFigura" + } + } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button21: Factura traslado transporte aereo extranjero + private async void button21_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseTraslado(); + invoice.Series = "Serie"; + + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "Sí", + EntradaSalidaMercId = "Salida", + PaisOrigenDestinoId = "USA", + ViaEntradaSalidaId = "03", + UnidadPesoId = "XBX", + PesoNetoTotal = 10, + RegimenAduaneros = new List + { + new RegimenAduanero { RegimenAduaneroId = "EXD" } + }, + Ubicaciones = new List + { + new Ubicacion + { + TipoUbicacion = "Origen", IdUbicacion = "OR101010", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario1", + NumEstacionId = "EA0417", NombreEstacion = "Loreto", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:00"), + TipoEstacionId = "01", + Domicilio = new Domicilio + { + Calle = "Calle2", NumeroExterior = "214", NumeroInterior = "215", + ColoniaId = "0347", LocalidadId = "23", Referencia = "casa negra", + MunicipioId = "004", EstadoId = "COA", PaisId = "MEX", CodigoPostalId = "25350" + } + }, + new Ubicacion + { + TipoUbicacion = "Destino", IdUbicacion = "DE202020", + RfcRemitenteDestinatario = "XEXX010101000", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario", + NumRegIdTrib = "01010101", ResidenciaFiscalId = "USA", + NumEstacionId = "EA0143", NombreEstacion = "Phoenix-Mesa Gateway", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + Domicilio = new Domicilio + { + Calle = "ST", NumeroExterior = "12344", ColoniaId = "N/A", + Referencia = "WHITE HOUSE", MunicipioId = "N/A", + EstadoId = "TX", PaisId = "USA", CodigoPostalId = "12345" + } + } + }, + Mercancias = new List + { + new Mercancia + { + BienesTranspId = "11121900", + Descripcion = "Accesorios de equipo de telefonía", + Cantidad = 1.0m, + ClaveUnidadId = "XBX", + MaterialPeligrosoId = "No", + DenominacionGenericaProd = "DenominacionGenericaProd1", + DenominacionDistintivaProd = "DenominacionDistintivaProd1", + Fabricante = "Fabricante1", + FechaCaducidad = DateTime.Parse("2028-01-01T00:00:00"), + LoteMedicamento = "LoteMedic1", + RegistroSanitarioFolioAutorizacion = "RegistroSanita1", + PesoEnKg = 1, + ValorMercancia = 100, + MonedaId = "MXN", + TipoMateriaId = "05", + DescripcionMateria = "otramateria", + CantidadTransporta = new List + { + new CantidadTransporta { Cantidad = 1, IdOrigen = "OR101010", IdDestino = "DE202020" } + } + } + }, + TransporteAereo = new TransporteAereo + { + PermSCTId = "TPAF01", + NumPermisoSCT = "Demo", + MatriculaAeronave = "61E5-WZ", + NombreAseg = "NombreAseg", + NumPolizaSeguro = "NumPolizaSeguro", + NumeroGuia = "acUbYlBVTmlzx", + LugarContrato = "LugarContrato", + CodigoTransportistaId = "CA001", + RfcEmbarcador = "EKU9003173C9", + NombreEmbarcador = "Embarcador" + }, + TiposFigura = new List + { + new TipoFigura + { + TipoFiguraId = "01", + RfcFigura = "EKU9003173C9", + NumLicencia = "a234567890", + NombreFigura = "NombreFigura" + } + } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button22: Factura traslado transporte aereo internacional aduanero + private async void button22_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseTraslado(); + invoice.Series = "Serie"; + + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "Sí", + EntradaSalidaMercId = "Entrada", + PaisOrigenDestinoId = "AFG", + ViaEntradaSalidaId = "03", + UnidadPesoId = "XBX", + PesoNetoTotal = 10, + RegimenAduaneros = new List + { + new RegimenAduanero { RegimenAduaneroId = "IMD" } + }, + Ubicaciones = new List + { + new Ubicacion + { + TipoUbicacion = "Origen", IdUbicacion = "OR101010", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario1", + NumEstacionId = "EA0417", NombreEstacion = "Loreto", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:00"), + TipoEstacionId = "01", + Domicilio = new Domicilio + { + Calle = "Calle1", NumeroExterior = "211", NumeroInterior = "212", + ColoniaId = "1957", LocalidadId = "13", Referencia = "casa blanca", + MunicipioId = "011", EstadoId = "CMX", PaisId = "MEX", CodigoPostalId = "13250" + } + }, + new Ubicacion + { + TipoUbicacion = "Destino", IdUbicacion = "DE202020", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario2", + NumEstacionId = "EA0418", NombreEstacion = "Los Cabos", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + TipoEstacionId = "03", + Domicilio = new Domicilio + { + Calle = "Calle2", NumeroExterior = "214", NumeroInterior = "215", + ColoniaId = "0347", LocalidadId = "23", Referencia = "casa negra", + MunicipioId = "004", EstadoId = "COA", PaisId = "MEX", CodigoPostalId = "25350" + } + } + }, + Mercancias = new List + { + new Mercancia + { + BienesTranspId = "11121900", + Descripcion = "Accesorios de equipo de telefonía", + Cantidad = 1.0m, + ClaveUnidadId = "XBX", + MaterialPeligrosoId = "No", + DenominacionGenericaProd = "DenominacionGenericaProd1", + DenominacionDistintivaProd = "DenominacionDistintivaProd1", + Fabricante = "Fabricante1", + FechaCaducidad = DateTime.Parse("2028-01-01T00:00:00"), + LoteMedicamento = "LoteMedic1", + RegistroSanitarioFolioAutorizacion = "RegistroSanita1", + PesoEnKg = 1, + ValorMercancia = 100, + MonedaId = "MXN", + TipoMateriaId = "05", + DescripcionMateria = "otramateria", + DocumentacionAduanera = new List + { + new DocumentoAduanero + { + TipoDocumentoId = "01", + NumPedimento = "23 43 0472 8000448", + RfcImpo = "EKU9003173C9" + } + }, + CantidadTransporta = new List + { + new CantidadTransporta { Cantidad = 1, IdOrigen = "OR101010", IdDestino = "DE202020" } + } + } + }, + TransporteAereo = new TransporteAereo + { + PermSCTId = "TPAF01", + NumPermisoSCT = "Demo", + MatriculaAeronave = "61E5-WZ", + NombreAseg = "NombreAseg", + NumPolizaSeguro = "NumPolizaSeguro", + NumeroGuia = "acUbYlBVTmlzx", + LugarContrato = "LugarContrato", + CodigoTransportistaId = "CA001", + RfcEmbarcador = "EKU9003173C9", + NombreEmbarcador = "Embarcador" + }, + TiposFigura = new List + { + new TipoFigura + { + TipoFiguraId = "01", + RfcFigura = "EKU9003173C9", + NumLicencia = "a234567890", + NombreFigura = "NombreFigura" + } + } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button23: Factura traslado transporte maritimo nacional + private async void button23_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseTraslado(); + invoice.Series = "Serie"; + + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "No", + UnidadPesoId = "XBX", + PesoNetoTotal = 1, + Ubicaciones = new List + { + new Ubicacion + { + TipoUbicacion = "Origen", IdUbicacion = "OR101010", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario1", + NumEstacionId = "PM001", NombreEstacion = "Rosarito", + NavegacionTraficoId = "Altura", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:00"), + TipoEstacionId = "01", + Domicilio = new Domicilio + { + Calle = "Calle1", NumeroExterior = "211", NumeroInterior = "212", + ColoniaId = "1957", LocalidadId = "13", Referencia = "casa blanca", + MunicipioId = "011", EstadoId = "CMX", PaisId = "MEX", CodigoPostalId = "13250" + } + }, + new Ubicacion + { + TipoUbicacion = "Destino", IdUbicacion = "DE202020", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario2", + NumEstacionId = "PM001", NombreEstacion = "Rosarito", + NavegacionTraficoId = "Altura", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + TipoEstacionId = "03", + Domicilio = new Domicilio + { + Calle = "Calle2", NumeroExterior = "214", NumeroInterior = "215", + ColoniaId = "0347", LocalidadId = "23", Referencia = "casa negra", + MunicipioId = "004", EstadoId = "COA", PaisId = "MEX", CodigoPostalId = "25350" + } + } + }, + Mercancias = new List + { + new Mercancia + { + BienesTranspId = "11121900", + Descripcion = "Accesorios de equipo de telefonía", + Cantidad = 1.0m, + ClaveUnidadId = "XBX", + MaterialPeligrosoId = "No", + DenominacionGenericaProd = "DenominacionGenericaProd1", + DenominacionDistintivaProd = "DenominacionDistintivaProd1", + Fabricante = "Fabricante1", + FechaCaducidad = DateTime.Parse("2028-01-01T00:00:00"), + LoteMedicamento = "LoteMedic1", + RegistroSanitarioFolioAutorizacion = "RegistroSanita1", + PesoEnKg = 1, + ValorMercancia = 100, + MonedaId = "MXN", + CantidadTransporta = new List + { + new CantidadTransporta { Cantidad = 1, IdOrigen = "OR101010", IdDestino = "DE202020" } + }, + DetalleMercancia = new DetalleMercancia + { + UnidadPesoMercId = "Tu", + PesoBruto = 1, + PesoNeto = 1, + PesoTara = 0.001m, + NumPiezas = 1 + } + } + }, + TransporteMaritimo = new TransporteMaritimo + { + PermSCTId = "TPAF01", + NumPermisoSCT = "NumPermisoSCT1", + NombreAseg = "NombreAseg1", + NumPolizaSeguro = "NumPolizaSeguro1", + TipoEmbarcacionId = "B01", + Matricula = "Matricula1", + NumeroOMI = "IMO1234567", + AnioEmbarcacion = 2003, + NombreEmbarc = "NombreEmbarc1", + NacionalidadEmbarcId = "AFG", + UnidadesDeArqBruto = 0.001m, + TipoCargaId = "CGS", + Eslora = 0.01m, + Manga = 0.01m, + Calado = 0.01m, + Puntal = 0.01m, + LineaNaviera = "LineaNaviera1", + NombreAgenteNaviero = "NombreAgenteNaviero1", + NumAutorizacionNavieroId = "ANC001/2022", + NumViaje = "NumViaje1", + NumConocEmbarc = "NumConocEmbarc1", + PermisoTempNavegacion = "PermisoTempNavegac1", + Contenedores = new List + { + new ContenedorMaritimo + { + TipoContenedorId = "CM011", + IdCCPRelacionado = "CCCBCD94-870A-4332-A52A-A52AA52AA52A", + PlacaVMCCP = "JNG7683", + FechaCertificacionCCP = "2024-06-20T11:11:00", + RemolquesCCP = new List + { + new RemolqueCCP { SubTipoRemCCPId = "CTR001", PlacaCCP = "JNG7636" } + } + } + } + }, + TiposFigura = new List + { + new TipoFigura + { + TipoFiguraId = "02", + RfcFigura = "EKU9003173C9", + NombreFigura = "NombreFigura", + PartesTransporte = new List + { + new ParteTransporte { ParteTransporteId = "PT02" } + }, + Domicilio = new Domicilio + { + Calle = "calle", NumeroExterior = "211", ColoniaId = "0814", + LocalidadId = "01", Referencia = "casa blanca", + MunicipioId = "010", EstadoId = "ZAC", PaisId = "MEX", CodigoPostalId = "99080" + } + } + } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button24: Factura traslado transporte maritimo extranjero + private async void button24_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseTraslado(); + invoice.Series = "Serie"; + + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "Sí", + EntradaSalidaMercId = "Salida", + PaisOrigenDestinoId = "USA", + ViaEntradaSalidaId = "02", + UnidadPesoId = "XBX", + PesoNetoTotal = 1, + RegimenAduaneros = new List + { + new RegimenAduanero { RegimenAduaneroId = "EXD" } + }, + Ubicaciones = new List + { + new Ubicacion + { + TipoUbicacion = "Origen", IdUbicacion = "OR101010", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario1", + NumEstacionId = "PM001", NombreEstacion = "Rosarito", + NavegacionTraficoId = "Altura", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:00"), + TipoEstacionId = "01", + Domicilio = new Domicilio + { + Calle = "Calle1", NumeroExterior = "211", NumeroInterior = "212", + ColoniaId = "1957", LocalidadId = "13", Referencia = "casa blanca", + MunicipioId = "011", EstadoId = "CMX", PaisId = "MEX", CodigoPostalId = "13250" + } + }, + new Ubicacion + { + TipoUbicacion = "Destino", IdUbicacion = "DE202020", + RfcRemitenteDestinatario = "XEXX010101000", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario2", + NumRegIdTrib = "01010101", ResidenciaFiscalId = "USA", + NumEstacionId = "PM120", NombreEstacion = "NombreEstacion", + NavegacionTraficoId = "Altura", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + Domicilio = new Domicilio + { + Calle = "ST", NumeroExterior = "12345", ColoniaId = "N/A", + Referencia = "N/A", MunicipioId = "N/A", + EstadoId = "TX", PaisId = "USA", CodigoPostalId = "12345" + } + } + }, + Mercancias = new List + { + new Mercancia + { + BienesTranspId = "11121900", + Descripcion = "Accesorios de equipo de telefonía", + Cantidad = 1.0m, + ClaveUnidadId = "XBX", + MaterialPeligrosoId = "No", + DenominacionGenericaProd = "DenominacionGenericaProd1", + DenominacionDistintivaProd = "DenominacionDistintivaProd1", + Fabricante = "Fabricante1", + FechaCaducidad = DateTime.Parse("2028-01-01T00:00:00"), + LoteMedicamento = "LoteMedic1", + RegistroSanitarioFolioAutorizacion = "RegistroSanita1", + PesoEnKg = 1, + ValorMercancia = 100, + MonedaId = "MXN", + TipoMateriaId = "05", + DescripcionMateria = "otramateria", + CantidadTransporta = new List + { + new CantidadTransporta { Cantidad = 1, IdOrigen = "OR101010", IdDestino = "DE202020" } + }, + DetalleMercancia = new DetalleMercancia + { + UnidadPesoMercId = "Tu", + PesoBruto = 1, + PesoNeto = 1, + PesoTara = 0.001m, + NumPiezas = 1 + } + } + }, + TransporteMaritimo = new TransporteMaritimo + { + PermSCTId = "TPAF01", + NumPermisoSCT = "NumPermisoSCT1", + NombreAseg = "NombreAseg1", + NumPolizaSeguro = "NumPolizaSeguro1", + TipoEmbarcacionId = "B01", + Matricula = "Matricula1", + NumeroOMI = "IMO1234567", + AnioEmbarcacion = 2003, + NombreEmbarc = "NombreEmbarc1", + NacionalidadEmbarcId = "AFG", + UnidadesDeArqBruto = 0.001m, + TipoCargaId = "CGS", + Eslora = 0.01m, + Manga = 0.01m, + Calado = 0.01m, + Puntal = 0.01m, + LineaNaviera = "LineaNaviera1", + NombreAgenteNaviero = "NombreAgenteNaviero1", + NumAutorizacionNavieroId = "ANC001/2022", + NumViaje = "NumViaje1", + NumConocEmbarc = "NumConocEmbarc1", + PermisoTempNavegacion = "PermisoTempNavegac1", + Contenedores = new List + { + new ContenedorMaritimo + { + TipoContenedorId = "CM011", + IdCCPRelacionado = "CCCBCD94-870A-4332-A52A-A52AA52AA52A", + PlacaVMCCP = "JNG7683", + FechaCertificacionCCP = "2024-06-20T11:11:00", + RemolquesCCP = new List + { + new RemolqueCCP { SubTipoRemCCPId = "CTR001", PlacaCCP = "JNG7636" } + } + } + } + }, + TiposFigura = new List + { + new TipoFigura + { + TipoFiguraId = "02", + RfcFigura = "EKU9003173C9", + NombreFigura = "NombreFigura", + PartesTransporte = new List + { + new ParteTransporte { ParteTransporteId = "PT02" } + }, + Domicilio = new Domicilio + { + Calle = "calle", NumeroExterior = "211", ColoniaId = "0814", + LocalidadId = "01", Referencia = "casa blanca", + MunicipioId = "010", EstadoId = "ZAC", PaisId = "MEX", CodigoPostalId = "99080" + } + } + } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + // button25: Factura traslado transporte maritimo internacional aduanero + private async void button25_Click(object sender, EventArgs e) + { + var fiscalApi = FiscalApiClient.Create(_settings); + + var invoice = CreateBaseTraslado(); + invoice.Series = "Serie"; + + invoice.Complement = new Complement + { + CartaPorte = new CartaPorte + { + TranspInternacId = "Sí", + EntradaSalidaMercId = "Entrada", + PaisOrigenDestinoId = "AFG", + ViaEntradaSalidaId = "02", + UnidadPesoId = "XBX", + PesoNetoTotal = 1, + RegimenAduaneros = new List + { + new RegimenAduanero { RegimenAduaneroId = "IMD" }, + new RegimenAduanero { RegimenAduaneroId = "IMD" } + }, + Ubicaciones = new List + { + new Ubicacion + { + TipoUbicacion = "Origen", IdUbicacion = "OR101010", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario1", + NumEstacionId = "PM001", NombreEstacion = "Rosarito", + NavegacionTraficoId = "Altura", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:00"), + TipoEstacionId = "01", + Domicilio = new Domicilio + { + Calle = "Calle1", NumeroExterior = "211", NumeroInterior = "212", + ColoniaId = "1957", LocalidadId = "13", Referencia = "casa blanca", + MunicipioId = "011", EstadoId = "CMX", PaisId = "MEX", CodigoPostalId = "13250" + } + }, + new Ubicacion + { + TipoUbicacion = "Destino", IdUbicacion = "DE202020", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario2", + NumEstacionId = "PM001", NombreEstacion = "Rosarito", + NavegacionTraficoId = "Altura", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:01"), + TipoEstacionId = "03", + Domicilio = new Domicilio + { + Calle = "Calle2", NumeroExterior = "214", NumeroInterior = "215", + ColoniaId = "0347", LocalidadId = "23", Referencia = "casa negra", + MunicipioId = "004", EstadoId = "COA", PaisId = "MEX", CodigoPostalId = "25350" + } + } + }, + Mercancias = new List + { + new Mercancia + { + BienesTranspId = "11121900", + Descripcion = "Accesorios de equipo de telefonía", + Cantidad = 1.0m, + ClaveUnidadId = "XBX", + MaterialPeligrosoId = "No", + DenominacionGenericaProd = "DenominacionGenericaProd1", + DenominacionDistintivaProd = "DenominacionDistintivaProd1", + Fabricante = "Fabricante1", + FechaCaducidad = DateTime.Parse("2028-01-01T00:00:00"), + LoteMedicamento = "LoteMedic1", + RegistroSanitarioFolioAutorizacion = "RegistroSanita1", + PesoEnKg = 1, + ValorMercancia = 100, + MonedaId = "MXN", + TipoMateriaId = "05", + DescripcionMateria = "otramateria", + DocumentacionAduanera = new List + { + new DocumentoAduanero + { + TipoDocumentoId = "01", + NumPedimento = "23 43 0472 8000448", + RfcImpo = "EKU9003173C9" + } + }, + CantidadTransporta = new List + { + new CantidadTransporta { Cantidad = 1, IdOrigen = "OR101010", IdDestino = "DE202020" } + }, + DetalleMercancia = new DetalleMercancia + { + UnidadPesoMercId = "Tu", + PesoBruto = 1, + PesoNeto = 1, + PesoTara = 0.001m, + NumPiezas = 1 + } + } + }, + TransporteMaritimo = new TransporteMaritimo + { + PermSCTId = "TPAF01", + NumPermisoSCT = "NumPermisoSCT1", + NombreAseg = "NombreAseg1", + NumPolizaSeguro = "NumPolizaSeguro1", + TipoEmbarcacionId = "B01", + Matricula = "Matricula1", + NumeroOMI = "IMO1234567", + AnioEmbarcacion = 2003, + NombreEmbarc = "NombreEmbarc1", + NacionalidadEmbarcId = "AFG", + UnidadesDeArqBruto = 0.001m, + TipoCargaId = "CGS", + Eslora = 0.01m, + Manga = 0.01m, + Calado = 0.01m, + Puntal = 0.01m, + LineaNaviera = "LineaNaviera1", + NombreAgenteNaviero = "NombreAgenteNaviero1", + NumAutorizacionNavieroId = "ANC001/2022", + NumViaje = "NumViaje1", + NumConocEmbarc = "NumConocEmbarc1", + PermisoTempNavegacion = "PermisoTempNavegac1", + Contenedores = new List + { + new ContenedorMaritimo + { + TipoContenedorId = "CM011", + IdCCPRelacionado = "CCCBCD94-870A-4332-A52A-A52AA52AA52A", + PlacaVMCCP = "JNG7683", + FechaCertificacionCCP = "2024-06-20T11:11:00", + RemolquesCCP = new List + { + new RemolqueCCP { SubTipoRemCCPId = "CTR001", PlacaCCP = "JNG7636" } + } + } + } + }, + TiposFigura = new List + { + new TipoFigura + { + TipoFiguraId = "02", + RfcFigura = "EKU9003173C9", + NombreFigura = "NombreFigura", + PartesTransporte = new List + { + new ParteTransporte { ParteTransporteId = "PT02" } + }, + Domicilio = new Domicilio + { + Calle = "calle", NumeroExterior = "211", ColoniaId = "0814", + LocalidadId = "01", Referencia = "casa blanca", + MunicipioId = "010", EstadoId = "ZAC", PaisId = "MEX", CodigoPostalId = "99080" + } + } + } + } + }; + + var apiResponse = await fiscalApi.Invoices.CreateAsync(invoice); + + if (apiResponse.Succeeded) + MessageBox.Show(JsonConvert.SerializeObject(apiResponse.Data, Formatting.Indented)); + else + { + MessageBox.Show(apiResponse.Message); + MessageBox.Show(apiResponse.Details); + } + } + + private TransporteFerroviario CreateTransporteFerroviario() + { + return new TransporteFerroviario + { + TipoDeServicioId = "TS01", + TipoDeTraficoId = "TT01", + DerechosDePaso = new List + { + new DerechoDePaso { TipoDerechoDePasoId = "CDP114", KilometrajePagado = 100 } + }, + Carros = new List + { + new Carro + { + TipoCarroId = "TC08", + MatriculaCarro = "A00012", + GuiaCarro = "123ASD", + ToneladasNetasCarro = 10 + } + } + }; + } + + private TipoFigura CreateTipoFiguraFerroviario() + { + return new TipoFigura + { + TipoFiguraId = "02", + RfcFigura = "EKU9003173C9", + NombreFigura = "NombreFigura", + PartesTransporte = new List + { + new ParteTransporte { ParteTransporteId = "PT02" } + }, + Domicilio = new Domicilio + { + Calle = "calle", NumeroExterior = "211", ColoniaId = "0814", + LocalidadId = "01", Referencia = "casa blanca", + MunicipioId = "010", EstadoId = "ZAC", PaisId = "MEX", CodigoPostalId = "99080" + } + }; + } + + private List CreateUbicacionesFerroviarioNacional() + { + return new List + { + new Ubicacion + { + TipoUbicacion = "Origen", IdUbicacion = "OR101010", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario1", + NumEstacionId = "Q0736", NombreEstacion = "SANTO NINO", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T00:00:00"), + TipoEstacionId = "01", + Domicilio = new Domicilio + { + Calle = "Calle1", NumeroExterior = "211", NumeroInterior = "212", + ColoniaId = "1957", LocalidadId = "13", Referencia = "casa blanca", + MunicipioId = "011", EstadoId = "CMX", PaisId = "MEX", CodigoPostalId = "13250" + } + }, + new Ubicacion + { + TipoUbicacion = "Destino", IdUbicacion = "DE202021", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario2", + NumEstacionId = "SC283", NombreEstacion = "HUAXTITLA", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T01:00:01"), + TipoEstacionId = "02", DistanciaRecorrida = 100.00m + }, + new Ubicacion + { + TipoUbicacion = "Destino", IdUbicacion = "DE202022", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario2", + NumEstacionId = "TG0", NombreEstacion = "NAVOJOA", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T02:00:01"), + TipoEstacionId = "02", DistanciaRecorrida = 100.00m + }, + new Ubicacion + { + TipoUbicacion = "Destino", IdUbicacion = "DE202023", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario2", + NumEstacionId = "E0029", NombreEstacion = "TRES JAGUEYES", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T03:00:01"), + TipoEstacionId = "02", DistanciaRecorrida = 100.00m + }, + new Ubicacion + { + TipoUbicacion = "Destino", IdUbicacion = "DE202024", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario2", + NumEstacionId = "TI032", NombreEstacion = "NAVOLATO", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T04:00:01"), + TipoEstacionId = "02", DistanciaRecorrida = 100.00m + }, + new Ubicacion + { + TipoUbicacion = "Destino", IdUbicacion = "DE202025", + RfcRemitenteDestinatario = "EKU9003173C9", + NombreRemitenteDestinatario = "NombreRemitenteDestinatario2", + NumEstacionId = "JM047", NombreEstacion = "HUEHUETOCA", + FechaHoraSalidaLlegada = DateTime.Parse("2023-08-01T05:00:01"), + TipoEstacionId = "03", DistanciaRecorrida = 100.00m, + Domicilio = new Domicilio + { + Calle = "Calle2", NumeroExterior = "214", NumeroInterior = "215", + ColoniaId = "0347", LocalidadId = "23", Referencia = "casa negra", + MunicipioId = "004", EstadoId = "COA", PaisId = "MEX", CodigoPostalId = "25350" + } + } + }; + } + + private Mercancia CreateMercanciaFerroviario(bool includeTipoMateria = false, bool includeDocumentacionAduanera = false) + { + var m = new Mercancia + { + BienesTranspId = "11121900", + Descripcion = "Accesorios de equipo de telefonía", + Cantidad = 1.0m, + ClaveUnidadId = "XBX", + MaterialPeligrosoId = "No", + DenominacionGenericaProd = "DenominacionGenericaProd1", + DenominacionDistintivaProd = "DenominacionDistintivaProd1", + Fabricante = "Fabricante1", + FechaCaducidad = DateTime.Parse("2028-01-01T00:00:00"), + LoteMedicamento = "LoteMedic1", + RegistroSanitarioFolioAutorizacion = "RegistroSanita1", + PesoEnKg = 1, + CantidadTransporta = new List + { + new CantidadTransporta { Cantidad = 1, IdOrigen = "OR101010", IdDestino = "DE202025" } + } + }; + + if (includeTipoMateria || includeDocumentacionAduanera) + { + m.TipoMateriaId = "05"; + m.DescripcionMateria = "otramateria"; + } + + if (includeDocumentacionAduanera) + { + m.DocumentacionAduanera = new List + { + new DocumentoAduanero + { + TipoDocumentoId = "01", + NumPedimento = "23 43 0472 8000448", + RfcImpo = "EKU9003173C9" + } + }; + } + + return m; + } + + private Invoice CreateBaseInvoiceFerroviario() + { + var invoice = CreateBaseInvoice(); + invoice.Series = "Serie"; + invoice.Recipient = new InvoiceRecipient + { + Tin = "EKU9003173C9", + LegalName = "ESCUELA KEMPER URGATE", + ZipCode = "42501", + TaxRegimeCode = "601", + CfdiUseCode = "S01" + }; + return invoice; + } + + private Invoice CreateBaseTraslado() + { + return new Invoice + { + VersionCode = "4.0", + CurrencyCode = "XXX", + TypeCode = "T", + ExpeditionZipCode = "42501", + PaymentMethodCode = "", + Date = DateTime.Now, + ExchangeRate = 1, + ExportCode = "01", + Issuer = CreateIssuer(), + Recipient = new InvoiceRecipient + { + Tin = "EKU9003173C9", + LegalName = "ESCUELA KEMPER URGATE", + ZipCode = "42501", + TaxRegimeCode = "601", + CfdiUseCode = "S01" + }, + Items = new List + { + new InvoiceItem + { + ItemCode = "78101800", + ItemSku = "UT421511", + Quantity = 1, + UnitOfMeasurementCode = "H87", + Description = "Transporte de carga por carretera", + UnitPrice = 100.00m, + Discount = 0, + TaxObjectCode = "01", + ItemTaxes = new List() + } + } + }; + } + } +} diff --git a/FiscalApi.Samples.NetFramework/FiscalApi.Samples.NetFramework.csproj b/FiscalApi.Samples.NetFramework/FiscalApi.Samples.NetFramework.csproj index ab374bb..8fda2d7 100644 --- a/FiscalApi.Samples.NetFramework/FiscalApi.Samples.NetFramework.csproj +++ b/FiscalApi.Samples.NetFramework/FiscalApi.Samples.NetFramework.csproj @@ -33,8 +33,8 @@ 4 - - ..\packages\Fiscalapi.4.0.360\lib\net461\Fiscalapi.dll + + ..\packages\Fiscalapi.4.0.372\lib\net461\Fiscalapi.dll ..\packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\netstandard2.0\Microsoft.Bcl.AsyncInterfaces.dll @@ -108,6 +108,18 @@ + + Form + + + BillOfLadingReferenceForm.cs + + + Form + + + BillOfLadingValueForm.cs + Form diff --git a/FiscalApi.Samples.NetFramework/Form1.cs b/FiscalApi.Samples.NetFramework/Form1.cs index 7babf0d..7816869 100644 --- a/FiscalApi.Samples.NetFramework/Form1.cs +++ b/FiscalApi.Samples.NetFramework/Form1.cs @@ -22,8 +22,8 @@ public Form1() Settings = new FiscalapiSettings { ApiUrl = "https://test.fiscalapi.com", - ApiKey = "sk_test_b4f8cc00_d02a_4ecc_a68a_f87ae970958c", - Tenant = "275510ee-f64d-435a-9e92-1553d8f10a7e", + ApiKey = "api_key", + Tenant = "tenant_id", }; // Create directory if not exists diff --git a/FiscalApi.Samples.NetFramework/InvoiceReferenceForm.cs b/FiscalApi.Samples.NetFramework/InvoiceReferenceForm.cs index 51b049d..8945834 100644 --- a/FiscalApi.Samples.NetFramework/InvoiceReferenceForm.cs +++ b/FiscalApi.Samples.NetFramework/InvoiceReferenceForm.cs @@ -173,7 +173,8 @@ private void button13_Click(object sender, EventArgs e) private void button14_Click(object sender, EventArgs e) { - + BillOfLadingReferenceForm billOfLadingReferenceForm = new BillOfLadingReferenceForm(_settings); + billOfLadingReferenceForm.ShowDialog(); } } } diff --git a/FiscalApi.Samples.NetFramework/InvoiceValueForm.cs b/FiscalApi.Samples.NetFramework/InvoiceValueForm.cs index 0a7858c..9fd2c62 100644 --- a/FiscalApi.Samples.NetFramework/InvoiceValueForm.cs +++ b/FiscalApi.Samples.NetFramework/InvoiceValueForm.cs @@ -717,7 +717,8 @@ private void button9_Click_1(object sender, EventArgs e) private void button13_Click_1(object sender, EventArgs e) { - + BillOfLadingValueForm cartaporteForm = new BillOfLadingValueForm(_settings); + cartaporteForm.ShowDialog(); } private void button10_Click_1(object sender, EventArgs e)