Method: Facturama::Samples::SampleApiMulti#sample_cfdis_create

Defined in:
lib/samples/sample_api_multi.rb

#sample_cfdis_create(facturama) ⇒ Object

Ejemplo de creación de un CFDI En la API MULTIMEMISOR Se puede cambiar el campo de “Issuer” y emitir una factura, siempre y cuando previamente cargáramos los Certificados CSD

  • Nota: La creación de una factura muy similar a la forma de crearla en API WEB. Y se diferencía en que aquí se tiene la sección de: “Issuer”:

    "FiscalRegime": "601",
    "Rfc": "AAA010101AAA",
    "Name": "EXPRESION EN SOFTWARE"
    

    ,



197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
# File 'lib/samples/sample_api_multi.rb', line 197

def sample_cfdis_create(facturama)

     cfdi = {
        "Serie": "R",
        "Currency": "MXN",
        "ExpeditionPlace": "78116",
        "PaymentConditions": "CREDITO A SIETE DIAS",
        "Folio": "100",
        "CfdiType": "I",
        "PaymentForm": "03",
        "PaymentMethod": "PUE",


        "Issuer": {
            "FiscalRegime": "601",
            "Rfc": "AAA010101AAA",
            "Name": "EXPRESION EN SOFTWARE"
        },


        "Receiver": {
            "Rfc": "XAXX010101000",
            "Name": "RADIAL SOFTWARE SOLUTIONS",
            "CfdiUse": "P01"
        },
        "Items": [
            {
                "ProductCode": "10101504",
                "IdentificationNumber": "EDL",
                "Description": "Estudios de viabilidad",
                "Unit": "NO APLICA",
                "UnitCode": "MTS",
                "UnitPrice": 50.0,
                "Quantity": 2.0,
                "Subtotal": 100.0,
                "Taxes": [{
                              "Total": 16.0,
                              "Name": "IVA",
                              "Base": 100.0,
                              "Rate": 0.16,
                              "IsRetention": false
                          }],
                "Total": 116.0
            },
            {
                "ProductCode": "10101504",
                "IdentificationNumber": "001",
                "Description": "SERVICIO DE COLOCACION",
                "Unit": "NO APLICA",
                "UnitCode": "E49",
                "UnitPrice": 100.0,
                "Quantity": 15.0,
                "Subtotal": 1500.0,
                "Discount": 0.0,
                "Taxes": [{
                              "Total": 240.0,
                              "Name": "IVA",
                              "Base": 1500.0,
                              "Rate": 0.16,
                              "IsRetention": false
                          }],
                "Total": 1740.0
            }
        ]
    }


     # Creación del CFDI mediante la API, para su creación

     facturama.cfdis.create(cfdi)
end