1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace PayPal\StructType; |
4
|
|
|
|
5
|
|
|
use \WsdlToPhp\PackageBase\AbstractStructBase; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* This class stands for IncentiveDetailsType StructType |
9
|
|
|
* Meta information extracted from the WSDL |
10
|
|
|
* - documentation: Information about the incentives that were applied from Ebay RYP page and PayPal RYP page. |
11
|
|
|
* @subpackage Structs |
12
|
|
|
* @author WsdlToPhp <[email protected]> |
13
|
|
|
*/ |
14
|
|
|
class IncentiveDetailsType extends AbstractStructBase |
15
|
|
|
{ |
16
|
|
|
/** |
17
|
|
|
* The UniqueIdentifier |
18
|
|
|
* Meta information extracted from the WSDL |
19
|
|
|
* - documentation: Unique Identifier consisting of redemption code, user friendly descripotion, incentive type, campaign code, incenitve application order and site redeemed on. |
20
|
|
|
* - maxOccurs: 1 |
21
|
|
|
* - minOccurs: 0 |
22
|
|
|
* @var string |
23
|
|
|
*/ |
24
|
|
|
public $UniqueIdentifier; |
25
|
|
|
/** |
26
|
|
|
* The SiteAppliedOn |
27
|
|
|
* Meta information extracted from the WSDL |
28
|
|
|
* - documentation: Defines if the incentive has been applied on Ebay or PayPal. |
29
|
|
|
* - maxOccurs: 1 |
30
|
|
|
* - minOccurs: 0 |
31
|
|
|
* @var string |
32
|
|
|
*/ |
33
|
|
|
public $SiteAppliedOn; |
34
|
|
|
/** |
35
|
|
|
* The TotalDiscountAmount |
36
|
|
|
* Meta information extracted from the WSDL |
37
|
|
|
* - documentation: The total discount amount for the incentive, summation of discounts up across all the buckets/items. |
38
|
|
|
* - maxOccurs: 1 |
39
|
|
|
* - minOccurs: 0 |
40
|
|
|
* @var \PayPal\StructType\BasicAmountType |
41
|
|
|
*/ |
42
|
|
|
public $TotalDiscountAmount; |
43
|
|
|
/** |
44
|
|
|
* The Status |
45
|
|
|
* Meta information extracted from the WSDL |
46
|
|
|
* - documentation: Status of incentive processing. Sussess or Error. |
47
|
|
|
* - maxOccurs: 1 |
48
|
|
|
* - minOccurs: 0 |
49
|
|
|
* @var string |
50
|
|
|
*/ |
51
|
|
|
public $Status; |
52
|
|
|
/** |
53
|
|
|
* The ErrorCode |
54
|
|
|
* Meta information extracted from the WSDL |
55
|
|
|
* - documentation: Error code if there are any errors. Zero otherwise. |
56
|
|
|
* - maxOccurs: 1 |
57
|
|
|
* - minOccurs: 0 |
58
|
|
|
* @var int |
59
|
|
|
*/ |
60
|
|
|
public $ErrorCode; |
61
|
|
|
/** |
62
|
|
|
* The IncentiveAppliedDetails |
63
|
|
|
* Meta information extracted from the WSDL |
64
|
|
|
* - documentation: Details of incentive application on individual bucket/item. |
65
|
|
|
* - maxOccurs: unbounded |
66
|
|
|
* - minOccurs: 0 |
67
|
|
|
* @var \PayPal\StructType\IncentiveAppliedDetailsType[] |
68
|
|
|
*/ |
69
|
|
|
public $IncentiveAppliedDetails; |
70
|
|
|
/** |
71
|
|
|
* Constructor method for IncentiveDetailsType |
72
|
|
|
* @uses IncentiveDetailsType::setUniqueIdentifier() |
73
|
|
|
* @uses IncentiveDetailsType::setSiteAppliedOn() |
74
|
|
|
* @uses IncentiveDetailsType::setTotalDiscountAmount() |
75
|
|
|
* @uses IncentiveDetailsType::setStatus() |
76
|
|
|
* @uses IncentiveDetailsType::setErrorCode() |
77
|
|
|
* @uses IncentiveDetailsType::setIncentiveAppliedDetails() |
78
|
|
|
* @param string $uniqueIdentifier |
79
|
|
|
* @param string $siteAppliedOn |
80
|
|
|
* @param \PayPal\StructType\BasicAmountType $totalDiscountAmount |
81
|
|
|
* @param string $status |
82
|
|
|
* @param int $errorCode |
83
|
|
|
* @param \PayPal\StructType\IncentiveAppliedDetailsType[] $incentiveAppliedDetails |
84
|
|
|
*/ |
85
|
|
|
public function __construct($uniqueIdentifier = null, $siteAppliedOn = null, \PayPal\StructType\BasicAmountType $totalDiscountAmount = null, $status = null, $errorCode = null, array $incentiveAppliedDetails = array()) |
86
|
|
|
{ |
87
|
|
|
$this |
88
|
|
|
->setUniqueIdentifier($uniqueIdentifier) |
89
|
|
|
->setSiteAppliedOn($siteAppliedOn) |
90
|
|
|
->setTotalDiscountAmount($totalDiscountAmount) |
91
|
|
|
->setStatus($status) |
92
|
|
|
->setErrorCode($errorCode) |
93
|
|
|
->setIncentiveAppliedDetails($incentiveAppliedDetails); |
94
|
|
|
} |
95
|
|
|
/** |
96
|
|
|
* Get UniqueIdentifier value |
97
|
|
|
* @return string|null |
98
|
|
|
*/ |
99
|
|
|
public function getUniqueIdentifier() |
100
|
|
|
{ |
101
|
|
|
return $this->UniqueIdentifier; |
102
|
|
|
} |
103
|
|
|
/** |
104
|
|
|
* Set UniqueIdentifier value |
105
|
|
|
* @param string $uniqueIdentifier |
106
|
|
|
* @return \PayPal\StructType\IncentiveDetailsType |
107
|
|
|
*/ |
108
|
|
|
public function setUniqueIdentifier($uniqueIdentifier = null) |
109
|
|
|
{ |
110
|
|
|
// validation for constraint: string |
111
|
|
|
if (!is_null($uniqueIdentifier) && !is_string($uniqueIdentifier)) { |
|
|
|
|
112
|
|
|
throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($uniqueIdentifier, true), gettype($uniqueIdentifier)), __LINE__); |
113
|
|
|
} |
114
|
|
|
$this->UniqueIdentifier = $uniqueIdentifier; |
115
|
|
|
return $this; |
116
|
|
|
} |
117
|
|
|
/** |
118
|
|
|
* Get SiteAppliedOn value |
119
|
|
|
* @return string|null |
120
|
|
|
*/ |
121
|
|
|
public function getSiteAppliedOn() |
122
|
|
|
{ |
123
|
|
|
return $this->SiteAppliedOn; |
124
|
|
|
} |
125
|
|
|
/** |
126
|
|
|
* Set SiteAppliedOn value |
127
|
|
|
* @uses \PayPal\EnumType\IncentiveSiteAppliedOnType::valueIsValid() |
128
|
|
|
* @uses \PayPal\EnumType\IncentiveSiteAppliedOnType::getValidValues() |
129
|
|
|
* @throws \InvalidArgumentException |
130
|
|
|
* @param string $siteAppliedOn |
131
|
|
|
* @return \PayPal\StructType\IncentiveDetailsType |
132
|
|
|
*/ |
133
|
|
|
public function setSiteAppliedOn($siteAppliedOn = null) |
134
|
|
|
{ |
135
|
|
|
// validation for constraint: enumeration |
136
|
|
|
if (!\PayPal\EnumType\IncentiveSiteAppliedOnType::valueIsValid($siteAppliedOn)) { |
137
|
|
|
throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \PayPal\EnumType\IncentiveSiteAppliedOnType', is_array($siteAppliedOn) ? implode(', ', $siteAppliedOn) : var_export($siteAppliedOn, true), implode(', ', \PayPal\EnumType\IncentiveSiteAppliedOnType::getValidValues())), __LINE__); |
|
|
|
|
138
|
|
|
} |
139
|
|
|
$this->SiteAppliedOn = $siteAppliedOn; |
140
|
|
|
return $this; |
141
|
|
|
} |
142
|
|
|
/** |
143
|
|
|
* Get TotalDiscountAmount value |
144
|
|
|
* @return \PayPal\StructType\BasicAmountType|null |
145
|
|
|
*/ |
146
|
|
|
public function getTotalDiscountAmount() |
147
|
|
|
{ |
148
|
|
|
return $this->TotalDiscountAmount; |
149
|
|
|
} |
150
|
|
|
/** |
151
|
|
|
* Set TotalDiscountAmount value |
152
|
|
|
* @param \PayPal\StructType\BasicAmountType $totalDiscountAmount |
153
|
|
|
* @return \PayPal\StructType\IncentiveDetailsType |
154
|
|
|
*/ |
155
|
|
|
public function setTotalDiscountAmount(\PayPal\StructType\BasicAmountType $totalDiscountAmount = null) |
156
|
|
|
{ |
157
|
|
|
$this->TotalDiscountAmount = $totalDiscountAmount; |
158
|
|
|
return $this; |
159
|
|
|
} |
160
|
|
|
/** |
161
|
|
|
* Get Status value |
162
|
|
|
* @return string|null |
163
|
|
|
*/ |
164
|
|
|
public function getStatus() |
165
|
|
|
{ |
166
|
|
|
return $this->Status; |
167
|
|
|
} |
168
|
|
|
/** |
169
|
|
|
* Set Status value |
170
|
|
|
* @uses \PayPal\EnumType\IncentiveAppliedStatusType::valueIsValid() |
171
|
|
|
* @uses \PayPal\EnumType\IncentiveAppliedStatusType::getValidValues() |
172
|
|
|
* @throws \InvalidArgumentException |
173
|
|
|
* @param string $status |
174
|
|
|
* @return \PayPal\StructType\IncentiveDetailsType |
175
|
|
|
*/ |
176
|
|
|
public function setStatus($status = null) |
177
|
|
|
{ |
178
|
|
|
// validation for constraint: enumeration |
179
|
|
|
if (!\PayPal\EnumType\IncentiveAppliedStatusType::valueIsValid($status)) { |
180
|
|
|
throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \PayPal\EnumType\IncentiveAppliedStatusType', is_array($status) ? implode(', ', $status) : var_export($status, true), implode(', ', \PayPal\EnumType\IncentiveAppliedStatusType::getValidValues())), __LINE__); |
|
|
|
|
181
|
|
|
} |
182
|
|
|
$this->Status = $status; |
183
|
|
|
return $this; |
184
|
|
|
} |
185
|
|
|
/** |
186
|
|
|
* Get ErrorCode value |
187
|
|
|
* @return int|null |
188
|
|
|
*/ |
189
|
|
|
public function getErrorCode() |
190
|
|
|
{ |
191
|
|
|
return $this->ErrorCode; |
192
|
|
|
} |
193
|
|
|
/** |
194
|
|
|
* Set ErrorCode value |
195
|
|
|
* @param int $errorCode |
196
|
|
|
* @return \PayPal\StructType\IncentiveDetailsType |
197
|
|
|
*/ |
198
|
|
|
public function setErrorCode($errorCode = null) |
199
|
|
|
{ |
200
|
|
|
// validation for constraint: int |
201
|
|
|
if (!is_null($errorCode) && !(is_int($errorCode) || ctype_digit($errorCode))) { |
|
|
|
|
202
|
|
|
throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide an integer value, %s given', var_export($errorCode, true), gettype($errorCode)), __LINE__); |
203
|
|
|
} |
204
|
|
|
$this->ErrorCode = $errorCode; |
205
|
|
|
return $this; |
206
|
|
|
} |
207
|
|
|
/** |
208
|
|
|
* Get IncentiveAppliedDetails value |
209
|
|
|
* @return \PayPal\StructType\IncentiveAppliedDetailsType[]|null |
210
|
|
|
*/ |
211
|
|
|
public function getIncentiveAppliedDetails() |
212
|
|
|
{ |
213
|
|
|
return $this->IncentiveAppliedDetails; |
214
|
|
|
} |
215
|
|
|
/** |
216
|
|
|
* This method is responsible for validating the values passed to the setIncentiveAppliedDetails method |
217
|
|
|
* This method is willingly generated in order to preserve the one-line inline validation within the setIncentiveAppliedDetails method |
218
|
|
|
* @param array $values |
219
|
|
|
* @return string A non-empty message if the values does not match the validation rules |
220
|
|
|
*/ |
221
|
|
|
public static function validateIncentiveAppliedDetailsForArrayConstraintsFromSetIncentiveAppliedDetails(array $values = array()) |
222
|
|
|
{ |
223
|
|
|
$message = ''; |
224
|
|
|
$invalidValues = []; |
225
|
|
|
foreach ($values as $incentiveDetailsTypeIncentiveAppliedDetailsItem) { |
226
|
|
|
// validation for constraint: itemType |
227
|
|
|
if (!$incentiveDetailsTypeIncentiveAppliedDetailsItem instanceof \PayPal\StructType\IncentiveAppliedDetailsType) { |
228
|
|
|
$invalidValues[] = is_object($incentiveDetailsTypeIncentiveAppliedDetailsItem) ? get_class($incentiveDetailsTypeIncentiveAppliedDetailsItem) : sprintf('%s(%s)', gettype($incentiveDetailsTypeIncentiveAppliedDetailsItem), var_export($incentiveDetailsTypeIncentiveAppliedDetailsItem, true)); |
229
|
|
|
} |
230
|
|
|
} |
231
|
|
|
if (!empty($invalidValues)) { |
232
|
|
|
$message = sprintf('The IncentiveAppliedDetails property can only contain items of type \PayPal\StructType\IncentiveAppliedDetailsType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); |
|
|
|
|
233
|
|
|
} |
234
|
|
|
unset($invalidValues); |
235
|
|
|
return $message; |
236
|
|
|
} |
237
|
|
|
/** |
238
|
|
|
* Set IncentiveAppliedDetails value |
239
|
|
|
* @throws \InvalidArgumentException |
240
|
|
|
* @param \PayPal\StructType\IncentiveAppliedDetailsType[] $incentiveAppliedDetails |
241
|
|
|
* @return \PayPal\StructType\IncentiveDetailsType |
242
|
|
|
*/ |
243
|
|
|
public function setIncentiveAppliedDetails(array $incentiveAppliedDetails = array()) |
244
|
|
|
{ |
245
|
|
|
// validation for constraint: array |
246
|
|
|
if ('' !== ($incentiveAppliedDetailsArrayErrorMessage = self::validateIncentiveAppliedDetailsForArrayConstraintsFromSetIncentiveAppliedDetails($incentiveAppliedDetails))) { |
247
|
|
|
throw new \InvalidArgumentException($incentiveAppliedDetailsArrayErrorMessage, __LINE__); |
248
|
|
|
} |
249
|
|
|
$this->IncentiveAppliedDetails = $incentiveAppliedDetails; |
250
|
|
|
return $this; |
251
|
|
|
} |
252
|
|
|
/** |
253
|
|
|
* Add item to IncentiveAppliedDetails value |
254
|
|
|
* @throws \InvalidArgumentException |
255
|
|
|
* @param \PayPal\StructType\IncentiveAppliedDetailsType $item |
256
|
|
|
* @return \PayPal\StructType\IncentiveDetailsType |
257
|
|
|
*/ |
258
|
|
|
public function addToIncentiveAppliedDetails(\PayPal\StructType\IncentiveAppliedDetailsType $item) |
259
|
|
|
{ |
260
|
|
|
// validation for constraint: itemType |
261
|
|
|
if (!$item instanceof \PayPal\StructType\IncentiveAppliedDetailsType) { |
|
|
|
|
262
|
|
|
throw new \InvalidArgumentException(sprintf('The IncentiveAppliedDetails property can only contain items of type \PayPal\StructType\IncentiveAppliedDetailsType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); |
263
|
|
|
} |
264
|
|
|
$this->IncentiveAppliedDetails[] = $item; |
265
|
|
|
return $this; |
266
|
|
|
} |
267
|
|
|
} |
268
|
|
|
|