wetcat-studios / fortie

Laravel 5 package for Fortnox API
Apache License 2.0
19 stars 20 forks source link

Required attributes issues in orders #39

Closed bagendahl closed 5 years ago

bagendahl commented 5 years ago

I got "Required attributes are CustomerNumber, Description, OrderedQuantity" error when I try to add an order. Solution was to add OrderRows into writable and attribute and change required to: `protected $required_create = [ 'CustomerNumber', 'OrderRows', ];

protected $required_update = [ 'CustomerNumber', ];`

I do not now your code is a legacy from old api but solution above works. If you approve please add solution into your repo.

Thanks

agoransson commented 5 years ago

Excellent, I'll have a look. Thanks.

agoransson commented 5 years ago

I recall some problems in this area when I first designed the library, it's really a problem in being multi-dimensional. The Order itself doesn't have a requirement for the Description I think, but according to the Fortnox API the Orderrow has that requirement*. I'll go with your fix, and perhaps review how to handle these checks in future.

Perhaps the best thing is just to allow attempts to create things without any check, only let Fortnox say when something is missing.

(*Fortnox seems to allow a missing description anyway.)

bagendahl commented 5 years ago

Hi, I think you forgot this fox because I had to add it by myself in latest version. Could you add this in core? Thanks