Skip to content

Commit

Permalink
Completely replace ProdServ identity type with key
Browse files Browse the repository at this point in the history
  • Loading branch information
cavalle committed Aug 18, 2023
1 parent 998cc80 commit 7dae90b
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion regimes/mx/item.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func validItemIdentities(value interface{}) error {

func normalizeItem(item *org.Item) error {
for _, id := range item.Identities {
if id.Type == IdentityTypeSAT && itemIdentityNormalizableCodeRegexp.MatchString(string(id.Code)) {
if id.Key == IdentityKeyCFDIProdServ && itemIdentityNormalizableCodeRegexp.MatchString(string(id.Code)) {
id.Code = id.Code + "00"
}
}
Expand Down
2 changes: 1 addition & 1 deletion regimes/mx/item_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func TestItemIdentityNormalization(t *testing.T) {
},
}
for _, ts := range tests {
item := &org.Item{Identities: []*org.Identity{{Code: ts.Code, Type: "SAT"}}}
item := &org.Item{Identities: []*org.Identity{{Code: ts.Code, Key: mx.IdentityKeyCFDIProdServ}}}
err := r.CalculateObject(item)
assert.NoError(t, err)
assert.Equal(t, ts.Expected, item.Identities[0].Code)
Expand Down
2 changes: 0 additions & 2 deletions regimes/mx/mx.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ const (
KeySATFormaPago cbc.Key = "sat-forma-pago" // for mapping to c_FormaPago’s codes
KeySATTipoDeComprobante cbc.Key = "sat-tipo-de-comprobante" // for mapping to c_TipoDeComprobante’s codes
KeySATTipoRelacion cbc.Key = "sat-tipo-relacion" // for mapping to c_TipoRelacion’s codes

IdentityTypeSAT cbc.Code = "SAT" // for custom codes mapped from identities (e.g. c_ClaveProdServ’s codes)
)

// SAT official codes to include in stamps.
Expand Down

0 comments on commit 7dae90b

Please sign in to comment.