Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Product price protection #28

Open
tescz opened this issue Feb 9, 2022 · 2 comments · May be fixed by #29
Open

Product price protection #28

tescz opened this issue Feb 9, 2022 · 2 comments · May be fixed by #29

Comments

@tescz
Copy link

tescz commented Feb 9, 2022

Zdravím,

pokud dobře chápu, zatím není možné přes tohoto API klienta změnit cenu produktu o více jak 30%. Musí se totiž zasílat force_token, ovšem jak v příkladech, tak v kódu jsem nenašel, jak je tohle možné provést. Nebo mýlím se?

https://mpapi-docs.mallgroup.com/#/Products

@MiChAeLoKGB MiChAeLoKGB linked a pull request Feb 10, 2022 that will close this issue
@FluffyDiscord
Copy link

Tohle by bylo třeba přidat také pro V3 verzi balíčku. Tahle "ochrana" by měla jít globálně vypnout v účtu MallPartner.

@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 a pull request may close this issue.

3 participants