Untitled

mail@pastecode.io avatar
unknown
plain_text
10 days ago
863 B
3
Indexable
Never



// Probar la emision de 100 facturas

func Facturar100 (t *testing.T) {

	folio:=744000
	for i=1 to 100 {
		nota,err = notas.Get(folio)

		f := &Factura{
			Numdoc: time.Now().Format("01-150405"),
			Fecha:  time.Now().Format("2006-01-02"),
			...
			"hora":		"`+time.Now().Format("15:04:05")+`",
			"numcli":	"1203",
			"numalm":	" 1",
			"divisa":	"P",
			"formapago": "1",
			"usoCFDI":	"G03",
			"metodopagosat":"PUE",
			"formapagosat":"01",
			"condicionesdepago":"CONTADO",
		}

		for _,notaitem := range nota.Items {
			item := &Item{
				Cant: notaitem.Cant,
				Numart: notaitem.Numart,
				..
			}
			f.Items = append(f.Items,item)
		}

		// Intentar timbrado
		r := apitest.Req2(t,
				201, "Facturando ",
				"POST /api/v3/facturas",
				utils.ToJsonStr(f))

		if r.Code != 201 {
			fmt.Printf(	r.Body.String() )
			os.Exit(1)
		}

		++folio 
	}

Leave a Comment