From 9ec32a3ffc7be2b8926ca8483c0ccef30d050da6 Mon Sep 17 00:00:00 2001 From: Jakub Chabek Date: Wed, 25 May 2016 15:20:41 +0200 Subject: [PATCH] productItemIds are not required --- src/ShopCertification.php | 4 +++- tests/ShopCertificationTest.php | 6 ------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/ShopCertification.php b/src/ShopCertification.php index c1c1eeb..2a1716e 100644 --- a/src/ShopCertification.php +++ b/src/ShopCertification.php @@ -160,7 +160,9 @@ public function logOrder() $data['orderId'] = $this->orderId; } - $data['productItemIds'] = $this->productItemIds; + if ($this->productItemIds) { + $data['productItemIds'] = $this->productItemIds; + } $result = $this->requester->request(IRequester::ACTION_LOG_ORDER, $data); if ($result->code !== 200) { diff --git a/tests/ShopCertificationTest.php b/tests/ShopCertificationTest.php index 8014c75..4f036dd 100644 --- a/tests/ShopCertificationTest.php +++ b/tests/ShopCertificationTest.php @@ -79,10 +79,6 @@ public function testLogOrderSuccessWithoutOptionalFields() $data = [ 'apiKey' => $apiKey = 'xxxxxxxxxx', 'email' => $email = 'john@doe.com', - 'productItemIds' => [ - $product1 = 'ab12345', - $product2 = '123459', - ], ]; $requester->shouldReceive('request') @@ -92,8 +88,6 @@ public function testLogOrderSuccessWithoutOptionalFields() $shopCertification = new ShopCertification($apiKey, [], $requester); $shopCertification->setEmail($email); - $shopCertification->addProductItemId($product1); - $shopCertification->addProductItemId($product2); $shopCertification->logOrder(); }