From 911040e81c3ea5eabdb771ae55a76c7df43ba115 Mon Sep 17 00:00:00 2001 From: novoseltsev Date: Tue, 4 Feb 2025 15:31:37 +0200 Subject: [PATCH 1/2] TMONE-894 - add product additional info --- .../Additional/ProductAdditionalInfo.php | 39 +++++++++++++++ .../Order/Additional/ProductOffer.php | 47 ++++++++++--------- 2 files changed, 64 insertions(+), 22 deletions(-) create mode 100644 src/API2Client/Entities/Order/Additional/ProductAdditionalInfo.php diff --git a/src/API2Client/Entities/Order/Additional/ProductAdditionalInfo.php b/src/API2Client/Entities/Order/Additional/ProductAdditionalInfo.php new file mode 100644 index 0000000..9f16ce5 --- /dev/null +++ b/src/API2Client/Entities/Order/Additional/ProductAdditionalInfo.php @@ -0,0 +1,39 @@ +orderId = $orderId; + } + + /** + * @return string + */ + public function getOrderId() + { + return $this->orderId; + } + + + /** + * @return array + */ + public function toArray() + { + return array_filter(array( + 'order_id' => $this->getOrderId(), + )); + } +} diff --git a/src/API2Client/Entities/Order/Additional/ProductOffer.php b/src/API2Client/Entities/Order/Additional/ProductOffer.php index 7d3bb87..8604ba0 100644 --- a/src/API2Client/Entities/Order/Additional/ProductOffer.php +++ b/src/API2Client/Entities/Order/Additional/ProductOffer.php @@ -10,7 +10,7 @@ namespace API2Client\Entities\Order\Additional; -class ProductOffer implements AdditionalInfoInterface +class ProductOffer extends ProductAdditionalInfo { /** * @var int @@ -45,7 +45,7 @@ class ProductOffer implements AdditionalInfoInterface /** * @param int $channelId */ - public function setChannelId ($channelId) + public function setChannelId($channelId) { $this->channelId = $channelId; } @@ -53,7 +53,7 @@ public function setChannelId ($channelId) /** * @return int */ - public function getChannelId () + public function getChannelId() { return $this->channelId; } @@ -61,7 +61,7 @@ public function getChannelId () /** * @param int $offerPercentDiscount */ - public function setOfferPercentDiscount ($offerPercentDiscount) + public function setOfferPercentDiscount($offerPercentDiscount) { $this->offerPercentDiscount = $offerPercentDiscount; } @@ -69,7 +69,7 @@ public function setOfferPercentDiscount ($offerPercentDiscount) /** * @return int */ - public function getOfferPercentDiscount () + public function getOfferPercentDiscount() { return $this->offerPercentDiscount; } @@ -77,7 +77,7 @@ public function getOfferPercentDiscount () /** * @param int $position */ - public function setPosition ($position) + public function setPosition($position) { $this->position = $position; } @@ -85,7 +85,7 @@ public function setPosition ($position) /** * @return int */ - public function getPosition () + public function getPosition() { return $this->position; } @@ -93,7 +93,7 @@ public function getPosition () /** * @param int $presentationId */ - public function setPresentationId ($presentationId) + public function setPresentationId($presentationId) { $this->presentationId = $presentationId; } @@ -101,7 +101,7 @@ public function setPresentationId ($presentationId) /** * @return int */ - public function getPresentationId () + public function getPresentationId() { return $this->presentationId; } @@ -109,7 +109,7 @@ public function getPresentationId () /** * @param int $searchContextId */ - public function setSearchContextId ($searchContextId) + public function setSearchContextId($searchContextId) { $this->searchContextId = $searchContextId; } @@ -117,7 +117,7 @@ public function setSearchContextId ($searchContextId) /** * @return int */ - public function getSearchContextId () + public function getSearchContextId() { return $this->searchContextId; } @@ -125,7 +125,7 @@ public function getSearchContextId () /** * @param int $templateId */ - public function setTemplateId ($templateId) + public function setTemplateId($templateId) { $this->templateId = $templateId; } @@ -133,7 +133,7 @@ public function setTemplateId ($templateId) /** * @return int */ - public function getTemplateId () + public function getTemplateId() { return $this->templateId; } @@ -141,15 +141,18 @@ public function getTemplateId () /** * @return array */ - public function toArray () + public function toArray() { - return array ( - 'channelId' => $this->getChannelId (), - 'offerPercentDiscount' => $this->getOfferPercentDiscount (), - 'position' => $this->getPosition (), - 'presentationId' => $this->getPresentationId (), - 'searchContextId' => $this->getSearchContextId (), - 'templateId' => $this->getTemplateId (), + return array_merge( + parent::toArray(), + array( + 'channelId' => $this->getChannelId(), + 'offerPercentDiscount' => $this->getOfferPercentDiscount(), + 'position' => $this->getPosition(), + 'presentationId' => $this->getPresentationId(), + 'searchContextId' => $this->getSearchContextId(), + 'templateId' => $this->getTemplateId(), + ) ); } -} \ No newline at end of file +} From 3296f3e709d6e809d46e212ab4ae0a6e763d00db Mon Sep 17 00:00:00 2001 From: novoseltsev Date: Tue, 4 Feb 2025 15:36:31 +0200 Subject: [PATCH 2/2] TMONE-894 - add product additional info --- .../Additional/{ProductAdditionalInfo.php => ProductInfo.php} | 2 +- src/API2Client/Entities/Order/Additional/ProductOffer.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename src/API2Client/Entities/Order/Additional/{ProductAdditionalInfo.php => ProductInfo.php} (89%) diff --git a/src/API2Client/Entities/Order/Additional/ProductAdditionalInfo.php b/src/API2Client/Entities/Order/Additional/ProductInfo.php similarity index 89% rename from src/API2Client/Entities/Order/Additional/ProductAdditionalInfo.php rename to src/API2Client/Entities/Order/Additional/ProductInfo.php index 9f16ce5..e1353ae 100644 --- a/src/API2Client/Entities/Order/Additional/ProductAdditionalInfo.php +++ b/src/API2Client/Entities/Order/Additional/ProductInfo.php @@ -2,7 +2,7 @@ namespace API2Client\Entities\Order\Additional; -class ProductAdditionalInfo implements AdditionalInfoInterface +class ProductInfo implements AdditionalInfoInterface { /** * @var string diff --git a/src/API2Client/Entities/Order/Additional/ProductOffer.php b/src/API2Client/Entities/Order/Additional/ProductOffer.php index 8604ba0..ddf3c20 100644 --- a/src/API2Client/Entities/Order/Additional/ProductOffer.php +++ b/src/API2Client/Entities/Order/Additional/ProductOffer.php @@ -10,7 +10,7 @@ namespace API2Client\Entities\Order\Additional; -class ProductOffer extends ProductAdditionalInfo +class ProductOffer extends ProductInfo { /** * @var int