-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathProject.php
More file actions
executable file
·515 lines (435 loc) · 11.3 KB
/
Copy pathProject.php
File metadata and controls
executable file
·515 lines (435 loc) · 11.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
<?php
// The content of this file was automatically generated
namespace ProcessOut;
use ProcessOut\ProcessOut;
use ProcessOut\Networking\Request;
class Project implements \JsonSerializable
{
/**
* ProcessOut's client
* @var ProcessOut\ProcessOut
*/
protected $client;
/**
* ID of the project
* @var string
*/
protected $id;
/**
* Project used to create this project
* @var object
*/
protected $supervisorProject;
/**
* ID of the project used to create this project
* @var string
*/
protected $supervisorProjectId;
/**
* Current API version of the project
* @var object
*/
protected $apiVersion;
/**
* Name of the project
* @var string
*/
protected $name;
/**
* Name of the project
* @var string
*/
protected $logoUrl;
/**
* Email of the project
* @var string
*/
protected $email;
/**
* Default currency of the project, used to compute analytics amounts
* @var string
*/
protected $defaultCurrency;
/**
* Private key of the project. Only returned when creating a project
* @var string
*/
protected $privateKey;
/**
* Dunning configuration of the project
* @var list
*/
protected $dunningConfiguration;
/**
* Date at which the project was created
* @var string
*/
protected $createdAt;
/**
* Project constructor
* @param ProcessOut\ProcessOut $client
* @param array|null $prefill
*/
public function __construct(ProcessOut $client, $prefill = array())
{
$this->client = $client;
$this->fillWithData($prefill);
}
/**
* Get Id
* ID of the project
* @return string
*/
public function getId()
{
return $this->id;
}
/**
* Set Id
* ID of the project
* @param string $value
* @return $this
*/
public function setId($value)
{
$this->id = $value;
return $this;
}
/**
* Get SupervisorProject
* Project used to create this project
* @return object
*/
public function getSupervisorProject()
{
return $this->supervisorProject;
}
/**
* Set SupervisorProject
* Project used to create this project
* @param object $value
* @return $this
*/
public function setSupervisorProject($value)
{
if (is_object($value))
$this->supervisorProject = $value;
else
{
$obj = new Project($this->client);
$obj->fillWithData($value);
$this->supervisorProject = $obj;
}
return $this;
}
/**
* Get SupervisorProjectId
* ID of the project used to create this project
* @return string
*/
public function getSupervisorProjectId()
{
return $this->supervisorProjectId;
}
/**
* Set SupervisorProjectId
* ID of the project used to create this project
* @param string $value
* @return $this
*/
public function setSupervisorProjectId($value)
{
$this->supervisorProjectId = $value;
return $this;
}
/**
* Get ApiVersion
* Current API version of the project
* @return object
*/
public function getApiVersion()
{
return $this->apiVersion;
}
/**
* Set ApiVersion
* Current API version of the project
* @param object $value
* @return $this
*/
public function setApiVersion($value)
{
if (is_object($value))
$this->apiVersion = $value;
else
{
$obj = new APIVersion($this->client);
$obj->fillWithData($value);
$this->apiVersion = $obj;
}
return $this;
}
/**
* Get Name
* Name of the project
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set Name
* Name of the project
* @param string $value
* @return $this
*/
public function setName($value)
{
$this->name = $value;
return $this;
}
/**
* Get LogoUrl
* Name of the project
* @return string
*/
public function getLogoUrl()
{
return $this->logoUrl;
}
/**
* Set LogoUrl
* Name of the project
* @param string $value
* @return $this
*/
public function setLogoUrl($value)
{
$this->logoUrl = $value;
return $this;
}
/**
* Get Email
* Email of the project
* @return string
*/
public function getEmail()
{
return $this->email;
}
/**
* Set Email
* Email of the project
* @param string $value
* @return $this
*/
public function setEmail($value)
{
$this->email = $value;
return $this;
}
/**
* Get DefaultCurrency
* Default currency of the project, used to compute analytics amounts
* @return string
*/
public function getDefaultCurrency()
{
return $this->defaultCurrency;
}
/**
* Set DefaultCurrency
* Default currency of the project, used to compute analytics amounts
* @param string $value
* @return $this
*/
public function setDefaultCurrency($value)
{
$this->defaultCurrency = $value;
return $this;
}
/**
* Get PrivateKey
* Private key of the project. Only returned when creating a project
* @return string
*/
public function getPrivateKey()
{
return $this->privateKey;
}
/**
* Set PrivateKey
* Private key of the project. Only returned when creating a project
* @param string $value
* @return $this
*/
public function setPrivateKey($value)
{
$this->privateKey = $value;
return $this;
}
/**
* Get DunningConfiguration
* Dunning configuration of the project
* @return array
*/
public function getDunningConfiguration()
{
return $this->dunningConfiguration;
}
/**
* Set DunningConfiguration
* Dunning configuration of the project
* @param array $value
* @return $this
*/
public function setDunningConfiguration($value)
{
if (count($value) > 0 && is_object($value[0]))
$this->dunningConfiguration = $value;
else
{
$a = array();
foreach ($value as $v)
{
$obj = new DunningAction($this->client);
$obj->fillWithData($v);
$a[] = $obj;
}
$this->dunningConfiguration = $a;
}
return $this;
}
/**
* Get CreatedAt
* Date at which the project was created
* @return string
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* Set CreatedAt
* Date at which the project was created
* @param string $value
* @return $this
*/
public function setCreatedAt($value)
{
$this->createdAt = $value;
return $this;
}
/**
* Fills the current object with the new values pulled from the data
* @param array $data
* @return Project
*/
public function fillWithData($data)
{
if(! empty($data['id']))
$this->setId($data['id']);
if(! empty($data['supervisor_project']))
$this->setSupervisorProject($data['supervisor_project']);
if(! empty($data['supervisor_project_id']))
$this->setSupervisorProjectId($data['supervisor_project_id']);
if(! empty($data['api_version']))
$this->setApiVersion($data['api_version']);
if(! empty($data['name']))
$this->setName($data['name']);
if(! empty($data['logo_url']))
$this->setLogoUrl($data['logo_url']);
if(! empty($data['email']))
$this->setEmail($data['email']);
if(! empty($data['default_currency']))
$this->setDefaultCurrency($data['default_currency']);
if(! empty($data['private_key']))
$this->setPrivateKey($data['private_key']);
if(! empty($data['dunning_configuration']))
$this->setDunningConfiguration($data['dunning_configuration']);
if(! empty($data['created_at']))
$this->setCreatedAt($data['created_at']);
return $this;
}
/**
* Implements the JsonSerializable interface
* @return array
*/
public function jsonSerialize(): array {
return array(
"id" => $this->getId(),
"supervisor_project" => $this->getSupervisorProject(),
"supervisor_project_id" => $this->getSupervisorProjectId(),
"api_version" => $this->getApiVersion(),
"name" => $this->getName(),
"logo_url" => $this->getLogoUrl(),
"email" => $this->getEmail(),
"default_currency" => $this->getDefaultCurrency(),
"private_key" => $this->getPrivateKey(),
"dunning_configuration" => $this->getDunningConfiguration(),
"created_at" => $this->getCreatedAt(),
);
}
/**
* Fetch the current project information.
* @param array $options
* @return $this
*/
public function fetch($options = array())
{
$this->fillWithData($options);
$request = new Request($this->client);
$path = "/projects/" . urlencode($this->getId()) . "";
$data = array(
);
$response = $request->get($path, $data, $options);
$returnValues = array();
// Handling for field project
$body = $response->getBody();
if (isset($body['project'])) {
$body = $body['project'];
$returnValues['fetch'] = $this->fillWithData($body);
}
return array_values($returnValues)[0];
}
/**
* Save the updated project's attributes.
* @param array $options
* @return $this
*/
public function save($options = array())
{
$this->fillWithData($options);
$request = new Request($this->client);
$path = "/projects/" . urlencode($this->getId()) . "";
$data = array(
);
$response = $request->put($path, $data, $options);
$returnValues = array();
// Handling for field project
$body = $response->getBody();
if (isset($body['project'])) {
$body = $body['project'];
$returnValues['save'] = $this->fillWithData($body);
}
return array_values($returnValues)[0];
}
/**
* Delete the project. Be careful! Executing this request will prevent any further interaction with the API that uses this project.
* @param array $options
* @return bool
*/
public function delete($options = array())
{
$this->fillWithData($options);
$request = new Request($this->client);
$path = "/projects/{project_id}";
$data = array(
);
$response = $request->delete($path, $data, $options);
$returnValues = array();
$returnValues['success'] = $response->isSuccess();
return array_values($returnValues)[0];
}
}