wetcat-studios / fortie

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

Order POST Order Rows #78

Open Glimbrant opened 3 years ago

Glimbrant commented 3 years ago

Trying to use the create function for the Orders Provider using $this->orders()->create($params)

array(2) { ["CustomerNumber"]=> string(5) "10810" ["OrderRows"]=> array(1) { [0]=> array(5) { ["ArticleNumber"]=> string(17) "ditte-malet-1000g" ["DeliveredQuantity"]=> float(1) ["Description"]=> string(11) "DITTE Malet" ["OrderedQuantity"]=> float(1) ["Unit"]=> string(2) "st" } } }

When posting the OrderRows always gets empty. Is something missing?

Glimbrant commented 3 years ago

Have anybody checked into this why you cant post order rows?

agoransson commented 3 years ago

Sorry, been very busy.

We should definitely look into this! I'll try to steal some time tonight when kids sleeping =)

KasparRosin commented 3 years ago

Any updates on this?

KasparRosin commented 3 years ago

Reverting to version 1.0.12 will resolve the OrderRows issue. In the most recent release, you are now initialising the classes each time we call the functions, can that cause the issue?

agoransson commented 3 years ago

@KasparRosin Thanks for the research, I wonder why that would cause this problem though. It's worth looking further into - checking now.

agoransson commented 3 years ago

Is it possible for you to make two logs from the CreateTrait, in version 1.0.12, and in version 1.0.13?

Please don't use "live" data. Don't want leaks here.

In this function, in CreateTrait.php:

  public function create (array $data)
  {
    $req = new FortieRequest();
    $req->method('POST');
    $req->path($this->basePath);
    $req->wrapper($this->wrapper);
    $req->setRequired($this->required_create);
    $req->data($data);

    return $this->send($req->build());
  }

Can you log 1) the input $data and 2) the built $req->build()

Thanks. That'll make it easier to understand what's going on I think.