IsraelOrtuno / pipedrive

Complete Pipedrive API client for PHP
MIT License
166 stars 58 forks source link

Product post endpoint expects prices as an array of objects #10

Closed casconed closed 8 years ago

casconed commented 8 years ago

Setting prices to anything other than a string results in the following error:

'Warning: preg_replace(): Parameter mismatch, pattern is a string while replacement is an array in /vagrant/vendor/devio/pipedrive/src/Builder.php on line 72

While setting it to a string returns an error from the API:

exception 'Devio\Pipedrive\Exceptions\PipedriveException' with message 'Prices must be given as array of objects.' in /vagrant/vendor/devio/pipedrive/src/Http/Request.php:85

IsraelOrtuno commented 8 years ago

Thanks for reporting, will dig into that today.

IsraelOrtuno commented 8 years ago

How are you exactly doing this? Like this I can reproduce the exact query.

IsraelOrtuno commented 8 years ago

This commit should fix e37b3a9489764ba8ad47d95cc512f59130c9e3f5

Can you update and test please?

IsraelOrtuno commented 8 years ago

I have tested

$pipedrive->products->add([
    'name' => 'Testing Product',
    'prices' => [
        [
            'currency' => 'EUR',
            'price' => 55,
            'cost' => 44,
        ]
    ]
]);

This works with the new update.

casconed commented 8 years ago

Awesome thanks. I will pull in the AM and try it out!

On Thu, Apr 21, 2016 at 11:07 PM -0700, "Israel Ortuño" notifications@github.com wrote:

I have tested

$pipedrive->products->add([ 'name' => 'Testing Product', 'prices' => [ [ 'currency' => 'EUR', 'price' => 55, 'cost' => 44, ] ] ]);

This works with the new update.

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub

IsraelOrtuno commented 8 years ago

@casconed fixed?

casconed commented 8 years ago

Fixed yes, thanks!