Skip to content

Conversation

@MiChAeLoKGB
Copy link

@MiChAeLoKGB MiChAeLoKGB commented Feb 10, 2022

Fixes #28

For PriceProtectionException to work, API must return PRICE_PROTECTION_ERROR instead of generic VALIDATION_ERROR when price protection mechanism is tripped.

@MiChAeLoKGB MiChAeLoKGB marked this pull request as ready for review February 11, 2022 10:59
@MiChAeLoKGB MiChAeLoKGB force-pushed the patch-1 branch 6 times, most recently from f2b7c0e to 4f17f04 Compare February 11, 2022 16:29
@MiChAeLoKGB MiChAeLoKGB force-pushed the patch-1 branch 2 times, most recently from 93810b1 to 13ad18f Compare February 21, 2022 15:44
@DRN88
Copy link

DRN88 commented Sep 7, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Product price protection

3 participants