tripletex-api2 icon indicating copy to clipboard operation
tripletex-api2 copied to clipboard

POST /ledger/voucher requires posting account name

Open MaximBalaganskiy opened this issue 7 months ago • 9 comments

Posting a voucher fails if account name is not specified, which is excessive. Supplying an empty string works but seems hacky.

MaximBalaganskiy avatar Apr 15 '25 00:04 MaximBalaganskiy

You should only need to specify the account on the Posting by giving the ID, account name is not needed. For instance like this:

"account" : { "id": "195547511" }

tlxVidar avatar Apr 16 '25 09:04 tlxVidar

Not specifying the name fails. Swagger clearly states the name is required

MaximBalaganskiy avatar Apr 16 '25 09:04 MaximBalaganskiy

Well, it works for us (just testet it now), and this is the recommended way of doing it.

Name and number is required if you want to Post or Put the account object itself, but not when you are just referring to an account on a Posting.

tlxVidar avatar Apr 16 '25 09:04 tlxVidar

The HTTP status code of the response was not expected (422). Status: 422 Response: { "status" : 422, "code" : 18000, "message" : "Validering feilet.", "link" : "https://tripletex.no/v2-docs/", "developerMessage" : null, "validationMessages" : [ { "field" : "postings.account.name", "message" : "Kan ikke være null.", "path" : "postings[0].account.name", "rootId" : null } ], "requestId" : "309af8e5-61d1-424d-b4a2-d34993e7611d" } Kan ikke være null. The HTTP status code of the response was not expected (422). Status: 422 Response: { "status" : 422, "code" : 18000, "message" : "Validering feilet.", "link" : "https://tripletex.no/v2-docs/", "developerMessage" : null, "validationMessages" : [ { "field" : "postings.account.name", "message" : "Kan ikke være null.", "path" : "postings[0].account.name", "rootId" : null } ], "requestId" : "309af8e5-61d1-424d-b4a2-d34993e7611d" } Kan ikke være null.

this is the erro i got couple of days ago. worked around it with setting blank value on accountname.

also we got suddenly issuews with currency factor. even though i am supplying all the amounts

The HTTP status code of the response was not expected (422). Status: 422 Response: { "status" : 422, "code" : 18000, "message" : "Validering feilet.", "link" : "https://tripletex.no/v2-docs/", "developerMessage" : "VALIDATION_ERROR", "validationMessages" : [ { "field" : "", "message" : "Ugyldig valuta", "path" : null, "rootId" : null } ], "requestId" : "3e2a59d5-c1f6-4696-bd6d-a0f5cd3625d8" } Ugyldig valuta The HTTP status code of the response was not expected (422). Status: 422 Response: { "status" : 422, "code" : 18000, "message" : "Validering feilet.", "link" : "https://tripletex.no/v2-docs/", "developerMessage" : "VALIDATION_ERROR", "validationMessages" : [ { "field" : "", "message" : "Ugyldig valuta", "path" : null, "rootId" : null } ], "requestId" : "3e2a59d5-c1f6-4696-bd6d-a0f5cd3625d8" } Ugyldig valuta

dagdynamik avatar Apr 16 '25 09:04 dagdynamik

maybe somone did a bleep and reverted it fast. but this was indeed my message a 2 days ago

dagdynamik avatar Apr 16 '25 09:04 dagdynamik

There has been no changes deployed or reverted here.
Have you tried to specify the account the way I showed above?

The second error message indicates that you are specifiying a currency ID that is not actually a legal currency ID.

These are not errors that we can reproduce, but if you can post the JSON that you are posting, then we can look more into it

tlxVidar avatar Apr 16 '25 10:04 tlxVidar

what happens if the client generated adds the name field but with null values ?

dagdynamik avatar Apr 16 '25 17:04 dagdynamik

Yep that was it. the new client didnt strip all null values, and your backend didnt like that :)

dagdynamik avatar Apr 16 '25 17:04 dagdynamik

and the currency error message was the wrong one i pasted. but i asume the one i got about factor also is related to bunch of null fields being sent

dagdynamik avatar Apr 16 '25 18:04 dagdynamik