diff --git a/bill/outlay.go b/bill/outlay.go index 0bc3cedf..b6cfdb95 100644 --- a/bill/outlay.go +++ b/bill/outlay.go @@ -47,8 +47,8 @@ func (o *Outlay) Validate() error { ) } -// JSONUnmarshal helps migrate the desc field to description. -func (o *Outlay) JSONUnmarshal(data []byte) error { +// UnmarshalJSON helps migrate the desc field to description. +func (o *Outlay) UnmarshalJSON(data []byte) error { type Alias Outlay aux := &struct { Desc string `json:"desc"` diff --git a/bill/outlay_test.go b/bill/outlay_test.go index 23310039..2c2a01eb 100644 --- a/bill/outlay_test.go +++ b/bill/outlay_test.go @@ -1,6 +1,7 @@ package bill import ( + "encoding/json" "testing" "github.com/invopop/gobl/num" @@ -10,7 +11,7 @@ import ( func TestOutlayUnmarshal(t *testing.T) { o := new(Outlay) - err := o.JSONUnmarshal([]byte(`{"desc":"foo"}`)) + err := json.Unmarshal([]byte(`{"desc":"foo"}`), o) require.NoError(t, err) assert.Equal(t, "foo", o.Description) } diff --git a/pay/advance.go b/pay/advance.go index 483dbeed..d5ed96c2 100644 --- a/pay/advance.go +++ b/pay/advance.go @@ -60,8 +60,8 @@ func (a *Advance) CalculateFrom(totalWithTax num.Amount) { } } -// JSONUnmarshal helps migrate the desc field to description. -func (a *Advance) JSONUnmarshal(data []byte) error { +// UnmarshalJSON helps migrate the desc field to description. +func (a *Advance) UnmarshalJSON(data []byte) error { type Alias Advance aux := &struct { Desc string `json:"desc,omitempty"` diff --git a/pay/advance_test.go b/pay/advance_test.go index eca13ef0..64c3db3d 100644 --- a/pay/advance_test.go +++ b/pay/advance_test.go @@ -1,6 +1,7 @@ package pay_test import ( + "encoding/json" "testing" "github.com/invopop/gobl/pay" @@ -10,7 +11,7 @@ import ( func TestAdvanceUnmarshal(t *testing.T) { a := new(pay.Advance) - err := a.JSONUnmarshal([]byte(`{"desc":"foo"}`)) + err := json.Unmarshal([]byte(`{"desc":"foo"}`), a) require.NoError(t, err) assert.Equal(t, "foo", a.Description) } diff --git a/regimes/co/examples/out/simplified.json b/regimes/co/examples/out/simplified.json index 1c4273d6..514dc26e 100644 --- a/regimes/co/examples/out/simplified.json +++ b/regimes/co/examples/out/simplified.json @@ -4,7 +4,7 @@ "uuid": "8a51fd30-2a27-11ee-be56-0242ac120002", "dig": { "alg": "sha256", - "val": "2346991aab5ee704bd2b0ad14a06260aaf81fa7baca32c2bcd211cbc177aa6a2" + "val": "f23f62eb0cf68db88a55bd391e5410bfba7bf06c24e1a7a863191346b07b644c" }, "draft": true }, @@ -50,7 +50,7 @@ "payment": { "advances": [ { - "desc": "Prepaid", + "description": "Prepaid", "percent": "100%", "amount": "238000.00" } diff --git a/regimes/es/examples/out/invoice-es-es-vateqs-provider.json b/regimes/es/examples/out/invoice-es-es-vateqs-provider.json index f724d5f0..e1cc70ab 100644 --- a/regimes/es/examples/out/invoice-es-es-vateqs-provider.json +++ b/regimes/es/examples/out/invoice-es-es-vateqs-provider.json @@ -4,7 +4,7 @@ "uuid": "8a51fd30-2a27-11ee-be56-0242ac120002", "dig": { "alg": "sha256", - "val": "72e81bc4530fcd56154953690b56d170d3de5109a833642876e1dc33399f8d6e" + "val": "43f53d3728f1840ae9a652d616a7af90f827a937e375e9bf68d2e5d61c986ddc" }, "draft": true }, @@ -111,7 +111,7 @@ "advances": [ { "date": "2021-09-01", - "desc": "Deposit paid upfront", + "description": "Deposit paid upfront", "amount": "25.00" } ], diff --git a/regimes/mx/examples/out/prepaid-invoice.json b/regimes/mx/examples/out/prepaid-invoice.json index 9e0e548b..28fe82cb 100644 --- a/regimes/mx/examples/out/prepaid-invoice.json +++ b/regimes/mx/examples/out/prepaid-invoice.json @@ -4,7 +4,7 @@ "uuid": "8a51fd30-2a27-11ee-be56-0242ac120002", "dig": { "alg": "sha256", - "val": "d8defb2c2e8f823f3ee18d3b75516cd38532f735a6f2635ceb7950af3fa7c150" + "val": "e87b2b2acf012c7fa3b9d9eda0046943b173b98ce47fa9bd27144f27b157b1b0" }, "draft": true }, @@ -94,13 +94,13 @@ "advances": [ { "key": "cash", - "desc": "Anticipo", + "description": "Anticipo", "percent": "10.0%", "amount": "2.20" }, { "key": "card", - "desc": "Saldo", + "description": "Saldo", "percent": "90.0%", "amount": "19.84" }