Skip to content

Commit

Permalink
Merge pull request #39 from bednarradek/MAR-13730
Browse files Browse the repository at this point in the history
MAR-13730 - decimal VAT support
  • Loading branch information
michalkelcik authored Feb 1, 2023
2 parents 504d2a2 + 81e9c4e commit 853e55f
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 15 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
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).

## 5.0.0 - 2023-01-19

### Changed

- `vat` attribute in article and order item is float

## 4.4.0 - 2022-10-03

### Changed
Expand Down
8 changes: 4 additions & 4 deletions src/Article/DTO/ProductRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ final class ProductRequest extends AbstractArticleRequest
use JsonSerializeEntityTrait;

private string $categoryId;
private int $vat;
private float $vat;
private ?float $price = null;
private VariantRequestIterator $variants;
/**
Expand All @@ -23,7 +23,7 @@ final class ProductRequest extends AbstractArticleRequest
private ?string $brandId = null;
private ?float $weeeFee = null;

public function __construct(string $id, string $title, string $shortDesc, string $longDesc, string $categoryId, int $vat, int $priority)
public function __construct(string $id, string $title, string $shortDesc, string $longDesc, string $categoryId, float $vat, int $priority)
{
parent::__construct($id, $title, $shortDesc, $longDesc, $priority);
$this->categoryId = $categoryId;
Expand Down Expand Up @@ -128,12 +128,12 @@ public function setCategoryId(string $categoryId): void
$this->categoryId = $categoryId;
}

public function getVat(): int
public function getVat(): float
{
return $this->vat;
}

public function setVat(int $vat): void
public function setVat(float $vat): void
{
$this->vat = $vat;
}
Expand Down
10 changes: 5 additions & 5 deletions src/Article/Entity/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ final class Product extends AbstractArticle

protected ProductStageEnum $stage;
protected string $categoryId;
protected int $vat;
protected float $vat;
protected VariantIterator $variants;
/**
* @var string[]
Expand All @@ -44,7 +44,7 @@ final class Product extends AbstractArticle
* @param float $price
* @param ?float $fairPrice
* @param float $purchasePrice
* @param int $vat
* @param float $vat
* @param float $rrp
* @param MediaIterator $media
* @param PromotionIterator $promotions
Expand Down Expand Up @@ -78,7 +78,7 @@ private function __construct(
float $price,
?float $fairPrice,
float $purchasePrice,
int $vat,
float $vat,
float $rrp,
MediaIterator $media,
PromotionIterator $promotions,
Expand Down Expand Up @@ -157,7 +157,7 @@ public static function createFromApi(array $data): self
(float) $data['price'],
isset($data['fair_price']) ? (float)$data['fair_price'] : null,
(float) $data['purchase_price'],
(int) $data['vat'],
(float) $data['vat'],
(float) $data['rrp'],
MediaIterator::createFromApi($data['media']),
PromotionIterator::createFromApi($data['promotions']),
Expand Down Expand Up @@ -189,7 +189,7 @@ public function getCategoryId(): string
return $this->categoryId;
}

public function getVat(): int
public function getVat(): float
{
return $this->vat;
}
Expand Down
2 changes: 1 addition & 1 deletion src/MpApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ final class MpApiClient implements ClientInterface, MpApiClientInterface
{

const APP_NAME = 'mp-api-client';
const APP_VERSION = '4.4.0';
const APP_VERSION = '5.0.0';

private BrandClientInterface $brandClient;
private CategoryClientInterface $categoryClient;
Expand Down
10 changes: 5 additions & 5 deletions src/Order/Entity/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ final class Item implements JsonSerializable
private int $articleId;
private int $quantity;
private float $price;
private int $vat;
private float $vat;
private ?float $commission;
private string $title;
/**
Expand All @@ -28,12 +28,12 @@ final class Item implements JsonSerializable
* @param int $articleId
* @param int $quantity
* @param float $price
* @param int $vat
* @param float $vat
* @param float|null $commission
* @param string $title
* @param string[] $serialNumbers
*/
private function __construct(string $id, int $articleId, int $quantity, float $price, int $vat, ?float $commission, string $title, array $serialNumbers)
private function __construct(string $id, int $articleId, int $quantity, float $price, float $vat, ?float $commission, string $title, array $serialNumbers)
{
$this->id = $id;
$this->articleId = $articleId;
Expand All @@ -57,7 +57,7 @@ public static function createFromApi(array $data): self
(int) $data['article_id'],
(int) $data['quantity'],
(float) $data['price'],
(int) $data['vat'],
(float) $data['vat'],
InputDataUtil::getNullableFloat($data, 'commission'),
(string) $data['title'],
$data['serial_numbers'],
Expand All @@ -84,7 +84,7 @@ public function getPrice(): float
return $this->price;
}

public function getVat(): int
public function getVat(): float
{
return $this->vat;
}
Expand Down

0 comments on commit 853e55f

Please sign in to comment.