-
Notifications
You must be signed in to change notification settings - Fork 13
API Multiemisor
Diego Rodriguez edited this page Apr 12, 2018
·
2 revisions
Para poder emitir facturas es importante contar con los CSD de cada Emisor.
Cargar un CSD
var csdRequest = new Csd
{
Rfc = "aaa010101aaa",
Certificate = "MIIF+TCCA+GgAwIBAgIUMzAwMDEwMDAwMDAzMDAwMjM3MDgwDQYJKoZIhvcNAQELBQAwggFmMSAwHgYDVQQDDBdBLkMuIDIgZGUgcHJ1ZWJhcyg0MDk2KTEvMC0GA1UECgwmU2VydmljaW8gZGUgQWRtaW5pc3RyYWNpw7NuIFRyaWJ1dGFyaWExODA2BgNVBAsML0FkbWluaXN0cmFjacOzbiBkZSBTZWd1cmlkYWQgZGUgbGEgSW5mb3JtYWNpw7NuMSkwJwYJKoZIhvcNAQkBFhphc2lzbmV0QHBydWViYXMuc2F0LmdvYi5teDEmMCQGA1UECQwdQXYuIEhpZGFsZ28gNzcsIENvbC4gR3VlcnJlcm8xDjAMBgNVBBEMBTA2MzAwMQswCQYDVQQGEwJNWDEZMBcGA1UECAwQRGlzdHJpdG8gRmVkZXJhbDESMBAGA1UEBwwJQ295b2Fjw6FuMRUwEwYDVQQtEwxTQVQ5NzA3MDFOTjMxITAfBgkqhkiG9w0BCQIMElJlc3BvbnNhYmxlOiBBQ0RNQTAeFw0xNzA1MTgwMzU0NTZaFw0yMTA1MTgwMzU0NTZaMIHlMSkwJwYDVQQDEyBBQ0NFTSBTRVJWSUNJT1MgRU1QUkVTQVJJQUxFUyBTQzEpMCcGA1UEKRMgQUNDRU0gU0VSVklDSU9TIEVNUFJFU0FSSUFMRVMgU0MxKTAnBgNVBAoTIEFDQ0VNIFNFUlZJQ0lPUyBFTVBSRVNBUklBTEVTIFNDMSUwIwYDVQQtExxBQUEwMTAxMDFBQUEgLyBIRUdUNzYxMDAzNFMyMR4wHAYDVQQFExUgLyBIRUdUNzYxMDAzTURGUk5OMDkxGzAZBgNVBAsUEkNTRDAxX0FBQTAxMDEwMUFBQTC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h4kdnTNUdkxEjqp+UVtBdaxswa6s4qrLbNeD7VN+1KJEMN6/zZ6+2Uj2KBMzaDA0zwAHMB1gyPkgX0v47e61iffaVAUQzDGYGbDERG2vT8234NSDdgqzOpsf7il2Pv+uF0oab+db62JiRvOEjNefXG5p8KRudYyaVO8N7iTdRRj/A/yDwjmSq9dDCZEZE0cD6BEaAgmjvqwF5IvGgJGnWYKhrOGBPv+VL6zGOXo/L9zenxYwKNTHzNYlvug/t4gXQmArroqA2YKBGpYb8/FY/q3t3k+u1bXWvNLOzWi81InvxFSCTu6l9GBCthyWwekWdoL6ssSzOmzPr/d2klSRST3ByJmAJzLGJFsj6AL01BaUVWERH0s+GmnSWOU8ZIQVGF7aOEWWbtD0vyjJRxQnxPxn+Tt3oT9Nob10QGwG/2tNZtZuhAMf1yt+cF8jl0hC/LI0FtMqmLAkxaEOiXHmFuKXbAjFxIjdIwgWsAZe1cTLzR44jIKwlB64jvh1LXmJ5jCszLd/fuCEB0XZUWLDRCZVb82MqcZl7U/gaFazSqm71NNafCDzWjWO4ukWN1lcTDJE05KgeRqoYIEcpU8jXy/CAEaoseA1bWDnfnLJk2axVXzmrtYnojyKjTjDz3In41Kjsx3nNOegqtH7O2gl9YBzJfgwZmF0ldk+udcotc0JwIXYWk7b5HmRgXWa+WvDHSwyLzMrbw=",
PrivateKeyPassword = "12345678a"
};
facturama.Csds.Create(csdRequest);
Eliminar CSD
facturama.Csds.Remove(csd.Rfc);
Para crear el CFDI debemos contar con los CSD cargados
Creacion de CFDI 3.3
var cfdi = new CfdiMulti
{
Folio = "100",
Serie = "R",
Currency = "MXN",
ExpeditionPlace = "78116",
PaymentConditions = "CREDITO A SIETE DIAS",
CfdiType = CfdiType.Ingreso,
PaymentForm = "03",
PaymentMethod = "PUE",
Issuer = new Issuer
{
FiscalRegime = "601",
Name = "Emisor SA de CV",
Rfc = "AAA010101AAA"
},
Receiver = new Receiver
{
Rfc = "RSS2202108U5",
Name = "RADIAL SOFTWARE SOLUTIONS",
CfdiUse = "P01"
},
Items = new List<Item>
{
new Item
{
ProductCode = "10101504",
IdentificationNumber = "EDL",
Description = "Estudios de viabilidad",
Unit = "NO APLICA",
UnitCode = "MTS",
UnitPrice = 50.00m,
Quantity = 2.00m,
Subtotal = 100.00m,
Taxes = new List<Tax>
{
new Tax
{
Total = 16.00m,
Name = "IVA",
Base = 100.00m,
Rate = 0.160000m,
IsRetention = false
}
},
Total = 116.0m
}
}
};
facturama.Cfdis.Create(cfdi);
Cancelación
facturama.Cfdis.Remove(cfdiCreated.Id);
Descarga de XML
facturama.Cfdis.SaveXml($"factura.xml", cfdiCreated.Id);
Consultar facturas creadas
facturama.Cfdis.List("Expresion en Software");