Skip to content

Commit

Permalink
Extract fuel item data into own struct
Browse files Browse the repository at this point in the history
  • Loading branch information
cavalle committed Oct 4, 2023
1 parent 46fe9e7 commit c3349a6
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
8 changes: 4 additions & 4 deletions fuel_account_balance.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ func newECCConceptos(lines []*mx.FuelAccountLine) []*ECCConcepto {
Rfc: l.VendorTaxCode.String(),
ClaveEstacion: l.ServiceStationCode.String(),
Cantidad: l.Quantity.String(),
TipoCombustible: l.FuelType.String(),
Unidad: l.Unit.UNECE().String(),
NombreCombustible: l.FuelName,
TipoCombustible: l.Item.Type.String(),
Unidad: l.Item.Unit.UNECE().String(),
NombreCombustible: l.Item.Name,
FolioOperacion: l.PurchaseCode.String(),
ValorUnitario: l.UnitPrice.String(),
ValorUnitario: l.Item.Price.String(),
Importe: l.Total.String(),
Traslados: newECCTraslados(l.Taxes),
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/invopop/gobl.cfdi
go 1.20

require (
github.com/invopop/gobl v0.59.1-0.20230929141759-4e8c219f6a99
github.com/invopop/gobl v0.59.1-0.20231004102208-ab524c938a9e
github.com/joho/godotenv v1.5.1
github.com/magefile/mage v1.15.0
github.com/spf13/cobra v1.7.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/invopop/gobl v0.59.1-0.20230929141759-4e8c219f6a99 h1:sW3LOy+DbzZOvIO4agqcTKnLnqtOZ83AjPp+ZZ26tZc=
github.com/invopop/gobl v0.59.1-0.20230929141759-4e8c219f6a99/go.mod h1:kt3cQtFSOhPCYVlgiaRI267syjI+X1VRW7QHTmitc+Q=
github.com/invopop/gobl v0.59.1-0.20231004102208-ab524c938a9e h1:UfIaxzJKnFW6vTjnk0KYvTzAMFe80HkLnc2Okn8PKMQ=
github.com/invopop/gobl v0.59.1-0.20231004102208-ab524c938a9e/go.mod h1:kt3cQtFSOhPCYVlgiaRI267syjI+X1VRW7QHTmitc+Q=
github.com/invopop/jsonschema v0.9.0 h1:m1Fe5PN4X9V7P1TCF+pA8Xly3Vj3pY905klC++8oOpM=
github.com/invopop/jsonschema v0.9.0/go.mod h1:uMhbTEOXoPcOKzdYRfk914W6UTGA/cVcgEQxXh1MJ7g=
github.com/invopop/validation v0.3.0 h1:o260kbjXzoBO/ypXDSSrCLL7SxEFUXBsX09YTE9AxZw=
Expand Down
20 changes: 12 additions & 8 deletions test/data/fuel-account-balance.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"uuid": "8a51fd30-2a27-11ee-be56-0242ac120002",
"dig": {
"alg": "sha256",
"val": "c0a43b719859e1f656b6a3bf6cc500703f1536240a110522a7f3f7fbeb566ef4"
"val": "1451d94f4ab432342eb1cf5721e978ff88bf45a90835c0538a917b58b9d59224"
},
"draft": true
},
Expand Down Expand Up @@ -105,10 +105,12 @@
"vendor_tax_code": "RWT860605OF5",
"service_station_code": "8171650",
"quantity": "9.661",
"fuel_type": "3",
"unit": "l",
"fuel_name": "Diesel",
"unit_price": "12.743",
"item": {
"type": "3",
"unit": "l",
"name": "Diesel",
"price": "12.743"
},
"purchase_code": "2794668",
"total": "123.11",
"taxes": [
Expand All @@ -130,9 +132,11 @@
"vendor_tax_code": "DJV320816JT1",
"service_station_code": "8171667",
"quantity": "9.680",
"fuel_type": "1",
"fuel_name": "Gasolina Magna",
"unit_price": "12.709",
"item": {
"type": "1",
"name": "Gasolina Magna",
"price": "12.709"
},
"purchase_code": "2794669",
"total": "123.02",
"taxes": [
Expand Down

0 comments on commit c3349a6

Please sign in to comment.