-
Notifications
You must be signed in to change notification settings - Fork 0
/
parties_test.go
65 lines (51 loc) · 1.92 KB
/
parties_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package cfdi_test
import (
"testing"
"github.com/invopop/gobl.cfdi/test"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestEmisor(t *testing.T) {
t.Run("should return a Document with the Emisor data", func(t *testing.T) {
doc, err := test.NewDocumentFrom("invoice-b2b-bare.json")
require.NoError(t, err)
e := doc.Emisor
assert.Equal(t, "EKU9003173C9", e.Rfc)
assert.Equal(t, "ESCUELA KEMPER URGATE", e.Nombre)
assert.Equal(t, "601", e.RegimenFiscal)
})
}
func TestReceptor(t *testing.T) {
t.Run("should return a Document with the Receptor data", func(t *testing.T) {
doc, err := test.NewDocumentFrom("invoice-b2b-bare.json")
require.NoError(t, err)
r := doc.Receptor
assert.Equal(t, "URE180429TM6", r.Rfc)
assert.Equal(t, "UNIVERSIDAD ROBOTICA ESPAÑOLA", r.Nombre)
assert.Equal(t, "65000", r.DomicilioFiscalReceptor)
assert.Equal(t, "601", r.RegimenFiscalReceptor)
assert.Equal(t, "G01", r.UsoCFDI)
})
t.Run("should return a Document with the Receptor data on simplified invoices", func(t *testing.T) {
doc, err := test.NewDocumentFrom("invoice-b2c.json")
require.NoError(t, err)
r := doc.Receptor
assert.Equal(t, "XAXX010101000", r.Rfc)
assert.Equal(t, "PÚBLICO EN GENERAL", r.Nombre)
assert.Equal(t, "26015", r.DomicilioFiscalReceptor)
assert.Equal(t, "616", r.RegimenFiscalReceptor)
assert.Equal(t, "S01", r.UsoCFDI)
})
t.Run("should return a Document with the Receptor data on export invoices", func(t *testing.T) {
doc, err := test.NewDocumentFrom("invoice-export.json")
require.NoError(t, err)
r := doc.Receptor
assert.Equal(t, "XEXX010101000", r.Rfc)
assert.Equal(t, "EXAMPLE CUSTOMER S.A.S.", r.Nombre)
assert.Equal(t, "26015", r.DomicilioFiscalReceptor)
assert.Equal(t, "616", r.RegimenFiscalReceptor)
assert.Equal(t, "S01", r.UsoCFDI)
assert.Equal(t, "9014514805", r.NumRegIdTrib)
assert.Equal(t, "COL", r.ResidenciaFiscal)
})
}