ho-nl / BolCom_RetailerApi

Package that talks to the bol.com v8 API
10 stars 10 forks source link

Support volume discount for pricing.bundlePrices #5

Closed mijnhost closed 5 years ago

mijnhost commented 5 years ago

Volume discount is now officially supported by the Bol.com Retailer API. Any plans of implanting this in the package?

JeroenVanLeusden commented 5 years ago

It should work already, the @todo's were there because it wasn't by the time this package was developed.

Are you experiencing issues using bundle prices?

mijnhost commented 5 years ago

Yes, I'm experiencing issues. For example, when using this command:

// update offer price
$processStatus = $messageBus->dispatch(\BolCom\RetailerApi\Model\Offer\Command\UpdateOfferPrice::with(
  \BolCom\RetailerApi\Model\Offer\OfferId::fromString($strOfferId),
  \BolCom\RetailerApi\Model\Offer\Pricing::fromArray([
    'bundlePrices' => [
      ['quantity' => 1, 'price' => 20],
      ['quantity' => 2, 'price' => 39]
    ]
])), $arrBolAccount['account']);

I'm getting an exception:

`400 Bad request: `pricing.bundlePrices`: Collection should contain bundle price with prices in decreasing order (no duplicates).` response: (truncated...)

When I remove the second bundle price (with quantity 2), it's working. I also tried to change the order (first quantity 2, then quantity 1), but the same error.

JeroenVanLeusden commented 5 years ago

According to the docs:

The price per single unit in case the customer orders at least the quantity provided. When using more than 1 price, the respective prices must be in decreasing order

You're now telling bol.com that 1 product costs 20 and when ordering two products, it's 39 each. I think when you set the price below 20 it will work.

mijnhost commented 5 years ago

You are right, that was the problem. Sorry for this and thank you!