diff --git a/README.md b/README.md index 13fb360..01f3bbf 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,8 @@ For this I have worked it all out as follows. The funny thing is that the ID doe **1 = Stk, 2 = m², 3 = m, 4 = kg, 5 = t, 6 = lfm, 7 = pauschal, 8 = m³, 9 = Std, 10 = km, 11 = %, 12 = Tag(e), 13 = l** +In sevDesk the price is transferred in gross, therefore we have added a calculation of the gross value to the function. So you set the net value + the VAT in the function. + ```go Position, err := NewPosition(Position{"45", "1", "16", "Backups", "9", "invoiceID", "token"}) if err != nil { diff --git a/position.go b/position.go index a926270..461446a 100644 --- a/position.go +++ b/position.go @@ -4,13 +4,14 @@ import ( "encoding/json" "net/http" "net/url" + "strconv" "strings" ) type Position struct { - Price string + PriceNet int Quantity string - TaxRate string + TaxRate int Name string UnityID string InvoiceID string @@ -136,9 +137,9 @@ func NewPosition(config Position) (PositionReturn, error) { // Define body data body := url.Values{} - body.Set("price", config.Price) + body.Set("price", strconv.Itoa(config.PriceNet+(config.PriceNet*config.TaxRate/100))) body.Set("quantity", config.Quantity) - body.Set("taxRate", config.TaxRate) + body.Set("taxRate", strconv.Itoa(config.TaxRate)) body.Set("name", config.Name) body.Set("unity[id]", config.UnityID) body.Set("unity[objectName]", "Unity")