Skip to content

Commit

Permalink
Added forceToken support for pricing endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
MichalSalon committed Feb 11, 2022
1 parent adbb569 commit d8abc3f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 4.2.0 - 2022-02-10

### Added

- support for `forceToken` parameter for `updateProductPricing` and `updateVariantPricing` methods of `Article` client

## 4.1.0 - 2021-12-16

### Added
Expand Down
16 changes: 12 additions & 4 deletions src/Article/ArticleClient.php
Expand Up @@ -87,9 +87,13 @@ public function getProductPricing(string $productId): Pricing
);
}

public function updateProductPricing(string $productId, Pricing $pricing): void
public function updateProductPricing(string $productId, Pricing $pricing, ?string $forceToken = null): void
{
$this->sendJson('PUT', sprintf(self::PRODUCT_PRICING, $productId), $pricing->getArrayForApi());
$url = sprintf(self::PRODUCT_PRICING, $productId);
if ($forceToken !== null) {
$url = sprintf('%s?force_token=%s', $url, $forceToken);
}
$this->sendJson('PUT', $url, $pricing->getArrayForApi());
}

public function listProductVariants(string $productId, ?Filter $filter): BasicVariantList
Expand Down Expand Up @@ -144,9 +148,13 @@ public function getVariantPricing(string $productId, string $variantId): Pricing
);
}

public function updateVariantPricing(string $productId, string $variantId, Pricing $pricing): void
public function updateVariantPricing(string $productId, string $variantId, Pricing $pricing, ?string $forceToken = null): void
{
$this->sendJson('PUT', sprintf(self::VARIANT_PRICING, $productId, $variantId), $pricing->getArrayForApi());
$url = sprintf(self::VARIANT_PRICING, $productId, $variantId);
if ($forceToken !== null) {
$url = sprintf('%s?force_token=%s', $url, $forceToken);
}
$this->sendJson('PUT', $url, $pricing->getArrayForApi());
}

public function updateBatchAvailability(BatchAvailabilityIterator $availability): void
Expand Down
2 changes: 1 addition & 1 deletion src/MpApiClient.php
Expand Up @@ -29,7 +29,7 @@ final class MpApiClient implements ClientInterface, MpApiClientInterface
{

const APP_NAME = 'mp-api-client';
const APP_VERSION = '4.1.0';
const APP_VERSION = '4.2.0';

private BrandClientInterface $brandClient;
private CategoryClientInterface $categoryClient;
Expand Down

0 comments on commit d8abc3f

Please sign in to comment.