From c9f5fa92af60e1b0324638679a6fecbec87b8929 Mon Sep 17 00:00:00 2001 From: raulleo Date: Thu, 27 May 2021 12:06:51 +0300 Subject: [PATCH] change quantity type from int to float (#14) --- .../Request/V4/ReceiptItemRequest.php | 12 ++++++------ tests/AtolOnlineClient/AtolOnlineTest.php | 2 +- .../Traits/PaymentReceiptRequestTrait.php | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/AtolOnlineClient/Request/V4/ReceiptItemRequest.php b/src/AtolOnlineClient/Request/V4/ReceiptItemRequest.php index 844da91..b9f6324 100644 --- a/src/AtolOnlineClient/Request/V4/ReceiptItemRequest.php +++ b/src/AtolOnlineClient/Request/V4/ReceiptItemRequest.php @@ -53,11 +53,11 @@ class ReceiptItemRequest private $price; /** - * @var integer + * @var float * required * @Serializer\Groups({"set", "get"}) * @Serializer\SerializedName("quantity") - * @Serializer\Type("integer") + * @Serializer\Type("float") */ private $quantity; @@ -175,17 +175,17 @@ class ReceiptItemRequest } /** - * @return int + * @return float */ - public function getQuantity(): int + public function getQuantity(): float { return $this->quantity; } /** - * @param int $quantity + * @param float $quantity */ - public function setQuantity(int $quantity): void + public function setQuantity(float $quantity): void { $this->quantity = $quantity; } diff --git a/tests/AtolOnlineClient/AtolOnlineTest.php b/tests/AtolOnlineClient/AtolOnlineTest.php index b9f58f7..22b098f 100644 --- a/tests/AtolOnlineClient/AtolOnlineTest.php +++ b/tests/AtolOnlineClient/AtolOnlineTest.php @@ -160,7 +160,7 @@ class AtolOnlineTest extends TestCase $request->setTimestamp('17.07.2019 10:14:22'); $this->assertEquals( - '{"external_id":"test","receipt":{"client":{"email":"test@test.local"},"company":{"email":"test@test.local","inn":"11111111","payment_address":"address"},"items":[{"name":"test item","price":100.1,"quantity":1,"sum":100.1,"measurement_unit":"kg","payment_method":"advance","payment_object":"agent_commission","vat":{"type":"vat20","sum":20.2},"nomenclature_code":"00"}],"payments":[{"type":0,"sum":100.1}],"vats":[{"type":"vat20","sum":20.2}],"total":100.1},"timestamp":"17.07.2019 10:14:22","service":{"callback_url":"test.local"}}', + '{"external_id":"test","receipt":{"client":{"email":"test@test.local"},"company":{"email":"test@test.local","inn":"11111111","payment_address":"address"},"items":[{"name":"test item","price":100.1,"quantity":1.1,"sum":100.1,"measurement_unit":"kg","payment_method":"advance","payment_object":"agent_commission","vat":{"type":"vat20","sum":20.2},"nomenclature_code":"00"}],"payments":[{"type":0,"sum":100.1}],"vats":[{"type":"vat20","sum":20.2}],"total":100.1},"timestamp":"17.07.2019 10:14:22","service":{"callback_url":"test.local"}}', $this->atol->serializeOperationRequest($request) ); } diff --git a/tests/AtolOnlineClient/Traits/PaymentReceiptRequestTrait.php b/tests/AtolOnlineClient/Traits/PaymentReceiptRequestTrait.php index 5933dce..a72cf1f 100644 --- a/tests/AtolOnlineClient/Traits/PaymentReceiptRequestTrait.php +++ b/tests/AtolOnlineClient/Traits/PaymentReceiptRequestTrait.php @@ -31,7 +31,7 @@ trait PaymentReceiptRequestTrait $item = new ReceiptItemRequest(); $item->setName('test item'); $item->setPrice(100.1); - $item->setQuantity(1); + $item->setQuantity(1.1); $item->setSum(100.1); $item->setMeasurementUnit('kg'); $item->setPaymentMethod(ReceiptItemRequest::PAYMENT_METHOD_ADVANCE);