Open MiChAeLoKGB opened 2 years ago
Why is this still not merged? This exception happens all the time.
vendor/mallgroup/mpapi-client/src/Article/ArticleClient.php
public function updateProduct(ProductRequest $product): void
{
$this->sendJson('PUT', sprintf(self::PRODUCT_DETAIL, $product->getId()), $product->getArrayForApi());
}
public function updateProductWithForceToken(ProductRequest $product, string $forceToken): void
{
$appendUrlWithForceToken = '?force_token=' . $forceToken;
$this->sendJson('PUT', sprintf(self::PRODUCT_DETAIL, $product->getId()) . $appendUrlWithForceToken, $product->getArrayForApi());
}
public function deleteProduct(string $productId): void
{
$this->sendJson('DELETE', sprintf(self::PRODUCT_DETAIL, $productId));
}
In a try-catch, get the force token, and use updateProductWithForceToken
to update the product.
Fixes #28
For
PriceProtectionException
to work, API must returnPRICE_PROTECTION_ERROR
instead of genericVALIDATION_ERROR
when price protection mechanism is tripped.