|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace PayPal\StructType; |
|
4
|
|
|
|
|
5
|
|
|
use \WsdlToPhp\PackageBase\AbstractStructBase; |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* This class stands for MassPayRequestType StructType |
|
9
|
|
|
* @subpackage Structs |
|
10
|
|
|
* @author WsdlToPhp <[email protected]> |
|
11
|
|
|
*/ |
|
12
|
|
|
class MassPayRequestType extends AbstractRequestType |
|
13
|
|
|
{ |
|
14
|
|
|
/** |
|
15
|
|
|
* The MassPayItem |
|
16
|
|
|
* Meta information extracted from the WSDL |
|
17
|
|
|
* - documentation: Details of each payment. A single MassPayRequest can include up to 250 MassPayItems. Required |
|
18
|
|
|
* - maxOccurs: 250 |
|
19
|
|
|
* - minOccurs: 1 |
|
20
|
|
|
* @var \PayPal\StructType\MassPayRequestItemType[] |
|
21
|
|
|
*/ |
|
22
|
|
|
public $MassPayItem; |
|
23
|
|
|
/** |
|
24
|
|
|
* The EmailSubject |
|
25
|
|
|
* Meta information extracted from the WSDL |
|
26
|
|
|
* - documentation: Subject line of the email sent to all recipients. This subject is not contained in the input file; you must create it with your application. Optional Character length and limitations: 255 single-byte alphanumeric characters |
|
27
|
|
|
* - maxOccurs: 1 |
|
28
|
|
|
* - minOccurs: 0 |
|
29
|
|
|
* @var string |
|
30
|
|
|
*/ |
|
31
|
|
|
public $EmailSubject; |
|
32
|
|
|
/** |
|
33
|
|
|
* The ReceiverType |
|
34
|
|
|
* Meta information extracted from the WSDL |
|
35
|
|
|
* - documentation: Indicates how you identify the recipients of payments in all MassPayItems: either by EmailAddress (ReceiverEmail in MassPayItem), PhoneNumber (ReceiverPhone in MassPayItem), or by UserID (ReceiverID in MassPayItem). Required. You |
|
36
|
|
|
* must specify one or the other of EmailAddress or UserID. |
|
37
|
|
|
* - maxOccurs: 1 |
|
38
|
|
|
* - minOccurs: 0 |
|
39
|
|
|
* @var string |
|
40
|
|
|
*/ |
|
41
|
|
|
public $ReceiverType; |
|
42
|
|
|
/** |
|
43
|
|
|
* The ButtonSource |
|
44
|
|
|
* Meta information extracted from the WSDL |
|
45
|
|
|
* - documentation: Known as BN code, to track the partner referred merchant transactions. OptionalCharacter length and limitations: 32 single-byte alphanumeric characters |
|
46
|
|
|
* - maxOccurs: 1 |
|
47
|
|
|
* - minOccurs: 0 |
|
48
|
|
|
* @var string |
|
49
|
|
|
*/ |
|
50
|
|
|
public $ButtonSource; |
|
51
|
|
|
/** |
|
52
|
|
|
* Constructor method for MassPayRequestType |
|
53
|
|
|
* @uses MassPayRequestType::setMassPayItem() |
|
54
|
|
|
* @uses MassPayRequestType::setEmailSubject() |
|
55
|
|
|
* @uses MassPayRequestType::setReceiverType() |
|
56
|
|
|
* @uses MassPayRequestType::setButtonSource() |
|
57
|
|
|
* @param \PayPal\StructType\MassPayRequestItemType[] $massPayItem |
|
58
|
|
|
* @param string $emailSubject |
|
59
|
|
|
* @param string $receiverType |
|
60
|
|
|
* @param string $buttonSource |
|
61
|
|
|
*/ |
|
62
|
|
|
public function __construct(array $massPayItem = array(), $emailSubject = null, $receiverType = null, $buttonSource = null) |
|
63
|
|
|
{ |
|
64
|
|
|
$this |
|
65
|
|
|
->setMassPayItem($massPayItem) |
|
66
|
|
|
->setEmailSubject($emailSubject) |
|
67
|
|
|
->setReceiverType($receiverType) |
|
68
|
|
|
->setButtonSource($buttonSource); |
|
69
|
|
|
} |
|
70
|
|
|
/** |
|
71
|
|
|
* Get MassPayItem value |
|
72
|
|
|
* @return \PayPal\StructType\MassPayRequestItemType[] |
|
73
|
|
|
*/ |
|
74
|
|
|
public function getMassPayItem() |
|
75
|
|
|
{ |
|
76
|
|
|
return $this->MassPayItem; |
|
77
|
|
|
} |
|
78
|
|
|
/** |
|
79
|
|
|
* This method is responsible for validating the values passed to the setMassPayItem method |
|
80
|
|
|
* This method is willingly generated in order to preserve the one-line inline validation within the setMassPayItem method |
|
81
|
|
|
* @param array $values |
|
82
|
|
|
* @return string A non-empty message if the values does not match the validation rules |
|
83
|
|
|
*/ |
|
84
|
|
|
public static function validateMassPayItemForArrayConstraintsFromSetMassPayItem(array $values = array()) |
|
85
|
|
|
{ |
|
86
|
|
|
$message = ''; |
|
87
|
|
|
$invalidValues = []; |
|
88
|
|
|
foreach ($values as $massPayRequestTypeMassPayItemItem) { |
|
89
|
|
|
// validation for constraint: itemType |
|
90
|
|
|
if (!$massPayRequestTypeMassPayItemItem instanceof \PayPal\StructType\MassPayRequestItemType) { |
|
91
|
|
|
$invalidValues[] = is_object($massPayRequestTypeMassPayItemItem) ? get_class($massPayRequestTypeMassPayItemItem) : sprintf('%s(%s)', gettype($massPayRequestTypeMassPayItemItem), var_export($massPayRequestTypeMassPayItemItem, true)); |
|
92
|
|
|
} |
|
93
|
|
|
} |
|
94
|
|
|
if (!empty($invalidValues)) { |
|
95
|
|
|
$message = sprintf('The MassPayItem property can only contain items of type \PayPal\StructType\MassPayRequestItemType, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); |
|
|
|
|
|
|
96
|
|
|
} |
|
97
|
|
|
unset($invalidValues); |
|
98
|
|
|
return $message; |
|
99
|
|
|
} |
|
100
|
|
|
/** |
|
101
|
|
|
* Set MassPayItem value |
|
102
|
|
|
* @throws \InvalidArgumentException |
|
103
|
|
|
* @param \PayPal\StructType\MassPayRequestItemType[] $massPayItem |
|
104
|
|
|
* @return \PayPal\StructType\MassPayRequestType |
|
105
|
|
|
*/ |
|
106
|
|
|
public function setMassPayItem(array $massPayItem = array()) |
|
107
|
|
|
{ |
|
108
|
|
|
// validation for constraint: array |
|
109
|
|
|
if ('' !== ($massPayItemArrayErrorMessage = self::validateMassPayItemForArrayConstraintsFromSetMassPayItem($massPayItem))) { |
|
110
|
|
|
throw new \InvalidArgumentException($massPayItemArrayErrorMessage, __LINE__); |
|
111
|
|
|
} |
|
112
|
|
|
// validation for constraint: maxOccurs(250) |
|
113
|
|
|
if (is_array($massPayItem) && count($massPayItem) > 250) { |
|
114
|
|
|
throw new \InvalidArgumentException(sprintf('Invalid count of %s, the number of elements contained by the property must be less than or equal to 250', count($massPayItem)), __LINE__); |
|
115
|
|
|
} |
|
116
|
|
|
$this->MassPayItem = $massPayItem; |
|
117
|
|
|
return $this; |
|
118
|
|
|
} |
|
119
|
|
|
/** |
|
120
|
|
|
* Add item to MassPayItem value |
|
121
|
|
|
* @throws \InvalidArgumentException |
|
122
|
|
|
* @param \PayPal\StructType\MassPayRequestItemType $item |
|
123
|
|
|
* @return \PayPal\StructType\MassPayRequestType |
|
124
|
|
|
*/ |
|
125
|
|
|
public function addToMassPayItem(\PayPal\StructType\MassPayRequestItemType $item) |
|
126
|
|
|
{ |
|
127
|
|
|
// validation for constraint: itemType |
|
128
|
|
|
if (!$item instanceof \PayPal\StructType\MassPayRequestItemType) { |
|
|
|
|
|
|
129
|
|
|
throw new \InvalidArgumentException(sprintf('The MassPayItem property can only contain items of type \PayPal\StructType\MassPayRequestItemType, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); |
|
130
|
|
|
} |
|
131
|
|
|
// validation for constraint: maxOccurs(250) |
|
132
|
|
|
if (is_array($this->MassPayItem) && count($this->MassPayItem) >= 250) { |
|
133
|
|
|
throw new \InvalidArgumentException(sprintf('You can\'t add anymore element to this property that already contains %s elements, the number of elements contained by the property must be less than or equal to 250', count($this->MassPayItem)), __LINE__); |
|
134
|
|
|
} |
|
135
|
|
|
$this->MassPayItem[] = $item; |
|
136
|
|
|
return $this; |
|
137
|
|
|
} |
|
138
|
|
|
/** |
|
139
|
|
|
* Get EmailSubject value |
|
140
|
|
|
* @return string|null |
|
141
|
|
|
*/ |
|
142
|
|
|
public function getEmailSubject() |
|
143
|
|
|
{ |
|
144
|
|
|
return $this->EmailSubject; |
|
145
|
|
|
} |
|
146
|
|
|
/** |
|
147
|
|
|
* Set EmailSubject value |
|
148
|
|
|
* @param string $emailSubject |
|
149
|
|
|
* @return \PayPal\StructType\MassPayRequestType |
|
150
|
|
|
*/ |
|
151
|
|
|
public function setEmailSubject($emailSubject = null) |
|
152
|
|
|
{ |
|
153
|
|
|
// validation for constraint: string |
|
154
|
|
|
if (!is_null($emailSubject) && !is_string($emailSubject)) { |
|
|
|
|
|
|
155
|
|
|
throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($emailSubject, true), gettype($emailSubject)), __LINE__); |
|
156
|
|
|
} |
|
157
|
|
|
$this->EmailSubject = $emailSubject; |
|
158
|
|
|
return $this; |
|
159
|
|
|
} |
|
160
|
|
|
/** |
|
161
|
|
|
* Get ReceiverType value |
|
162
|
|
|
* @return string|null |
|
163
|
|
|
*/ |
|
164
|
|
|
public function getReceiverType() |
|
165
|
|
|
{ |
|
166
|
|
|
return $this->ReceiverType; |
|
167
|
|
|
} |
|
168
|
|
|
/** |
|
169
|
|
|
* Set ReceiverType value |
|
170
|
|
|
* @uses \PayPal\EnumType\ReceiverInfoCodeType::valueIsValid() |
|
171
|
|
|
* @uses \PayPal\EnumType\ReceiverInfoCodeType::getValidValues() |
|
172
|
|
|
* @throws \InvalidArgumentException |
|
173
|
|
|
* @param string $receiverType |
|
174
|
|
|
* @return \PayPal\StructType\MassPayRequestType |
|
175
|
|
|
*/ |
|
176
|
|
|
public function setReceiverType($receiverType = null) |
|
177
|
|
|
{ |
|
178
|
|
|
// validation for constraint: enumeration |
|
179
|
|
|
if (!\PayPal\EnumType\ReceiverInfoCodeType::valueIsValid($receiverType)) { |
|
180
|
|
|
throw new \InvalidArgumentException(sprintf('Invalid value(s) %s, please use one of: %s from enumeration class \PayPal\EnumType\ReceiverInfoCodeType', is_array($receiverType) ? implode(', ', $receiverType) : var_export($receiverType, true), implode(', ', \PayPal\EnumType\ReceiverInfoCodeType::getValidValues())), __LINE__); |
|
|
|
|
|
|
181
|
|
|
} |
|
182
|
|
|
$this->ReceiverType = $receiverType; |
|
183
|
|
|
return $this; |
|
184
|
|
|
} |
|
185
|
|
|
/** |
|
186
|
|
|
* Get ButtonSource value |
|
187
|
|
|
* @return string|null |
|
188
|
|
|
*/ |
|
189
|
|
|
public function getButtonSource() |
|
190
|
|
|
{ |
|
191
|
|
|
return $this->ButtonSource; |
|
192
|
|
|
} |
|
193
|
|
|
/** |
|
194
|
|
|
* Set ButtonSource value |
|
195
|
|
|
* @param string $buttonSource |
|
196
|
|
|
* @return \PayPal\StructType\MassPayRequestType |
|
197
|
|
|
*/ |
|
198
|
|
|
public function setButtonSource($buttonSource = null) |
|
199
|
|
|
{ |
|
200
|
|
|
// validation for constraint: string |
|
201
|
|
|
if (!is_null($buttonSource) && !is_string($buttonSource)) { |
|
|
|
|
|
|
202
|
|
|
throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($buttonSource, true), gettype($buttonSource)), __LINE__); |
|
203
|
|
|
} |
|
204
|
|
|
$this->ButtonSource = $buttonSource; |
|
205
|
|
|
return $this; |
|
206
|
|
|
} |
|
207
|
|
|
} |
|
208
|
|
|
|