Skip to content

Commit 911040e

Browse files
TMONE-894 - add product additional info
1 parent 01a3fe0 commit 911040e

File tree

2 files changed

+64
-22
lines changed

2 files changed

+64
-22
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
namespace API2Client\Entities\Order\Additional;
4+
5+
class ProductAdditionalInfo implements AdditionalInfoInterface
6+
{
7+
/**
8+
* @var string
9+
*/
10+
protected $orderId;
11+
12+
13+
/**
14+
* @param string $orderId
15+
*/
16+
public function setOrderId($orderId)
17+
{
18+
$this->orderId = $orderId;
19+
}
20+
21+
/**
22+
* @return string
23+
*/
24+
public function getOrderId()
25+
{
26+
return $this->orderId;
27+
}
28+
29+
30+
/**
31+
* @return array
32+
*/
33+
public function toArray()
34+
{
35+
return array_filter(array(
36+
'order_id' => $this->getOrderId(),
37+
));
38+
}
39+
}

src/API2Client/Entities/Order/Additional/ProductOffer.php

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
namespace API2Client\Entities\Order\Additional;
1111

1212

13-
class ProductOffer implements AdditionalInfoInterface
13+
class ProductOffer extends ProductAdditionalInfo
1414
{
1515
/**
1616
* @var int
@@ -45,111 +45,114 @@ class ProductOffer implements AdditionalInfoInterface
4545
/**
4646
* @param int $channelId
4747
*/
48-
public function setChannelId ($channelId)
48+
public function setChannelId($channelId)
4949
{
5050
$this->channelId = $channelId;
5151
}
5252

5353
/**
5454
* @return int
5555
*/
56-
public function getChannelId ()
56+
public function getChannelId()
5757
{
5858
return $this->channelId;
5959
}
6060

6161
/**
6262
* @param int $offerPercentDiscount
6363
*/
64-
public function setOfferPercentDiscount ($offerPercentDiscount)
64+
public function setOfferPercentDiscount($offerPercentDiscount)
6565
{
6666
$this->offerPercentDiscount = $offerPercentDiscount;
6767
}
6868

6969
/**
7070
* @return int
7171
*/
72-
public function getOfferPercentDiscount ()
72+
public function getOfferPercentDiscount()
7373
{
7474
return $this->offerPercentDiscount;
7575
}
7676

7777
/**
7878
* @param int $position
7979
*/
80-
public function setPosition ($position)
80+
public function setPosition($position)
8181
{
8282
$this->position = $position;
8383
}
8484

8585
/**
8686
* @return int
8787
*/
88-
public function getPosition ()
88+
public function getPosition()
8989
{
9090
return $this->position;
9191
}
9292

9393
/**
9494
* @param int $presentationId
9595
*/
96-
public function setPresentationId ($presentationId)
96+
public function setPresentationId($presentationId)
9797
{
9898
$this->presentationId = $presentationId;
9999
}
100100

101101
/**
102102
* @return int
103103
*/
104-
public function getPresentationId ()
104+
public function getPresentationId()
105105
{
106106
return $this->presentationId;
107107
}
108108

109109
/**
110110
* @param int $searchContextId
111111
*/
112-
public function setSearchContextId ($searchContextId)
112+
public function setSearchContextId($searchContextId)
113113
{
114114
$this->searchContextId = $searchContextId;
115115
}
116116

117117
/**
118118
* @return int
119119
*/
120-
public function getSearchContextId ()
120+
public function getSearchContextId()
121121
{
122122
return $this->searchContextId;
123123
}
124124

125125
/**
126126
* @param int $templateId
127127
*/
128-
public function setTemplateId ($templateId)
128+
public function setTemplateId($templateId)
129129
{
130130
$this->templateId = $templateId;
131131
}
132132

133133
/**
134134
* @return int
135135
*/
136-
public function getTemplateId ()
136+
public function getTemplateId()
137137
{
138138
return $this->templateId;
139139
}
140140

141141
/**
142142
* @return array
143143
*/
144-
public function toArray ()
144+
public function toArray()
145145
{
146-
return array (
147-
'channelId' => $this->getChannelId (),
148-
'offerPercentDiscount' => $this->getOfferPercentDiscount (),
149-
'position' => $this->getPosition (),
150-
'presentationId' => $this->getPresentationId (),
151-
'searchContextId' => $this->getSearchContextId (),
152-
'templateId' => $this->getTemplateId (),
146+
return array_merge(
147+
parent::toArray(),
148+
array(
149+
'channelId' => $this->getChannelId(),
150+
'offerPercentDiscount' => $this->getOfferPercentDiscount(),
151+
'position' => $this->getPosition(),
152+
'presentationId' => $this->getPresentationId(),
153+
'searchContextId' => $this->getSearchContextId(),
154+
'templateId' => $this->getTemplateId(),
155+
)
153156
);
154157
}
155-
}
158+
}

0 commit comments

Comments
 (0)