|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace PayPal\StructType; |
|
4
|
|
|
|
|
5
|
|
|
use \WsdlToPhp\PackageBase\AbstractStructBase; |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* This class stands for IncentiveDetailType StructType |
|
9
|
|
|
* @subpackage Structs |
|
10
|
|
|
* @author WsdlToPhp <[email protected]> |
|
11
|
|
|
*/ |
|
12
|
|
|
class IncentiveDetailType extends AbstractStructBase |
|
13
|
|
|
{ |
|
14
|
|
|
/** |
|
15
|
|
|
* The RedemptionCode |
|
16
|
|
|
* Meta information extracted from the WSDL |
|
17
|
|
|
* - minOccurs: 0 |
|
18
|
|
|
* @var string |
|
19
|
|
|
*/ |
|
20
|
|
|
public $RedemptionCode; |
|
21
|
|
|
/** |
|
22
|
|
|
* The DisplayCode |
|
23
|
|
|
* Meta information extracted from the WSDL |
|
24
|
|
|
* - minOccurs: 0 |
|
25
|
|
|
* @var string |
|
26
|
|
|
*/ |
|
27
|
|
|
public $DisplayCode; |
|
28
|
|
|
/** |
|
29
|
|
|
* The ProgramId |
|
30
|
|
|
* Meta information extracted from the WSDL |
|
31
|
|
|
* - minOccurs: 0 |
|
32
|
|
|
* @var string |
|
33
|
|
|
*/ |
|
34
|
|
|
public $ProgramId; |
|
35
|
|
|
/** |
|
36
|
|
|
* The IncentiveType |
|
37
|
|
|
* Meta information extracted from the WSDL |
|
38
|
|
|
* - minOccurs: 0 |
|
39
|
|
|
* @var string |
|
40
|
|
|
*/ |
|
41
|
|
|
public $IncentiveType; |
|
42
|
|
|
/** |
|
43
|
|
|
* The IncentiveDescription |
|
44
|
|
|
* Meta information extracted from the WSDL |
|
45
|
|
|
* - minOccurs: 0 |
|
46
|
|
|
* @var string |
|
47
|
|
|
*/ |
|
48
|
|
|
public $IncentiveDescription; |
|
49
|
|
|
/** |
|
50
|
|
|
* The AppliedTo |
|
51
|
|
|
* Meta information extracted from the WSDL |
|
52
|
|
|
* - maxOccurs: unbounded |
|
53
|
|
|
* - minOccurs: 0 |
|
54
|
|
|
* @var \PayPal\StructType\IncentiveAppliedToType[] |
|
55
|
|
|
*/ |
|
56
|
|
|
public $AppliedTo; |
|
57
|
|
|
/** |
|
58
|
|
|
* The Status |
|
59
|
|
|
* Meta information extracted from the WSDL |
|
60
|
|
|
* - minOccurs: 0 |
|
61
|
|
|
* @var string |
|
62
|
|
|
*/ |
|
63
|
|
|
public $Status; |
|
64
|
|
|
/** |
|
65
|
|
|
* The ErrorCode |
|
66
|
|
|
* Meta information extracted from the WSDL |
|
67
|
|
|
* - minOccurs: 0 |
|
68
|
|
|
* @var string |
|
69
|
|
|
*/ |
|
70
|
|
|
public $ErrorCode; |
|
71
|
|
|
/** |
|
72
|
|
|
* Constructor method for IncentiveDetailType |
|
73
|
|
|
* @uses IncentiveDetailType::setRedemptionCode() |
|
74
|
|
|
* @uses IncentiveDetailType::setDisplayCode() |
|
75
|
|
|
* @uses IncentiveDetailType::setProgramId() |
|
76
|
|
|
* @uses IncentiveDetailType::setIncentiveType() |
|
77
|
|
|
* @uses IncentiveDetailType::setIncentiveDescription() |
|
78
|
|
|
* @uses IncentiveDetailType::setAppliedTo() |
|
79
|
|
|
* @uses IncentiveDetailType::setStatus() |
|
80
|
|
|
* @uses IncentiveDetailType::setErrorCode() |
|
81
|
|
|
* @param string $redemptionCode |
|
82
|
|
|
* @param string $displayCode |
|
83
|
|
|
* @param string $programId |
|
84
|
|
|
* @param string $incentiveType |
|
85
|
|
|
* @param string $incentiveDescription |
|
86
|
|
|
* @param \PayPal\StructType\IncentiveAppliedToType[] $appliedTo |
|
87
|
|
|
* @param string $status |
|
88
|
|
|
* @param string $errorCode |
|
89
|
|
|
*/ |
|
90
|
|
|
public function __construct($redemptionCode = null, $displayCode = null, $programId = null, $incentiveType = null, $incentiveDescription = null, array $appliedTo = array(), $status = null, $errorCode = null) |
|
91
|
|
|
{ |
|
92
|
|
|
$this |
|
93
|
|
|
->setRedemptionCode($redemptionCode) |
|
94
|
|
|
->setDisplayCode($displayCode) |
|
95
|
|
|
->setProgramId($programId) |
|
96
|
|
|
->setIncentiveType($incentiveType) |
|
97
|
|
|
->setIncentiveDescription($incentiveDescription) |
|
98
|
|
|
->setAppliedTo($appliedTo) |
|
99
|
|
|
->setStatus($status) |
|
100
|
|
|
->setErrorCode($errorCode); |
|
101
|
|
|
} |
|
102
|
|
|
/** |
|
103
|
|
|
* Get RedemptionCode value |
|
104
|
|
|
* @return string|null |
|
105
|
|
|
*/ |
|
106
|
|
|
public function getRedemptionCode() |
|
107
|
|
|
{ |
|
108
|
|
|
return $this->RedemptionCode; |
|
109
|
|
|
} |
|
110
|
|
|
/** |
|
111
|
|
|
* Set RedemptionCode value |
|
112
|
|
|
* @param string $redemptionCode |
|
113
|
|
|
* @return \PayPal\StructType\IncentiveDetailType |
|
114
|
|
|
*/ |
|
115
|
|
|
public function setRedemptionCode($redemptionCode = null) |
|
116
|
|
|
{ |
|
117
|
|
|
// validation for constraint: string |
|
118
|
|
|
if (!is_null($redemptionCode) && !is_string($redemptionCode)) { |
|
|
|
|
|
|
119
|
|
|
throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($redemptionCode, true), gettype($redemptionCode)), __LINE__); |
|
120
|
|
|
} |
|
121
|
|
|
$this->RedemptionCode = $redemptionCode; |
|
122
|
|
|
return $this; |
|
123
|
|
|
} |
|
124
|
|
|
/** |
|
125
|
|
|
* Get DisplayCode value |
|
126
|
|
|
* @return string|null |
|
127
|
|
|
*/ |
|
128
|
|
|
public function getDisplayCode() |
|
129
|
|
|
{ |
|
130
|
|
|
return $this->DisplayCode; |
|
131
|
|
|
} |
|
132
|
|
|
/** |
|
133
|
|
|
* Set DisplayCode value |
|
134
|
|
|
* @param string $displayCode |
|
135
|
|
|
* @return \PayPal\StructType\IncentiveDetailType |
|
136
|
|
|
*/ |
|
137
|
|
|
public function setDisplayCode($displayCode = null) |
|
138
|
|
|
{ |
|
139
|
|
|
// validation for constraint: string |
|
140
|
|
|
if (!is_null($displayCode) && !is_string($displayCode)) { |
|
|
|
|
|
|
141
|
|
|
throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($displayCode, true), gettype($displayCode)), __LINE__); |
|
142
|
|
|
} |
|
143
|
|
|
$this->DisplayCode = $displayCode; |
|
144
|
|
|
return $this; |
|
145
|
|
|
} |
|
146
|
|
|
/** |
|
147
|
|
|
* Get ProgramId value |
|
148
|
|
|
* @return string|null |
|
149
|
|
|
*/ |
|
150
|
|
|
public function getProgramId() |
|
151
|
|
|
{ |
|
152
|
|
|
return $this->ProgramId; |
|
153
|
|
|
} |
|
154
|
|
|
/** |
|
155
|
|
|
* Set ProgramId value |
|
156
|
|
|
* @param string $programId |
|
157
|
|
|
* @return \PayPal\StructType\IncentiveDetailType |
|
158
|
|
|
*/ |
|
159
|
|
|
public function setProgramId($programId = null) |
|
160
|
|
|
{ |
|
161
|
|
|
// validation for constraint: string |
|
162
|
|
|
if (!is_null($programId) && !is_string($programId)) { |
|
|
|
|
|
|
163
|
|
|
throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($programId, true), gettype($programId)), __LINE__); |
|
164
|
|
|
} |
|
165
|
|
|
$this->ProgramId = $programId; |
|
166
|
|
|
return $this; |
|
167
|
|
|
} |
|
168
|
|
|
/** |
|
169
|
|
|
* Get IncentiveType value |
|
170
|
|
|
* @return string|null |
|
171
|
|
|
*/ |
|
172
|
|
|
public function getIncentiveType() |
|
173
|
|
|
{ |
|
174
|
|
|
return $this->IncentiveType; |
|
175
|
|
|
} |
|
176
|
|
|
/** |
|
177
|
|
|
* Set IncentiveType value |
|
178
|
|
|
* @uses \PayPal\EnumType\IncentiveTypeCodeType::valueIsValid() |
|
179
|
|
|
* @uses \PayPal\EnumType\IncentiveTypeCodeType::getValidValues() |
|
180
|
|
|
* @throws \InvalidArgumentException |
|
181
|
|
|
* @param string $incentiveType |
|
182
|
|
|
* @return \PayPal\StructType\IncentiveDetailType |
|
183
|
|
|
*/ |
|
184
|
|
|
public function setIncentiveType($incentiveType = null) |
|
185
|
|
|
{ |
|
186
|
|
|
// validation for constraint: enumeration |
|
187
|
|
|
if (!\PayPal\EnumType\IncentiveTypeCodeType::valueIsValid($incentiveType)) { |
|
188
|
|
|
throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \PayPal\EnumType\IncentiveTypeCodeType', is_array($incentiveType) ? implode(', ', $incentiveType) : var_export($incentiveType, true), implode(', ', \PayPal\EnumType\IncentiveTypeCodeType::getValidValues())), __LINE__); |
|
|
|
|
|
|
189
|
|
|
} |
|
190
|
|
|
$this->IncentiveType = $incentiveType; |
|
191
|
|
|
return $this; |
|
192
|
|
|
} |
|
193
|
|
|
/** |
|
194
|
|
|
* Get IncentiveDescription value |
|
195
|
|
|
* @return string|null |
|
196
|
|
|
*/ |
|
197
|
|
|
public function getIncentiveDescription() |
|
198
|
|
|
{ |
|
199
|
|
|
return $this->IncentiveDescription; |
|
200
|
|
|
} |
|
201
|
|
|
/** |
|
202
|
|
|
* Set IncentiveDescription value |
|
203
|
|
|
* @param string $incentiveDescription |
|
204
|
|
|
* @return \PayPal\StructType\IncentiveDetailType |
|
205
|
|
|
*/ |
|
206
|
|
|
public function setIncentiveDescription($incentiveDescription = null) |
|
207
|
|
|
{ |
|
208
|
|
|
// validation for constraint: string |
|
209
|
|
|
if (!is_null($incentiveDescription) && !is_string($incentiveDescription)) { |
|
|
|
|
|
|
210
|
|
|
throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($incentiveDescription, true), gettype($incentiveDescription)), __LINE__); |
|
211
|
|
|
} |
|
212
|
|
|
$this->IncentiveDescription = $incentiveDescription; |
|
213
|
|
|
return $this; |
|
214
|
|
|
} |
|
215
|
|
|
/** |
|
216
|
|
|
* Get AppliedTo value |
|
217
|
|
|
* @return \PayPal\StructType\IncentiveAppliedToType[]|null |
|
218
|
|
|
*/ |
|
219
|
|
|
public function getAppliedTo() |
|
220
|
|
|
{ |
|
221
|
|
|
return $this->AppliedTo; |
|
222
|
|
|
} |
|
223
|
|
|
/** |
|
224
|
|
|
* This method is responsible for validating the values passed to the setAppliedTo method |
|
225
|
|
|
* This method is willingly generated in order to preserve the one-line inline validation within the setAppliedTo method |
|
226
|
|
|
* @param array $values |
|
227
|
|
|
* @return string A non-empty message if the values does not match the validation rules |
|
228
|
|
|
*/ |
|
229
|
|
|
public static function validateAppliedToForArrayConstraintsFromSetAppliedTo(array $values = array()) |
|
230
|
|
|
{ |
|
231
|
|
|
$message = ''; |
|
232
|
|
|
$invalidValues = []; |
|
233
|
|
|
foreach ($values as $incentiveDetailTypeAppliedToItem) { |
|
234
|
|
|
// validation for constraint: itemType |
|
235
|
|
|
if (!$incentiveDetailTypeAppliedToItem instanceof \PayPal\StructType\IncentiveAppliedToType) { |
|
236
|
|
|
$invalidValues[] = is_object($incentiveDetailTypeAppliedToItem) ? get_class($incentiveDetailTypeAppliedToItem) : sprintf('%s(%s)', gettype($incentiveDetailTypeAppliedToItem), var_export($incentiveDetailTypeAppliedToItem, true)); |
|
237
|
|
|
} |
|
238
|
|
|
} |
|
239
|
|
|
if (!empty($invalidValues)) { |
|
240
|
|
|
$message = sprintf('The AppliedTo property can only contain items of type \PayPal\StructType\IncentiveAppliedToType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); |
|
|
|
|
|
|
241
|
|
|
} |
|
242
|
|
|
unset($invalidValues); |
|
243
|
|
|
return $message; |
|
244
|
|
|
} |
|
245
|
|
|
/** |
|
246
|
|
|
* Set AppliedTo value |
|
247
|
|
|
* @throws \InvalidArgumentException |
|
248
|
|
|
* @param \PayPal\StructType\IncentiveAppliedToType[] $appliedTo |
|
249
|
|
|
* @return \PayPal\StructType\IncentiveDetailType |
|
250
|
|
|
*/ |
|
251
|
|
|
public function setAppliedTo(array $appliedTo = array()) |
|
252
|
|
|
{ |
|
253
|
|
|
// validation for constraint: array |
|
254
|
|
|
if ('' !== ($appliedToArrayErrorMessage = self::validateAppliedToForArrayConstraintsFromSetAppliedTo($appliedTo))) { |
|
255
|
|
|
throw new \InvalidArgumentException($appliedToArrayErrorMessage, __LINE__); |
|
256
|
|
|
} |
|
257
|
|
|
$this->AppliedTo = $appliedTo; |
|
258
|
|
|
return $this; |
|
259
|
|
|
} |
|
260
|
|
|
/** |
|
261
|
|
|
* Add item to AppliedTo value |
|
262
|
|
|
* @throws \InvalidArgumentException |
|
263
|
|
|
* @param \PayPal\StructType\IncentiveAppliedToType $item |
|
264
|
|
|
* @return \PayPal\StructType\IncentiveDetailType |
|
265
|
|
|
*/ |
|
266
|
|
|
public function addToAppliedTo(\PayPal\StructType\IncentiveAppliedToType $item) |
|
267
|
|
|
{ |
|
268
|
|
|
// validation for constraint: itemType |
|
269
|
|
|
if (!$item instanceof \PayPal\StructType\IncentiveAppliedToType) { |
|
|
|
|
|
|
270
|
|
|
throw new \InvalidArgumentException(sprintf('The AppliedTo property can only contain items of type \PayPal\StructType\IncentiveAppliedToType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); |
|
271
|
|
|
} |
|
272
|
|
|
$this->AppliedTo[] = $item; |
|
273
|
|
|
return $this; |
|
274
|
|
|
} |
|
275
|
|
|
/** |
|
276
|
|
|
* Get Status value |
|
277
|
|
|
* @return string|null |
|
278
|
|
|
*/ |
|
279
|
|
|
public function getStatus() |
|
280
|
|
|
{ |
|
281
|
|
|
return $this->Status; |
|
282
|
|
|
} |
|
283
|
|
|
/** |
|
284
|
|
|
* Set Status value |
|
285
|
|
|
* @param string $status |
|
286
|
|
|
* @return \PayPal\StructType\IncentiveDetailType |
|
287
|
|
|
*/ |
|
288
|
|
|
public function setStatus($status = null) |
|
289
|
|
|
{ |
|
290
|
|
|
// validation for constraint: string |
|
291
|
|
|
if (!is_null($status) && !is_string($status)) { |
|
|
|
|
|
|
292
|
|
|
throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($status, true), gettype($status)), __LINE__); |
|
293
|
|
|
} |
|
294
|
|
|
$this->Status = $status; |
|
295
|
|
|
return $this; |
|
296
|
|
|
} |
|
297
|
|
|
/** |
|
298
|
|
|
* Get ErrorCode value |
|
299
|
|
|
* @return string|null |
|
300
|
|
|
*/ |
|
301
|
|
|
public function getErrorCode() |
|
302
|
|
|
{ |
|
303
|
|
|
return $this->ErrorCode; |
|
304
|
|
|
} |
|
305
|
|
|
/** |
|
306
|
|
|
* Set ErrorCode value |
|
307
|
|
|
* @param string $errorCode |
|
308
|
|
|
* @return \PayPal\StructType\IncentiveDetailType |
|
309
|
|
|
*/ |
|
310
|
|
|
public function setErrorCode($errorCode = null) |
|
311
|
|
|
{ |
|
312
|
|
|
// validation for constraint: string |
|
313
|
|
|
if (!is_null($errorCode) && !is_string($errorCode)) { |
|
|
|
|
|
|
314
|
|
|
throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($errorCode, true), gettype($errorCode)), __LINE__); |
|
315
|
|
|
} |
|
316
|
|
|
$this->ErrorCode = $errorCode; |
|
317
|
|
|
return $this; |
|
318
|
|
|
} |
|
319
|
|
|
} |
|
320
|
|
|
|