diff --git a/parser.go b/parser.go index 88c792a..49a195e 100644 --- a/parser.go +++ b/parser.go @@ -31,6 +31,7 @@ const ( fieldBIC = "26" // BIC fieldOrderID = "17" // ID pokynu fieldAuthor = "9" // Provedl + fieldPayerReference = "27" // Reference plátce xmlTimeFormat = "2006-01-02-07:00" ) @@ -217,6 +218,8 @@ func parseTransaction(t xmlTtransaction) (*Transaction, error) { tx.BIC = col.Value case fieldOrderID: tx.OrderID = col.Value + case fieldPayerReference: + tx.PayerReference = col.Value case fieldAuthor: default: return nil, fmt.Errorf(`unable to parse column: "%v"`, col.Name) diff --git a/transactions.go b/transactions.go index b0c451f..1fd9565 100644 --- a/transactions.go +++ b/transactions.go @@ -54,6 +54,7 @@ type Transaction struct { Comment string BIC string OrderID string + PayerReference string } // ByPeriodOptions represents options passed to ByPeriod. diff --git a/transactions_test.go b/transactions_test.go index bc8f4d2..402eff7 100644 --- a/transactions_test.go +++ b/transactions_test.go @@ -48,6 +48,7 @@ const transactionsResponse = ` RIDBSKBXXXX 15689512949 45.97 EUR + 2000000003 @@ -113,6 +114,7 @@ func TestByPeriod(t *testing.T) { Specification: "45.97 EUR", UserIdentification: "john doe", Type: "Bezhotovostní příjem", + PayerReference: "2000000003", }, }, } @@ -207,6 +209,7 @@ func TestGetStatement(t *testing.T) { Specification: "45.97 EUR", UserIdentification: "john doe", Type: "Bezhotovostní příjem", + PayerReference: "2000000003", }, }, } @@ -253,5 +256,6 @@ func assertEqualTransaction(t *testing.T, want Transaction, got Transaction) { require.Equal(t, want.Comment, got.Comment) require.Equal(t, want.UserIdentification, got.UserIdentification) require.Equal(t, want.Type, got.Type) + require.Equal(t, want.PayerReference, got.PayerReference) require.True(t, want.Date.Equal(got.Date)) }